From af5eacfc014621cb78ddea022589b4d9bc2bf0ee Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Sat, 22 Dec 2012 20:28:19 -0800 Subject: [PATCH] api: Annotate autoscale apis Signed-off-by: Rohit Yadav --- .../autoscale/CreateAutoScalePolicyCmd.java | 6 ++--- .../autoscale/CreateAutoScaleVmGroupCmd.java | 20 ++++++++------- .../CreateAutoScaleVmProfileCmd.java | 21 +++++++++------- .../user/autoscale/CreateConditionCmd.java | 11 ++++---- .../autoscale/DeleteAutoScalePolicyCmd.java | 6 ++--- .../autoscale/DeleteAutoScaleVmGroupCmd.java | 6 ++--- .../DeleteAutoScaleVmProfileCmd.java | 6 ++--- .../user/autoscale/DeleteConditionCmd.java | 6 ++--- .../autoscale/DisableAutoScaleVmGroupCmd.java | 5 ++-- .../autoscale/EnableAutoScaleVmGroupCmd.java | 5 ++-- .../autoscale/ListAutoScalePoliciesCmd.java | 15 +++++------ .../autoscale/ListAutoScaleVmGroupsCmd.java | 25 +++++++++++-------- .../autoscale/ListAutoScaleVmProfilesCmd.java | 10 ++++---- .../user/autoscale/ListConditionsCmd.java | 14 +++++------ .../user/autoscale/ListCountersCmd.java | 5 ++-- .../autoscale/UpdateAutoScalePolicyCmd.java | 10 ++++---- .../autoscale/UpdateAutoScaleVmGroupCmd.java | 14 +++++------ .../UpdateAutoScaleVmProfileCmd.java | 15 +++++------ .../api/response/AutoScalePolicyResponse.java | 3 +++ .../response/AutoScaleVmGroupResponse.java | 3 +++ .../response/AutoScaleVmProfileResponse.java | 3 +++ .../api/response/ConditionResponse.java | 3 +++ .../api/response/FirewallRuleResponse.java | 3 +++ 23 files changed, 119 insertions(+), 96 deletions(-) diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScalePolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScalePolicyCmd.java index 47549aba6d7..48e06b9c275 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScalePolicyCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScalePolicyCmd.java @@ -18,12 +18,12 @@ package org.apache.cloudstack.api.command.user.autoscale; import java.util.List; +import org.apache.cloudstack.api.response.ConditionResponse; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; 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; @@ -55,8 +55,8 @@ public class CreateAutoScalePolicyCmd extends BaseAsyncCreateCmd { @Parameter(name = ApiConstants.QUIETTIME, type = CommandType.INTEGER, description = "the cool down period for which the policy should not be evaluated after the action has been taken") private Integer quietTime; - @IdentityMapper(entityTableName = "conditions") - @Parameter(name = ApiConstants.CONDITION_IDS, type = CommandType.LIST, collectionType = CommandType.LONG, required = true, description = "the list of IDs of the conditions that are being evaluated on every interval") + @Parameter(name = ApiConstants.CONDITION_IDS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = ConditionResponse.class, + required = true, description = "the list of IDs of the conditions that are being evaluated on every interval") private List conditionIds; // /////////////////////////////////////////////////// diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmGroupCmd.java index 70ec7d57928..dadc9658e07 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmGroupCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmGroupCmd.java @@ -23,11 +23,13 @@ import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; 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.AutoScaleVmGroupResponse; +import org.apache.cloudstack.api.response.AutoScalePolicyResponse; +import org.apache.cloudstack.api.response.AutoScaleVmProfileResponse; +import org.apache.cloudstack.api.response.FirewallRuleResponse; import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; @@ -45,8 +47,8 @@ public class CreateAutoScaleVmGroupCmd extends BaseAsyncCreateCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @IdentityMapper(entityTableName = "firewall_rules") - @Parameter(name = ApiConstants.LBID, type = CommandType.LONG, required = true, description = "the ID of the load balancer rule") + @Parameter(name = ApiConstants.LBID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, + required = true, description = "the ID of the load balancer rule") private long lbRuleId; @Parameter(name = ApiConstants.MIN_MEMBERS, type = CommandType.INTEGER, required = true, description = "the minimum number of members in the vmgroup, the number of instances in the vm group will be equal to or more than this number.") @@ -58,16 +60,16 @@ public class CreateAutoScaleVmGroupCmd extends BaseAsyncCreateCmd { @Parameter(name = ApiConstants.INTERVAL, type = CommandType.INTEGER, description = "the frequency at which the conditions have to be evaluated") private Integer interval; - @IdentityMapper(entityTableName = "autoscale_policies") - @Parameter(name = ApiConstants.SCALEUP_POLICY_IDS, type = CommandType.LIST, collectionType = CommandType.LONG, required = true, description = "list of scaleup autoscale policies") + @Parameter(name = ApiConstants.SCALEUP_POLICY_IDS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = AutoScalePolicyResponse.class, + required = true, description = "list of scaleup autoscale policies") private List scaleUpPolicyIds; - @IdentityMapper(entityTableName = "autoscale_policies") - @Parameter(name = ApiConstants.SCALEDOWN_POLICY_IDS, type = CommandType.LIST, collectionType = CommandType.LONG, required = true, description = "list of scaledown autoscale policies") + @Parameter(name = ApiConstants.SCALEDOWN_POLICY_IDS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = AutoScalePolicyResponse.class, + required = true, description = "list of scaledown autoscale policies") private List scaleDownPolicyIds; - @IdentityMapper(entityTableName = "autoscale_vmprofiles") - @Parameter(name = ApiConstants.VMPROFILE_ID, type = CommandType.LONG, required = true, description = "the autoscale profile that contains information about the vms in the vm group.") + @Parameter(name = ApiConstants.VMPROFILE_ID, type = CommandType.UUID, entityType = AutoScaleVmProfileResponse.class, + required = true, description = "the autoscale profile that contains information about the vms in the vm group.") private long profileId; // /////////////////////////////////////////////////// diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java index 6ad4c61a0aa..05ddaa6d4d0 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java @@ -24,11 +24,14 @@ import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; 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.AutoScaleVmProfileResponse; +import org.apache.cloudstack.api.response.DiskOfferingResponse; +import org.apache.cloudstack.api.response.TemplateResponse; +import org.apache.cloudstack.api.response.UserResponse; +import org.apache.cloudstack.api.response.ZoneResponse; import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; @@ -49,16 +52,16 @@ public class CreateAutoScaleVmProfileCmd extends BaseAsyncCreateCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @IdentityMapper(entityTableName = "data_center") - @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.LONG, required = true, description = "availability zone for the auto deployed virtual machine") + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, + required = true, description = "availability zone for the auto deployed virtual machine") private Long zoneId; - @IdentityMapper(entityTableName = "disk_offering") - @Parameter(name = ApiConstants.SERVICE_OFFERING_ID, type = CommandType.LONG, required = true, description = "the service offering of the auto deployed virtual machine") + @Parameter(name = ApiConstants.SERVICE_OFFERING_ID, type = CommandType.UUID, entityType = DiskOfferingResponse.class, + required = true, description = "the service offering of the auto deployed virtual machine") private Long serviceOfferingId; - @IdentityMapper(entityTableName = "vm_template") - @Parameter(name = ApiConstants.TEMPLATE_ID, type = CommandType.LONG, required = true, description = "the template of the auto deployed virtual machine") + @Parameter(name = ApiConstants.TEMPLATE_ID, type = CommandType.UUID, entityType = TemplateResponse.class, + required = true, description = "the template of the auto deployed virtual machine") private Long templateId; @Parameter(name = ApiConstants.OTHER_DEPLOY_PARAMS, type = CommandType.STRING, description = "parameters other than zoneId/serviceOfferringId/templateId of the auto deployed virtual machine") @@ -70,8 +73,8 @@ public class CreateAutoScaleVmProfileCmd extends BaseAsyncCreateCmd { @Parameter(name = ApiConstants.COUNTERPARAM_LIST, type = CommandType.MAP, description = "counterparam list. Example: counterparam[0].name=snmpcommunity&counterparam[0].value=public&counterparam[1].name=snmpport&counterparam[1].value=161") private Map counterParamList; - @IdentityMapper(entityTableName = "user") - @Parameter(name = ApiConstants.AUTOSCALE_USER_ID, type = CommandType.LONG, description = "the ID of the user used to launch and destroy the VMs") + @Parameter(name = ApiConstants.AUTOSCALE_USER_ID, type = CommandType.UUID, entityType = UserResponse.class, + description = "the ID of the user used to launch and destroy the VMs") private Long autoscaleUserId; private Map otherDeployParamMap; diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateConditionCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateConditionCmd.java index fbc610abd59..a9dcd2f6f2a 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateConditionCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateConditionCmd.java @@ -17,12 +17,13 @@ package org.apache.cloudstack.api.command.user.autoscale; +import org.apache.cloudstack.api.response.CounterResponse; +import org.apache.cloudstack.api.response.DomainResponse; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; 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; @@ -42,8 +43,8 @@ public class CreateConditionCmd extends BaseAsyncCreateCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @IdentityMapper(entityTableName = "counter") - @Parameter(name = ApiConstants.COUNTER_ID, type = CommandType.LONG, required = true, description = "ID of the Counter.") + @Parameter(name = ApiConstants.COUNTER_ID, type = CommandType.UUID, entityType = CounterResponse.class, + required = true, description = "ID of the Counter.") private long counterId; @Parameter(name = ApiConstants.RELATIONAL_OPERATOR, type = CommandType.STRING, required = true, description = "Relational Operator to be used with threshold.") @@ -56,8 +57,8 @@ public class CreateConditionCmd extends BaseAsyncCreateCmd { "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 account.") + @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, + description = "the domain ID of the account.") private Long domainId; // /////////////////////////////////////////////////// diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScalePolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScalePolicyCmd.java index 33c758cf6fd..ceb5f6aa889 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScalePolicyCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScalePolicyCmd.java @@ -16,12 +16,12 @@ // under the License. package org.apache.cloudstack.api.command.user.autoscale; +import org.apache.cloudstack.api.response.AutoScalePolicyResponse; 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; @@ -40,8 +40,8 @@ public class DeleteAutoScalePolicyCmd extends BaseAsyncCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @IdentityMapper(entityTableName = "autoscale_policies") - @Parameter(name = ApiConstants.ID, type = CommandType.LONG, required = true, description = "the ID of the autoscale policy") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = AutoScalePolicyResponse.class, + required = true, description = "the ID of the autoscale policy") private Long id; // /////////////////////////////////////////////////// diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmGroupCmd.java index e78cced0172..9628e8476c7 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmGroupCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmGroupCmd.java @@ -16,12 +16,12 @@ // under the License. package org.apache.cloudstack.api.command.user.autoscale; +import org.apache.cloudstack.api.response.AutoScaleVmGroupResponse; 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; @@ -40,8 +40,8 @@ public class DeleteAutoScaleVmGroupCmd extends BaseAsyncCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @IdentityMapper(entityTableName = "autoscale_vmgroups") - @Parameter(name = ApiConstants.ID, type = CommandType.LONG, required = true, description = "the ID of the autoscale group") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = AutoScaleVmGroupResponse.class, + required = true, description = "the ID of the autoscale group") private Long id; // /////////////////////////////////////////////////// diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmProfileCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmProfileCmd.java index a1ae31bb187..5605f0279d2 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmProfileCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmProfileCmd.java @@ -16,12 +16,12 @@ // under the License. package org.apache.cloudstack.api.command.user.autoscale; +import org.apache.cloudstack.api.response.AutoScaleVmProfileResponse; 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; @@ -40,8 +40,8 @@ public class DeleteAutoScaleVmProfileCmd extends BaseAsyncCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @IdentityMapper(entityTableName = "autoscale_vmprofiles") - @Parameter(name = ApiConstants.ID, type = CommandType.LONG, required = true, description = "the ID of the autoscale profile") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = AutoScaleVmProfileResponse.class, + required = true, description = "the ID of the autoscale profile") private Long id; // /////////////////////////////////////////////////// diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteConditionCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteConditionCmd.java index a300ee553a2..94b366313b8 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteConditionCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteConditionCmd.java @@ -17,12 +17,12 @@ package org.apache.cloudstack.api.command.user.autoscale; +import org.apache.cloudstack.api.response.ConditionResponse; 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; @@ -42,8 +42,8 @@ public class DeleteConditionCmd extends BaseAsyncCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @IdentityMapper(entityTableName = "conditions") - @Parameter(name = ApiConstants.ID, type = CommandType.LONG, required = true, description = "the ID of the condition.") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ConditionResponse.class, + required= true, description = "the ID of the condition.") private Long id; // /////////////////////////////////////////////////// diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/DisableAutoScaleVmGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/DisableAutoScaleVmGroupCmd.java index fdf5fb45696..c02c4ed5869 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/DisableAutoScaleVmGroupCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/DisableAutoScaleVmGroupCmd.java @@ -22,7 +22,6 @@ 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; @@ -41,8 +40,8 @@ public class DisableAutoScaleVmGroupCmd extends BaseAsyncCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @IdentityMapper(entityTableName="autoscale_vmgroups") - @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the autoscale group") + @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = AutoScaleVmGroupResponse.class, + required=true, description="the ID of the autoscale group") private Long id; // /////////////////////////////////////////////////// diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/EnableAutoScaleVmGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/EnableAutoScaleVmGroupCmd.java index cc76e6c3bef..1c3c852208a 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/EnableAutoScaleVmGroupCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/EnableAutoScaleVmGroupCmd.java @@ -22,7 +22,6 @@ 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; @@ -41,8 +40,8 @@ public class EnableAutoScaleVmGroupCmd extends BaseAsyncCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @IdentityMapper(entityTableName="autoscale_vmgroups") - @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the autoscale group") + @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = AutoScaleVmGroupResponse.class, + required=true, description="the ID of the autoscale group") private Long id; // /////////////////////////////////////////////////// diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScalePoliciesCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScalePoliciesCmd.java index b7df018df91..60e6c39fe55 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScalePoliciesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScalePoliciesCmd.java @@ -19,11 +19,12 @@ package org.apache.cloudstack.api.command.user.autoscale; import java.util.ArrayList; import java.util.List; +import org.apache.cloudstack.api.response.AutoScaleVmGroupResponse; +import org.apache.cloudstack.api.response.ConditionResponse; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListAccountResourcesCmd; -import org.apache.cloudstack.api.IdentityMapper; import org.apache.cloudstack.api.Implementation; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.AutoScalePolicyResponse; @@ -40,19 +41,19 @@ public class ListAutoScalePoliciesCmd extends BaseListAccountResourcesCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @IdentityMapper(entityTableName = "autoscale_policies") - @Parameter(name = ApiConstants.ID, type = CommandType.LONG, description = "the ID of the autoscale policy") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = AutoScalePolicyResponse.class, + description = "the ID of the autoscale policy") private Long id; - @IdentityMapper(entityTableName = "conditions") - @Parameter(name = ApiConstants.CONDITION_ID, type = CommandType.LONG, description = "the ID of the condition of the policy") + @Parameter(name = ApiConstants.CONDITION_ID, type = CommandType.UUID, entityType = ConditionResponse.class, + description = "the ID of the condition of the policy") private Long conditionId; @Parameter(name = ApiConstants.ACTION, type = CommandType.STRING, description = "the action to be executed if all the conditions evaluate to true for the specified duration.") private String action; - @IdentityMapper(entityTableName="autoscale_vmgroups") - @Parameter(name = ApiConstants.VMGROUP_ID, type = CommandType.LONG, description = "the ID of the autoscale vm group") + @Parameter(name = ApiConstants.VMGROUP_ID, type = CommandType.UUID, entityType = AutoScaleVmGroupResponse.class, + description = "the ID of the autoscale vm group") private Long vmGroupId; // /////////////////////////////////////////////////// diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmGroupsCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmGroupsCmd.java index 63719ac2de8..7024cfc989a 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmGroupsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmGroupsCmd.java @@ -23,11 +23,14 @@ import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd; -import org.apache.cloudstack.api.IdentityMapper; import org.apache.cloudstack.api.Implementation; import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.response.AutoScalePolicyResponse; import org.apache.cloudstack.api.response.AutoScaleVmGroupResponse; +import org.apache.cloudstack.api.response.AutoScaleVmProfileResponse; +import org.apache.cloudstack.api.response.FirewallRuleResponse; import org.apache.cloudstack.api.response.ListResponse; +import org.apache.cloudstack.api.response.ZoneResponse; import com.cloud.exception.InvalidParameterValueException; import com.cloud.network.as.AutoScaleVmGroup; @@ -41,24 +44,24 @@ public class ListAutoScaleVmGroupsCmd extends BaseListProjectAndAccountResources // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @IdentityMapper(entityTableName="autoscale_vmgroups") - @Parameter(name = ApiConstants.ID, type = CommandType.LONG, description = "the ID of the autoscale vm group") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = AutoScaleVmGroupResponse.class, + description = "the ID of the autoscale vm group") private Long id; - @IdentityMapper(entityTableName="firewall_rules") - @Parameter(name = ApiConstants.LBID, type = CommandType.LONG, description = "the ID of the loadbalancer") + @Parameter(name = ApiConstants.LBID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, + description = "the ID of the loadbalancer") private Long loadBalancerId; - @IdentityMapper(entityTableName="autoscale_vmprofiles") - @Parameter(name = ApiConstants.VMPROFILE_ID, type = CommandType.LONG, description = "the ID of the profile") + @Parameter(name = ApiConstants.VMPROFILE_ID, type = CommandType.UUID, entityType = AutoScaleVmProfileResponse.class, + description = "the ID of the profile") private Long profileId; - @IdentityMapper(entityTableName="autoscale_policies") - @Parameter(name = ApiConstants.POLICY_ID, type = CommandType.LONG, description = "the ID of the policy") + @Parameter(name = ApiConstants.POLICY_ID, type = CommandType.UUID, entityType = AutoScalePolicyResponse.class, + description = "the ID of the policy") private Long policyId; - @IdentityMapper(entityTableName="data_center") - @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.LONG, description = "the availability zone ID") + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, + description = "the availability zone ID") private Long zoneId; // /////////////////////////////////////////////////// // ///////////////// Accessors /////////////////////// diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmProfilesCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmProfilesCmd.java index 71459849c84..908c299dbac 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmProfilesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmProfilesCmd.java @@ -19,11 +19,11 @@ package org.apache.cloudstack.api.command.user.autoscale; import java.util.ArrayList; import java.util.List; +import org.apache.cloudstack.api.response.TemplateResponse; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd; -import org.apache.cloudstack.api.IdentityMapper; import org.apache.cloudstack.api.Implementation; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.AutoScaleVmProfileResponse; @@ -40,12 +40,12 @@ public class ListAutoScaleVmProfilesCmd extends BaseListProjectAndAccountResourc // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @IdentityMapper(entityTableName="autoscale_vmprofiles") - @Parameter(name = ApiConstants.ID, type = CommandType.LONG, description = "the ID of the autoscale vm profile") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = AutoScaleVmProfileResponse.class, + description = "the ID of the autoscale vm profile") private Long id; - @IdentityMapper(entityTableName="vm_template") - @Parameter(name=ApiConstants.TEMPLATE_ID, type=CommandType.LONG, description="the templateid of the autoscale vm profile") + @Parameter(name=ApiConstants.TEMPLATE_ID, type=CommandType.UUID, entityType = TemplateResponse.class, + description="the templateid of the autoscale vm profile") private Long templateId; @Parameter(name=ApiConstants.OTHER_DEPLOY_PARAMS, type=CommandType.STRING, description="the otherdeployparameters of the autoscale vm profile") diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListConditionsCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListConditionsCmd.java index 7686910cb44..c66f7cff7a5 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListConditionsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListConditionsCmd.java @@ -20,11 +20,11 @@ package org.apache.cloudstack.api.command.user.autoscale; import java.util.ArrayList; import java.util.List; +import org.apache.cloudstack.api.response.AutoScalePolicyResponse; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListAccountResourcesCmd; -import org.apache.cloudstack.api.IdentityMapper; import org.apache.cloudstack.api.Implementation; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.ConditionResponse; @@ -41,16 +41,16 @@ public class ListConditionsCmd extends BaseListAccountResourcesCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @IdentityMapper(entityTableName = "conditions") - @Parameter(name = ApiConstants.ID, type = CommandType.LONG, required = false, description = "ID of the Condition.") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ConditionResponse.class, + required = false, description = "ID of the Condition.") private Long id; - @IdentityMapper(entityTableName = "counter") - @Parameter(name = ApiConstants.COUNTER_ID, type = CommandType.LONG, required = false, description = "Counter-id of the condition.") + @Parameter(name = ApiConstants.COUNTER_ID, type = CommandType.UUID, entityType = CounterResponse.class, + required = false, description = "Counter-id of the condition.") private Long counterId; - @IdentityMapper(entityTableName="autoscale_policies") - @Parameter(name = ApiConstants.POLICY_ID, type = CommandType.LONG, description = "the ID of the policy") + @Parameter(name = ApiConstants.POLICY_ID, type = CommandType.UUID, entityType = AutoScalePolicyResponse.class, + description = "the ID of the policy") private Long policyId; // /////////////////////////////////////////////////// // ///////////// API Implementation/////////////////// diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListCountersCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListCountersCmd.java index 47803c54541..04e6006a0cc 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListCountersCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListCountersCmd.java @@ -24,7 +24,6 @@ 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.CounterResponse; @@ -41,8 +40,8 @@ public class ListCountersCmd extends BaseListCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @IdentityMapper(entityTableName = "counter") - @Parameter(name = ApiConstants.ID, type = CommandType.LONG, description = "ID of the Counter.") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = CounterResponse.class, + description = "ID of the Counter.") private Long id; @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "Name of the counter.") diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScalePolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScalePolicyCmd.java index 918aa8e7c7e..a949888a612 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScalePolicyCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScalePolicyCmd.java @@ -19,12 +19,12 @@ package org.apache.cloudstack.api.command.user.autoscale; import java.util.List; +import org.apache.cloudstack.api.response.ConditionResponse; 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; @@ -51,12 +51,12 @@ public class UpdateAutoScalePolicyCmd extends BaseAsyncCmd { @Parameter(name = ApiConstants.QUIETTIME, type = CommandType.INTEGER, description = "the cool down period for which the policy should not be evaluated after the action has been taken") private Integer quietTime; - @IdentityMapper(entityTableName = "conditions") - @Parameter(name = ApiConstants.CONDITION_IDS, type = CommandType.LIST, collectionType = CommandType.LONG, description = "the list of IDs of the conditions that are being evaluated on every interval") + @Parameter(name = ApiConstants.CONDITION_IDS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = ConditionResponse.class, + description = "the list of IDs of the conditions that are being evaluated on every interval") private List conditionIds; - @IdentityMapper(entityTableName = "autoscale_policies") - @Parameter(name = ApiConstants.ID, type = CommandType.LONG, required = true, description = "the ID of the autoscale policy") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = AutoScalePolicyResponse.class, + required = true, description = "the ID of the autoscale policy") private Long id; @Override diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmGroupCmd.java index ecc86ab4554..2ca95159c8c 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmGroupCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmGroupCmd.java @@ -19,12 +19,12 @@ package org.apache.cloudstack.api.command.user.autoscale; import java.util.List; +import org.apache.cloudstack.api.response.AutoScalePolicyResponse; 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; @@ -54,16 +54,16 @@ public class UpdateAutoScaleVmGroupCmd extends BaseAsyncCmd { @Parameter(name=ApiConstants.INTERVAL, type=CommandType.INTEGER, description="the frequency at which the conditions have to be evaluated") private Integer interval; - @IdentityMapper(entityTableName = "autoscale_policies") - @Parameter(name = ApiConstants.SCALEUP_POLICY_IDS, type = CommandType.LIST, collectionType = CommandType.LONG, description = "list of scaleup autoscale policies") + @Parameter(name = ApiConstants.SCALEUP_POLICY_IDS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = AutoScalePolicyResponse.class, + description = "list of scaleup autoscale policies") private List scaleUpPolicyIds; - @IdentityMapper(entityTableName = "autoscale_policies") - @Parameter(name = ApiConstants.SCALEDOWN_POLICY_IDS, type = CommandType.LIST, collectionType = CommandType.LONG, description = "list of scaledown autoscale policies") + @Parameter(name = ApiConstants.SCALEDOWN_POLICY_IDS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = AutoScalePolicyResponse.class, + description = "list of scaledown autoscale policies") private List scaleDownPolicyIds; - @IdentityMapper(entityTableName = "autoscale_vmgroups") - @Parameter(name = ApiConstants.ID, type = CommandType.LONG, required = true, description = "the ID of the autoscale group") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = AutoScaleVmGroupResponse.class, + required = true, description = "the ID of the autoscale group") private Long id; // /////////////////////////////////////////////////// diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmProfileCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmProfileCmd.java index 45911c1bb64..d616eb94bdf 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmProfileCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmProfileCmd.java @@ -19,12 +19,13 @@ package org.apache.cloudstack.api.command.user.autoscale; import java.util.Map; +import org.apache.cloudstack.api.response.TemplateResponse; +import org.apache.cloudstack.api.response.UserResponse; 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; @@ -45,12 +46,12 @@ public class UpdateAutoScaleVmProfileCmd extends BaseAsyncCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @IdentityMapper(entityTableName = "autoscale_vmprofiles") - @Parameter(name = ApiConstants.ID, type = CommandType.LONG, required = true, description = "the ID of the autoscale vm profile") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = AutoScaleVmProfileResponse.class, + required = true, description = "the ID of the autoscale vm profile") private Long id; - @IdentityMapper(entityTableName = "vm_template") - @Parameter(name = ApiConstants.TEMPLATE_ID, type = CommandType.LONG, description = "the template of the auto deployed virtual machine") + @Parameter(name = ApiConstants.TEMPLATE_ID, type = CommandType.UUID, entityType = TemplateResponse.class, + description = "the template of the auto deployed virtual machine") private Long templateId; @Parameter(name = ApiConstants.AUTOSCALE_VM_DESTROY_TIME, type = CommandType.INTEGER, description = "the time allowed for existing connections to get closed before a vm is destroyed") @@ -59,8 +60,8 @@ public class UpdateAutoScaleVmProfileCmd extends BaseAsyncCmd { @Parameter(name = ApiConstants.COUNTERPARAM_LIST, type = CommandType.MAP, description = "counterparam list. Example: counterparam[0].name=snmpcommunity&counterparam[0].value=public&counterparam[1].name=snmpport&counterparam[1].value=161") private Map counterParamList; - @IdentityMapper(entityTableName = "user") - @Parameter(name = ApiConstants.AUTOSCALE_USER_ID, type = CommandType.LONG, description = "the ID of the user used to launch and destroy the VMs") + @Parameter(name = ApiConstants.AUTOSCALE_USER_ID, type = CommandType.UUID, entityType = UserResponse.class, + description = "the ID of the user used to launch and destroy the VMs") private Long autoscaleUserId; // /////////////////////////////////////////////////// diff --git a/api/src/org/apache/cloudstack/api/response/AutoScalePolicyResponse.java b/api/src/org/apache/cloudstack/api/response/AutoScalePolicyResponse.java index 3be8a425f0d..27b50bead73 100644 --- a/api/src/org/apache/cloudstack/api/response/AutoScalePolicyResponse.java +++ b/api/src/org/apache/cloudstack/api/response/AutoScalePolicyResponse.java @@ -16,13 +16,16 @@ // under the License. package org.apache.cloudstack.api.response; +import com.cloud.network.as.AutoScalePolicy; import org.apache.cloudstack.api.ApiConstants; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; +import org.apache.cloudstack.api.Entity; import java.util.List; +@Entity(value=AutoScalePolicy.class) public class AutoScalePolicyResponse extends BaseResponse implements ControlledEntityResponse { @SerializedName(ApiConstants.ID) diff --git a/api/src/org/apache/cloudstack/api/response/AutoScaleVmGroupResponse.java b/api/src/org/apache/cloudstack/api/response/AutoScaleVmGroupResponse.java index 125aa9bf9e1..d7938994541 100644 --- a/api/src/org/apache/cloudstack/api/response/AutoScaleVmGroupResponse.java +++ b/api/src/org/apache/cloudstack/api/response/AutoScaleVmGroupResponse.java @@ -16,14 +16,17 @@ // under the License. package org.apache.cloudstack.api.response; +import com.cloud.network.as.AutoScaleVmGroup; import org.apache.cloudstack.api.ApiConstants; import com.cloud.utils.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; +import org.apache.cloudstack.api.Entity; import java.util.List; +@Entity(value=AutoScaleVmGroup.class) public class AutoScaleVmGroupResponse extends BaseResponse implements ControlledEntityResponse { @SerializedName(ApiConstants.ID) diff --git a/api/src/org/apache/cloudstack/api/response/AutoScaleVmProfileResponse.java b/api/src/org/apache/cloudstack/api/response/AutoScaleVmProfileResponse.java index f5ed4b1bdba..356460b0948 100644 --- a/api/src/org/apache/cloudstack/api/response/AutoScaleVmProfileResponse.java +++ b/api/src/org/apache/cloudstack/api/response/AutoScaleVmProfileResponse.java @@ -20,14 +20,17 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import com.cloud.network.as.AutoScaleVmProfile; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseCmd.CommandType; import org.apache.cloudstack.api.BaseResponse; +import org.apache.cloudstack.api.Entity; import org.apache.cloudstack.api.Parameter; import com.cloud.serializer.Param; import com.cloud.utils.Pair; import com.google.gson.annotations.SerializedName; +@Entity(value=AutoScaleVmProfile.class) public class AutoScaleVmProfileResponse extends BaseResponse implements ControlledEntityResponse { @SerializedName(ApiConstants.ID) diff --git a/api/src/org/apache/cloudstack/api/response/ConditionResponse.java b/api/src/org/apache/cloudstack/api/response/ConditionResponse.java index 168ba5c90c8..f2665c7bcc9 100644 --- a/api/src/org/apache/cloudstack/api/response/ConditionResponse.java +++ b/api/src/org/apache/cloudstack/api/response/ConditionResponse.java @@ -19,11 +19,14 @@ package org.apache.cloudstack.api.response; import java.util.List; +import com.cloud.network.as.Condition; import org.apache.cloudstack.api.ApiConstants; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; +import org.apache.cloudstack.api.Entity; +@Entity(value=Condition.class) @SuppressWarnings("unused") public class ConditionResponse extends BaseResponse implements ControlledEntityResponse { @SerializedName("id") diff --git a/api/src/org/apache/cloudstack/api/response/FirewallRuleResponse.java b/api/src/org/apache/cloudstack/api/response/FirewallRuleResponse.java index 4dae4c5b857..8f7be39d6a7 100644 --- a/api/src/org/apache/cloudstack/api/response/FirewallRuleResponse.java +++ b/api/src/org/apache/cloudstack/api/response/FirewallRuleResponse.java @@ -18,11 +18,14 @@ package org.apache.cloudstack.api.response; import java.util.List; +import com.cloud.network.rules.FirewallRule; import org.apache.cloudstack.api.ApiConstants; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; +import org.apache.cloudstack.api.Entity; +@Entity(value=FirewallRule.class) @SuppressWarnings("unused") public class FirewallRuleResponse extends BaseResponse { @SerializedName(ApiConstants.ID) @Param(description="the ID of the port forwarding rule")