Updated Branches:
  refs/heads/api_refactoring a0a8a0bb5 -> 66c2c0cbb

api: Annotate snapshot related apis

Signed-off-by: Rohit Yadav <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/66c2c0cb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/66c2c0cb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/66c2c0cb

Branch: refs/heads/api_refactoring
Commit: 66c2c0cbb79ad075f6ab80d1812c21c3c4b4b2bd
Parents: a0a8a0b
Author: Rohit Yadav <[email protected]>
Authored: Sun Dec 23 03:44:45 2012 -0800
Committer: Rohit Yadav <[email protected]>
Committed: Sun Dec 23 03:44:45 2012 -0800

----------------------------------------------------------------------
 .../command/user/snapshot/CreateSnapshotCmd.java   |   16 ++++++++------
 .../user/snapshot/CreateSnapshotPolicyCmd.java     |    6 ++--
 .../command/user/snapshot/DeleteSnapshotCmd.java   |    7 ++---
 .../user/snapshot/DeleteSnapshotPoliciesCmd.java   |   12 ++++------
 .../user/snapshot/ListSnapshotPoliciesCmd.java     |    6 ++--
 .../command/user/snapshot/ListSnapshotsCmd.java    |   11 ++++-----
 .../api/response/SnapshotPolicyResponse.java       |    3 ++
 7 files changed, 31 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/66c2c0cb/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java
 
b/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java
index 9d9c747..13175c7 100644
--- 
a/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java
+++ 
b/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java
@@ -22,11 +22,13 @@ import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.BaseAsyncCmd;
 import org.apache.cloudstack.api.BaseAsyncCreateCmd;
 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.SnapshotResponse;
+import org.apache.cloudstack.api.response.DomainResponse;
+import org.apache.cloudstack.api.response.SnapshotPolicyResponse;
+import org.apache.cloudstack.api.response.VolumeResponse;
 import com.cloud.async.AsyncJob;
 import com.cloud.event.EventTypes;
 import com.cloud.exception.InvalidParameterValueException;
