You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2012/12/23 12:34:01 UTC
[1/2] git commit: api: Annotate resource apis
Updated Branches:
refs/heads/api_refactoring 07f5e1ac2 -> a0a8a0bb5
api: Annotate resource apis
Signed-off-by: Rohit Yadav <bh...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/a0a8a0bb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/a0a8a0bb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/a0a8a0bb
Branch: refs/heads/api_refactoring
Commit: a0a8a0bb5d34fdd27084f4599df10fe4519d63dd
Parents: 4d79909
Author: Rohit Yadav <bh...@apache.org>
Authored: Sun Dec 23 03:33:37 2012 -0800
Committer: Rohit Yadav <bh...@apache.org>
Committed: Sun Dec 23 03:33:37 2012 -0800
----------------------------------------------------------------------
.../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(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a0a8a0bb/api/src/org/apache/cloudstack/api/command/user/resource/GetCloudIdentifierCmd.java
----------------------------------------------------------------------
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 feec81f..398cae5 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///////////////////
/////////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a0a8a0bb/api/src/org/apache/cloudstack/api/command/user/resource/ListHypervisorsCmd.java
----------------------------------------------------------------------
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 4ee1111..ece0c9f 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;
// ///////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a0a8a0bb/api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceCountCmd.java
----------------------------------------------------------------------
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 3db1b98..8af243f 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;
/////////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a0a8a0bb/api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceLimitCmd.java
----------------------------------------------------------------------
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 0e74d50..bdb65cc 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.")