From a0a8a0bb5d34fdd27084f4599df10fe4519d63dd Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Sun, 23 Dec 2012 03:33:37 -0800 Subject: [PATCH] api: Annotate resource apis Signed-off-by: Rohit Yadav --- .../command/user/resource/GetCloudIdentifierCmd.java | 8 +++----- .../command/user/resource/ListHypervisorsCmd.java | 6 +++--- .../user/resource/UpdateResourceCountCmd.java | 12 ++++++------ .../user/resource/UpdateResourceLimitCmd.java | 12 ++++++------ 4 files changed, 18 insertions(+), 20 deletions(-) diff --git a/api/src/org/apache/cloudstack/api/command/user/resource/GetCloudIdentifierCmd.java b/api/src/org/apache/cloudstack/api/command/user/resource/GetCloudIdentifierCmd.java index feec81fa1c8..398cae5ee9a 100644 --- a/api/src/org/apache/cloudstack/api/command/user/resource/GetCloudIdentifierCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/resource/GetCloudIdentifierCmd.java @@ -22,11 +22,11 @@ import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.IdentityMapper; import org.apache.cloudstack.api.Implementation; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.CloudIdentifierResponse; +import org.apache.cloudstack.api.response.UserResponse; import com.cloud.user.Account; @Implementation(description="Retrieves a cloud identifier.", responseObject=CloudIdentifierResponse.class) @@ -38,11 +38,10 @@ public class GetCloudIdentifierCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @IdentityMapper(entityTableName="user") - @Parameter(name=ApiConstants.USER_ID, type=CommandType.LONG, required=true, description="the user ID for the cloud identifier") + @Parameter(name=ApiConstants.USER_ID, type=CommandType.UUID, entityType = UserResponse.class, + required=true, description="the user ID for the cloud identifier") private Long userid; - ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -51,7 +50,6 @@ public class GetCloudIdentifierCmd extends BaseCmd { return userid; } - ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// diff --git a/api/src/org/apache/cloudstack/api/command/user/resource/ListHypervisorsCmd.java b/api/src/org/apache/cloudstack/api/command/user/resource/ListHypervisorsCmd.java index 4ee11113d45..ece0c9fe2c4 100644 --- a/api/src/org/apache/cloudstack/api/command/user/resource/ListHypervisorsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/resource/ListHypervisorsCmd.java @@ -24,11 +24,11 @@ import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.IdentityMapper; import org.apache.cloudstack.api.Implementation; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.HypervisorResponse; import org.apache.cloudstack.api.response.ListResponse; +import org.apache.cloudstack.api.response.ZoneResponse; import com.cloud.user.Account; @Implementation(description = "List hypervisors", responseObject = HypervisorResponse.class) @@ -45,8 +45,8 @@ public class ListHypervisorsCmd extends BaseCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @IdentityMapper(entityTableName="data_center") - @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.LONG, description = "the zone id for listing hypervisors.") + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, + description = "the zone id for listing hypervisors.") private Long zoneId; // /////////////////////////////////////////////////// diff --git a/api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceCountCmd.java b/api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceCountCmd.java index 3db1b987fd6..8af243f1c48 100644 --- a/api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceCountCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceCountCmd.java @@ -23,17 +23,17 @@ import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.IdentityMapper; import org.apache.cloudstack.api.Implementation; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.DomainResponse; +import org.apache.cloudstack.api.response.ProjectResponse; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.ResourceCountResponse; import com.cloud.configuration.ResourceCount; import com.cloud.user.Account; import com.cloud.user.UserContext; - @Implementation(description="Recalculate and update resource count for an account or domain.", responseObject=ResourceCountResponse.class) public class UpdateResourceCountCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(UpdateResourceCountCmd.class.getName()); @@ -48,8 +48,8 @@ public class UpdateResourceCountCmd extends BaseCmd { @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="Update resource count for a specified account. Must be used with the domainId parameter.") private String accountName; - @IdentityMapper(entityTableName="domain") - @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, required=true, description="If account parameter specified then updates resource counts for a specified account in this domain else update resource counts for all accounts & child domains in specified domain.") + @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType = DomainResponse.class, + required=true, description="If account parameter specified then updates resource counts for a specified account in this domain else update resource counts for all accounts & child domains in specified domain.") private Long domainId; @Parameter(name=ApiConstants.RESOURCE_TYPE, type=CommandType.INTEGER, description= "Type of resource to update. If specifies valid values are 0, 1, 2, 3, and 4. If not specified will update all resource counts" + @@ -60,8 +60,8 @@ public class UpdateResourceCountCmd extends BaseCmd { "4 - Template. Number of templates that a user can register/create.") private Integer resourceType; - @IdentityMapper(entityTableName="projects") - @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="Update resource limits for project") + @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.UUID, entityType = ProjectResponse.class, + description="Update resource limits for project") private Long projectId; ///////////////////////////////////////////////////// diff --git a/api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceLimitCmd.java b/api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceLimitCmd.java index 0e74d50a4bb..bdb65cc6f97 100644 --- a/api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceLimitCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceLimitCmd.java @@ -20,10 +20,11 @@ import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.IdentityMapper; import org.apache.cloudstack.api.Implementation; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.DomainResponse; +import org.apache.cloudstack.api.response.ProjectResponse; import org.apache.cloudstack.api.response.ResourceLimitResponse; import com.cloud.configuration.ResourceLimit; import com.cloud.user.UserContext; @@ -34,7 +35,6 @@ public class UpdateResourceLimitCmd extends BaseCmd { private static final String s_name = "updateresourcelimitresponse"; - ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// @@ -42,12 +42,12 @@ public class UpdateResourceLimitCmd extends BaseCmd { @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="Update resource for a specified account. Must be used with the domainId parameter.") private String accountName; - @IdentityMapper(entityTableName="domain") - @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="Update resource limits for all accounts in specified domain. If used with the account parameter, updates resource limits for a specified account in specified domain.") + @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType = DomainResponse.class, + description="Update resource limits for all accounts in specified domain. If used with the account parameter, updates resource limits for a specified account in specified domain.") private Long domainId; - @IdentityMapper(entityTableName="projects") - @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="Update resource limits for project") + @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.UUID, entityType = ProjectResponse.class, + description="Update resource limits for project") private Long projectId; @Parameter(name=ApiConstants.MAX, type=CommandType.LONG, description=" Maximum resource limit.")