@@ -50,16 +52,16 @@ public class CreateSnapshotCmd extends BaseAsyncCreateCmd {
     @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, 
description = "The account of the snapshot. The account parameter must be used 
with the domainId parameter.")
     private String accountName;
 
-    @IdentityMapper(entityTableName="domain")
-    @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.LONG, 
description = "The domain ID of the snapshot. If used with the account 
parameter, specifies a domain for the account associated with the disk volume.")
+    @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, 
entityType = DomainResponse.class,
+            description = "The domain ID of the snapshot. If used with the 
account parameter, specifies a domain for the account associated with the disk 
volume.")
     private Long domainId;
 
-    @IdentityMapper(entityTableName="volumes")
-    @Parameter(name = ApiConstants.VOLUME_ID, type = CommandType.LONG, 
required = true, description = "The ID of the disk volume")
+    @Parameter(name = ApiConstants.VOLUME_ID, type = CommandType.UUID, 
entityType = VolumeResponse.class,
+            required = true, description = "The ID of the disk volume")
     private Long volumeId;
 
-    @IdentityMapper(entityTableName="snapshot_policy")
-    @Parameter(name = ApiConstants.POLICY_ID, type = CommandType.LONG, 
description = "policy id of the snapshot, if this is null, then use 
MANUAL_POLICY.")
+    @Parameter(name = ApiConstants.POLICY_ID, type = CommandType.UUID, 
entityType = SnapshotPolicyResponse.class,
+            description = "policy id of the snapshot, if this is null, then 
use MANUAL_POLICY.")
     private Long policyId;
 
     private String syncObjectType = BaseAsyncCmd.snapshotHostSyncObject;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/66c2c0cb/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java
 
b/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java
index 53a84d3..ceb5ec1 100644
--- 
a/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java
+++ 
b/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java
@@ -20,11 +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.SnapshotPolicyResponse;
+import org.apache.cloudstack.api.response.VolumeResponse;
 import com.cloud.exception.InvalidParameterValueException;
 import com.cloud.exception.PermissionDeniedException;
 import com.cloud.projects.Project;
@@ -59,8 +59,8 @@ public class CreateSnapshotPolicyCmd extends BaseCmd {
     @Parameter(name=ApiConstants.TIMEZONE, type=CommandType.STRING, 
required=true, description="Specifies a timezone for this command. For more 
information on the timezone parameter, see Time Zone Format.")
     private String timezone;
 
-    @IdentityMapper(entityTableName="volumes")
-    @Parameter(name=ApiConstants.VOLUME_ID, type=CommandType.LONG, 
required=true, description="the ID of the disk volume")
+    @Parameter(name=ApiConstants.VOLUME_ID, type=CommandType.UUID, entityType 
= VolumeResponse.class,
+            required=true, description="the ID of the disk volume")
     private Long volumeId;
 
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/66c2c0cb/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotCmd.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotCmd.java
 
b/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotCmd.java
index 92e8d38..0ef553b 100644
--- 
a/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotCmd.java
+++ 
b/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotCmd.java
@@ -21,10 +21,10 @@ import org.apache.log4j.Logger;
 import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.BaseAsyncCmd;
 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.SnapshotResponse;
 import org.apache.cloudstack.api.response.SuccessResponse;
 import com.cloud.async.AsyncJob;
 import com.cloud.event.EventTypes;
@@ -41,11 +41,10 @@ public class DeleteSnapshotCmd extends BaseAsyncCmd {
     //////////////// API parameters /////////////////////
     /////////////////////////////////////////////////////
 
-    @IdentityMapper(entityTableName="snapshots")
-    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, 
description="The ID of the snapshot")
+    @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = 
SnapshotResponse.class,
+            required=true, description="The ID of the snapshot")
     private Long id;
 
-
     /////////////////////////////////////////////////////
     /////////////////// Accessors ///////////////////////
     /////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/66c2c0cb/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotPoliciesCmd.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotPoliciesCmd.java
 
b/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotPoliciesCmd.java
index f3a3baa..dd682ed 100644
--- 
a/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotPoliciesCmd.java
+++ 
b/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotPoliciesCmd.java
@@ -22,10 +22,10 @@ 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.SnapshotPolicyResponse;
 import org.apache.cloudstack.api.response.SuccessResponse;
 import com.cloud.user.Account;
 
@@ -39,15 +39,14 @@ public class DeleteSnapshotPoliciesCmd extends BaseCmd {
     //////////////// API parameters /////////////////////
     /////////////////////////////////////////////////////
 
-    @IdentityMapper(entityTableName="snapshot_policy")
-    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the 
Id of the snapshot policy")
+    @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = 
SnapshotPolicyResponse.class,
+            description="the Id of the snapshot policy")
     private Long id;
 
-    @IdentityMapper(entityTableName="snapshot_policy")
-    @Parameter(name=ApiConstants.IDS, type=CommandType.LIST, 
collectionType=CommandType.LONG, description="list of snapshots policy IDs 
separated by comma")
+    @Parameter(name=ApiConstants.IDS, type=CommandType.LIST, 
collectionType=CommandType.UUID, entityType = SnapshotPolicyResponse.class,
+            description="list of snapshots policy IDs separated by comma")
     private List<Long> ids;
 
-
     /////////////////////////////////////////////////////
     /////////////////// Accessors ///////////////////////
     /////////////////////////////////////////////////////
@@ -60,7 +59,6 @@ public class DeleteSnapshotPoliciesCmd extends BaseCmd {
         return ids;
     }
 
-
     /////////////////////////////////////////////////////
     /////////////// API Implementation///////////////////
     /////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/66c2c0cb/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotPoliciesCmd.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotPoliciesCmd.java
 
b/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotPoliciesCmd.java
index e1a6fd6..f3cea49 100644
--- 
a/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotPoliciesCmd.java
+++ 
b/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotPoliciesCmd.java
@@ -23,11 +23,11 @@ import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.BaseListCmd;
-import org.apache.cloudstack.api.IdentityMapper;
 import org.apache.cloudstack.api.Implementation;
 import org.apache.cloudstack.api.Parameter;
 import org.apache.cloudstack.api.response.ListResponse;
 import org.apache.cloudstack.api.response.SnapshotPolicyResponse;
+import org.apache.cloudstack.api.response.VolumeResponse;
 import com.cloud.storage.snapshot.SnapshotPolicy;
 
 @Implementation(description="Lists snapshot policies.", 
responseObject=SnapshotPolicyResponse.class)
@@ -40,8 +40,8 @@ public class ListSnapshotPoliciesCmd extends BaseListCmd {
     //////////////// API parameters /////////////////////
     /////////////////////////////////////////////////////
 
-    @IdentityMapper(entityTableName="volumes")
-    @Parameter(name=ApiConstants.VOLUME_ID, type=CommandType.LONG, 
required=true, description="the ID of the disk volume")
+    @Parameter(name=ApiConstants.VOLUME_ID, type=CommandType.UUID, entityType 
= VolumeResponse.class,
+            required=true, description="the ID of the disk volume")
     private Long volumeId;
 
     /////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/66c2c0cb/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java 
b/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java
index ae152b3..10da8c5 100644
--- 
a/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java
+++ 
b/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java
@@ -23,16 +23,15 @@ import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
-import org.apache.cloudstack.api.IdentityMapper;
 import org.apache.cloudstack.api.Implementation;
 import org.apache.cloudstack.api.Parameter;
 import org.apache.cloudstack.api.response.ListResponse;
 import org.apache.cloudstack.api.response.SnapshotResponse;
+import org.apache.cloudstack.api.response.VolumeResponse;
 import com.cloud.async.AsyncJob;
 import com.cloud.storage.Snapshot;
 import com.cloud.utils.Pair;
 
-
 @Implementation(description="Lists all available snapshots for the account.", 
responseObject=SnapshotResponse.class)
 public class ListSnapshotsCmd extends BaseListTaggedResourcesCmd {
     public static final Logger s_logger = 
Logger.getLogger(ListSnapshotsCmd.class.getName());
@@ -43,8 +42,8 @@ public class ListSnapshotsCmd extends 
BaseListTaggedResourcesCmd {
     //////////////// API parameters /////////////////////
     /////////////////////////////////////////////////////
 
-    @IdentityMapper(entityTableName="snapshots")
-    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="lists 
snapshot by snapshot ID")
+    @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = 
SnapshotResponse.class,
+            description="lists snapshot by snapshot ID")
     private Long id;
 
     @Parameter(name=ApiConstants.INTERVAL_TYPE, type=CommandType.STRING, 
description="valid values are HOURLY, DAILY, WEEKLY, and MONTHLY.")
@@ -56,8 +55,8 @@ public class ListSnapshotsCmd extends 
BaseListTaggedResourcesCmd {
     @Parameter(name=ApiConstants.SNAPSHOT_TYPE, type=CommandType.STRING, 
description="valid values are MANUAL or RECURRING.")
     private String snapshotType;
 
-    @IdentityMapper(entityTableName="volumes")
-    @Parameter(name=ApiConstants.VOLUME_ID, type=CommandType.LONG, 
description="the ID of the disk volume")
+    @Parameter(name=ApiConstants.VOLUME_ID, type=CommandType.UUID, entityType 
= VolumeResponse.class,
+            description="the ID of the disk volume")
     private Long volumeId;
 
     /////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/66c2c0cb/api/src/org/apache/cloudstack/api/response/SnapshotPolicyResponse.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/response/SnapshotPolicyResponse.java 
b/api/src/org/apache/cloudstack/api/response/SnapshotPolicyResponse.java
index 79d4eff..de1a317 100644
--- a/api/src/org/apache/cloudstack/api/response/SnapshotPolicyResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/SnapshotPolicyResponse.java
@@ -17,9 +17,12 @@
 package org.apache.cloudstack.api.response;
 
 import com.cloud.serializer.Param;
+import com.cloud.storage.snapshot.SnapshotPolicy;
 import com.google.gson.annotations.SerializedName;
 import org.apache.cloudstack.api.BaseResponse;
+import org.apache.cloudstack.api.Entity;
 
+@Entity(value=SnapshotPolicy.class)
 public class SnapshotPolicyResponse extends BaseResponse {
     @SerializedName("id") @Param(description="the ID of the snapshot policy")
     private String id;

Reply via email to