diff --git a/api/src/com/cloud/api/BaseAsyncCmd.java b/api/src/com/cloud/api/BaseAsyncCmd.java index 993eac79254..e102d0b8cd3 100644 --- a/api/src/com/cloud/api/BaseAsyncCmd.java +++ b/api/src/com/cloud/api/BaseAsyncCmd.java @@ -57,7 +57,7 @@ public abstract class BaseAsyncCmd extends BaseCmd { public ResponseObject getResponse(long jobId) { AsyncJobResponse response = new AsyncJobResponse(); - response.setId(_identityService.getIdentityUuid("async_job", String.valueOf(jobId))); + response.setId(jobId); response.setResponseName(getCommandName()); return response; } diff --git a/api/src/com/cloud/api/commands/ActivateProjectCmd.java b/api/src/com/cloud/api/commands/ActivateProjectCmd.java index 8db959eb2d5..385c585f409 100644 --- a/api/src/com/cloud/api/commands/ActivateProjectCmd.java +++ b/api/src/com/cloud/api/commands/ActivateProjectCmd.java @@ -23,6 +23,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.BaseCmd.CommandType; import com.cloud.api.Implementation; import com.cloud.api.Parameter; @@ -43,6 +44,7 @@ public class ActivateProjectCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="id of the project to be modified") private Long id; diff --git a/api/src/com/cloud/api/commands/AddAccountToProjectCmd.java b/api/src/com/cloud/api/commands/AddAccountToProjectCmd.java index 450ea857a7c..e45177ee1c6 100644 --- a/api/src/com/cloud/api/commands/AddAccountToProjectCmd.java +++ b/api/src/com/cloud/api/commands/AddAccountToProjectCmd.java @@ -23,6 +23,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -42,6 +43,7 @@ public class AddAccountToProjectCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, required=true, description="id of the project to add the account to") private Long projectId; diff --git a/api/src/com/cloud/api/commands/AddClusterCmd.java b/api/src/com/cloud/api/commands/AddClusterCmd.java index 454035fd96d..2b1daadc786 100755 --- a/api/src/com/cloud/api/commands/AddClusterCmd.java +++ b/api/src/com/cloud/api/commands/AddClusterCmd.java @@ -25,6 +25,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -46,6 +47,7 @@ public class AddClusterCmd extends BaseCmd { @Parameter(name=ApiConstants.PASSWORD, type=CommandType.STRING, required=false, description="the password for the host") private String password; + @IdentityMapper(entityTableName="host_pod_ref") @Parameter(name=ApiConstants.POD_ID, type=CommandType.LONG, description="the Pod ID for the host") private Long podId; @@ -55,6 +57,7 @@ public class AddClusterCmd extends BaseCmd { @Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, required=false, description="the username for the cluster") private String username; + @IdentityMapper(entityTableName="data_center") @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, required=true, description="the Zone ID for the cluster") private Long zoneId; diff --git a/api/src/com/cloud/api/commands/AddHostCmd.java b/api/src/com/cloud/api/commands/AddHostCmd.java index f6d54ce941d..a71f672288f 100755 --- a/api/src/com/cloud/api/commands/AddHostCmd.java +++ b/api/src/com/cloud/api/commands/AddHostCmd.java @@ -24,6 +24,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -44,6 +45,7 @@ public class AddHostCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="cluster") @Parameter(name=ApiConstants.CLUSTER_ID, type=CommandType.LONG, description="the cluster ID for the host") private Long clusterId; @@ -53,6 +55,7 @@ public class AddHostCmd extends BaseCmd { @Parameter(name=ApiConstants.PASSWORD, type=CommandType.STRING, required=true, description="the password for the host") private String password; + @IdentityMapper(entityTableName="host_pod_ref") @Parameter(name=ApiConstants.POD_ID, type=CommandType.LONG, description="the Pod ID for the host") private Long podId; @@ -62,6 +65,7 @@ public class AddHostCmd extends BaseCmd { @Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, required=true, description="the username for the host") private String username; + @IdentityMapper(entityTableName="data_center") @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, required=true, description="the Zone ID for the host") private Long zoneId; diff --git a/api/src/com/cloud/api/commands/AddSecondaryStorageCmd.java b/api/src/com/cloud/api/commands/AddSecondaryStorageCmd.java index 5b18d23bd6d..3a673f3a69b 100644 --- a/api/src/com/cloud/api/commands/AddSecondaryStorageCmd.java +++ b/api/src/com/cloud/api/commands/AddSecondaryStorageCmd.java @@ -24,6 +24,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -44,6 +45,7 @@ public class AddSecondaryStorageCmd extends BaseCmd { @Parameter(name=ApiConstants.URL, type=CommandType.STRING, required=true, description="the URL for the secondary storage") private String url; + @IdentityMapper(entityTableName="data_center") @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the Zone ID for the secondary storage") private Long zoneId; diff --git a/api/src/com/cloud/api/commands/AddVpnUserCmd.java b/api/src/com/cloud/api/commands/AddVpnUserCmd.java index bd65c5e2a4d..c56ac17f101 100644 --- a/api/src/com/cloud/api/commands/AddVpnUserCmd.java +++ b/api/src/com/cloud/api/commands/AddVpnUserCmd.java @@ -23,6 +23,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCreateCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -51,9 +52,11 @@ public class AddVpnUserCmd extends BaseAsyncCreateCmd { @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="an optional account for the vpn user. Must be used with domainId.") private String accountName; + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="add vpn user to the specific project") private Long projectId; + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="an optional domainId for the vpn user. If the account parameter is used, domainId must also be used.") private Long domainId; diff --git a/api/src/com/cloud/api/commands/AssignToLoadBalancerRuleCmd.java b/api/src/com/cloud/api/commands/AssignToLoadBalancerRuleCmd.java index 537d3cffb9c..20c5f3b72c5 100644 --- a/api/src/com/cloud/api/commands/AssignToLoadBalancerRuleCmd.java +++ b/api/src/com/cloud/api/commands/AssignToLoadBalancerRuleCmd.java @@ -24,6 +24,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -45,9 +46,11 @@ public class AssignToLoadBalancerRuleCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="firewall_rules") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the load balancer rule") private Long id; + @IdentityMapper(entityTableName="vm_instance") @Parameter(name=ApiConstants.VIRTUAL_MACHINE_IDS, type=CommandType.LIST, collectionType=CommandType.LONG, required=true, description="the list of IDs of the virtual machine that are being assigned to the load balancer rule(i.e. virtualMachineIds=1,2,3)") private List virtualMachineIds; diff --git a/api/src/com/cloud/api/commands/AssociateIPAddrCmd.java b/api/src/com/cloud/api/commands/AssociateIPAddrCmd.java index 6a94b3e02cb..cd63502e6e7 100644 --- a/api/src/com/cloud/api/commands/AssociateIPAddrCmd.java +++ b/api/src/com/cloud/api/commands/AssociateIPAddrCmd.java @@ -25,6 +25,7 @@ import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseAsyncCreateCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -56,15 +57,19 @@ public class AssociateIPAddrCmd extends BaseAsyncCreateCmd { @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="the account to associate with this IP address") private String accountName; + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="the ID of the domain to associate with this IP address") private Long domainId; + @IdentityMapper(entityTableName="data_center") @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, required=true, description="the ID of the availability zone you want to acquire an public IP address from") private Long zoneId; + @IdentityMapper(entityTableName="networks") @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.LONG, description="The network this ip address should be associated to.") private Long networkId; + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="Deploy vm for the project") private Long projectId; diff --git a/api/src/com/cloud/api/commands/AttachIsoCmd.java b/api/src/com/cloud/api/commands/AttachIsoCmd.java index 1ea03709a4f..5bb982badc8 100755 --- a/api/src/com/cloud/api/commands/AttachIsoCmd.java +++ b/api/src/com/cloud/api/commands/AttachIsoCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -41,9 +42,11 @@ public class AttachIsoCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="vm_template") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the ISO file") private Long id; + @IdentityMapper(entityTableName="vm_instance") @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.LONG, required=true, description="the ID of the virtual machine") private Long virtualMachineId; diff --git a/api/src/com/cloud/api/commands/AttachVolumeCmd.java b/api/src/com/cloud/api/commands/AttachVolumeCmd.java index da4e8700f27..032415d0ecd 100755 --- a/api/src/com/cloud/api/commands/AttachVolumeCmd.java +++ b/api/src/com/cloud/api/commands/AttachVolumeCmd.java @@ -23,6 +23,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -55,9 +56,11 @@ public class AttachVolumeCmd extends BaseAsyncCmd { "* 9 - /dev/xvdj") private Long deviceId; + @IdentityMapper(entityTableName="volumes") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the disk volume") private Long id; + @IdentityMapper(entityTableName="vm_instance") @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.LONG, required=true, description=" the ID of the virtual machine") private Long virtualMachineId; diff --git a/api/src/com/cloud/api/commands/AuthorizeSecurityGroupIngressCmd.java b/api/src/com/cloud/api/commands/AuthorizeSecurityGroupIngressCmd.java index e718d57353b..5150f381c77 100644 --- a/api/src/com/cloud/api/commands/AuthorizeSecurityGroupIngressCmd.java +++ b/api/src/com/cloud/api/commands/AuthorizeSecurityGroupIngressCmd.java @@ -29,6 +29,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -75,15 +76,18 @@ public class AuthorizeSecurityGroupIngressCmd extends BaseAsyncCmd { @Parameter(name = ApiConstants.USER_SECURITY_GROUP_LIST, type = CommandType.MAP, description = "user to security group mapping") private Map userSecurityGroupList; + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="an optional domainId for the security group. If the account parameter is used, domainId must also be used.") private Long domainId; @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="an optional account for the security group. Must be used with domainId.") private String accountName; + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="an optional project of the security group") private Long projectId; + @IdentityMapper(entityTableName="security_group") @Parameter(name=ApiConstants.SECURITY_GROUP_ID, type=CommandType.LONG, description="The ID of the security group. Mutually exclusive with securityGroupName parameter") private Long securityGroupId; diff --git a/api/src/com/cloud/api/commands/CancelMaintenanceCmd.java b/api/src/com/cloud/api/commands/CancelMaintenanceCmd.java index 7bf93326d70..289f442cc48 100644 --- a/api/src/com/cloud/api/commands/CancelMaintenanceCmd.java +++ b/api/src/com/cloud/api/commands/CancelMaintenanceCmd.java @@ -23,6 +23,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -43,6 +44,7 @@ public class CancelMaintenanceCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="host") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the host ID") private Long id; diff --git a/api/src/com/cloud/api/commands/CancelPrimaryStorageMaintenanceCmd.java b/api/src/com/cloud/api/commands/CancelPrimaryStorageMaintenanceCmd.java index 44d312c3df1..b4d4257731b 100644 --- a/api/src/com/cloud/api/commands/CancelPrimaryStorageMaintenanceCmd.java +++ b/api/src/com/cloud/api/commands/CancelPrimaryStorageMaintenanceCmd.java @@ -23,6 +23,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -44,6 +45,7 @@ public class CancelPrimaryStorageMaintenanceCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="storage_pool") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the primary storage ID") private Long id; diff --git a/api/src/com/cloud/api/commands/CopyTemplateCmd.java b/api/src/com/cloud/api/commands/CopyTemplateCmd.java index 7269871d114..e8e38fe886a 100755 --- a/api/src/com/cloud/api/commands/CopyTemplateCmd.java +++ b/api/src/com/cloud/api/commands/CopyTemplateCmd.java @@ -25,6 +25,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -46,12 +47,15 @@ public class CopyTemplateCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="data_center") @Parameter(name=ApiConstants.DESTINATION_ZONE_ID, type=CommandType.LONG, required=true, description="ID of the zone the template is being copied to.") private Long destZoneId; + @IdentityMapper(entityTableName="vm_template") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="Template ID.") private Long id; + @IdentityMapper(entityTableName="data_center") @Parameter(name=ApiConstants.SOURCE_ZONE_ID, type=CommandType.LONG, required=true, description="ID of the zone the template is currently hosted on.") private Long sourceZoneId; diff --git a/api/src/com/cloud/api/commands/CreateAccountCmd.java b/api/src/com/cloud/api/commands/CreateAccountCmd.java index d973876fb20..69e47278f5f 100644 --- a/api/src/com/cloud/api/commands/CreateAccountCmd.java +++ b/api/src/com/cloud/api/commands/CreateAccountCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -47,6 +48,7 @@ public class CreateAccountCmd extends BaseCmd { @Parameter(name=ApiConstants.ACCOUNT_TYPE, type=CommandType.SHORT, required=true, description="Type of the account. Specify 0 for user, 1 for root admin, and 2 for domain admin") private Short accountType; + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="Creates the user under the specified domain.") private Long domainId; diff --git a/api/src/com/cloud/api/commands/CreateDiskOfferingCmd.java b/api/src/com/cloud/api/commands/CreateDiskOfferingCmd.java index 9240664a65f..7ddf0f88e05 100755 --- a/api/src/com/cloud/api/commands/CreateDiskOfferingCmd.java +++ b/api/src/com/cloud/api/commands/CreateDiskOfferingCmd.java @@ -21,6 +21,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -53,6 +54,7 @@ public class CreateDiskOfferingCmd extends BaseCmd { @Parameter(name=ApiConstants.CUSTOMIZED, type=CommandType.BOOLEAN, description="whether disk offering is custom or not") private Boolean customized; + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="the ID of the containing domain, null for public offerings") private Long domainId; diff --git a/api/src/com/cloud/api/commands/CreateDomainCmd.java b/api/src/com/cloud/api/commands/CreateDomainCmd.java index 2c4c8f6fad0..9fb1bb94cba 100644 --- a/api/src/com/cloud/api/commands/CreateDomainCmd.java +++ b/api/src/com/cloud/api/commands/CreateDomainCmd.java @@ -21,6 +21,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -42,6 +43,7 @@ public class CreateDomainCmd extends BaseCmd { @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="creates domain with this name") private String domainName; + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.PARENT_DOMAIN_ID, type=CommandType.LONG, description="assigns new domain a parent domain by domain ID of the parent. If no parent domain is specied, the ROOT domain is assumed.") private Long parentDomainId; diff --git a/api/src/com/cloud/api/commands/CreateFirewallRuleCmd.java b/api/src/com/cloud/api/commands/CreateFirewallRuleCmd.java index 1a81f8d732c..730af9cd397 100644 --- a/api/src/com/cloud/api/commands/CreateFirewallRuleCmd.java +++ b/api/src/com/cloud/api/commands/CreateFirewallRuleCmd.java @@ -27,6 +27,7 @@ import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseAsyncCreateCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -51,6 +52,7 @@ public class CreateFirewallRuleCmd extends BaseAsyncCreateCmd implements Firewal // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// + @IdentityMapper(entityTableName="user_ip_address") @Parameter(name = ApiConstants.IP_ADDRESS_ID, type = CommandType.LONG, required = true, description = "the IP address id of the port forwarding rule") private Long ipAddressId; diff --git a/api/src/com/cloud/api/commands/CreateIpForwardingRuleCmd.java b/api/src/com/cloud/api/commands/CreateIpForwardingRuleCmd.java index 4ed54674973..ce705ead6f4 100644 --- a/api/src/com/cloud/api/commands/CreateIpForwardingRuleCmd.java +++ b/api/src/com/cloud/api/commands/CreateIpForwardingRuleCmd.java @@ -26,6 +26,7 @@ import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseAsyncCreateCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -51,6 +52,7 @@ public class CreateIpForwardingRuleCmd extends BaseAsyncCreateCmd implements Sta //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="user_ip_address") @Parameter(name=ApiConstants.IP_ADDRESS_ID, type=CommandType.LONG, required=true, description="the public IP address id of the forwarding rule, already associated via associateIp") private Long ipAddressId; diff --git a/api/src/com/cloud/api/commands/CreateLoadBalancerRuleCmd.java b/api/src/com/cloud/api/commands/CreateLoadBalancerRuleCmd.java index 32c2f3d7eca..c7e76771754 100644 --- a/api/src/com/cloud/api/commands/CreateLoadBalancerRuleCmd.java +++ b/api/src/com/cloud/api/commands/CreateLoadBalancerRuleCmd.java @@ -26,6 +26,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCreateCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -64,9 +65,11 @@ public class CreateLoadBalancerRuleCmd extends BaseAsyncCreateCmd /*implements @Parameter(name=ApiConstants.PRIVATE_PORT, type=CommandType.INTEGER, required=true, description="the private port of the private ip address/virtual machine where the network traffic will be load balanced to") private Integer privatePort; + @IdentityMapper(entityTableName="user_ip_address") @Parameter(name=ApiConstants.PUBLIC_IP_ID, type=CommandType.LONG, required=false, description="public ip address id from where the network traffic will be load balanced from") private Long publicIpId; + @IdentityMapper(entityTableName="data_center") @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, required=false, description="public ip address id from where the network traffic will be load balanced from") private Long zoneId; @@ -79,6 +82,7 @@ public class CreateLoadBalancerRuleCmd extends BaseAsyncCreateCmd /*implements @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="the account associated with the load balancer. 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 associated with the load balancer") private Long domainId; diff --git a/api/src/com/cloud/api/commands/CreateNetworkCmd.java b/api/src/com/cloud/api/commands/CreateNetworkCmd.java index b07a24cb838..da982d49f82 100644 --- a/api/src/com/cloud/api/commands/CreateNetworkCmd.java +++ b/api/src/com/cloud/api/commands/CreateNetworkCmd.java @@ -24,6 +24,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -54,6 +55,7 @@ public class CreateNetworkCmd extends BaseCmd { @Parameter(name=ApiConstants.NETWORK_OFFERING_ID, type=CommandType.LONG, required=true, description="the network offering id") private Long networkOfferingId; + @IdentityMapper(entityTableName="data_center") @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, required=true, description="the Zone ID for the network") private Long zoneId; @@ -75,9 +77,11 @@ public class CreateNetworkCmd extends BaseCmd { @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="account who will own the network") private String accountName; + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="an optional project for the ssh key") private Long projectId; + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="domain ID of the account owning a network") private Long domainId; diff --git a/api/src/com/cloud/api/commands/CreatePodCmd.java b/api/src/com/cloud/api/commands/CreatePodCmd.java index ea5cfddad94..a0e04a5db0d 100755 --- a/api/src/com/cloud/api/commands/CreatePodCmd.java +++ b/api/src/com/cloud/api/commands/CreatePodCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -55,6 +56,7 @@ public class CreatePodCmd extends BaseCmd { @Parameter(name=ApiConstants.START_IP, type=CommandType.STRING, required=true, description="the starting IP address for the Pod") private String startIp; + @IdentityMapper(entityTableName="data_center") @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, required=true, description="the Zone ID in which the Pod will be created ") private Long zoneId; diff --git a/api/src/com/cloud/api/commands/CreatePortForwardingRuleCmd.java b/api/src/com/cloud/api/commands/CreatePortForwardingRuleCmd.java index c492bf2d520..340f69e5872 100644 --- a/api/src/com/cloud/api/commands/CreatePortForwardingRuleCmd.java +++ b/api/src/com/cloud/api/commands/CreatePortForwardingRuleCmd.java @@ -26,6 +26,7 @@ import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseAsyncCreateCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -50,6 +51,7 @@ public class CreatePortForwardingRuleCmd extends BaseAsyncCreateCmd implements P // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// + @IdentityMapper(entityTableName="user_ip_address") @Parameter(name = ApiConstants.IP_ADDRESS_ID, type = CommandType.LONG, required = true, description = "the IP address id of the port forwarding rule") private Long ipAddressId; diff --git a/api/src/com/cloud/api/commands/CreateProjectCmd.java b/api/src/com/cloud/api/commands/CreateProjectCmd.java index 541448d21a5..88aa089f95a 100644 --- a/api/src/com/cloud/api/commands/CreateProjectCmd.java +++ b/api/src/com/cloud/api/commands/CreateProjectCmd.java @@ -23,6 +23,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCreateCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -47,6 +48,7 @@ public class CreateProjectCmd extends BaseAsyncCreateCmd { @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="account who will own the project") private String accountName; + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="domain ID of the account owning a project") private Long domainId; diff --git a/api/src/com/cloud/api/commands/CreateRemoteAccessVpnCmd.java b/api/src/com/cloud/api/commands/CreateRemoteAccessVpnCmd.java index 861b6a999be..9622cb0f2dd 100644 --- a/api/src/com/cloud/api/commands/CreateRemoteAccessVpnCmd.java +++ b/api/src/com/cloud/api/commands/CreateRemoteAccessVpnCmd.java @@ -24,6 +24,7 @@ import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseAsyncCreateCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -44,6 +45,7 @@ public class CreateRemoteAccessVpnCmd extends BaseAsyncCreateCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="user_ip_address") @Parameter(name=ApiConstants.PUBLIC_IP_ID, type=CommandType.LONG, required=true, description="public ip address id of the vpn server") private Long publicIpId; @@ -55,6 +57,7 @@ public class CreateRemoteAccessVpnCmd extends BaseAsyncCreateCmd { private String accountName; @Deprecated + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="an optional domainId for the VPN. If the account parameter is used, domainId must also be used.") private Long domainId; diff --git a/api/src/com/cloud/api/commands/CreateSSHKeyPairCmd.java b/api/src/com/cloud/api/commands/CreateSSHKeyPairCmd.java index e005b638051..b51c510e46d 100644 --- a/api/src/com/cloud/api/commands/CreateSSHKeyPairCmd.java +++ b/api/src/com/cloud/api/commands/CreateSSHKeyPairCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.response.SSHKeyPairResponse; @@ -45,9 +46,11 @@ public class CreateSSHKeyPairCmd extends BaseCmd { @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="an optional account for the ssh key. Must be used with domainId.") private String accountName; + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="an optional domainId for the ssh key. If the account parameter is used, domainId must also be used.") private Long domainId; + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="an optional project for the ssh key") private Long projectId; diff --git a/api/src/com/cloud/api/commands/CreateSecurityGroupCmd.java b/api/src/com/cloud/api/commands/CreateSecurityGroupCmd.java index d47aab8558c..063b3559434 100644 --- a/api/src/com/cloud/api/commands/CreateSecurityGroupCmd.java +++ b/api/src/com/cloud/api/commands/CreateSecurityGroupCmd.java @@ -21,6 +21,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -43,6 +44,7 @@ public class CreateSecurityGroupCmd extends BaseCmd { @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="an optional account for the security group. Must be used with domainId.") private String accountName; + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="an optional domainId for the security group. If the account parameter is used, domainId must also be used.") private Long domainId; @@ -52,6 +54,7 @@ public class CreateSecurityGroupCmd extends BaseCmd { @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="name of the security group") private String securityGroupName; + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="Deploy vm for the project") private Long projectId; diff --git a/api/src/com/cloud/api/commands/CreateServiceOfferingCmd.java b/api/src/com/cloud/api/commands/CreateServiceOfferingCmd.java index 6ea421257bc..d86a044486d 100644 --- a/api/src/com/cloud/api/commands/CreateServiceOfferingCmd.java +++ b/api/src/com/cloud/api/commands/CreateServiceOfferingCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -65,6 +66,7 @@ public class CreateServiceOfferingCmd extends BaseCmd { @Parameter(name=ApiConstants.TAGS, type=CommandType.STRING, description="the tags for this service offering.") private String tags; + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="the ID of the containing domain, null for public offerings") private Long domainId; diff --git a/api/src/com/cloud/api/commands/CreateSnapshotCmd.java b/api/src/com/cloud/api/commands/CreateSnapshotCmd.java index ca5e0cd30a3..64eaa84f3d8 100755 --- a/api/src/com/cloud/api/commands/CreateSnapshotCmd.java +++ b/api/src/com/cloud/api/commands/CreateSnapshotCmd.java @@ -23,6 +23,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCreateCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -47,12 +48,15 @@ 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.") private Long domainId; + @IdentityMapper(entityTableName="volumes") @Parameter(name = ApiConstants.VOLUME_ID, type = CommandType.LONG, 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.") private Long policyId; diff --git a/api/src/com/cloud/api/commands/CreateSnapshotPolicyCmd.java b/api/src/com/cloud/api/commands/CreateSnapshotPolicyCmd.java index f8fa74da7dc..23bfa1f0ca8 100644 --- a/api/src/com/cloud/api/commands/CreateSnapshotPolicyCmd.java +++ b/api/src/com/cloud/api/commands/CreateSnapshotPolicyCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -57,6 +58,7 @@ 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") private Long volumeId; diff --git a/api/src/com/cloud/api/commands/CreateStoragePoolCmd.java b/api/src/com/cloud/api/commands/CreateStoragePoolCmd.java index 87c51e4a47d..b64416a7fa3 100644 --- a/api/src/com/cloud/api/commands/CreateStoragePoolCmd.java +++ b/api/src/com/cloud/api/commands/CreateStoragePoolCmd.java @@ -25,6 +25,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -45,6 +46,7 @@ public class CreateStoragePoolCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="cluster") @Parameter(name=ApiConstants.CLUSTER_ID, type=CommandType.LONG, description="the cluster ID for the storage pool") private Long clusterId; @@ -54,6 +56,7 @@ public class CreateStoragePoolCmd extends BaseCmd { @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="the name for the storage pool") private String storagePoolName; + @IdentityMapper(entityTableName="host_pod_ref") @Parameter(name=ApiConstants.POD_ID, type=CommandType.LONG, description="the Pod ID for the storage pool") private Long podId; @@ -63,6 +66,7 @@ public class CreateStoragePoolCmd extends BaseCmd { @Parameter(name=ApiConstants.URL, type=CommandType.STRING, required=true, description="the URL of the storage pool") private String url; + @IdentityMapper(entityTableName="data_center") @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, required=true, description="the Zone ID for the storage pool") private Long zoneId; diff --git a/api/src/com/cloud/api/commands/CreateTemplateCmd.java b/api/src/com/cloud/api/commands/CreateTemplateCmd.java index ef9002f118f..afe09ef4ebb 100755 --- a/api/src/com/cloud/api/commands/CreateTemplateCmd.java +++ b/api/src/com/cloud/api/commands/CreateTemplateCmd.java @@ -25,6 +25,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCreateCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -64,6 +65,7 @@ import com.cloud.user.UserContext; @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "the name of the template") private String templateName; + @IdentityMapper(entityTableName="guest_os") @Parameter(name = ApiConstants.OS_TYPE_ID, type = CommandType.LONG, required = true, description = "the ID of the OS Type that best represents the OS of this template.") private Long osTypeId; @@ -73,12 +75,15 @@ import com.cloud.user.UserContext; @Parameter(name = ApiConstants.REQUIRES_HVM, type = CommandType.BOOLEAN, description = "true if the template requres HVM, false otherwise") private Boolean requiresHvm; + @IdentityMapper(entityTableName="snapshots") @Parameter(name = ApiConstants.SNAPSHOT_ID, type = CommandType.LONG, description = "the ID of the snapshot the template is being created from. Either this parameter, or volumeId has to be passed in") private Long snapshotId; + @IdentityMapper(entityTableName="volumes") @Parameter(name = ApiConstants.VOLUME_ID, type = CommandType.LONG, description = "the ID of the disk volume the template is being created from. Either this parameter, or snapshotId has to be passed in") private Long volumeId; + @IdentityMapper(entityTableName="vm_instance") @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.LONG, description="Optional, VM ID. If this presents, it is going to create a baremetal template for VM this ID refers to. This is only for VM whose hypervisor type is BareMetal") private Long vmId; diff --git a/api/src/com/cloud/api/commands/CreateUserCmd.java b/api/src/com/cloud/api/commands/CreateUserCmd.java index 6cd208baf72..7e5aa85fde4 100644 --- a/api/src/com/cloud/api/commands/CreateUserCmd.java +++ b/api/src/com/cloud/api/commands/CreateUserCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -43,6 +44,7 @@ public class CreateUserCmd extends BaseCmd { @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, required=true, description="Creates the user under the specified account. If no account is specified, the username will be used as the account name.") private String accountName; + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="Creates the user under the specified domain. Has to be accompanied with the account parameter") private Long domainId; diff --git a/api/src/com/cloud/api/commands/CreateVMGroupCmd.java b/api/src/com/cloud/api/commands/CreateVMGroupCmd.java index 2387b25b966..1593a98939b 100644 --- a/api/src/com/cloud/api/commands/CreateVMGroupCmd.java +++ b/api/src/com/cloud/api/commands/CreateVMGroupCmd.java @@ -21,6 +21,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -44,9 +45,11 @@ public class CreateVMGroupCmd extends BaseCmd{ @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="the account of the instance group. 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 account owning the instance group") private Long domainId; + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="The project of the instance group") private Long projectId; diff --git a/api/src/com/cloud/api/commands/CreateVlanIpRangeCmd.java b/api/src/com/cloud/api/commands/CreateVlanIpRangeCmd.java index 3353af834f6..338a3c4e5ac 100644 --- a/api/src/com/cloud/api/commands/CreateVlanIpRangeCmd.java +++ b/api/src/com/cloud/api/commands/CreateVlanIpRangeCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -45,9 +46,11 @@ public class CreateVlanIpRangeCmd extends BaseCmd { @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="account who will own the VLAN. If VLAN is Zone wide, this parameter should be ommited") private String accountName; + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="project who will own the VLAN. If VLAN is Zone wide, this parameter should be ommited") private Long projectId; + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="domain ID of the account owning a VLAN") private Long domainId; @@ -63,6 +66,7 @@ public class CreateVlanIpRangeCmd extends BaseCmd { @Parameter(name=ApiConstants.NETMASK, type=CommandType.STRING, description="the netmask of the VLAN IP range") private String netmask; + @IdentityMapper(entityTableName="host_pod_ref") @Parameter(name=ApiConstants.POD_ID, type=CommandType.LONG, description="optional parameter. Have to be specified for Direct Untagged vlan only.") private Long podId; @@ -72,9 +76,11 @@ public class CreateVlanIpRangeCmd extends BaseCmd { @Parameter(name=ApiConstants.VLAN, type=CommandType.STRING, description="the ID or VID of the VLAN. Default is an \"untagged\" VLAN.") private String vlan; + @IdentityMapper(entityTableName="data_center") @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the Zone ID of the VLAN IP range") private Long zoneId; + @IdentityMapper(entityTableName="networks") @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.LONG, description="the network id") private Long networkID; diff --git a/api/src/com/cloud/api/commands/CreateVolumeCmd.java b/api/src/com/cloud/api/commands/CreateVolumeCmd.java index 7f184f3c7a7..f2b07642ad4 100644 --- a/api/src/com/cloud/api/commands/CreateVolumeCmd.java +++ b/api/src/com/cloud/api/commands/CreateVolumeCmd.java @@ -23,6 +23,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCreateCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -47,12 +48,15 @@ public class CreateVolumeCmd extends BaseAsyncCreateCmd { @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="the account associated with the disk volume. Must be used with the domainId parameter.") private String accountName; + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="the project associated with the volume. Mutually exclusive with account parameter") private Long projectId; + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="the domain ID associated with the disk offering. If used with the account parameter returns the disk volume associated with the account for the specified domain.") private Long domainId; + @IdentityMapper(entityTableName="disk_offering") @Parameter(name=ApiConstants.DISK_OFFERING_ID,required = false, type=CommandType.LONG, description="the ID of the disk offering. Either diskOfferingId or snapshotId must be passed in.") private Long diskOfferingId; @@ -62,9 +66,11 @@ public class CreateVolumeCmd extends BaseAsyncCreateCmd { @Parameter(name=ApiConstants.SIZE, type=CommandType.LONG, description="Arbitrary volume size") private Long size; + @IdentityMapper(entityTableName="snapshots") @Parameter(name=ApiConstants.SNAPSHOT_ID, type=CommandType.LONG, description="the snapshot ID for the disk volume. Either diskOfferingId or snapshotId must be passed in.") private Long snapshotId; + @IdentityMapper(entityTableName="data_center") @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the ID of the availability zone") private Long zoneId; diff --git a/api/src/com/cloud/api/commands/CreateZoneCmd.java b/api/src/com/cloud/api/commands/CreateZoneCmd.java index 8363e67723d..1b764fbea76 100755 --- a/api/src/com/cloud/api/commands/CreateZoneCmd.java +++ b/api/src/com/cloud/api/commands/CreateZoneCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -63,6 +64,7 @@ public class CreateZoneCmd extends BaseCmd { @Parameter(name=ApiConstants.DOMAIN, type=CommandType.STRING, description="Network domain name for the networks in the zone") private String domain; + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="the ID of the containing domain, null for public zones") private Long domainId; diff --git a/api/src/com/cloud/api/commands/DeleteAccountCmd.java b/api/src/com/cloud/api/commands/DeleteAccountCmd.java index 98fa690472b..7e35858b24b 100644 --- a/api/src/com/cloud/api/commands/DeleteAccountCmd.java +++ b/api/src/com/cloud/api/commands/DeleteAccountCmd.java @@ -23,6 +23,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -41,6 +42,8 @@ public class DeleteAccountCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + + @IdentityMapper(entityTableName="account") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="Account id") private Long id; diff --git a/api/src/com/cloud/api/commands/DeleteAccountFromProjectCmd.java b/api/src/com/cloud/api/commands/DeleteAccountFromProjectCmd.java index 73829f3e00f..74ef226e655 100644 --- a/api/src/com/cloud/api/commands/DeleteAccountFromProjectCmd.java +++ b/api/src/com/cloud/api/commands/DeleteAccountFromProjectCmd.java @@ -23,6 +23,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -41,6 +42,7 @@ public class DeleteAccountFromProjectCmd extends BaseAsyncCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, required=true, description="id of the project to remove the account from") private Long projectId; diff --git a/api/src/com/cloud/api/commands/DeleteClusterCmd.java b/api/src/com/cloud/api/commands/DeleteClusterCmd.java index 9242be05aec..c0e67e44ec5 100644 --- a/api/src/com/cloud/api/commands/DeleteClusterCmd.java +++ b/api/src/com/cloud/api/commands/DeleteClusterCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -39,6 +40,7 @@ public class DeleteClusterCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="cluster") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the cluster ID") private Long id; diff --git a/api/src/com/cloud/api/commands/DeleteDiskOfferingCmd.java b/api/src/com/cloud/api/commands/DeleteDiskOfferingCmd.java index a483c16ec15..4ef6baeb812 100644 --- a/api/src/com/cloud/api/commands/DeleteDiskOfferingCmd.java +++ b/api/src/com/cloud/api/commands/DeleteDiskOfferingCmd.java @@ -21,6 +21,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -36,6 +37,7 @@ public class DeleteDiskOfferingCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="disk_offering") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="ID of the disk offering") private Long id; diff --git a/api/src/com/cloud/api/commands/DeleteDomainCmd.java b/api/src/com/cloud/api/commands/DeleteDomainCmd.java index d2e0d96f48d..6271cc25a09 100644 --- a/api/src/com/cloud/api/commands/DeleteDomainCmd.java +++ b/api/src/com/cloud/api/commands/DeleteDomainCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -40,6 +41,7 @@ public class DeleteDomainCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="ID of domain to delete") private Long id; diff --git a/api/src/com/cloud/api/commands/DeleteFirewallRuleCmd.java b/api/src/com/cloud/api/commands/DeleteFirewallRuleCmd.java index 4433fb23e7c..40083bd46f4 100644 --- a/api/src/com/cloud/api/commands/DeleteFirewallRuleCmd.java +++ b/api/src/com/cloud/api/commands/DeleteFirewallRuleCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -41,10 +42,12 @@ public class DeleteFirewallRuleCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="firewall_rules") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the firewall rule") private Long id; // unexposed parameter needed for events logging + @IdentityMapper(entityTableName="account") @Parameter(name=ApiConstants.ACCOUNT_ID, type=CommandType.LONG, expose=false) private Long ownerId; ///////////////////////////////////////////////////// diff --git a/api/src/com/cloud/api/commands/DeleteHostCmd.java b/api/src/com/cloud/api/commands/DeleteHostCmd.java index b0ac0ecfb3c..bc53500c908 100644 --- a/api/src/com/cloud/api/commands/DeleteHostCmd.java +++ b/api/src/com/cloud/api/commands/DeleteHostCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -38,6 +39,7 @@ public class DeleteHostCmd extends BaseCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// + @IdentityMapper(entityTableName="host") @Parameter(name = ApiConstants.ID, type = CommandType.LONG, required = true, description = "the host ID") private Long id; diff --git a/api/src/com/cloud/api/commands/DeleteIpForwardingRuleCmd.java b/api/src/com/cloud/api/commands/DeleteIpForwardingRuleCmd.java index 445f40aacc3..363a31af3e1 100644 --- a/api/src/com/cloud/api/commands/DeleteIpForwardingRuleCmd.java +++ b/api/src/com/cloud/api/commands/DeleteIpForwardingRuleCmd.java @@ -23,6 +23,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -42,11 +43,13 @@ public class DeleteIpForwardingRuleCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="firewall_rules") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the id of the forwarding rule") private Long id; // unexposed parameter needed for events logging + @IdentityMapper(entityTableName="account") @Parameter(name=ApiConstants.ACCOUNT_ID, type=CommandType.LONG, expose=false) private Long ownerId; ///////////////////////////////////////////////////// diff --git a/api/src/com/cloud/api/commands/DeleteIsoCmd.java b/api/src/com/cloud/api/commands/DeleteIsoCmd.java index f48e249b01d..e35687e3c0b 100755 --- a/api/src/com/cloud/api/commands/DeleteIsoCmd.java +++ b/api/src/com/cloud/api/commands/DeleteIsoCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -41,9 +42,11 @@ public class DeleteIsoCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="vm_template") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the ISO file") private Long id; + @IdentityMapper(entityTableName="data_center") @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the ID of the zone of the ISO file. If not specified, the ISO will be deleted from all the zones") private Long zoneId; diff --git a/api/src/com/cloud/api/commands/DeleteLoadBalancerRuleCmd.java b/api/src/com/cloud/api/commands/DeleteLoadBalancerRuleCmd.java index b91a621a4e9..686e9efef40 100644 --- a/api/src/com/cloud/api/commands/DeleteLoadBalancerRuleCmd.java +++ b/api/src/com/cloud/api/commands/DeleteLoadBalancerRuleCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -40,6 +41,7 @@ public class DeleteLoadBalancerRuleCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="firewall_rules") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the load balancer rule") private Long id; diff --git a/api/src/com/cloud/api/commands/DeleteNetworkCmd.java b/api/src/com/cloud/api/commands/DeleteNetworkCmd.java index b3a9d0572c0..142166bcd7a 100644 --- a/api/src/com/cloud/api/commands/DeleteNetworkCmd.java +++ b/api/src/com/cloud/api/commands/DeleteNetworkCmd.java @@ -23,6 +23,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -41,6 +42,7 @@ public class DeleteNetworkCmd extends BaseAsyncCmd{ //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="networks") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the network") private Long id; diff --git a/api/src/com/cloud/api/commands/DeleteNetworkOfferingCmd.java b/api/src/com/cloud/api/commands/DeleteNetworkOfferingCmd.java index 97418546216..a668c2eee6b 100644 --- a/api/src/com/cloud/api/commands/DeleteNetworkOfferingCmd.java +++ b/api/src/com/cloud/api/commands/DeleteNetworkOfferingCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -37,6 +38,7 @@ public class DeleteNetworkOfferingCmd extends BaseCmd{ //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="network_offerings") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the network offering") private Long id; diff --git a/api/src/com/cloud/api/commands/DeletePodCmd.java b/api/src/com/cloud/api/commands/DeletePodCmd.java index 73ca32a78a9..17f770d635b 100644 --- a/api/src/com/cloud/api/commands/DeletePodCmd.java +++ b/api/src/com/cloud/api/commands/DeletePodCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -38,6 +39,7 @@ public class DeletePodCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="host_pod_ref") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the Pod") private Long id; diff --git a/api/src/com/cloud/api/commands/DeletePoolCmd.java b/api/src/com/cloud/api/commands/DeletePoolCmd.java index 326b9b6b015..bb2d96fcf5f 100644 --- a/api/src/com/cloud/api/commands/DeletePoolCmd.java +++ b/api/src/com/cloud/api/commands/DeletePoolCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -39,6 +40,7 @@ public class DeletePoolCmd extends BaseCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// + @IdentityMapper(entityTableName="storage_pool") @Parameter(name = ApiConstants.ID, type = CommandType.LONG, required = true, description = "Storage pool id") private Long id; diff --git a/api/src/com/cloud/api/commands/DeletePortForwardingRuleCmd.java b/api/src/com/cloud/api/commands/DeletePortForwardingRuleCmd.java index ed287204873..f8427a2048b 100644 --- a/api/src/com/cloud/api/commands/DeletePortForwardingRuleCmd.java +++ b/api/src/com/cloud/api/commands/DeletePortForwardingRuleCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -40,10 +41,12 @@ public class DeletePortForwardingRuleCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="firewall_rules") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the port forwarding rule") private Long id; // unexposed parameter needed for events logging + @IdentityMapper(entityTableName="account") @Parameter(name=ApiConstants.ACCOUNT_ID, type=CommandType.LONG, expose=false) private Long ownerId; ///////////////////////////////////////////////////// diff --git a/api/src/com/cloud/api/commands/DeleteProjectCmd.java b/api/src/com/cloud/api/commands/DeleteProjectCmd.java index 31c7e8906a7..096a7dd9d06 100644 --- a/api/src/com/cloud/api/commands/DeleteProjectCmd.java +++ b/api/src/com/cloud/api/commands/DeleteProjectCmd.java @@ -23,6 +23,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -42,6 +43,7 @@ public class DeleteProjectCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="id of the project to be deleted") private Long id; diff --git a/api/src/com/cloud/api/commands/DeleteProjectInvitationCmd.java b/api/src/com/cloud/api/commands/DeleteProjectInvitationCmd.java index ca909ae57c2..723167b79f9 100644 --- a/api/src/com/cloud/api/commands/DeleteProjectInvitationCmd.java +++ b/api/src/com/cloud/api/commands/DeleteProjectInvitationCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -38,6 +39,7 @@ public class DeleteProjectInvitationCmd extends BaseAsyncCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="project_invitations") @Parameter(name=ApiConstants.ID, required=true, type=CommandType.LONG, description="id of the invitation") private Long id; diff --git a/api/src/com/cloud/api/commands/DeleteRemoteAccessVpnCmd.java b/api/src/com/cloud/api/commands/DeleteRemoteAccessVpnCmd.java index 8077b941cd0..582da4f03f8 100644 --- a/api/src/com/cloud/api/commands/DeleteRemoteAccessVpnCmd.java +++ b/api/src/com/cloud/api/commands/DeleteRemoteAccessVpnCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.response.SuccessResponse; @@ -38,10 +39,12 @@ public class DeleteRemoteAccessVpnCmd extends BaseAsyncCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="user_ip_address") @Parameter(name=ApiConstants.PUBLIC_IP_ID, type=CommandType.LONG, required=true, description="public ip address id of the vpn server") private Long publicIpId; // unexposed parameter needed for events logging + @IdentityMapper(entityTableName="account") @Parameter(name=ApiConstants.ACCOUNT_ID, type=CommandType.LONG, expose=false) private Long ownerId; ///////////////////////////////////////////////////// diff --git a/api/src/com/cloud/api/commands/DeleteSSHKeyPairCmd.java b/api/src/com/cloud/api/commands/DeleteSSHKeyPairCmd.java index e51c12a03bc..e79c208ba44 100644 --- a/api/src/com/cloud/api/commands/DeleteSSHKeyPairCmd.java +++ b/api/src/com/cloud/api/commands/DeleteSSHKeyPairCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.response.SuccessResponse; @@ -44,9 +45,11 @@ public class DeleteSSHKeyPairCmd extends BaseCmd { @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="the account associated with the keypair. 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 associated with the keypair") private Long domainId; + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="the project associated with keypair") private Long projectId; diff --git a/api/src/com/cloud/api/commands/DeleteSecurityGroupCmd.java b/api/src/com/cloud/api/commands/DeleteSecurityGroupCmd.java index 28383a4e32e..70cc1322438 100644 --- a/api/src/com/cloud/api/commands/DeleteSecurityGroupCmd.java +++ b/api/src/com/cloud/api/commands/DeleteSecurityGroupCmd.java @@ -4,6 +4,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -24,12 +25,15 @@ public class DeleteSecurityGroupCmd extends BaseCmd { @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="the account of the security group. Must be specified with domain ID") private String accountName; + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="the domain ID of account owning the security group") private Long domainId; + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="the project of the security group") private Long projectId; + @IdentityMapper(entityTableName="security_group") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="The ID of the security group. Mutually exclusive with name parameter") private Long id; diff --git a/api/src/com/cloud/api/commands/DeleteServiceOfferingCmd.java b/api/src/com/cloud/api/commands/DeleteServiceOfferingCmd.java index bea544e50e8..880cee40737 100644 --- a/api/src/com/cloud/api/commands/DeleteServiceOfferingCmd.java +++ b/api/src/com/cloud/api/commands/DeleteServiceOfferingCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -37,6 +38,7 @@ public class DeleteServiceOfferingCmd extends BaseCmd{ //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="disk_offering") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the service offering") private Long id; diff --git a/api/src/com/cloud/api/commands/DeleteSnapshotCmd.java b/api/src/com/cloud/api/commands/DeleteSnapshotCmd.java index fdf875060f4..f3322dec9e6 100644 --- a/api/src/com/cloud/api/commands/DeleteSnapshotCmd.java +++ b/api/src/com/cloud/api/commands/DeleteSnapshotCmd.java @@ -23,6 +23,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -42,6 +43,7 @@ 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") private Long id; diff --git a/api/src/com/cloud/api/commands/DeleteSnapshotPoliciesCmd.java b/api/src/com/cloud/api/commands/DeleteSnapshotPoliciesCmd.java index 6bfcfdfd730..8cad576063e 100644 --- a/api/src/com/cloud/api/commands/DeleteSnapshotPoliciesCmd.java +++ b/api/src/com/cloud/api/commands/DeleteSnapshotPoliciesCmd.java @@ -24,6 +24,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -40,9 +41,11 @@ public class DeleteSnapshotPoliciesCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="snapshots") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the Id of the snapshot") private Long id; + @IdentityMapper(entityTableName="snapshots") @Parameter(name=ApiConstants.IDS, type=CommandType.LIST, collectionType=CommandType.LONG, description="list of snapshots IDs separated by comma") private List ids; diff --git a/api/src/com/cloud/api/commands/DeleteTemplateCmd.java b/api/src/com/cloud/api/commands/DeleteTemplateCmd.java index b9e00589c9f..c231dfa19cc 100755 --- a/api/src/com/cloud/api/commands/DeleteTemplateCmd.java +++ b/api/src/com/cloud/api/commands/DeleteTemplateCmd.java @@ -23,6 +23,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -42,9 +43,11 @@ public class DeleteTemplateCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="vm_template") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the template") private Long id; + @IdentityMapper(entityTableName="data_center") @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the ID of zone of the template") private Long zoneId; diff --git a/api/src/com/cloud/api/commands/DeleteUserCmd.java b/api/src/com/cloud/api/commands/DeleteUserCmd.java index 7455ade4c75..794cead5220 100644 --- a/api/src/com/cloud/api/commands/DeleteUserCmd.java +++ b/api/src/com/cloud/api/commands/DeleteUserCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -40,7 +41,7 @@ public class DeleteUserCmd extends BaseCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - + @IdentityMapper(entityTableName="user") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="Deletes a user") private Long id; diff --git a/api/src/com/cloud/api/commands/DeleteVMGroupCmd.java b/api/src/com/cloud/api/commands/DeleteVMGroupCmd.java index daab8259231..b21025e30e2 100644 --- a/api/src/com/cloud/api/commands/DeleteVMGroupCmd.java +++ b/api/src/com/cloud/api/commands/DeleteVMGroupCmd.java @@ -21,6 +21,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -37,6 +38,7 @@ public class DeleteVMGroupCmd extends BaseCmd{ //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="instance_group") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the instance group") private Long id; diff --git a/api/src/com/cloud/api/commands/DeleteVlanIpRangeCmd.java b/api/src/com/cloud/api/commands/DeleteVlanIpRangeCmd.java index a26804f5473..66230daba44 100644 --- a/api/src/com/cloud/api/commands/DeleteVlanIpRangeCmd.java +++ b/api/src/com/cloud/api/commands/DeleteVlanIpRangeCmd.java @@ -18,10 +18,13 @@ package com.cloud.api.commands; +import java.util.UUID; + import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -38,6 +41,7 @@ public class DeleteVlanIpRangeCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="vlan") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the id of the VLAN IP range") private Long id; diff --git a/api/src/com/cloud/api/commands/DeleteVolumeCmd.java b/api/src/com/cloud/api/commands/DeleteVolumeCmd.java index 6c6d99ebb96..55687a31a61 100644 --- a/api/src/com/cloud/api/commands/DeleteVolumeCmd.java +++ b/api/src/com/cloud/api/commands/DeleteVolumeCmd.java @@ -23,6 +23,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -41,6 +42,7 @@ public class DeleteVolumeCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="volumes") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="The ID of the disk volume") private Long id; diff --git a/api/src/com/cloud/api/commands/DeleteZoneCmd.java b/api/src/com/cloud/api/commands/DeleteZoneCmd.java index bd39bdb98da..a892a90d51f 100644 --- a/api/src/com/cloud/api/commands/DeleteZoneCmd.java +++ b/api/src/com/cloud/api/commands/DeleteZoneCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -38,6 +39,7 @@ public class DeleteZoneCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="data_center") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the Zone") private Long id; diff --git a/api/src/com/cloud/api/commands/DeployVMCmd.java b/api/src/com/cloud/api/commands/DeployVMCmd.java index 60a15807419..3b6be389d06 100644 --- a/api/src/com/cloud/api/commands/DeployVMCmd.java +++ b/api/src/com/cloud/api/commands/DeployVMCmd.java @@ -30,6 +30,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCreateCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -61,12 +62,15 @@ public class DeployVMCmd extends BaseAsyncCreateCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="data_center") @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, required=true, description="availability zone for the virtual machine") private Long zoneId; + @IdentityMapper(entityTableName="disk_offering") @Parameter(name=ApiConstants.SERVICE_OFFERING_ID, type=CommandType.LONG, required=true, description="the ID of the service offering for the virtual machine") private Long serviceOfferingId; + @IdentityMapper(entityTableName="vm_template") @Parameter(name=ApiConstants.TEMPLATE_ID, type=CommandType.LONG, required=true, description="the ID of the template for the virtual machine") private Long templateId; @@ -80,14 +84,17 @@ public class DeployVMCmd extends BaseAsyncCreateCmd { @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="an optional account for the virtual machine. Must be used with domainId.") private String accountName; + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="an optional domainId for the virtual machine. If the account parameter is used, domainId must also be used.") private Long domainId; //Network information + @IdentityMapper(entityTableName="networks") @Parameter(name=ApiConstants.NETWORK_IDS, type=CommandType.LIST, collectionType=CommandType.LONG, description="list of network ids used by virtual machine. Can't be specified with ipToNetworkList parameter") private List networkIds; //DataDisk information + @IdentityMapper(entityTableName="disk_offering") @Parameter(name=ApiConstants.DISK_OFFERING_ID, type=CommandType.LONG, description="the ID of the disk offering for the virtual machine. If the template is of ISO format, the diskOfferingId is for the root disk volume. Otherwise this parameter is used to indicate the offering for the data disk volume. If the templateId parameter passed is from a Template object, the diskOfferingId refers to a DATA Disk Volume created. If the templateId parameter passed is from an ISO object, the diskOfferingId refers to a ROOT Disk Volume created.") private Long diskOfferingId; @@ -106,15 +113,18 @@ public class DeployVMCmd extends BaseAsyncCreateCmd { @Parameter(name=ApiConstants.SSH_KEYPAIR, type=CommandType.STRING, description="name of the ssh key pair used to login to the virtual machine") private String sshKeyPairName; + @IdentityMapper(entityTableName="host") @Parameter(name=ApiConstants.HOST_ID, type=CommandType.LONG, description="destination Host ID to deploy the VM to - parameter available for root admin only") private Long hostId; + @IdentityMapper(entityTableName="security_group") @Parameter(name=ApiConstants.SECURITY_GROUP_IDS, type=CommandType.LIST, collectionType=CommandType.LONG, description="comma separated list of security groups id that going to be applied to the virtual machine. Should be passed only when vm is created from a zone with Basic Network support. Mutually exclusive with securitygroupnames parameter") private List securityGroupIdList; @Parameter(name=ApiConstants.SECURITY_GROUP_NAMES, type=CommandType.LIST, collectionType=CommandType.STRING, description="comma separated list of security groups names that going to be applied to the virtual machine. Should be passed only when vm is created from a zone with Basic Network support. Mutually exclusive with securitygroupids parameter") private List securityGroupNameList; + @IdentityMapper(entityTableName="networks") @Parameter(name = ApiConstants.IP_NETWORK_LIST, type = CommandType.MAP, description = "ip to network mapping. Can't be specified with networkIds parameter. Example: iptonetworklist[0].ip=10.10.10.11&iptonetworklist[0].networkid=204 - requests to use ip 10.10.10.11 in network id=204") private Map ipToNetworkList; @@ -124,6 +134,7 @@ public class DeployVMCmd extends BaseAsyncCreateCmd { @Parameter(name=ApiConstants.KEYBOARD, type=CommandType.STRING, description="an optional keyboard device type for the virtual machine. valid value can be one of de,de-ch,es,fi,fr,fr-be,fr-ch,is,it,jp,nl-be,no,pt,uk,us") private String keyboard; + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="Deploy vm for the project") private Long projectId; diff --git a/api/src/com/cloud/api/commands/DestroyRouterCmd.java b/api/src/com/cloud/api/commands/DestroyRouterCmd.java index a1a735e0ecc..24a02ca4474 100644 --- a/api/src/com/cloud/api/commands/DestroyRouterCmd.java +++ b/api/src/com/cloud/api/commands/DestroyRouterCmd.java @@ -23,6 +23,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -44,6 +45,7 @@ public class DestroyRouterCmd extends BaseAsyncCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// + @IdentityMapper(entityTableName="vm_instance") @Parameter(name = ApiConstants.ID, type = CommandType.LONG, required = true, description = "the ID of the router") private Long id; diff --git a/api/src/com/cloud/api/commands/DetachIsoCmd.java b/api/src/com/cloud/api/commands/DetachIsoCmd.java index 1253095f869..2b1b6c4214b 100755 --- a/api/src/com/cloud/api/commands/DetachIsoCmd.java +++ b/api/src/com/cloud/api/commands/DetachIsoCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -40,6 +41,7 @@ public class DetachIsoCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="vm_instance") @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.LONG, required=true, description="The ID of the virtual machine") private Long virtualMachineId; diff --git a/api/src/com/cloud/api/commands/DetachVolumeCmd.java b/api/src/com/cloud/api/commands/DetachVolumeCmd.java index b3143d44ffb..f0bf919d315 100755 --- a/api/src/com/cloud/api/commands/DetachVolumeCmd.java +++ b/api/src/com/cloud/api/commands/DetachVolumeCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -42,12 +43,14 @@ public class DetachVolumeCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="volumes") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the ID of the disk volume") private Long id; @Parameter(name=ApiConstants.DEVICE_ID, type=CommandType.LONG, description="the device ID on the virtual machine where volume is detached from") private Long deviceId; + @IdentityMapper(entityTableName="vm_instance") @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.LONG, description="the ID of the virtual machine where the volume is detached from") private Long virtualMachineId; diff --git a/api/src/com/cloud/api/commands/DisableAccountCmd.java b/api/src/com/cloud/api/commands/DisableAccountCmd.java index 706795af532..aab1e12e054 100644 --- a/api/src/com/cloud/api/commands/DisableAccountCmd.java +++ b/api/src/com/cloud/api/commands/DisableAccountCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -44,6 +45,7 @@ public class DisableAccountCmd extends BaseAsyncCmd { @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, required=true, description="Disables specified account.") private String accountName; + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, required=true, description="Disables specified account in this domain.") private Long domainId; diff --git a/api/src/com/cloud/api/commands/DisableStaticNatCmd.java b/api/src/com/cloud/api/commands/DisableStaticNatCmd.java index afc68cd7d66..3835001aa98 100644 --- a/api/src/com/cloud/api/commands/DisableStaticNatCmd.java +++ b/api/src/com/cloud/api/commands/DisableStaticNatCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -40,6 +41,7 @@ public class DisableStaticNatCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="user_ip_address") @Parameter(name=ApiConstants.IP_ADDRESS_ID, type=CommandType.LONG, required=true, description="the public IP address id for which static nat feature is being disableed") private Long ipAddressId; diff --git a/api/src/com/cloud/api/commands/DisableUserCmd.java b/api/src/com/cloud/api/commands/DisableUserCmd.java index 6f171501f6a..021b2d1d933 100644 --- a/api/src/com/cloud/api/commands/DisableUserCmd.java +++ b/api/src/com/cloud/api/commands/DisableUserCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -41,6 +42,7 @@ public class DisableUserCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="user") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="Disables user by user ID.") private Long id; diff --git a/api/src/com/cloud/api/commands/DisassociateIPAddrCmd.java b/api/src/com/cloud/api/commands/DisassociateIPAddrCmd.java index 0714fecbbcc..4063655ade4 100644 --- a/api/src/com/cloud/api/commands/DisassociateIPAddrCmd.java +++ b/api/src/com/cloud/api/commands/DisassociateIPAddrCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -42,10 +43,12 @@ public class DisassociateIPAddrCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="user_ip_address") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the id of the public ip address to disassociate") private Long id; // unexposed parameter needed for events logging + @IdentityMapper(entityTableName="account") @Parameter(name=ApiConstants.ACCOUNT_ID, type=CommandType.LONG, expose=false) private Long ownerId; ///////////////////////////////////////////////////// diff --git a/api/src/com/cloud/api/commands/EnableAccountCmd.java b/api/src/com/cloud/api/commands/EnableAccountCmd.java index 32b4fa27c6f..54e89d02a34 100644 --- a/api/src/com/cloud/api/commands/EnableAccountCmd.java +++ b/api/src/com/cloud/api/commands/EnableAccountCmd.java @@ -21,6 +21,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -39,6 +40,7 @@ public class EnableAccountCmd extends BaseCmd { @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, required=true, description="Enables specified account.") private String accountName; + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, required=true, description="Enables specified account in this domain.") private Long domainId; diff --git a/api/src/com/cloud/api/commands/EnableStaticNatCmd.java b/api/src/com/cloud/api/commands/EnableStaticNatCmd.java index e8f1879e7ab..71113216557 100644 --- a/api/src/com/cloud/api/commands/EnableStaticNatCmd.java +++ b/api/src/com/cloud/api/commands/EnableStaticNatCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -40,9 +41,11 @@ public class EnableStaticNatCmd extends BaseCmd{ //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="user_ip_address") @Parameter(name=ApiConstants.IP_ADDRESS_ID, type=CommandType.LONG, required=true, description="the public IP address id for which static nat feature is being enabled") private Long ipAddressId; + @IdentityMapper(entityTableName="vm_instance") @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.LONG, required=true, description="the ID of the virtual machine for enabling static nat feature") private Long virtualMachineId; diff --git a/api/src/com/cloud/api/commands/EnableUserCmd.java b/api/src/com/cloud/api/commands/EnableUserCmd.java index 7e867abbe3e..737f3e57750 100644 --- a/api/src/com/cloud/api/commands/EnableUserCmd.java +++ b/api/src/com/cloud/api/commands/EnableUserCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -40,6 +41,7 @@ public class EnableUserCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="user") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="Enables user by user ID.") private Long id; diff --git a/api/src/com/cloud/api/commands/ExtractIsoCmd.java b/api/src/com/cloud/api/commands/ExtractIsoCmd.java index 817bbda6e57..478258a1da6 100755 --- a/api/src/com/cloud/api/commands/ExtractIsoCmd.java +++ b/api/src/com/cloud/api/commands/ExtractIsoCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -42,12 +43,14 @@ public class ExtractIsoCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="vm_template") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the ISO file") private Long id; @Parameter(name=ApiConstants.URL, type=CommandType.STRING, required=false, description="the url to which the ISO would be extracted") private String url; + @IdentityMapper(entityTableName="data_center") @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, required=true, description="the ID of the zone where the ISO is originally located") private Long zoneId; diff --git a/api/src/com/cloud/api/commands/ExtractTemplateCmd.java b/api/src/com/cloud/api/commands/ExtractTemplateCmd.java index ad450de14b0..a0668180420 100755 --- a/api/src/com/cloud/api/commands/ExtractTemplateCmd.java +++ b/api/src/com/cloud/api/commands/ExtractTemplateCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -42,12 +43,14 @@ public class ExtractTemplateCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="vm_template") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the template") private Long id; @Parameter(name=ApiConstants.URL, type=CommandType.STRING, required=false, description="the url to which the ISO would be extracted") private String url; + @IdentityMapper(entityTableName="data_center") @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, required=true, description="the ID of the zone where the ISO is originally located" ) private Long zoneId; diff --git a/api/src/com/cloud/api/commands/ExtractVolumeCmd.java b/api/src/com/cloud/api/commands/ExtractVolumeCmd.java index 61c770dd120..ee64bc3af7e 100755 --- a/api/src/com/cloud/api/commands/ExtractVolumeCmd.java +++ b/api/src/com/cloud/api/commands/ExtractVolumeCmd.java @@ -24,6 +24,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -47,6 +48,7 @@ public class ExtractVolumeCmd extends BaseAsyncCmd { ///////////////////////////////////////////////////// //FIXME - add description + @IdentityMapper(entityTableName="volumes") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the volume") private Long id; @@ -55,6 +57,7 @@ public class ExtractVolumeCmd extends BaseAsyncCmd { private String url; //FIXME - add description + @IdentityMapper(entityTableName="data_center") @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, required=true, description="the ID of the zone where the volume is located") private Long zoneId; @@ -133,6 +136,7 @@ public class ExtractVolumeCmd extends BaseAsyncCmd { ExtractResponse response = new ExtractResponse(); response.setResponseName(getCommandName()); response.setObjectName("volume"); + response.setIdentityTableName("volumes"); response.setId(id); response.setName(_entityMgr.findById(Volume.class, id).getName()); response.setZoneId(zoneId); diff --git a/api/src/com/cloud/api/commands/GetCloudIdentifierCmd.java b/api/src/com/cloud/api/commands/GetCloudIdentifierCmd.java index 0dc7d54dc7e..ff8b6841165 100644 --- a/api/src/com/cloud/api/commands/GetCloudIdentifierCmd.java +++ b/api/src/com/cloud/api/commands/GetCloudIdentifierCmd.java @@ -24,6 +24,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -39,6 +40,7 @@ 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") private Long userid; diff --git a/api/src/com/cloud/api/commands/ListAccountsCmd.java b/api/src/com/cloud/api/commands/ListAccountsCmd.java index e8a7ac0b3ec..07a8bb53480 100644 --- a/api/src/com/cloud/api/commands/ListAccountsCmd.java +++ b/api/src/com/cloud/api/commands/ListAccountsCmd.java @@ -24,6 +24,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.BaseCmd.CommandType; @@ -43,9 +44,11 @@ public class ListAccountsCmd extends BaseListCmd { @Parameter(name=ApiConstants.ACCOUNT_TYPE, type=CommandType.LONG, description="list accounts by account type. Valid account types are 1 (admin), 2 (domain-admin), and 0 (user).") private Long accountType; + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="list all accounts in specified domain. If used with the name parameter, retrieves account information for the account with specified name in specified domain.") private Long domainId; + @IdentityMapper(entityTableName="account") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list account by account ID") private Long id; diff --git a/api/src/com/cloud/api/commands/ListAlertsCmd.java b/api/src/com/cloud/api/commands/ListAlertsCmd.java index dbb603d06ef..82688794f85 100644 --- a/api/src/com/cloud/api/commands/ListAlertsCmd.java +++ b/api/src/com/cloud/api/commands/ListAlertsCmd.java @@ -25,6 +25,7 @@ import org.apache.log4j.Logger; import com.cloud.alert.Alert; import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.response.AlertResponse; @@ -41,6 +42,7 @@ public class ListAlertsCmd extends BaseListCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// + @IdentityMapper(entityTableName="alert") @Parameter(name = ApiConstants.ID, type = CommandType.LONG, description = "the ID of the alert") private Long id; diff --git a/api/src/com/cloud/api/commands/ListAsyncJobsCmd.java b/api/src/com/cloud/api/commands/ListAsyncJobsCmd.java index 5e20d302159..25c7cfefa30 100644 --- a/api/src/com/cloud/api/commands/ListAsyncJobsCmd.java +++ b/api/src/com/cloud/api/commands/ListAsyncJobsCmd.java @@ -23,6 +23,7 @@ import java.util.List; import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.response.AsyncJobResponse; @@ -40,6 +41,7 @@ public class ListAsyncJobsCmd extends BaseListCmd { @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="the account associated with the async job (this account is the job initiator). 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 associated with the async job. If used with the account parameter, returns async jobs for the account in the specified domain.") private Long domainId; diff --git a/api/src/com/cloud/api/commands/ListCapacityCmd.java b/api/src/com/cloud/api/commands/ListCapacityCmd.java index 9ef5410f33d..2d21def7ac8 100755 --- a/api/src/com/cloud/api/commands/ListCapacityCmd.java +++ b/api/src/com/cloud/api/commands/ListCapacityCmd.java @@ -25,6 +25,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.BaseCmd.CommandType; @@ -44,12 +45,15 @@ public class ListCapacityCmd extends BaseListCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="data_center") @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="lists capacity by the Zone ID") private Long zoneId = 1L; + @IdentityMapper(entityTableName="host_pod_ref") @Parameter(name=ApiConstants.POD_ID, type=CommandType.LONG, description="lists capacity by the Pod ID") private Long podId; + @IdentityMapper(entityTableName="cluster") @Parameter(name=ApiConstants.CLUSTER_ID, type=CommandType.LONG, description="lists capacity by the Cluster ID") private Long clusterId; diff --git a/api/src/com/cloud/api/commands/ListClustersCmd.java b/api/src/com/cloud/api/commands/ListClustersCmd.java index fb6515c198d..0e474947192 100755 --- a/api/src/com/cloud/api/commands/ListClustersCmd.java +++ b/api/src/com/cloud/api/commands/ListClustersCmd.java @@ -25,6 +25,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.BaseCmd.CommandType; @@ -42,15 +43,18 @@ public class ListClustersCmd extends BaseListCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="cluster") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="lists clusters by the cluster ID") private Long id; @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="lists clusters by the cluster name") private String clusterName; + @IdentityMapper(entityTableName="host_pod_ref") @Parameter(name=ApiConstants.POD_ID, type=CommandType.LONG, description="lists clusters by Pod ID") private Long podId; + @IdentityMapper(entityTableName="data_center") @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="lists clusters by Zone ID") private Long zoneId; diff --git a/api/src/com/cloud/api/commands/ListDiskOfferingsCmd.java b/api/src/com/cloud/api/commands/ListDiskOfferingsCmd.java index d6499c3de08..cfb979b09d0 100644 --- a/api/src/com/cloud/api/commands/ListDiskOfferingsCmd.java +++ b/api/src/com/cloud/api/commands/ListDiskOfferingsCmd.java @@ -24,6 +24,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.response.DiskOfferingResponse; @@ -40,9 +41,11 @@ public class ListDiskOfferingsCmd extends BaseListCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="the ID of the domain of the disk offering.") private Long domainId; + @IdentityMapper(entityTableName="disk_offering") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="ID of the disk offering") private Long id; diff --git a/api/src/com/cloud/api/commands/ListDomainChildrenCmd.java b/api/src/com/cloud/api/commands/ListDomainChildrenCmd.java index b083b979737..3f3f93e9fac 100644 --- a/api/src/com/cloud/api/commands/ListDomainChildrenCmd.java +++ b/api/src/com/cloud/api/commands/ListDomainChildrenCmd.java @@ -24,6 +24,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.response.DomainResponse; @@ -40,6 +41,7 @@ public class ListDomainChildrenCmd extends BaseListCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list children domain by parent domain ID.") private Long id; diff --git a/api/src/com/cloud/api/commands/ListDomainsCmd.java b/api/src/com/cloud/api/commands/ListDomainsCmd.java index d97db72d345..1512659c119 100644 --- a/api/src/com/cloud/api/commands/ListDomainsCmd.java +++ b/api/src/com/cloud/api/commands/ListDomainsCmd.java @@ -24,6 +24,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.response.DomainResponse; @@ -40,6 +41,7 @@ public class ListDomainsCmd extends BaseListCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="List domain by domain ID.") private Long id; diff --git a/api/src/com/cloud/api/commands/ListEventsCmd.java b/api/src/com/cloud/api/commands/ListEventsCmd.java index e9eef0450e4..e7aa9e21a9d 100755 --- a/api/src/com/cloud/api/commands/ListEventsCmd.java +++ b/api/src/com/cloud/api/commands/ListEventsCmd.java @@ -25,6 +25,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.BaseCmd.CommandType; @@ -45,9 +46,11 @@ public class ListEventsCmd extends BaseListCmd { @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="the account for the event. 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 for the event. If used with the account parameter, returns all events for an account in the specified domain ID.") private Long domainId; + @IdentityMapper(entityTableName="event") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the ID of the event") private Long id; @@ -69,6 +72,7 @@ public class ListEventsCmd extends BaseListCmd { @Parameter(name=ApiConstants.TYPE, type=CommandType.STRING, description="the event type (see event types)") private String type; + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="list events by projectId") private Long projectId; diff --git a/api/src/com/cloud/api/commands/ListFirewallRulesCmd.java b/api/src/com/cloud/api/commands/ListFirewallRulesCmd.java index f80f497757c..888e451f1a5 100644 --- a/api/src/com/cloud/api/commands/ListFirewallRulesCmd.java +++ b/api/src/com/cloud/api/commands/ListFirewallRulesCmd.java @@ -24,6 +24,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.response.FirewallResponse; @@ -39,18 +40,22 @@ public class ListFirewallRulesCmd extends BaseListCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="firewall_rules") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="Lists rule with the specified ID.") private Long id; + @IdentityMapper(entityTableName="user_ip_address") @Parameter(name=ApiConstants.IP_ADDRESS_ID, type=CommandType.LONG, description="the id of IP address of the firwall services") private Long ipAddressId; @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="account. 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. If used with the account parameter, lists firewall rules for the specified account in this domain.") private Long domainId; + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="list firewall rules by project") private Long projectId; diff --git a/api/src/com/cloud/api/commands/ListGuestOsCategoriesCmd.java b/api/src/com/cloud/api/commands/ListGuestOsCategoriesCmd.java index 819203356c6..f94658d07ec 100644 --- a/api/src/com/cloud/api/commands/ListGuestOsCategoriesCmd.java +++ b/api/src/com/cloud/api/commands/ListGuestOsCategoriesCmd.java @@ -25,6 +25,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.response.GuestOSCategoryResponse; @@ -41,6 +42,7 @@ public class ListGuestOsCategoriesCmd extends BaseListCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="guest_os_category") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list Os category by id") private Long id; diff --git a/api/src/com/cloud/api/commands/ListGuestOsCmd.java b/api/src/com/cloud/api/commands/ListGuestOsCmd.java index 6548de98ddf..f7e485b3520 100644 --- a/api/src/com/cloud/api/commands/ListGuestOsCmd.java +++ b/api/src/com/cloud/api/commands/ListGuestOsCmd.java @@ -25,6 +25,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.response.GuestOSResponse; @@ -41,9 +42,11 @@ public class ListGuestOsCmd extends BaseListCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="guest_os") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list by Os type Id") private Long id; + @IdentityMapper(entityTableName="guest_os_category") @Parameter(name=ApiConstants.OS_CATEGORY_ID, type=CommandType.LONG, description="list by Os Category id") private Long osCategoryId; diff --git a/api/src/com/cloud/api/commands/ListHostsCmd.java b/api/src/com/cloud/api/commands/ListHostsCmd.java index c8d7d119013..f5f61e8ca10 100644 --- a/api/src/com/cloud/api/commands/ListHostsCmd.java +++ b/api/src/com/cloud/api/commands/ListHostsCmd.java @@ -25,6 +25,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.response.HostResponse; @@ -43,15 +44,18 @@ public class ListHostsCmd extends BaseListCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="cluster") @Parameter(name=ApiConstants.CLUSTER_ID, type=CommandType.LONG, description="lists hosts existing in particular cluster") private Long clusterId; + @IdentityMapper(entityTableName="host") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the id of the host") private Long id; @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the host") private String hostName; + @IdentityMapper(entityTableName="host_pod_ref") @Parameter(name=ApiConstants.POD_ID, type=CommandType.LONG, description="the Pod ID for the host") private Long podId; @@ -61,9 +65,11 @@ public class ListHostsCmd extends BaseListCmd { @Parameter(name=ApiConstants.TYPE, type=CommandType.STRING, description="the host type") private String type; + @IdentityMapper(entityTableName="data_center") @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the Zone ID for the host") private Long zoneId; + @IdentityMapper(entityTableName="vm_instance") @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.LONG, required=false, description="lists hosts in the same cluster as this VM and flag hosts with enough CPU/RAm to host this VM") private Long virtualMachineId; diff --git a/api/src/com/cloud/api/commands/ListHypervisorCapabilitiesCmd.java b/api/src/com/cloud/api/commands/ListHypervisorCapabilitiesCmd.java index d857dd31f1b..fe06cd64baf 100644 --- a/api/src/com/cloud/api/commands/ListHypervisorCapabilitiesCmd.java +++ b/api/src/com/cloud/api/commands/ListHypervisorCapabilitiesCmd.java @@ -24,6 +24,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.response.HypervisorCapabilitiesResponse; @@ -41,6 +42,7 @@ public class ListHypervisorCapabilitiesCmd extends BaseListCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="hypervisor_capabilities") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="ID of the hypervisor capability") private Long id; diff --git a/api/src/com/cloud/api/commands/ListHypervisorsCmd.java b/api/src/com/cloud/api/commands/ListHypervisorsCmd.java index 80fb45ce54b..c9f8fb10f77 100644 --- a/api/src/com/cloud/api/commands/ListHypervisorsCmd.java +++ b/api/src/com/cloud/api/commands/ListHypervisorsCmd.java @@ -24,6 +24,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.response.HypervisorResponse; @@ -44,6 +45,7 @@ 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.") private Long zoneId; diff --git a/api/src/com/cloud/api/commands/ListIpForwardingRulesCmd.java b/api/src/com/cloud/api/commands/ListIpForwardingRulesCmd.java index dfb580ce7f4..b05936339a0 100644 --- a/api/src/com/cloud/api/commands/ListIpForwardingRulesCmd.java +++ b/api/src/com/cloud/api/commands/ListIpForwardingRulesCmd.java @@ -24,6 +24,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.BaseCmd.CommandType; @@ -43,21 +44,26 @@ public class ListIpForwardingRulesCmd extends BaseListCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="user_ip_address") @Parameter(name=ApiConstants.IP_ADDRESS_ID, type=CommandType.LONG, description="list the rule belonging to this public ip address") private Long publicIpAddressId; @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="the account associated with the ip forwarding rule. Must be used with the domainId parameter.") private String accountName; + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="Lists all rules for this id. If used with the account parameter, returns all rules for an account in the specified domain ID.") private Long domainId; + @IdentityMapper(entityTableName="firewall_rules") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="Lists rule with the specified ID.") private Long id; + @IdentityMapper(entityTableName="vm_instance") @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.LONG, description="Lists all rules applied to the specified Vm.") private Long vmId; + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="list static nat rules by project") private Long projectId; diff --git a/api/src/com/cloud/api/commands/ListIsosCmd.java b/api/src/com/cloud/api/commands/ListIsosCmd.java index 29d7a4265bc..ede44600310 100755 --- a/api/src/com/cloud/api/commands/ListIsosCmd.java +++ b/api/src/com/cloud/api/commands/ListIsosCmd.java @@ -26,6 +26,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.response.ListResponse; @@ -52,12 +53,14 @@ public class ListIsosCmd extends BaseListCmd { @Parameter(name=ApiConstants.BOOTABLE, type=CommandType.BOOLEAN, description="true if the ISO is bootable, false otherwise") private Boolean bootable; + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="lists all available ISO files by ID of a domain. If used with the account parameter, lists all available ISO files for the account in the ID of a domain.") private Long domainId; @Parameter(name=ApiConstants.HYPERVISOR, type=CommandType.STRING, description="the hypervisor for which to restrict the search") private String hypervisor; + @IdentityMapper(entityTableName="vm_template") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list all isos by id") private Long id; @@ -77,9 +80,11 @@ public class ListIsosCmd extends BaseListCmd { @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="list all isos by name") private String isoName; + @IdentityMapper(entityTableName="data_center") @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the ID of the zone") private Long zoneId; + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="list isos by project") private Long projectId; diff --git a/api/src/com/cloud/api/commands/ListLoadBalancerRuleInstancesCmd.java b/api/src/com/cloud/api/commands/ListLoadBalancerRuleInstancesCmd.java index 718cd5b306b..fb23f9ada00 100644 --- a/api/src/com/cloud/api/commands/ListLoadBalancerRuleInstancesCmd.java +++ b/api/src/com/cloud/api/commands/ListLoadBalancerRuleInstancesCmd.java @@ -24,6 +24,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.response.ListResponse; @@ -43,6 +44,7 @@ public class ListLoadBalancerRuleInstancesCmd extends BaseListCmd { @Parameter(name=ApiConstants.APPLIED, type=CommandType.BOOLEAN, description="true if listing all virtual machines currently applied to the load balancer rule; default is true") private Boolean applied; + @IdentityMapper(entityTableName="firewall_rules") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the load balancer rule") private Long id; diff --git a/api/src/com/cloud/api/commands/ListLoadBalancerRulesCmd.java b/api/src/com/cloud/api/commands/ListLoadBalancerRulesCmd.java index ba8105b946c..b42b39ce8f6 100644 --- a/api/src/com/cloud/api/commands/ListLoadBalancerRulesCmd.java +++ b/api/src/com/cloud/api/commands/ListLoadBalancerRulesCmd.java @@ -25,6 +25,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.BaseCmd.CommandType; @@ -45,24 +46,30 @@ public class ListLoadBalancerRulesCmd extends BaseListCmd { @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "the account of the load balancer rule. 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 load balancer rule. If used with the account parameter, lists load balancer rules for the account in the specified domain.") private Long domainId; + @IdentityMapper(entityTableName="firewall_rules") @Parameter(name = ApiConstants.ID, type = CommandType.LONG, description = "the ID of the load balancer rule") private Long id; @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the load balancer rule") private String loadBalancerRuleName; + @IdentityMapper(entityTableName="user_ip_address") @Parameter(name = ApiConstants.PUBLIC_IP_ID, type = CommandType.LONG, description = "the public IP address id of the load balancer rule ") private Long publicIpId; + @IdentityMapper(entityTableName="vm_instance") @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.LONG, description = "the ID of the virtual machine of the load balancer rule") private Long virtualMachineId; + @IdentityMapper(entityTableName="data_center") @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.LONG, description = "the availability zone ID") private Long zoneId; + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="list port forwarding rules by project") private Long projectId; diff --git a/api/src/com/cloud/api/commands/ListNetworkOfferingsCmd.java b/api/src/com/cloud/api/commands/ListNetworkOfferingsCmd.java index 078b1cd85e4..2533f5b7a2d 100644 --- a/api/src/com/cloud/api/commands/ListNetworkOfferingsCmd.java +++ b/api/src/com/cloud/api/commands/ListNetworkOfferingsCmd.java @@ -25,6 +25,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.response.ListResponse; @@ -40,6 +41,7 @@ public class ListNetworkOfferingsCmd extends BaseListCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="network_offerings") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list network offerings by id") private Long id; @@ -67,6 +69,7 @@ public class ListNetworkOfferingsCmd extends BaseListCmd { @Parameter(name=ApiConstants.GUEST_IP_TYPE, type=CommandType.STRING, description="the guest ip type for the network offering, supported types are Direct and Virtual.") private String guestIpType; + @IdentityMapper(entityTableName="data_center") @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="list netowrk offerings available for network creation in specific zone") private Long zoneId; diff --git a/api/src/com/cloud/api/commands/ListNetworksCmd.java b/api/src/com/cloud/api/commands/ListNetworksCmd.java index a198a044148..037245ff66b 100644 --- a/api/src/com/cloud/api/commands/ListNetworksCmd.java +++ b/api/src/com/cloud/api/commands/ListNetworksCmd.java @@ -25,6 +25,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.BaseCmd.CommandType; @@ -41,15 +42,18 @@ public class ListNetworksCmd extends BaseListCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="networks") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list networks by id") private Long id; @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="account who will own the VLAN. If VLAN is Zone wide, this parameter should be ommited") private String accountName; + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="domain ID of the account owning a VLAN") private Long domainId; + @IdentityMapper(entityTableName="data_center") @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the Zone ID of the network") private Long zoneId; @@ -68,6 +72,7 @@ public class ListNetworksCmd extends BaseListCmd { @Parameter(name=ApiConstants.TRAFFIC_TYPE, type=CommandType.STRING, description="type of the traffic") private String trafficType; + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="list networks by project id") private Long projectId; diff --git a/api/src/com/cloud/api/commands/ListPodsByCmd.java b/api/src/com/cloud/api/commands/ListPodsByCmd.java index e42949609ed..7e220e02d59 100755 --- a/api/src/com/cloud/api/commands/ListPodsByCmd.java +++ b/api/src/com/cloud/api/commands/ListPodsByCmd.java @@ -25,6 +25,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.BaseCmd.CommandType; @@ -42,12 +43,14 @@ public class ListPodsByCmd extends BaseListCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="host_pod_ref") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list Pods by ID") private Long id; @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="list Pods by name") private String podName; + @IdentityMapper(entityTableName="data_center") @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="list Pods by Zone ID") private Long zoneId; diff --git a/api/src/com/cloud/api/commands/ListPortForwardingRulesCmd.java b/api/src/com/cloud/api/commands/ListPortForwardingRulesCmd.java index 7874935efce..ebcdf3c58af 100644 --- a/api/src/com/cloud/api/commands/ListPortForwardingRulesCmd.java +++ b/api/src/com/cloud/api/commands/ListPortForwardingRulesCmd.java @@ -24,6 +24,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.response.FirewallRuleResponse; @@ -39,18 +40,23 @@ public class ListPortForwardingRulesCmd extends BaseListCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + + @IdentityMapper(entityTableName="firewall_rules") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="Lists rule with the specified ID.") private Long id; + @IdentityMapper(entityTableName="user_ip_address") @Parameter(name=ApiConstants.IP_ADDRESS_ID, type=CommandType.LONG, description="the id of IP address of the port forwarding services") private Long ipAddressId; @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="account. 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. If used with the account parameter, lists port forwarding rules for the specified account in this domain.") private Long domainId; + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="list port forwarding rules by project") private Long projectId; diff --git a/api/src/com/cloud/api/commands/ListProjectAccountsCmd.java b/api/src/com/cloud/api/commands/ListProjectAccountsCmd.java index 2a8ab6c91f4..4c03cf85232 100644 --- a/api/src/com/cloud/api/commands/ListProjectAccountsCmd.java +++ b/api/src/com/cloud/api/commands/ListProjectAccountsCmd.java @@ -25,6 +25,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.response.ListResponse; @@ -43,6 +44,7 @@ public class ListProjectAccountsCmd extends BaseListCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, required=true, description="id of the project") private Long projectId; diff --git a/api/src/com/cloud/api/commands/ListProjectInvitationsCmd.java b/api/src/com/cloud/api/commands/ListProjectInvitationsCmd.java index cb08c8a7d28..156e547de8f 100644 --- a/api/src/com/cloud/api/commands/ListProjectInvitationsCmd.java +++ b/api/src/com/cloud/api/commands/ListProjectInvitationsCmd.java @@ -24,6 +24,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.response.ListResponse; @@ -38,12 +39,14 @@ public class ListProjectInvitationsCmd extends BaseListCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="list by project id") private Long projectId; @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="list invitations for specified account; this parameter has to be specified with domainId") private String accountName; + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="list all invitations in specified domain") private Long domainId; @@ -53,6 +56,7 @@ public class ListProjectInvitationsCmd extends BaseListCmd { @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="list invitations by state") private String state; + @IdentityMapper(entityTableName="project_invitations") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list invitations by id") private Long id; ///////////////////////////////////////////////////// diff --git a/api/src/com/cloud/api/commands/ListProjectsCmd.java b/api/src/com/cloud/api/commands/ListProjectsCmd.java index b85ca528106..2edc362c557 100644 --- a/api/src/com/cloud/api/commands/ListProjectsCmd.java +++ b/api/src/com/cloud/api/commands/ListProjectsCmd.java @@ -24,6 +24,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.response.ListResponse; @@ -39,12 +40,14 @@ public class ListProjectsCmd extends BaseListCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list projects by project ID") private Long id; @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="list projects by owner name") private String accountName; + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="list projects for the domain specified") private Long domainId; diff --git a/api/src/com/cloud/api/commands/ListPublicIpAddressesCmd.java b/api/src/com/cloud/api/commands/ListPublicIpAddressesCmd.java index dd648b6758d..a3688e9f178 100644 --- a/api/src/com/cloud/api/commands/ListPublicIpAddressesCmd.java +++ b/api/src/com/cloud/api/commands/ListPublicIpAddressesCmd.java @@ -25,6 +25,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.response.IPAddressResponse; @@ -48,27 +49,32 @@ public class ListPublicIpAddressesCmd extends BaseListCmd { @Parameter(name=ApiConstants.ALLOCATED_ONLY, type=CommandType.BOOLEAN, description="limits search results to allocated public IP addresses") private Boolean allocatedOnly; + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="lists all public IP addresses by domain ID. If used with the account parameter, lists all public IP addresses by account for specified domain.") private Long domainId; @Parameter(name=ApiConstants.FOR_VIRTUAL_NETWORK, type=CommandType.BOOLEAN, description="the virtual network for the IP address") private Boolean forVirtualNetwork; + @IdentityMapper(entityTableName="user_ip_address") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="lists ip address by id") private Long id; @Parameter(name=ApiConstants.IP_ADDRESS, type=CommandType.STRING, description="lists the specified IP address") private String ipAddress; + @IdentityMapper(entityTableName="vlan") @Parameter(name=ApiConstants.VLAN_ID, type=CommandType.LONG, description="lists all public IP addresses by VLAN ID") private Long vlanId; + @IdentityMapper(entityTableName="data_center") @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="lists all public IP addresses by Zone ID") private Long zoneId; @Parameter(name=ApiConstants.FOR_LOAD_BALANCING, type=CommandType.BOOLEAN, description="list only ips used for load balancing") private Boolean forLoadBalancing; + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="list ips by project") private Long projectId; diff --git a/api/src/com/cloud/api/commands/ListRemoteAccessVpnsCmd.java b/api/src/com/cloud/api/commands/ListRemoteAccessVpnsCmd.java index 630ad91f010..ab83663e0fb 100644 --- a/api/src/com/cloud/api/commands/ListRemoteAccessVpnsCmd.java +++ b/api/src/com/cloud/api/commands/ListRemoteAccessVpnsCmd.java @@ -25,6 +25,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.response.ListResponse; @@ -44,12 +45,15 @@ public class ListRemoteAccessVpnsCmd extends BaseListCmd { @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="the account of the remote access vpn. 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 remote access vpn rule. If used with the account parameter, lists remote access vpns for the account in the specified domain.") private Long domainId; + @IdentityMapper(entityTableName="user_ip_address") @Parameter(name=ApiConstants.PUBLIC_IP_ID, type=CommandType.LONG, required=true, description="public ip address id of the vpn server") private Long publicIpId; + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="list remote access vpn by project") private Long projectId; diff --git a/api/src/com/cloud/api/commands/ListResourceLimitsCmd.java b/api/src/com/cloud/api/commands/ListResourceLimitsCmd.java index 83da5b2764e..06dc81506c0 100644 --- a/api/src/com/cloud/api/commands/ListResourceLimitsCmd.java +++ b/api/src/com/cloud/api/commands/ListResourceLimitsCmd.java @@ -25,6 +25,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.response.ListResponse; @@ -44,9 +45,11 @@ public class ListResourceLimitsCmd extends BaseListCmd { @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="Lists resource limits by account. Must be used with the domainId parameter.") private String accountName; + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="Lists resource limits by project") private Long projectId; + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="Lists resource limits by domain ID. If used with the account parameter, lists resource limits for a specified account in a specified domain.") private Long domainId; diff --git a/api/src/com/cloud/api/commands/ListRoutersCmd.java b/api/src/com/cloud/api/commands/ListRoutersCmd.java index a0a9067771f..e4502b64e7b 100644 --- a/api/src/com/cloud/api/commands/ListRoutersCmd.java +++ b/api/src/com/cloud/api/commands/ListRoutersCmd.java @@ -25,6 +25,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.response.DomainRouterResponse; @@ -45,30 +46,37 @@ public class ListRoutersCmd extends BaseListCmd { @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="the name of the account associated with the router. 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 associated with the router. If used with the account parameter, lists all routers associated with an account in the specified domain.") private Long domainId; + @IdentityMapper(entityTableName="host") @Parameter(name=ApiConstants.HOST_ID, type=CommandType.LONG, description="the host ID of the router") private Long hostId; + @IdentityMapper(entityTableName="vm_instance") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the ID of the disk router") private Long id; @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the router") private String routerName; + @IdentityMapper(entityTableName="host_pod_ref") @Parameter(name=ApiConstants.POD_ID, type=CommandType.LONG, description="the Pod ID of the router") private Long podId; @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="the state of the router") private String state; + @IdentityMapper(entityTableName="data_center") @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the Zone ID of the router") private Long zoneId; + @IdentityMapper(entityTableName="networks") @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.LONG, description="list by network id") private Long networkId; + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="list firewall rules by project") private Long projectId; diff --git a/api/src/com/cloud/api/commands/ListSecurityGroupsCmd.java b/api/src/com/cloud/api/commands/ListSecurityGroupsCmd.java index be2b07c4566..96a5480afba 100644 --- a/api/src/com/cloud/api/commands/ListSecurityGroupsCmd.java +++ b/api/src/com/cloud/api/commands/ListSecurityGroupsCmd.java @@ -23,6 +23,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.BaseCmd.CommandType; @@ -44,18 +45,22 @@ public class ListSecurityGroupsCmd extends BaseListCmd { @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="lists all available port security groups for the account. Must be used with domainID parameter") private String accountName; + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="lists all available security groups for the domain ID. If used with the account parameter, lists all available security groups for the account in the specified domain ID.") private Long domainId; @Parameter(name=ApiConstants.SECURITY_GROUP_NAME, type=CommandType.STRING, description="lists security groups by name") private String securityGroupName; + @IdentityMapper(entityTableName="vm_instance") @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.LONG, description="lists security groups by virtual machine id") private Long virtualMachineId; + @IdentityMapper(entityTableName="security_group") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list the security group by the id provided") private Long id; + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="list security groups by project") private Long projectId; diff --git a/api/src/com/cloud/api/commands/ListServiceOfferingsCmd.java b/api/src/com/cloud/api/commands/ListServiceOfferingsCmd.java index 0387ed835da..23cbbd37683 100644 --- a/api/src/com/cloud/api/commands/ListServiceOfferingsCmd.java +++ b/api/src/com/cloud/api/commands/ListServiceOfferingsCmd.java @@ -24,6 +24,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.BaseCmd.CommandType; @@ -41,15 +42,18 @@ public class ListServiceOfferingsCmd extends BaseListCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="disk_offering") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="ID of the service offering") private Long id; @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="name of the service offering") private String serviceOfferingName; + @IdentityMapper(entityTableName="vm_instance") @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.LONG, description="the ID of the virtual machine. Pass this in if you want to see the available service offering that a virtual machine can be changed to.") private Long virtualMachineId; + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="the ID of the domain associated with the service offering") private Long domainId; diff --git a/api/src/com/cloud/api/commands/ListSnapshotPoliciesCmd.java b/api/src/com/cloud/api/commands/ListSnapshotPoliciesCmd.java index 2aedec6ccf4..615551c3123 100644 --- a/api/src/com/cloud/api/commands/ListSnapshotPoliciesCmd.java +++ b/api/src/com/cloud/api/commands/ListSnapshotPoliciesCmd.java @@ -25,6 +25,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.response.ListResponse; @@ -44,9 +45,11 @@ public class ListSnapshotPoliciesCmd extends BaseListCmd { @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="lists snapshot policies for the specified account. Must be used with domainid parameter.") private String accountName; + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="the domain ID. If used with the account parameter, lists snapshot policies for the specified account in this domain.") private Long domainId; + @IdentityMapper(entityTableName="volumes") @Parameter(name=ApiConstants.VOLUME_ID, type=CommandType.LONG, required=true, description="the ID of the disk volume") private Long volumeId; diff --git a/api/src/com/cloud/api/commands/ListSnapshotsCmd.java b/api/src/com/cloud/api/commands/ListSnapshotsCmd.java index dc976b13a0e..e111e598f2a 100644 --- a/api/src/com/cloud/api/commands/ListSnapshotsCmd.java +++ b/api/src/com/cloud/api/commands/ListSnapshotsCmd.java @@ -24,6 +24,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.response.ListResponse; @@ -44,9 +45,11 @@ public class ListSnapshotsCmd extends BaseListCmd { @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="lists snapshot belongig to the specified account. 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. If used with the account parameter, lists snapshots for the specified account in this domain.") private Long domainId; + @IdentityMapper(entityTableName="snapshots") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="lists snapshot by snapshot ID") private Long id; @@ -59,12 +62,14 @@ public class ListSnapshotsCmd extends BaseListCmd { @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") private Long volumeId; @Parameter(name=ApiConstants.IS_RECURSIVE, type=CommandType.BOOLEAN, description="defaults to false, but if true, lists all snapshots from the parent specified by the domain id till leaves.") private Boolean recursive; + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="list snapshots by project") private Long projectId; diff --git a/api/src/com/cloud/api/commands/ListStoragePoolsCmd.java b/api/src/com/cloud/api/commands/ListStoragePoolsCmd.java index 6c56010e7b8..60300573023 100644 --- a/api/src/com/cloud/api/commands/ListStoragePoolsCmd.java +++ b/api/src/com/cloud/api/commands/ListStoragePoolsCmd.java @@ -25,6 +25,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.BaseCmd.CommandType; @@ -43,6 +44,7 @@ public class ListStoragePoolsCmd extends BaseListCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="cluster") @Parameter(name=ApiConstants.CLUSTER_ID, type=CommandType.LONG, description="list storage pools belongig to the specific cluster") private Long clusterId; @@ -55,12 +57,15 @@ public class ListStoragePoolsCmd extends BaseListCmd { @Parameter(name=ApiConstants.PATH, type=CommandType.STRING, description="the storage pool path") private String path; + @IdentityMapper(entityTableName="host_pod_ref") @Parameter(name=ApiConstants.POD_ID, type=CommandType.LONG, description="the Pod ID for the storage pool") private Long podId; + @IdentityMapper(entityTableName="data_center") @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the Zone ID for the storage pool") private Long zoneId; + @IdentityMapper(entityTableName="storage_pool") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the ID of the storage pool") private Long id; diff --git a/api/src/com/cloud/api/commands/ListSystemVMsCmd.java b/api/src/com/cloud/api/commands/ListSystemVMsCmd.java index d4acd506080..195a5e370d4 100644 --- a/api/src/com/cloud/api/commands/ListSystemVMsCmd.java +++ b/api/src/com/cloud/api/commands/ListSystemVMsCmd.java @@ -42,6 +42,7 @@ public class ListSystemVMsCmd extends BaseListCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="host") @Parameter(name=ApiConstants.HOST_ID, type=CommandType.LONG, description="the host ID of the system VM") private Long hostId; @@ -52,6 +53,7 @@ public class ListSystemVMsCmd extends BaseListCmd { @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the system VM") private String systemVmName; + @IdentityMapper(entityTableName="host_pod_ref") @Parameter(name=ApiConstants.POD_ID, type=CommandType.LONG, description="the Pod ID of the system VM") private Long podId; @@ -61,6 +63,7 @@ public class ListSystemVMsCmd extends BaseListCmd { @Parameter(name=ApiConstants.SYSTEM_VM_TYPE, type=CommandType.STRING, description="the system VM type. Possible types are \"consoleproxy\" and \"secondarystoragevm\".") private String systemVmType; + @IdentityMapper(entityTableName="data_center") @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the Zone ID of the system VM") private Long zoneId; diff --git a/api/src/com/cloud/api/commands/ListTemplateOrIsoPermissionsCmd.java b/api/src/com/cloud/api/commands/ListTemplateOrIsoPermissionsCmd.java index af92890cb8b..0552dd70300 100644 --- a/api/src/com/cloud/api/commands/ListTemplateOrIsoPermissionsCmd.java +++ b/api/src/com/cloud/api/commands/ListTemplateOrIsoPermissionsCmd.java @@ -23,6 +23,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.response.TemplatePermissionsResponse; @@ -42,9 +43,11 @@ public class ListTemplateOrIsoPermissionsCmd extends BaseCmd { @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="List template visibility and permissions for the specified account. Must be used with the domainId parameter.") private String accountName; + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="List template visibility and permissions by domain. If used with the account parameter, specifies in which domain the specified account exists.") private Long domainId; + @IdentityMapper(entityTableName="vm_template") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the template ID") private Long id; diff --git a/api/src/com/cloud/api/commands/ListTemplatesCmd.java b/api/src/com/cloud/api/commands/ListTemplatesCmd.java index 1a5fd3ebafa..ac0ff65d27c 100755 --- a/api/src/com/cloud/api/commands/ListTemplatesCmd.java +++ b/api/src/com/cloud/api/commands/ListTemplatesCmd.java @@ -26,6 +26,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.response.ListResponse; @@ -49,12 +50,14 @@ public class ListTemplatesCmd extends BaseListCmd { @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="list template by account. Must be used with the domainId parameter.") private String accountName; + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="list all templates in specified domain. If used with the account parameter, lists all templates for an account in the specified domain.") private Long domainId; @Parameter(name=ApiConstants.HYPERVISOR, type=CommandType.STRING, description="the hypervisor for which to restrict the search") private String hypervisor; + @IdentityMapper(entityTableName="vm_template") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the template ID") private Long id; @@ -68,9 +71,11 @@ public class ListTemplatesCmd extends BaseListCmd { "* executable-all templates that can be used to deploy a new VM* community-templates that are public.") private String templateFilter; + @IdentityMapper(entityTableName="data_center") @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="list templates by zoneId") private Long zoneId; + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="list templates by project") private Long projectId; diff --git a/api/src/com/cloud/api/commands/ListUsersCmd.java b/api/src/com/cloud/api/commands/ListUsersCmd.java index 17729ad7c07..666630ed732 100644 --- a/api/src/com/cloud/api/commands/ListUsersCmd.java +++ b/api/src/com/cloud/api/commands/ListUsersCmd.java @@ -25,6 +25,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.response.ListResponse; @@ -47,9 +48,11 @@ public class ListUsersCmd extends BaseListCmd { @Parameter(name=ApiConstants.ACCOUNT_TYPE, type=CommandType.LONG, description="List users by account type. Valid types include admin, domain-admin, read-only-admin, or user.") private Long accountType; + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="List all users in a domain. If used with the account parameter, lists an account in a specific domain.") private Long domainId; + @IdentityMapper(entityTableName="user") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="List user by ID.") private Long id; diff --git a/api/src/com/cloud/api/commands/ListVMGroupsCmd.java b/api/src/com/cloud/api/commands/ListVMGroupsCmd.java index ddcc1c42835..909a65a8f89 100644 --- a/api/src/com/cloud/api/commands/ListVMGroupsCmd.java +++ b/api/src/com/cloud/api/commands/ListVMGroupsCmd.java @@ -24,6 +24,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.BaseCmd.CommandType; @@ -41,6 +42,7 @@ public class ListVMGroupsCmd extends BaseListCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="instance_group") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list instance groups by ID") private Long id; @@ -50,9 +52,11 @@ public class ListVMGroupsCmd extends BaseListCmd { @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="list instance group belonging to the specified account. Must be used with domainid parameter") private String accountName; + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="the domain ID. If used with the account parameter, lists virtual machines for the specified account in this domain.") private Long domainId; + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="list instance group belonging to the specified project") private Long projectId; diff --git a/api/src/com/cloud/api/commands/ListVMsCmd.java b/api/src/com/cloud/api/commands/ListVMsCmd.java index dcebdbf9d32..1be72e8241b 100755 --- a/api/src/com/cloud/api/commands/ListVMsCmd.java +++ b/api/src/com/cloud/api/commands/ListVMsCmd.java @@ -44,15 +44,18 @@ public class ListVMsCmd extends BaseListCmd { @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="account. 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. If used with the account parameter, lists virtual machines for the specified account in this domain.") private Long domainId; @Parameter(name=ApiConstants.IS_RECURSIVE, type=CommandType.BOOLEAN, description="Must be used with domainId parameter. Defaults to false, but if true, lists all vms from the parent specified by the domain id till leaves.") private Boolean recursive; + @IdentityMapper(entityTableName="instance_group") @Parameter(name=ApiConstants.GROUP_ID, type=CommandType.LONG, description="the group ID") private Long groupId; + @IdentityMapper(entityTableName="host") @Parameter(name=ApiConstants.HOST_ID, type=CommandType.LONG, description="the host ID") private Long hostId; @@ -63,27 +66,32 @@ public class ListVMsCmd extends BaseListCmd { @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="name of the virtual machine") private String instanceName; + @IdentityMapper(entityTableName="host_pod_ref") @Parameter(name=ApiConstants.POD_ID, type=CommandType.LONG, description="the pod ID") private Long podId; @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="state of the virtual machine") private String state; + @IdentityMapper(entityTableName="data_center") @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the availability zone ID") private Long zoneId; @Parameter(name=ApiConstants.FOR_VIRTUAL_NETWORK, type=CommandType.BOOLEAN, description="list by network type; true if need to list vms using Virtual Network, false otherwise") private Boolean forVirtualNetwork; + @IdentityMapper(entityTableName="networks") @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.LONG, description="list by network id") private Long networkId; @Parameter(name=ApiConstants.HYPERVISOR, type=CommandType.STRING, description="the target hypervisor for the template") private String hypervisor; + @IdentityMapper(entityTableName="storage_pool") @Parameter(name=ApiConstants.STORAGE_ID, type=CommandType.LONG, description="the storage ID where vm's volumes belong to") private Long storageId; + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="list vms by project") private Long projectId; diff --git a/api/src/com/cloud/api/commands/ListVlanIpRangesCmd.java b/api/src/com/cloud/api/commands/ListVlanIpRangesCmd.java index 1198584d9e2..628c626af9e 100644 --- a/api/src/com/cloud/api/commands/ListVlanIpRangesCmd.java +++ b/api/src/com/cloud/api/commands/ListVlanIpRangesCmd.java @@ -24,6 +24,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.BaseCmd.CommandType; @@ -44,24 +45,30 @@ public class ListVlanIpRangesCmd extends BaseListCmd { @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="the account with which the VLAN IP range is associated. Must be used with the domainId parameter.") private String accountName; + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="project who will own the VLAN") private Long projectId; + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="the domain ID with which the VLAN IP range is associated. If used with the account parameter, returns all VLAN IP ranges for that account in the specified domain.") private Long domainId; + @IdentityMapper(entityTableName="vlan") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=false, description="the ID of the VLAN IP range") private Long id; + @IdentityMapper(entityTableName="host_pod_ref") @Parameter(name=ApiConstants.POD_ID, type=CommandType.LONG, description="the Pod ID of the VLAN IP range") private Long podId; @Parameter(name=ApiConstants.VLAN, type=CommandType.STRING, description="the ID or VID of the VLAN. Default is an \"untagged\" VLAN.") private String vlan; + @IdentityMapper(entityTableName="data_center") @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the Zone ID of the VLAN IP range") private Long zoneId; + @IdentityMapper(entityTableName="networks") @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.LONG, description="network id of the VLAN IP range") private Long networkId; diff --git a/api/src/com/cloud/api/commands/ListVolumesCmd.java b/api/src/com/cloud/api/commands/ListVolumesCmd.java index 923da760e59..94e8448a5bd 100755 --- a/api/src/com/cloud/api/commands/ListVolumesCmd.java +++ b/api/src/com/cloud/api/commands/ListVolumesCmd.java @@ -24,6 +24,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.response.ListResponse; @@ -44,33 +45,40 @@ public class ListVolumesCmd extends BaseListCmd { @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="the account associated with the disk volume. Must be used with the domainId parameter.") private String accountName; + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="Lists all disk volumes for the specified domain ID. If used with the account parameter, returns all disk volumes for an account in the specified domain ID.") private Long domainId; + @IdentityMapper(entityTableName="host") @Parameter(name=ApiConstants.HOST_ID, type=CommandType.LONG, description="list volumes on specified host") private Long hostId; + @IdentityMapper(entityTableName="volumes") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the ID of the disk volume") private Long id; @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the disk volume") private String volumeName; + @IdentityMapper(entityTableName="host_pod_ref") @Parameter(name=ApiConstants.POD_ID, type=CommandType.LONG, description="the pod id the disk volume belongs to") private Long podId; @Parameter(name=ApiConstants.TYPE, type=CommandType.STRING, description="the type of disk volume") private String type; + @IdentityMapper(entityTableName="vm_instance") @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.LONG, description="the ID of the virtual machine") private Long virtualMachineId; + @IdentityMapper(entityTableName="data_center") @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the ID of the availability zone") private Long zoneId; @Parameter(name=ApiConstants.IS_RECURSIVE, type=CommandType.BOOLEAN, description="defaults to false, but if true, lists all volumes from the parent specified by the domain id till leaves.") private Boolean recursive; + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="list firewall rules by project") private Long projectId; diff --git a/api/src/com/cloud/api/commands/ListVpnUsersCmd.java b/api/src/com/cloud/api/commands/ListVpnUsersCmd.java index 25c826de119..98867db44fb 100644 --- a/api/src/com/cloud/api/commands/ListVpnUsersCmd.java +++ b/api/src/com/cloud/api/commands/ListVpnUsersCmd.java @@ -25,6 +25,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.response.ListResponse; @@ -44,15 +45,18 @@ public class ListVpnUsersCmd extends BaseListCmd { @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="the account of the remote access vpn. 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 remote access vpn. If used with the account parameter, lists remote access vpns for the account in the specified domain.") private Long domainId; + @IdentityMapper(entityTableName="vpn_users") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the ID of the vpn user") private Long id; @Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, description="the username of the vpn user.") private String userName; + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="list firewall rules by project") private Long projectId; ///////////////////////////////////////////////////// diff --git a/api/src/com/cloud/api/commands/ListZonesByCmd.java b/api/src/com/cloud/api/commands/ListZonesByCmd.java index 58f42e4fac8..d5fbc7530cf 100755 --- a/api/src/com/cloud/api/commands/ListZonesByCmd.java +++ b/api/src/com/cloud/api/commands/ListZonesByCmd.java @@ -24,6 +24,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.BaseCmd.CommandType; @@ -40,12 +41,14 @@ public class ListZonesByCmd extends BaseListCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="data_center") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the ID of the zone") private Long id; @Parameter(name=ApiConstants.AVAILABLE, type=CommandType.BOOLEAN, description="true if you want to retrieve all available Zones. False if you only want to return the Zones from which you have at least one VM. Default is false.") private Boolean available; + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="the ID of the domain associated with the zone") private Long domainId; diff --git a/api/src/com/cloud/api/commands/LockAccountCmd.java b/api/src/com/cloud/api/commands/LockAccountCmd.java index 3eed7cfaa61..54814507932 100644 --- a/api/src/com/cloud/api/commands/LockAccountCmd.java +++ b/api/src/com/cloud/api/commands/LockAccountCmd.java @@ -21,6 +21,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.response.AccountResponse; @@ -39,6 +40,7 @@ public class LockAccountCmd extends BaseCmd { @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, required=true, description="Locks the specified account.") private String accountName; + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, required=true, description="Locks the specified account on this domain.") private Long domainId; diff --git a/api/src/com/cloud/api/commands/LockUserCmd.java b/api/src/com/cloud/api/commands/LockUserCmd.java index efcf072f71c..dfe82a752a4 100644 --- a/api/src/com/cloud/api/commands/LockUserCmd.java +++ b/api/src/com/cloud/api/commands/LockUserCmd.java @@ -21,6 +21,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -39,6 +40,7 @@ public class LockUserCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="user") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="Locks user by user ID.") private Long id; diff --git a/api/src/com/cloud/api/commands/MigrateSystemVMCmd.java b/api/src/com/cloud/api/commands/MigrateSystemVMCmd.java index 1bab6294f91..dfa6b0462cb 100644 --- a/api/src/com/cloud/api/commands/MigrateSystemVMCmd.java +++ b/api/src/com/cloud/api/commands/MigrateSystemVMCmd.java @@ -48,6 +48,7 @@ public class MigrateSystemVMCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="host") @Parameter(name=ApiConstants.HOST_ID, type=CommandType.LONG, required=true, description="destination Host ID to migrate VM to") private Long hostId; diff --git a/api/src/com/cloud/api/commands/MigrateVMCmd.java b/api/src/com/cloud/api/commands/MigrateVMCmd.java index 47560c1990d..3a447bbfb76 100644 --- a/api/src/com/cloud/api/commands/MigrateVMCmd.java +++ b/api/src/com/cloud/api/commands/MigrateVMCmd.java @@ -57,6 +57,7 @@ public class MigrateVMCmd extends BaseAsyncCmd { @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.LONG, required=true, description="the ID of the virtual machine") private Long virtualMachineId; + @IdentityMapper(entityTableName="storage_pool") @Parameter(name=ApiConstants.STORAGE_ID, type=CommandType.LONG, required=false, description="destination storage pool ID to migrate VM to") private Long storageId; diff --git a/api/src/com/cloud/api/commands/MigrateVolumeCmd.java b/api/src/com/cloud/api/commands/MigrateVolumeCmd.java index 33ed96280b7..f8964c0e998 100644 --- a/api/src/com/cloud/api/commands/MigrateVolumeCmd.java +++ b/api/src/com/cloud/api/commands/MigrateVolumeCmd.java @@ -3,6 +3,7 @@ package com.cloud.api.commands; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -21,9 +22,11 @@ public class MigrateVolumeCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="volumes") @Parameter(name=ApiConstants.VOLUME_ID, type=CommandType.LONG, required=true, description="the ID of the volume") private Long volumeId; + @IdentityMapper(entityTableName="storage_pool") @Parameter(name=ApiConstants.STORAGE_ID, type=CommandType.LONG, required=false, description="destination storage pool ID to migrate the volume to") private Long storageId; diff --git a/api/src/com/cloud/api/commands/PrepareForMaintenanceCmd.java b/api/src/com/cloud/api/commands/PrepareForMaintenanceCmd.java index ab4bfaf0515..2cd36220bde 100644 --- a/api/src/com/cloud/api/commands/PrepareForMaintenanceCmd.java +++ b/api/src/com/cloud/api/commands/PrepareForMaintenanceCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -42,6 +43,7 @@ public class PrepareForMaintenanceCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="host") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the host ID") private Long id; diff --git a/api/src/com/cloud/api/commands/PreparePrimaryStorageForMaintenanceCmd.java b/api/src/com/cloud/api/commands/PreparePrimaryStorageForMaintenanceCmd.java index 8200233fbce..c3a98414070 100644 --- a/api/src/com/cloud/api/commands/PreparePrimaryStorageForMaintenanceCmd.java +++ b/api/src/com/cloud/api/commands/PreparePrimaryStorageForMaintenanceCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -43,6 +44,7 @@ public class PreparePrimaryStorageForMaintenanceCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="storage_pool") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="Primary storage ID") private Long id; diff --git a/api/src/com/cloud/api/commands/PrepareTemplateCmd.java b/api/src/com/cloud/api/commands/PrepareTemplateCmd.java index c75936746e5..9fd268ae146 100644 --- a/api/src/com/cloud/api/commands/PrepareTemplateCmd.java +++ b/api/src/com/cloud/api/commands/PrepareTemplateCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.response.ListResponse; @@ -39,9 +40,11 @@ public class PrepareTemplateCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="data_center") @Parameter(name=ApiConstants.ZONE_ID, required=true, type=CommandType.LONG, description="zone ID of the template to be prepared in primary storage(s).") private Long zoneId; + @IdentityMapper(entityTableName="vm_template") @Parameter(name=ApiConstants.TEMPLATE_ID, required=true, type=CommandType.LONG, description="template ID of the template to be prepared in primary storage(s).") private Long templateId; diff --git a/api/src/com/cloud/api/commands/RebootRouterCmd.java b/api/src/com/cloud/api/commands/RebootRouterCmd.java index 6d6cd5df900..0daf28577fc 100644 --- a/api/src/com/cloud/api/commands/RebootRouterCmd.java +++ b/api/src/com/cloud/api/commands/RebootRouterCmd.java @@ -23,6 +23,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -45,6 +46,7 @@ public class RebootRouterCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="vm_instance") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the router") private Long id; diff --git a/api/src/com/cloud/api/commands/ReconnectHostCmd.java b/api/src/com/cloud/api/commands/ReconnectHostCmd.java index 0c7d3b13b15..e90aa193a0a 100755 --- a/api/src/com/cloud/api/commands/ReconnectHostCmd.java +++ b/api/src/com/cloud/api/commands/ReconnectHostCmd.java @@ -23,6 +23,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -44,6 +45,7 @@ public class ReconnectHostCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="host") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the host ID") private Long id; diff --git a/api/src/com/cloud/api/commands/RegisterCmd.java b/api/src/com/cloud/api/commands/RegisterCmd.java index b548de82649..d679ec8dfdc 100644 --- a/api/src/com/cloud/api/commands/RegisterCmd.java +++ b/api/src/com/cloud/api/commands/RegisterCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.response.RegisterResponse; @@ -37,7 +38,8 @@ public class RegisterCmd extends BaseCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - + + @IdentityMapper(entityTableName="user") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="User id") private Long id; diff --git a/api/src/com/cloud/api/commands/RegisterIsoCmd.java b/api/src/com/cloud/api/commands/RegisterIsoCmd.java index 74be343f912..16b72a39950 100755 --- a/api/src/com/cloud/api/commands/RegisterIsoCmd.java +++ b/api/src/com/cloud/api/commands/RegisterIsoCmd.java @@ -23,6 +23,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -63,15 +64,18 @@ public class RegisterIsoCmd extends BaseCmd { @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="the name of the ISO") private String isoName; + @IdentityMapper(entityTableName="guest_os") @Parameter(name=ApiConstants.OS_TYPE_ID, type=CommandType.LONG, description="the ID of the OS Type that best represents the OS of this ISO. If the iso is bootable this parameter needs to be passed") private Long osTypeId; @Parameter(name=ApiConstants.URL, type=CommandType.STRING, required=true, description="the URL to where the ISO is currently being hosted") private String url; + @IdentityMapper(entityTableName="data_center") @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, required=true, description="the ID of the zone you wish to register the ISO to.") private Long zoneId; + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="an optional domainId. If the account parameter is used, domainId must also be used.") private Long domainId; @@ -81,6 +85,7 @@ public class RegisterIsoCmd extends BaseCmd { @Parameter(name=ApiConstants.CHECKSUM, type=CommandType.STRING, description="the MD5 checksum value of this ISO") private String checksum; + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="Register iso for the project") private Long projectId; diff --git a/api/src/com/cloud/api/commands/RegisterSSHKeyPairCmd.java b/api/src/com/cloud/api/commands/RegisterSSHKeyPairCmd.java index 94cefd92038..8240d3af3eb 100644 --- a/api/src/com/cloud/api/commands/RegisterSSHKeyPairCmd.java +++ b/api/src/com/cloud/api/commands/RegisterSSHKeyPairCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.response.SSHKeyPairResponse; @@ -48,9 +49,11 @@ public class RegisterSSHKeyPairCmd extends BaseCmd { @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="an optional account for the ssh key. Must be used with domainId.") private String accountName; + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="an optional domainId for the ssh key. If the account parameter is used, domainId must also be used.") private Long domainId; + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="an optional project for the ssh key") private Long projectId; diff --git a/api/src/com/cloud/api/commands/RegisterTemplateCmd.java b/api/src/com/cloud/api/commands/RegisterTemplateCmd.java index 2b4731a6740..7cfff9fa754 100755 --- a/api/src/com/cloud/api/commands/RegisterTemplateCmd.java +++ b/api/src/com/cloud/api/commands/RegisterTemplateCmd.java @@ -24,6 +24,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -69,6 +70,7 @@ public class RegisterTemplateCmd extends BaseCmd { private String templateName; @Parameter(name=ApiConstants.OS_TYPE_ID, type=CommandType.LONG, required=true, description="the ID of the OS Type that best represents the OS of this template.") + @IdentityMapper(entityTableName="guest_os") private Long osTypeId; @Parameter(name=ApiConstants.PASSWORD_ENABLED, type=CommandType.BOOLEAN, description="true if the template supports the password reset feature; default is false") @@ -83,9 +85,11 @@ public class RegisterTemplateCmd extends BaseCmd { @Parameter(name=ApiConstants.URL, type=CommandType.STRING, required=true, description="the URL of where the template is hosted. Possible URL include http:// and https://") private String url; + @IdentityMapper(entityTableName="data_center") @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, required=true, description="the ID of the zone the template is to be hosted on") private Long zoneId; + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="an optional domainId. If the account parameter is used, domainId must also be used.") private Long domainId; @@ -98,6 +102,7 @@ public class RegisterTemplateCmd extends BaseCmd { @Parameter(name=ApiConstants.TEMPLATE_TAG, type=CommandType.STRING, description="the tag for this template.") private String templateTag; + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="Register template for the project") private Long projectId; diff --git a/api/src/com/cloud/api/commands/RemoveFromLoadBalancerRuleCmd.java b/api/src/com/cloud/api/commands/RemoveFromLoadBalancerRuleCmd.java index 1ad8f018c6a..db79f03f2f7 100644 --- a/api/src/com/cloud/api/commands/RemoveFromLoadBalancerRuleCmd.java +++ b/api/src/com/cloud/api/commands/RemoveFromLoadBalancerRuleCmd.java @@ -24,6 +24,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -45,9 +46,11 @@ public class RemoveFromLoadBalancerRuleCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="firewall_rules") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="The ID of the load balancer rule") private Long id; + @IdentityMapper(entityTableName="vm_instance") @Parameter(name=ApiConstants.VIRTUAL_MACHINE_IDS, type=CommandType.LIST, required = true, collectionType=CommandType.LONG, description="the list of IDs of the virtual machines that are being removed from the load balancer rule (i.e. virtualMachineIds=1,2,3)") private List virtualMachineIds; diff --git a/api/src/com/cloud/api/commands/RemoveVpnUserCmd.java b/api/src/com/cloud/api/commands/RemoveVpnUserCmd.java index 75a1e77bd88..cca05ed947e 100644 --- a/api/src/com/cloud/api/commands/RemoveVpnUserCmd.java +++ b/api/src/com/cloud/api/commands/RemoveVpnUserCmd.java @@ -23,6 +23,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -46,9 +47,11 @@ public class RemoveVpnUserCmd extends BaseAsyncCmd { @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="an optional account for the vpn user. Must be used with domainId.") private String accountName; + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="remove vpn user from the project") private Long projectId; + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="an optional domainId for the vpn user. If the account parameter is used, domainId must also be used.") private Long domainId; diff --git a/api/src/com/cloud/api/commands/RestartNetworkCmd.java b/api/src/com/cloud/api/commands/RestartNetworkCmd.java index bd16a0df7b1..afe7e2e4ad6 100644 --- a/api/src/com/cloud/api/commands/RestartNetworkCmd.java +++ b/api/src/com/cloud/api/commands/RestartNetworkCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -45,6 +46,7 @@ public class RestartNetworkCmd extends BaseAsyncCmd { ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="networks") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="The id of the network to restart.") private Long id; diff --git a/api/src/com/cloud/api/commands/RevokeSecurityGroupIngressCmd.java b/api/src/com/cloud/api/commands/RevokeSecurityGroupIngressCmd.java index 0f429f2085b..ed3da11015b 100644 --- a/api/src/com/cloud/api/commands/RevokeSecurityGroupIngressCmd.java +++ b/api/src/com/cloud/api/commands/RevokeSecurityGroupIngressCmd.java @@ -23,6 +23,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -42,6 +43,7 @@ public class RevokeSecurityGroupIngressCmd extends BaseAsyncCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// + @IdentityMapper(entityTableName="security_ingress_rule") @Parameter(name = ApiConstants.ID, type = CommandType.LONG, required = true, description = "The ID of the ingress rule") private Long id; diff --git a/api/src/com/cloud/api/commands/StartRouterCmd.java b/api/src/com/cloud/api/commands/StartRouterCmd.java index e00c8cce60a..77ee0eb7183 100644 --- a/api/src/com/cloud/api/commands/StartRouterCmd.java +++ b/api/src/com/cloud/api/commands/StartRouterCmd.java @@ -23,6 +23,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -47,6 +48,7 @@ public class StartRouterCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="vm_instance") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the router") private Long id; diff --git a/api/src/com/cloud/api/commands/StopRouterCmd.java b/api/src/com/cloud/api/commands/StopRouterCmd.java index b6dde691463..3f2d64dd26f 100644 --- a/api/src/com/cloud/api/commands/StopRouterCmd.java +++ b/api/src/com/cloud/api/commands/StopRouterCmd.java @@ -23,6 +23,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -44,6 +45,7 @@ public class StopRouterCmd extends BaseAsyncCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// + @IdentityMapper(entityTableName="vm_instance") @Parameter(name = ApiConstants.ID, type = CommandType.LONG, required = true, description = "the ID of the router") private Long id; diff --git a/api/src/com/cloud/api/commands/StopVMCmd.java b/api/src/com/cloud/api/commands/StopVMCmd.java index 534d0df97c5..68b7d4b506b 100644 --- a/api/src/com/cloud/api/commands/StopVMCmd.java +++ b/api/src/com/cloud/api/commands/StopVMCmd.java @@ -1,129 +1,130 @@ -/** - * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. - * - * This software is licensed under the GNU General Public License v3 or later. - * - * It is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or any later version. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ +/** + * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. + * + * This software is licensed under the GNU General Public License v3 or later. + * + * It is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ package com.cloud.api.commands; -import org.apache.log4j.Logger; - -import com.cloud.api.ApiConstants; -import com.cloud.api.BaseAsyncCmd; -import com.cloud.api.BaseCmd; -import com.cloud.api.IdentityMapper; -import com.cloud.api.Implementation; -import com.cloud.api.Parameter; -import com.cloud.api.ServerApiException; -import com.cloud.api.response.UserVmResponse; -import com.cloud.async.AsyncJob; -import com.cloud.event.EventTypes; -import com.cloud.exception.ConcurrentOperationException; -import com.cloud.hypervisor.Hypervisor.HypervisorType; -import com.cloud.user.Account; -import com.cloud.user.UserContext; -import com.cloud.uservm.UserVm; - +import org.apache.log4j.Logger; + +import com.cloud.api.ApiConstants; +import com.cloud.api.BaseAsyncCmd; +import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; +import com.cloud.api.Implementation; +import com.cloud.api.Parameter; +import com.cloud.api.ServerApiException; +import com.cloud.api.response.UserVmResponse; +import com.cloud.async.AsyncJob; +import com.cloud.event.EventTypes; +import com.cloud.exception.ConcurrentOperationException; +import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.user.Account; +import com.cloud.user.UserContext; +import com.cloud.uservm.UserVm; + @Implementation(responseObject=UserVmResponse.class, description="Stops a virtual machine.") public class StopVMCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(StopVMCmd.class.getName()); private static final String s_name = "stopvirtualmachineresponse"; - ///////////////////////////////////////////////////// - //////////////// API parameters ///////////////////// - ///////////////////////////////////////////////////// - - @IdentityMapper(entityTableName="vm_instance") - @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="The ID of the virtual machine") - private Long id; - - @Parameter(name=ApiConstants.FORCED, type=CommandType.BOOLEAN, required=false, description="Force stop the VM. The caller knows the VM is stopped.") - private Boolean forced; - - ///////////////////////////////////////////////////// - /////////////////// Accessors /////////////////////// - ///////////////////////////////////////////////////// - - public Long getId() { - return id; - } - - ///////////////////////////////////////////////////// - /////////////// API Implementation/////////////////// - ///////////////////////////////////////////////////// - - @Override + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @IdentityMapper(entityTableName="vm_instance") + @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="The ID of the virtual machine") + private Long id; + + @Parameter(name=ApiConstants.FORCED, type=CommandType.BOOLEAN, required=false, description="Force stop the VM. The caller knows the VM is stopped.") + private Boolean forced; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + + @Override public String getCommandName() { return s_name; - } - - public static String getResultObjectName() { - return "virtualmachine"; - } - - @Override - public long getEntityOwnerId() { - UserVm vm = _responseGenerator.findUserVmById(getId()); - if (vm != null) { - return vm.getAccountId(); - } - - return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked - } - - @Override - public String getEventType() { - return EventTypes.EVENT_VM_STOP; - } - - @Override - public String getEventDescription() { - return "stopping user vm: " + getId(); - } - - @Override - public AsyncJob.Type getInstanceType() { - return AsyncJob.Type.VirtualMachine; - } - - @Override - public Long getInstanceId() { - return getId(); - } - - public boolean isForced() { - return (forced != null) ? forced : false; - } - - @Override - public void execute() throws ServerApiException, ConcurrentOperationException{ - UserContext.current().setEventDetails("Vm Id: "+getId()); - UserVm result; - - if (_userVmService.getHypervisorTypeOfUserVM(getId()) == HypervisorType.BareMetal) { - result = _bareMetalVmService.stopVirtualMachine(getId(), isForced()); - } else { - result = _userVmService.stopVirtualMachine(getId(), isForced()); - } - - if (result != null) { - UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", result).get(0); - response.setResponseName(getCommandName()); - this.setResponseObject(response); - } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to stop vm"); - } + } + + public static String getResultObjectName() { + return "virtualmachine"; + } + + @Override + public long getEntityOwnerId() { + UserVm vm = _responseGenerator.findUserVmById(getId()); + if (vm != null) { + return vm.getAccountId(); + } + + return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked + } + + @Override + public String getEventType() { + return EventTypes.EVENT_VM_STOP; + } + + @Override + public String getEventDescription() { + return "stopping user vm: " + getId(); + } + + @Override + public AsyncJob.Type getInstanceType() { + return AsyncJob.Type.VirtualMachine; + } + + @Override + public Long getInstanceId() { + return getId(); + } + + public boolean isForced() { + return (forced != null) ? forced : false; + } + + @Override + public void execute() throws ServerApiException, ConcurrentOperationException{ + UserContext.current().setEventDetails("Vm Id: "+getId()); + UserVm result; + + if (_userVmService.getHypervisorTypeOfUserVM(getId()) == HypervisorType.BareMetal) { + result = _bareMetalVmService.stopVirtualMachine(getId(), isForced()); + } else { + result = _userVmService.stopVirtualMachine(getId(), isForced()); + } + + if (result != null) { + UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", result).get(0); + response.setResponseName(getCommandName()); + this.setResponseObject(response); + } else { + throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to stop vm"); + } } } diff --git a/api/src/com/cloud/api/commands/SuspendProjectCmd.java b/api/src/com/cloud/api/commands/SuspendProjectCmd.java index 727d007492c..a22bb90cf8f 100644 --- a/api/src/com/cloud/api/commands/SuspendProjectCmd.java +++ b/api/src/com/cloud/api/commands/SuspendProjectCmd.java @@ -23,6 +23,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -44,6 +45,7 @@ public class SuspendProjectCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="id of the project to be suspended") private Long id; diff --git a/api/src/com/cloud/api/commands/UpdateAccountCmd.java b/api/src/com/cloud/api/commands/UpdateAccountCmd.java index 69b0e5164d5..bb0443602b5 100644 --- a/api/src/com/cloud/api/commands/UpdateAccountCmd.java +++ b/api/src/com/cloud/api/commands/UpdateAccountCmd.java @@ -21,6 +21,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -39,6 +40,7 @@ public class UpdateAccountCmd extends BaseCmd{ @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, required=true, description="the current account name") private String accountName; + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, required=true, description="the ID of the domain where the account exists") private Long domainId; diff --git a/api/src/com/cloud/api/commands/UpdateClusterCmd.java b/api/src/com/cloud/api/commands/UpdateClusterCmd.java index 5995da7f10d..a4d10095c00 100755 --- a/api/src/com/cloud/api/commands/UpdateClusterCmd.java +++ b/api/src/com/cloud/api/commands/UpdateClusterCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -36,6 +37,7 @@ public class UpdateClusterCmd extends BaseCmd { private static final String s_name = "updateclusterresponse"; + @IdentityMapper(entityTableName="cluster") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the Cluster") private Long id; diff --git a/api/src/com/cloud/api/commands/UpdateDiskOfferingCmd.java b/api/src/com/cloud/api/commands/UpdateDiskOfferingCmd.java index 03ed6817c94..d496e22b491 100644 --- a/api/src/com/cloud/api/commands/UpdateDiskOfferingCmd.java +++ b/api/src/com/cloud/api/commands/UpdateDiskOfferingCmd.java @@ -21,6 +21,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -40,6 +41,7 @@ public class UpdateDiskOfferingCmd extends BaseCmd{ @Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, description="updates alternate display text of the disk offering with this value", length=4096) private String displayText; + @IdentityMapper(entityTableName="disk_offering") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="ID of the disk offering") private Long id; diff --git a/api/src/com/cloud/api/commands/UpdateDomainCmd.java b/api/src/com/cloud/api/commands/UpdateDomainCmd.java index 4af4daa771a..3570a7c7df9 100644 --- a/api/src/com/cloud/api/commands/UpdateDomainCmd.java +++ b/api/src/com/cloud/api/commands/UpdateDomainCmd.java @@ -21,6 +21,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -38,6 +39,7 @@ public class UpdateDomainCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="ID of domain to update") private Long id; diff --git a/api/src/com/cloud/api/commands/UpdateHostCmd.java b/api/src/com/cloud/api/commands/UpdateHostCmd.java index ee808f13f51..8648e1164d3 100644 --- a/api/src/com/cloud/api/commands/UpdateHostCmd.java +++ b/api/src/com/cloud/api/commands/UpdateHostCmd.java @@ -24,6 +24,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -41,9 +42,11 @@ public class UpdateHostCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="host") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the host to update") private Long id; + @IdentityMapper(entityTableName="guest_os_category") @Parameter(name=ApiConstants.OS_CATEGORY_ID, type=CommandType.LONG, description="the id of Os category to update the host with") private Long osCategoryId; diff --git a/api/src/com/cloud/api/commands/UpdateHostPasswordCmd.java b/api/src/com/cloud/api/commands/UpdateHostPasswordCmd.java index b386d700d27..0c869ef43f1 100644 --- a/api/src/com/cloud/api/commands/UpdateHostPasswordCmd.java +++ b/api/src/com/cloud/api/commands/UpdateHostPasswordCmd.java @@ -23,6 +23,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -41,9 +42,11 @@ public class UpdateHostPasswordCmd extends BaseCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// + @IdentityMapper(entityTableName="host") @Parameter(name=ApiConstants.HOST_ID, type=CommandType.LONG, description="the host ID") private Long hostId; + @IdentityMapper(entityTableName="cluster") @Parameter(name=ApiConstants.CLUSTER_ID, type=CommandType.LONG, description="the cluster ID for the host") private Long clusterId; diff --git a/api/src/com/cloud/api/commands/UpdateHypervisorCapabilitiesCmd.java b/api/src/com/cloud/api/commands/UpdateHypervisorCapabilitiesCmd.java index 4497a44fc5c..24f43251b45 100644 --- a/api/src/com/cloud/api/commands/UpdateHypervisorCapabilitiesCmd.java +++ b/api/src/com/cloud/api/commands/UpdateHypervisorCapabilitiesCmd.java @@ -17,10 +17,13 @@ */ package com.cloud.api.commands; +import java.util.UUID; + import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -39,6 +42,7 @@ public class UpdateHypervisorCapabilitiesCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="hypervisor_capabilities") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="ID of the hypervisor capability") private Long id; diff --git a/api/src/com/cloud/api/commands/UpdateLoadBalancerRuleCmd.java b/api/src/com/cloud/api/commands/UpdateLoadBalancerRuleCmd.java index 6732f526930..c8a140b2233 100644 --- a/api/src/com/cloud/api/commands/UpdateLoadBalancerRuleCmd.java +++ b/api/src/com/cloud/api/commands/UpdateLoadBalancerRuleCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -46,6 +47,7 @@ public class UpdateLoadBalancerRuleCmd extends BaseAsyncCmd { @Parameter(name=ApiConstants.DESCRIPTION, type=CommandType.STRING, description="the description of the load balancer rule", length=4096) private String description; + @IdentityMapper(entityTableName="firewall_rules") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the id of the load balancer rule to update") private Long id; diff --git a/api/src/com/cloud/api/commands/UpdateNetworkCmd.java b/api/src/com/cloud/api/commands/UpdateNetworkCmd.java index 142beb1c383..be199d76dd4 100644 --- a/api/src/com/cloud/api/commands/UpdateNetworkCmd.java +++ b/api/src/com/cloud/api/commands/UpdateNetworkCmd.java @@ -25,6 +25,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -45,6 +46,7 @@ public class UpdateNetworkCmd extends BaseAsyncCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="networks") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the network") private Long id; @@ -60,6 +62,7 @@ public class UpdateNetworkCmd extends BaseAsyncCmd { @Parameter(name=ApiConstants.NETWORK_DOMAIN, type=CommandType.STRING, description="network domain") private String networkDomain; + @IdentityMapper(entityTableName="network_offerings") @Parameter(name=ApiConstants.NETWORK_OFFERING_ID, type=CommandType.LONG, description="network offering ID") private Long networkOfferingId; diff --git a/api/src/com/cloud/api/commands/UpdateNetworkOfferingCmd.java b/api/src/com/cloud/api/commands/UpdateNetworkOfferingCmd.java index 23c9425803b..764aef50f00 100644 --- a/api/src/com/cloud/api/commands/UpdateNetworkOfferingCmd.java +++ b/api/src/com/cloud/api/commands/UpdateNetworkOfferingCmd.java @@ -18,10 +18,13 @@ package com.cloud.api.commands; +import java.util.UUID; + import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -39,6 +42,7 @@ public class UpdateNetworkOfferingCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="network_offerings") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the id of the network offering") private Long id; diff --git a/api/src/com/cloud/api/commands/UpdatePodCmd.java b/api/src/com/cloud/api/commands/UpdatePodCmd.java index c83bcf9beca..cb9813d70af 100755 --- a/api/src/com/cloud/api/commands/UpdatePodCmd.java +++ b/api/src/com/cloud/api/commands/UpdatePodCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -49,6 +50,7 @@ public class UpdatePodCmd extends BaseCmd { @Parameter(name=ApiConstants.GATEWAY, type=CommandType.STRING, description="the gateway for the Pod") private String gateway; + @IdentityMapper(entityTableName="host_pod_ref") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the Pod") private Long id; diff --git a/api/src/com/cloud/api/commands/UpdatePortForwardingRuleCmd.java b/api/src/com/cloud/api/commands/UpdatePortForwardingRuleCmd.java index df271686951..923e790674b 100644 --- a/api/src/com/cloud/api/commands/UpdatePortForwardingRuleCmd.java +++ b/api/src/com/cloud/api/commands/UpdatePortForwardingRuleCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.response.FirewallRuleResponse; @@ -47,12 +48,14 @@ public class UpdatePortForwardingRuleCmd extends BaseAsyncCmd { @Parameter(name=ApiConstants.PROTOCOL, type=CommandType.STRING, required=true, description="the protocol for the port fowarding rule. Valid values are TCP or UDP.") private String protocol; + @IdentityMapper(entityTableName="user_ip_address") @Parameter(name=ApiConstants.IP_ADDRESS_ID, type=CommandType.LONG, required=true, description="the IP address id of the port forwarding rule") private Long publicIpId; @Parameter(name=ApiConstants.PUBLIC_PORT, type=CommandType.STRING, required=true, description="the public port of the port forwarding rule") private String publicPort; + @IdentityMapper(entityTableName="vm_instance") @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.LONG, description="the ID of the virtual machine for the port forwarding rule") private Long virtualMachineId; diff --git a/api/src/com/cloud/api/commands/UpdateProjectCmd.java b/api/src/com/cloud/api/commands/UpdateProjectCmd.java index 4801ce257a3..db155ca4bd6 100644 --- a/api/src/com/cloud/api/commands/UpdateProjectCmd.java +++ b/api/src/com/cloud/api/commands/UpdateProjectCmd.java @@ -23,6 +23,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.BaseCmd.CommandType; import com.cloud.api.Implementation; import com.cloud.api.Parameter; @@ -43,6 +44,7 @@ public class UpdateProjectCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="id of the project to be modified") private Long id; diff --git a/api/src/com/cloud/api/commands/UpdateProjectInvitationCmd.java b/api/src/com/cloud/api/commands/UpdateProjectInvitationCmd.java index 2ca4a854975..bfa662603ff 100644 --- a/api/src/com/cloud/api/commands/UpdateProjectInvitationCmd.java +++ b/api/src/com/cloud/api/commands/UpdateProjectInvitationCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -39,6 +40,7 @@ public class UpdateProjectInvitationCmd extends BaseAsyncCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.PROJECT_ID, required=true, type=CommandType.LONG, description="id of the project to join") private Long projectId; diff --git a/api/src/com/cloud/api/commands/UpdateResourceCountCmd.java b/api/src/com/cloud/api/commands/UpdateResourceCountCmd.java index 0939b6a7a58..a5797382dec 100644 --- a/api/src/com/cloud/api/commands/UpdateResourceCountCmd.java +++ b/api/src/com/cloud/api/commands/UpdateResourceCountCmd.java @@ -25,6 +25,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -49,6 +50,7 @@ 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.") private Long domainId; @@ -60,6 +62,7 @@ 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") private Long projectId; diff --git a/api/src/com/cloud/api/commands/UpdateResourceLimitCmd.java b/api/src/com/cloud/api/commands/UpdateResourceLimitCmd.java index 1de04451f7a..e150f587f87 100644 --- a/api/src/com/cloud/api/commands/UpdateResourceLimitCmd.java +++ b/api/src/com/cloud/api/commands/UpdateResourceLimitCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -43,9 +44,11 @@ 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.") private Long domainId; + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="Update resource limits for project") private Long projectId; diff --git a/api/src/com/cloud/api/commands/UpdateServiceOfferingCmd.java b/api/src/com/cloud/api/commands/UpdateServiceOfferingCmd.java index ec4fe63549a..9d46b8c754c 100644 --- a/api/src/com/cloud/api/commands/UpdateServiceOfferingCmd.java +++ b/api/src/com/cloud/api/commands/UpdateServiceOfferingCmd.java @@ -21,6 +21,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -40,6 +41,7 @@ public class UpdateServiceOfferingCmd extends BaseCmd { @Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, description="the display text of the service offering to be updated") private String displayText; + @IdentityMapper(entityTableName="disk_offering") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the service offering to be updated") private Long id; diff --git a/api/src/com/cloud/api/commands/UpdateStoragePoolCmd.java b/api/src/com/cloud/api/commands/UpdateStoragePoolCmd.java index e786dbd25c0..00b0730eb8a 100644 --- a/api/src/com/cloud/api/commands/UpdateStoragePoolCmd.java +++ b/api/src/com/cloud/api/commands/UpdateStoragePoolCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -39,6 +40,7 @@ public class UpdateStoragePoolCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="storage_pool") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the Id of the storage pool") private Long id; diff --git a/api/src/com/cloud/api/commands/UpdateTemplateOrIsoCmd.java b/api/src/com/cloud/api/commands/UpdateTemplateOrIsoCmd.java index 4c46eb9d20b..ab667d0107e 100644 --- a/api/src/com/cloud/api/commands/UpdateTemplateOrIsoCmd.java +++ b/api/src/com/cloud/api/commands/UpdateTemplateOrIsoCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Parameter; public abstract class UpdateTemplateOrIsoCmd extends BaseCmd { @@ -37,6 +38,7 @@ public abstract class UpdateTemplateOrIsoCmd extends BaseCmd { @Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, description="the display text of the image", length=4096) private String displayText; + @IdentityMapper(entityTableName="vm_template") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the image file") private Long id; diff --git a/api/src/com/cloud/api/commands/UpdateTemplateOrIsoPermissionsCmd.java b/api/src/com/cloud/api/commands/UpdateTemplateOrIsoPermissionsCmd.java index 019633aac4f..27021ab9fd4 100755 --- a/api/src/com/cloud/api/commands/UpdateTemplateOrIsoPermissionsCmd.java +++ b/api/src/com/cloud/api/commands/UpdateTemplateOrIsoPermissionsCmd.java @@ -24,6 +24,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Parameter; import com.cloud.exception.InvalidParameterValueException; @@ -38,6 +39,7 @@ public abstract class UpdateTemplateOrIsoPermissionsCmd extends BaseCmd { @Parameter(name = ApiConstants.ACCOUNTS, type = CommandType.LIST, collectionType = CommandType.STRING, description = "a comma delimited list of accounts. If specified, \"op\" parameter has to be passed in.") private List accountNames; + @IdentityMapper(entityTableName="vm_template") @Parameter(name = ApiConstants.ID, type = CommandType.LONG, required = true, description = "the template ID") private Long id; @@ -53,6 +55,7 @@ public abstract class UpdateTemplateOrIsoPermissionsCmd extends BaseCmd { @Parameter(name = ApiConstants.OP, type = CommandType.STRING, description = "permission operator (add, remove, reset)") private String operation; + @IdentityMapper(entityTableName="projects") @Parameter(name = ApiConstants.PROJECT_IDS, type = CommandType.LIST, collectionType = CommandType.LONG, description = "a comma delimited list of projects. If specified, \"op\" parameter has to be passed in.") private List projectIds; diff --git a/api/src/com/cloud/api/commands/UpdateUserCmd.java b/api/src/com/cloud/api/commands/UpdateUserCmd.java index 8709a45aca1..c0150bafc6b 100644 --- a/api/src/com/cloud/api/commands/UpdateUserCmd.java +++ b/api/src/com/cloud/api/commands/UpdateUserCmd.java @@ -22,6 +22,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -50,6 +51,7 @@ public class UpdateUserCmd extends BaseCmd { @Parameter(name=ApiConstants.FIRSTNAME, type=CommandType.STRING, description="first name") private String firstname; + @IdentityMapper(entityTableName="user") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="User id") private Long id; diff --git a/api/src/com/cloud/api/commands/UpdateVMCmd.java b/api/src/com/cloud/api/commands/UpdateVMCmd.java index 59d3fa41572..a35538d2fbe 100644 --- a/api/src/com/cloud/api/commands/UpdateVMCmd.java +++ b/api/src/com/cloud/api/commands/UpdateVMCmd.java @@ -52,6 +52,7 @@ public class UpdateVMCmd extends BaseCmd{ @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="The ID of the virtual machine") private Long id; + @IdentityMapper(entityTableName="guest_os") @Parameter(name=ApiConstants.OS_TYPE_ID, type=CommandType.LONG, description="the ID of the OS type that best represents this VM.") private Long osTypeId; diff --git a/api/src/com/cloud/api/commands/UpdateZoneCmd.java b/api/src/com/cloud/api/commands/UpdateZoneCmd.java index 9c09cd1ceeb..9e7f7b37fbd 100755 --- a/api/src/com/cloud/api/commands/UpdateZoneCmd.java +++ b/api/src/com/cloud/api/commands/UpdateZoneCmd.java @@ -25,6 +25,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -51,6 +52,7 @@ public class UpdateZoneCmd extends BaseCmd { @Parameter(name=ApiConstants.GUEST_CIDR_ADDRESS, type=CommandType.STRING, description="the guest CIDR address for the Zone") private String guestCidrAddress; + @IdentityMapper(entityTableName="data_center") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the Zone") private Long id; diff --git a/api/src/com/cloud/api/commands/UpgradeRouterCmd.java b/api/src/com/cloud/api/commands/UpgradeRouterCmd.java index 598ec6b3921..5848fc0030d 100644 --- a/api/src/com/cloud/api/commands/UpgradeRouterCmd.java +++ b/api/src/com/cloud/api/commands/UpgradeRouterCmd.java @@ -21,6 +21,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -37,9 +38,11 @@ public class UpgradeRouterCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="vm_instance") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="The ID of the router") private Long id; + @IdentityMapper(entityTableName="disk_offering") @Parameter(name=ApiConstants.SERVICE_OFFERING_ID, type=CommandType.LONG, required=true, description="the service offering ID to apply to the domain router") private Long serviceOfferingId; diff --git a/api/src/com/cloud/api/commands/UpgradeVMCmd.java b/api/src/com/cloud/api/commands/UpgradeVMCmd.java index 4299edb7042..305c4278b89 100644 --- a/api/src/com/cloud/api/commands/UpgradeVMCmd.java +++ b/api/src/com/cloud/api/commands/UpgradeVMCmd.java @@ -47,6 +47,7 @@ public class UpgradeVMCmd extends BaseCmd { @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="The ID of the virtual machine") private Long id; + @IdentityMapper(entityTableName="disk_offering") @Parameter(name=ApiConstants.SERVICE_OFFERING_ID, type=CommandType.LONG, required=true, description="the service offering ID to apply to the virtual machine") private Long serviceOfferingId; diff --git a/api/src/com/cloud/api/response/AccountResponse.java b/api/src/com/cloud/api/response/AccountResponse.java index 690c0b01ec1..72d2d12d894 100644 --- a/api/src/com/cloud/api/response/AccountResponse.java +++ b/api/src/com/cloud/api/response/AccountResponse.java @@ -20,12 +20,13 @@ package com.cloud.api.response; import java.util.List; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; public class AccountResponse extends BaseResponse { @SerializedName(ApiConstants.ID) @Param(description="the id of the account") - private Long id; + private IdentityProxy id = new IdentityProxy("account"); @SerializedName(ApiConstants.NAME) @Param(description="the name of the account") private String name; @@ -34,7 +35,7 @@ public class AccountResponse extends BaseResponse { private Short accountType; @SerializedName(ApiConstants.DOMAIN_ID) @Param(description="id of the Domain the account belongs too") - private Long domainId; + private IdentityProxy domainId = new IdentityProxy("domain"); @SerializedName(ApiConstants.DOMAIN) @Param(description="name of the Domain the account belongs too") private String domainName; @@ -109,11 +110,11 @@ public class AccountResponse extends BaseResponse { private String networkDomain; public Long getId() { - return id; + return id.getValue(); } public void setId(Long id) { - this.id = id; + this.id.setValue(id); } public String getName() { @@ -133,11 +134,11 @@ public class AccountResponse extends BaseResponse { } public Long getDomainId() { - return domainId; + return domainId.getValue(); } public void setDomainId(Long domainId) { - this.domainId = domainId; + this.domainId.setValue(domainId); } public String getDomainName() { diff --git a/api/src/com/cloud/api/response/AlertResponse.java b/api/src/com/cloud/api/response/AlertResponse.java index 65c3fe79244..9d3d1d809f2 100644 --- a/api/src/com/cloud/api/response/AlertResponse.java +++ b/api/src/com/cloud/api/response/AlertResponse.java @@ -20,13 +20,14 @@ package com.cloud.api.response; import java.util.Date; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; @SuppressWarnings("unused") public class AlertResponse extends BaseResponse { @SerializedName(ApiConstants.ID) @Param(description="the id of the alert") - private Long id; + private IdentityProxy id = new IdentityProxy("alert"); @SerializedName(ApiConstants.TYPE) @Param(description="the alert type") private Short alertType; @@ -38,7 +39,7 @@ public class AlertResponse extends BaseResponse { private Date lastSent; public void setId(Long id) { - this.id = id; + this.id.setValue(id); } public void setAlertType(Short alertType) { diff --git a/api/src/com/cloud/api/response/AsyncJobResponse.java b/api/src/com/cloud/api/response/AsyncJobResponse.java index 7b416d7e0ce..f4a99d4c2b5 100644 --- a/api/src/com/cloud/api/response/AsyncJobResponse.java +++ b/api/src/com/cloud/api/response/AsyncJobResponse.java @@ -27,13 +27,13 @@ import com.google.gson.annotations.SerializedName; public class AsyncJobResponse extends BaseResponse { @SerializedName(ApiConstants.JOB_ID) @Param(description="async job ID") - private String id; + private IdentityProxy id = new IdentityProxy("async_job"); @SerializedName("accountid") @Param(description="the account that executed the async command") - private Long accountId; + private IdentityProxy accountId = new IdentityProxy("account"); @SerializedName(ApiConstants.USER_ID) @Param(description="the user that executed the async command") - private Long userId; + private IdentityProxy userId = new IdentityProxy("user"); @SerializedName("cmd") @Param(description="the async command executed") private String cmd; @@ -63,28 +63,28 @@ public class AsyncJobResponse extends BaseResponse { @SerializedName(ApiConstants.CREATED) @Param(description=" the created date of the job") private Date created; - public String getId() { - return id; + public Long getId() { + return id.getValue(); } - public void setId(String id) { - this.id = id; + public void setId(Long id) { + this.id.setValue(id); } public Long getAccountId() { - return accountId; + return accountId.getValue(); } public void setAccountId(Long accountId) { - this.accountId = accountId; + this.accountId.setValue(accountId); } public Long getUserId() { - return userId; + return userId.getValue(); } public void setUserId(Long userId) { - this.userId = userId; + this.userId.setValue(userId); } public String getCmd() { diff --git a/api/src/com/cloud/api/response/CloudIdentifierResponse.java b/api/src/com/cloud/api/response/CloudIdentifierResponse.java index 146d9fb8bd8..62b1e6903e3 100644 --- a/api/src/com/cloud/api/response/CloudIdentifierResponse.java +++ b/api/src/com/cloud/api/response/CloudIdentifierResponse.java @@ -19,13 +19,14 @@ package com.cloud.api.response; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; public class CloudIdentifierResponse extends BaseResponse { @SerializedName(ApiConstants.USER_ID) @Param(description="the user ID for the cloud identifier") - private Long userId; + private IdentityProxy userId = new IdentityProxy("user"); @SerializedName("cloudidentifier") @Param(description="the cloud identifier") private String cloudIdentifier; @@ -34,11 +35,11 @@ public class CloudIdentifierResponse extends BaseResponse { private String signature; public Long getUserId() { - return userId; + return userId.getValue(); } public void setUserId(Long userId) { - this.userId = userId; + this.userId.setValue(userId); } public String getCloudIdentifier() { diff --git a/api/src/com/cloud/api/response/ClusterResponse.java b/api/src/com/cloud/api/response/ClusterResponse.java index 2b03039316f..aef86f9ed96 100755 --- a/api/src/com/cloud/api/response/ClusterResponse.java +++ b/api/src/com/cloud/api/response/ClusterResponse.java @@ -21,6 +21,7 @@ import java.util.ArrayList; import java.util.List; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.api.Parameter; import com.cloud.api.BaseCmd.CommandType; import com.cloud.serializer.Param; @@ -28,19 +29,19 @@ import com.google.gson.annotations.SerializedName; public class ClusterResponse extends BaseResponse { @SerializedName(ApiConstants.ID) @Param(description="the cluster ID") - private Long id; + private IdentityProxy id = new IdentityProxy("cluster"); @SerializedName(ApiConstants.NAME) @Param(description="the cluster name") private String name; @SerializedName(ApiConstants.POD_ID) @Param(description="the Pod ID of the cluster") - private Long podId; + private IdentityProxy podId = new IdentityProxy("host_pod_ref"); @SerializedName("podname") @Param(description="the Pod name of the cluster") private String podName; @SerializedName(ApiConstants.ZONE_ID) @Param(description="the Zone ID of the cluster") - private Long zoneId; + private IdentityProxy zoneId = new IdentityProxy("data_center"); @SerializedName("zonename") @Param(description="the Zone name of the cluster") private String zoneName; @@ -61,11 +62,11 @@ public class ClusterResponse extends BaseResponse { private List capacitites; public Long getId() { - return id; + return id.getValue(); } public void setId(Long id) { - this.id = id; + this.id.setValue(id); } public String getName() { @@ -77,11 +78,11 @@ public class ClusterResponse extends BaseResponse { } public Long getPodId() { - return podId; + return podId.getValue(); } public void setPodId(Long podId) { - this.podId = podId; + this.podId.setValue(podId); } public String getPodName() { @@ -93,11 +94,11 @@ public class ClusterResponse extends BaseResponse { } public Long getZoneId() { - return zoneId; + return zoneId.getValue(); } public void setZoneId(Long zoneId) { - this.zoneId = zoneId; + this.zoneId.setValue(zoneId); } public String getZoneName() { diff --git a/api/src/com/cloud/api/response/DiskOfferingResponse.java b/api/src/com/cloud/api/response/DiskOfferingResponse.java index 32c123431ad..43f1a2214fd 100644 --- a/api/src/com/cloud/api/response/DiskOfferingResponse.java +++ b/api/src/com/cloud/api/response/DiskOfferingResponse.java @@ -20,15 +20,16 @@ package com.cloud.api.response; import java.util.Date; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; public class DiskOfferingResponse extends BaseResponse { @SerializedName(ApiConstants.ID) @Param(description="unique ID of the disk offering") - private Long id; + private IdentityProxy id = new IdentityProxy("disk_offering"); @SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain ID this disk offering belongs to. Ignore this information as it is not currently applicable.") - private Long domainId; + private IdentityProxy domainId = new IdentityProxy("domain"); @SerializedName(ApiConstants.DOMAIN) @Param(description="the domain name this disk offering belongs to. Ignore this information as it is not currently applicable.") private String domain; @@ -52,19 +53,19 @@ public class DiskOfferingResponse extends BaseResponse { private String tags; public Long getId() { - return id; + return id.getValue(); } public void setId(Long id) { - this.id = id; + this.id.setValue(id); } public Long getDomainId() { - return domainId; + return domainId.getValue(); } public void setDomainId(Long domainId) { - this.domainId = domainId; + this.domainId.setValue(domainId); } public String getDomain() { diff --git a/api/src/com/cloud/api/response/DomainResponse.java b/api/src/com/cloud/api/response/DomainResponse.java index f1242705b71..5fcfff3f912 100644 --- a/api/src/com/cloud/api/response/DomainResponse.java +++ b/api/src/com/cloud/api/response/DomainResponse.java @@ -18,12 +18,13 @@ package com.cloud.api.response; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; public class DomainResponse extends BaseResponse { @SerializedName(ApiConstants.ID) @Param(description="the ID of the domain") - private Long id; + private IdentityProxy id = new IdentityProxy("domain"); @SerializedName(ApiConstants.NAME) @Param(description="the name of the domain") private String domainName; @@ -32,7 +33,7 @@ public class DomainResponse extends BaseResponse { private Integer level; @SerializedName("parentdomainid") @Param(description="the domain ID of the parent domain") - private Long parentDomainId; + private IdentityProxy parentDomainId = new IdentityProxy("domain"); @SerializedName("parentdomainname") @Param(description="the domain name of the parent domain") private String parentDomainName; @@ -44,11 +45,11 @@ public class DomainResponse extends BaseResponse { private String networkDomain; public Long getId() { - return id; + return id.getValue(); } public void setId(Long id) { - this.id = id; + this.id.setValue(id); } public String getDomainName() { @@ -68,11 +69,11 @@ public class DomainResponse extends BaseResponse { } public Long getParentDomainId() { - return parentDomainId; + return parentDomainId.getValue(); } public void setParentDomainId(Long parentDomainId) { - this.parentDomainId = parentDomainId; + this.parentDomainId.setValue(parentDomainId); } public String getParentDomainName() { diff --git a/api/src/com/cloud/api/response/DomainRouterResponse.java b/api/src/com/cloud/api/response/DomainRouterResponse.java index f5def8a36e7..916e24bb574 100644 --- a/api/src/com/cloud/api/response/DomainRouterResponse.java +++ b/api/src/com/cloud/api/response/DomainRouterResponse.java @@ -20,6 +20,7 @@ package com.cloud.api.response; import java.util.Date; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.cloud.vm.VirtualMachine.State; import com.google.gson.annotations.SerializedName; @@ -27,10 +28,10 @@ import com.google.gson.annotations.SerializedName; @SuppressWarnings("unused") public class DomainRouterResponse extends BaseResponse implements ControlledEntityResponse{ @SerializedName(ApiConstants.ID) @Param(description="the id of the router") - private Long id; + private IdentityProxy id = new IdentityProxy("vm_instance"); @SerializedName(ApiConstants.ZONE_ID) @Param(description="the Zone ID for the router") - private Long zoneId; + private IdentityProxy zoneId = new IdentityProxy("data_center"); @SerializedName("zonename") @Param(description="the Zone name for the router") private String zoneName; @@ -51,10 +52,10 @@ public class DomainRouterResponse extends BaseResponse implements ControlledEnti private String name; @SerializedName(ApiConstants.POD_ID) @Param(description="the Pod ID for the router") - private Long podId; + private IdentityProxy podId = new IdentityProxy("host_pod_ref"); @SerializedName(ApiConstants.HOST_ID) @Param(description="the host ID for the router") - private Long hostId; + private IdentityProxy hostId = new IdentityProxy("host"); @SerializedName("hostname") @Param(description="the hostname for the router") private String hostName; @@ -81,7 +82,7 @@ public class DomainRouterResponse extends BaseResponse implements ControlledEnti private String publicNetmask; @SerializedName("publicnetworkid") @Param(description="the ID of the corresponding public network") - private Long publicNetworkId; + private IdentityProxy publicNetworkId = new IdentityProxy("networks"); @SerializedName("guestipaddress") @Param(description="the guest IP address for the router") private String guestIpAddress; @@ -93,10 +94,10 @@ public class DomainRouterResponse extends BaseResponse implements ControlledEnti private String guestNetmask; @SerializedName("guestnetworkid") @Param(description="the ID of the corresponding guest network") - private Long guestNetworkId; + private IdentityProxy guestNetworkId = new IdentityProxy("networks"); @SerializedName(ApiConstants.TEMPLATE_ID) @Param(description="the template ID for the router") - private Long templateId; + private IdentityProxy templateId = new IdentityProxy("vm_template"); @SerializedName(ApiConstants.CREATED) @Param(description="the date and time the router was created") private Date created; @@ -108,19 +109,19 @@ public class DomainRouterResponse extends BaseResponse implements ControlledEnti private String accountName; @SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id of the ipaddress") - private Long projectId; + private IdentityProxy projectId = new IdentityProxy("projects"); @SerializedName(ApiConstants.PROJECT) @Param(description="the project name of the address") private String projectName; @SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain ID associated with the router") - private Long domainId; + private IdentityProxy domainId = new IdentityProxy("domain"); @SerializedName(ApiConstants.DOMAIN) @Param(description="the domain associated with the router") private String domainName; @SerializedName("serviceofferingid") @Param(description="the ID of the service offering of the virtual machine") - private Long serviceOfferingId; + private IdentityProxy serviceOfferingId = new IdentityProxy("disk_offering"); @SerializedName("serviceofferingname") @Param(description="the name of the service offering of the virtual machine") private String serviceOfferingName; @@ -143,15 +144,15 @@ public class DomainRouterResponse extends BaseResponse implements ControlledEnti } public Long getId() { - return id; + return id.getValue(); } public void setId(Long id) { - this.id = id; + this.id.setValue(id); } public void setZoneId(Long zoneId) { - this.zoneId = zoneId; + this.zoneId.setValue(zoneId); } public void setZoneName(String zoneName) { @@ -179,11 +180,11 @@ public class DomainRouterResponse extends BaseResponse implements ControlledEnti } public void setPodId(Long podId) { - this.podId = podId; + this.podId.setValue(podId); } public void setHostId(Long hostId) { - this.hostId = hostId; + this.hostId.setValue(hostId); } public void setHostName(String hostName) { @@ -215,7 +216,7 @@ public class DomainRouterResponse extends BaseResponse implements ControlledEnti } public void setTemplateId(Long templateId) { - this.templateId = templateId; + this.templateId.setValue(templateId); } public void setCreated(Date created) { @@ -233,7 +234,7 @@ public class DomainRouterResponse extends BaseResponse implements ControlledEnti @Override public void setDomainId(Long domainId) { - this.domainId = domainId; + this.domainId.setValue(domainId); } @Override @@ -242,11 +243,11 @@ public class DomainRouterResponse extends BaseResponse implements ControlledEnti } public void setPublicNetworkId(Long publicNetworkId) { - this.publicNetworkId = publicNetworkId; + this.publicNetworkId.setValue(publicNetworkId); } public void setGuestNetworkId(Long guestNetworkId) { - this.guestNetworkId = guestNetworkId; + this.guestNetworkId.setValue(guestNetworkId); } public void setLinkLocalIp(String linkLocalIp) { @@ -266,7 +267,7 @@ public class DomainRouterResponse extends BaseResponse implements ControlledEnti } public void setServiceOfferingId(Long serviceOfferingId) { - this.serviceOfferingId = serviceOfferingId; + this.serviceOfferingId.setValue(serviceOfferingId); } public void setServiceOfferingName(String serviceOfferingName) { @@ -298,7 +299,7 @@ public class DomainRouterResponse extends BaseResponse implements ControlledEnti } @Override public void setProjectId(Long projectId) { - this.projectId = projectId; + this.projectId.setValue(projectId); } @Override diff --git a/api/src/com/cloud/api/response/EventResponse.java b/api/src/com/cloud/api/response/EventResponse.java index 15540a2b23f..0f02d4bf899 100644 --- a/api/src/com/cloud/api/response/EventResponse.java +++ b/api/src/com/cloud/api/response/EventResponse.java @@ -20,6 +20,7 @@ package com.cloud.api.response; import java.util.Date; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.event.Event; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; @@ -27,7 +28,7 @@ import com.google.gson.annotations.SerializedName; @SuppressWarnings("unused") public class EventResponse extends BaseResponse implements ControlledEntityResponse{ @SerializedName(ApiConstants.ID) @Param(description="the ID of the event") - private Long id; + private IdentityProxy id = new IdentityProxy("event"); @SerializedName(ApiConstants.USERNAME) @Param(description="the name of the user who performed the action (can be different from the account if an admin is performing an action for a user, e.g. starting/stopping a user's virtual machine)") private String username; @@ -45,13 +46,13 @@ public class EventResponse extends BaseResponse implements ControlledEntityRespo private String accountName; @SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id of the ipaddress") - private Long projectId; + private IdentityProxy projectId = new IdentityProxy("projects"); @SerializedName(ApiConstants.PROJECT) @Param(description="the project name of the address") private String projectName; @SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the id of the account's domain") - private Long domainId; + private IdentityProxy domainId = new IdentityProxy("domain"); @SerializedName(ApiConstants.DOMAIN) @Param(description="the name of the account's domain") private String domainName; @@ -63,10 +64,10 @@ public class EventResponse extends BaseResponse implements ControlledEntityRespo private Event.State state; @SerializedName("parentid") @Param(description="whether the event is parented") - private Long parentId; + private IdentityProxy parentId = new IdentityProxy("event"); public void setId(Long id) { - this.id = id; + this.id.setValue(id); } public void setUsername(String username) { @@ -92,7 +93,7 @@ public class EventResponse extends BaseResponse implements ControlledEntityRespo @Override public void setDomainId(Long domainId) { - this.domainId = domainId; + this.domainId.setValue(domainId); } @Override @@ -109,12 +110,12 @@ public class EventResponse extends BaseResponse implements ControlledEntityRespo } public void setParentId(Long parentId) { - this.parentId = parentId; + this.parentId.setValue(parentId); } @Override public void setProjectId(Long projectId) { - this.projectId = projectId; + this.projectId.setValue(projectId); } @Override diff --git a/api/src/com/cloud/api/response/ExtractResponse.java b/api/src/com/cloud/api/response/ExtractResponse.java index 26e21ae850f..628b547f9d3 100755 --- a/api/src/com/cloud/api/response/ExtractResponse.java +++ b/api/src/com/cloud/api/response/ExtractResponse.java @@ -20,18 +20,19 @@ package com.cloud.api.response; import java.util.Date; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; public class ExtractResponse extends BaseResponse { @SerializedName(ApiConstants.ID) @Param(description="the id of extracted object") - private Long id; + private IdentityProxy id = new IdentityProxy("vm_template"); @SerializedName(ApiConstants.NAME) @Param(description="the name of the extracted object") private String name; @SerializedName("extractId") @Param(description="the upload id of extracted object") - private Long uploadId; + private IdentityProxy uploadId = new IdentityProxy("async_job"); @SerializedName("uploadpercentage") @Param(description="the percentage of the entity uploaded to the specified location") private Integer uploadPercent; @@ -40,7 +41,7 @@ public class ExtractResponse extends BaseResponse { private String status; @SerializedName("accountid") @Param(description="the account id to which the extracted object belongs") - private Long accountId; + private IdentityProxy accountId = new IdentityProxy("account"); @SerializedName("resultstring") @Param(includeInApiDoc=false) private String resultString; @@ -58,7 +59,7 @@ public class ExtractResponse extends BaseResponse { private String storage; @SerializedName(ApiConstants.ZONE_ID) @Param(description="zone ID the object was extracted from") - private Long zoneId; + private IdentityProxy zoneId = new IdentityProxy("data_center"); @SerializedName("zonename") @Param(description="zone name the object was extracted from") private String zoneName; @@ -74,19 +75,23 @@ public class ExtractResponse extends BaseResponse { public ExtractResponse(Long typeId, String typeName, long accountId, String state, Long uploadId) { - this.id = typeId; + this.id.setValue(typeId); this.name = typeName; - this.accountId = accountId; + this.accountId.setValue(accountId); this.state = state; - this.uploadId = uploadId; + this.uploadId.setValue(uploadId); } public Long getId() { - return id; + return id.getValue(); } public void setId(long id) { - this.id = id; + this.id.setValue(id); + } + + public void setIdentityTableName(String tableName) { + this.id.setTableName(tableName); } public String getName() { @@ -98,11 +103,11 @@ public class ExtractResponse extends BaseResponse { } public Long getUploadId() { - return uploadId; + return uploadId.getValue(); } public void setUploadId(Long uploadId) { - this.uploadId = uploadId; + this.uploadId.setValue(uploadId); } public Integer getUploadPercent() { @@ -122,11 +127,11 @@ public class ExtractResponse extends BaseResponse { } public Long getAccountId() { - return accountId; + return accountId.getValue(); } public void setAccountId(long accountId) { - this.accountId = accountId; + this.accountId.setValue(accountId); } public String getResultString() { @@ -170,11 +175,11 @@ public class ExtractResponse extends BaseResponse { } public Long getZoneId() { - return zoneId; + return zoneId.getValue(); } public void setZoneId(Long zoneId) { - this.zoneId = zoneId; + this.zoneId.setValue(zoneId); } public String getZoneName() { diff --git a/api/src/com/cloud/api/response/FirewallResponse.java b/api/src/com/cloud/api/response/FirewallResponse.java index cf6f9632e28..9d4a5848941 100644 --- a/api/src/com/cloud/api/response/FirewallResponse.java +++ b/api/src/com/cloud/api/response/FirewallResponse.java @@ -18,12 +18,13 @@ package com.cloud.api.response; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; public class FirewallResponse extends BaseResponse { @SerializedName(ApiConstants.ID) @Param(description="the ID of the firewall rule") - private Long id; + private IdentityProxy id = new IdentityProxy("firewall_rules"); @SerializedName(ApiConstants.PROTOCOL) @Param(description="the protocol of the firewall rule") private String protocol; @@ -53,7 +54,7 @@ public class FirewallResponse extends BaseResponse { private Integer icmpCode; public void setId(Long id) { - this.id = id; + this.id.setValue(id); } public void setProtocol(String protocol) { diff --git a/api/src/com/cloud/api/response/FirewallRuleResponse.java b/api/src/com/cloud/api/response/FirewallRuleResponse.java index fac658f0b17..c3dd438e5c3 100644 --- a/api/src/com/cloud/api/response/FirewallRuleResponse.java +++ b/api/src/com/cloud/api/response/FirewallRuleResponse.java @@ -18,12 +18,13 @@ package com.cloud.api.response; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; public class FirewallRuleResponse extends BaseResponse{ @SerializedName(ApiConstants.ID) @Param(description="the ID of the port forwarding rule") - private Long id; + private IdentityProxy id = new IdentityProxy("firewall_rules"); @SerializedName(ApiConstants.PRIVATE_START_PORT) @Param(description = "the starting port of port forwarding rule's private port range") private String privateStartPort; @@ -41,7 +42,7 @@ public class FirewallRuleResponse extends BaseResponse{ private String publicEndPort; @SerializedName(ApiConstants.VIRTUAL_MACHINE_ID) @Param(description="the VM ID for the port forwarding rule") - private Long virtualMachineId; + private IdentityProxy virtualMachineId = new IdentityProxy("vm_instance"); @SerializedName("virtualmachinename") @Param(description="the VM name for the port forwarding rule") private String virtualMachineName; @@ -50,7 +51,7 @@ public class FirewallRuleResponse extends BaseResponse{ private String virtualMachineDisplayName; @SerializedName(ApiConstants.IP_ADDRESS_ID) @Param(description="the public ip address id for the port forwarding rule") - private Long publicIpAddressId; + private IdentityProxy publicIpAddressId = new IdentityProxy("user_ip_address"); @SerializedName(ApiConstants.IP_ADDRESS) @Param(description="the public ip address for the port forwarding rule") private String publicIpAddress; @@ -64,11 +65,11 @@ public class FirewallRuleResponse extends BaseResponse{ public Long getId() { - return id; + return id.getValue(); } public void setId(Long id) { - this.id = id; + this.id.setValue(id); } public String getPrivateStartPort() { @@ -112,11 +113,11 @@ public class FirewallRuleResponse extends BaseResponse{ } public Long getVirtualMachineId() { - return virtualMachineId; + return virtualMachineId.getValue(); } public void setVirtualMachineId(Long virtualMachineId) { - this.virtualMachineId = virtualMachineId; + this.virtualMachineId.setValue(virtualMachineId); } public String getVirtualMachineName() { @@ -152,11 +153,11 @@ public class FirewallRuleResponse extends BaseResponse{ } public Long getPublicIpAddressId() { - return publicIpAddressId; + return publicIpAddressId.getValue(); } public void setPublicIpAddressId(Long publicIpAddressId) { - this.publicIpAddressId = publicIpAddressId; + this.publicIpAddressId.setValue(publicIpAddressId); } public String getCidrList() { diff --git a/api/src/com/cloud/api/response/GuestOSCategoryResponse.java b/api/src/com/cloud/api/response/GuestOSCategoryResponse.java index 6427f6e20a3..e15d6f81702 100644 --- a/api/src/com/cloud/api/response/GuestOSCategoryResponse.java +++ b/api/src/com/cloud/api/response/GuestOSCategoryResponse.java @@ -18,22 +18,23 @@ package com.cloud.api.response; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; public class GuestOSCategoryResponse extends BaseResponse { @SerializedName(ApiConstants.ID) @Param(description="the ID of the OS category") - private Long id; + private IdentityProxy id = new IdentityProxy("guest_os_category"); @SerializedName(ApiConstants.NAME) @Param(description="the name of the OS category") private String name; public Long getId() { - return id; + return id.getValue(); } public void setId(Long id) { - this.id = id; + this.id.setValue(id); } public String getName() { diff --git a/api/src/com/cloud/api/response/GuestOSResponse.java b/api/src/com/cloud/api/response/GuestOSResponse.java index c2ab867eb94..c142a297f57 100644 --- a/api/src/com/cloud/api/response/GuestOSResponse.java +++ b/api/src/com/cloud/api/response/GuestOSResponse.java @@ -18,33 +18,34 @@ package com.cloud.api.response; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; public class GuestOSResponse extends BaseResponse { @SerializedName(ApiConstants.ID) @Param(description="the ID of the OS type") - private Long id; + private IdentityProxy id = new IdentityProxy("guest_os"); @SerializedName(ApiConstants.OS_CATEGORY_ID) @Param(description="the ID of the OS category") - private Long osCategoryId; + private IdentityProxy osCategoryId = new IdentityProxy("guest_os_category"); @SerializedName(ApiConstants.DESCRIPTION) @Param(description="the name/description of the OS type") private String description; public Long getId() { - return id; + return id.getValue(); } public void setId(Long id) { - this.id = id; + this.id.setValue(id); } public Long getOsCategoryId() { - return osCategoryId; + return osCategoryId.getValue(); } public void setOsCategoryId(Long osCategoryId) { - this.osCategoryId = osCategoryId; + this.osCategoryId.setValue(osCategoryId); } public String getDescription() { diff --git a/api/src/com/cloud/api/response/HostResponse.java b/api/src/com/cloud/api/response/HostResponse.java index c7526a11824..32633ba76ad 100755 --- a/api/src/com/cloud/api/response/HostResponse.java +++ b/api/src/com/cloud/api/response/HostResponse.java @@ -20,6 +20,7 @@ package com.cloud.api.response; import java.util.Date; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.host.Host; import com.cloud.host.Status; import com.cloud.hypervisor.Hypervisor.HypervisorType; @@ -28,7 +29,7 @@ import com.google.gson.annotations.SerializedName; public class HostResponse extends BaseResponse { @SerializedName(ApiConstants.ID) @Param(description="the ID of the host") - private Long id; + private IdentityProxy id = new IdentityProxy("host"); @SerializedName(ApiConstants.NAME) @Param(description="the name of the host") private String name; @@ -43,7 +44,7 @@ public class HostResponse extends BaseResponse { private Host.Type hostType; @SerializedName("oscategoryid") @Param(description="the OS category ID of the host") - private Long osCategoryId; + private IdentityProxy osCategoryId = new IdentityProxy("guest_os_category"); @SerializedName("oscategoryname") @Param(description="the OS category name of the host") private String osCategoryName; @@ -52,13 +53,13 @@ public class HostResponse extends BaseResponse { private String ipAddress; @SerializedName(ApiConstants.ZONE_ID) @Param(description="the Zone ID of the host") - private Long zoneId; + private IdentityProxy zoneId = new IdentityProxy("data_center"); @SerializedName("zonename") @Param(description="the Zone name of the host") private String zoneName; @SerializedName(ApiConstants.POD_ID) @Param(description="the Pod ID of the host") - private Long podId; + private IdentityProxy podId = new IdentityProxy("host_pod_ref"); @SerializedName("podname") @Param(description="the Pod name of the host") private String podName; @@ -118,7 +119,7 @@ public class HostResponse extends BaseResponse { private Long managementServerId; @SerializedName("clusterid") @Param(description="the cluster ID of the host") - private Long clusterId; + private IdentityProxy clusterId = new IdentityProxy("cluster"); @SerializedName("clustername") @Param(description="the cluster name of the host") private String clusterName; @@ -139,7 +140,7 @@ public class HostResponse extends BaseResponse { private String events; @SerializedName(ApiConstants.JOB_ID) @Param(description="shows the current pending asynchronous job ID. This tag is not returned if no current pending jobs are acting on the host") - private Long jobId; + private IdentityProxy jobId = new IdentityProxy("async_job"); @SerializedName("jobstatus") @Param(description="shows the current pending asynchronous job status") private Integer jobStatus; @@ -167,12 +168,12 @@ public class HostResponse extends BaseResponse { @Override public Long getJobId() { - return jobId; + return jobId.getValue(); } @Override public void setJobId(Long jobId) { - this.jobId = jobId; + this.jobId.setValue(jobId); } @Override @@ -186,11 +187,11 @@ public class HostResponse extends BaseResponse { } public Long getId() { - return id; + return id.getValue(); } public void setId(Long id) { - this.id = id; + this.id.setValue(id); } public String getName() { @@ -226,11 +227,11 @@ public class HostResponse extends BaseResponse { } public Long getOsCategoryId() { - return osCategoryId; + return osCategoryId.getValue(); } public void setOsCategoryId(Long osCategoryId) { - this.osCategoryId = osCategoryId; + this.osCategoryId.setValue(osCategoryId); } public String getOsCategoryName() { @@ -250,11 +251,11 @@ public class HostResponse extends BaseResponse { } public Long getZoneId() { - return zoneId; + return zoneId.getValue(); } public void setZoneId(Long zoneId) { - this.zoneId = zoneId; + this.zoneId.setValue(zoneId); } public String getZoneName() { @@ -266,11 +267,11 @@ public class HostResponse extends BaseResponse { } public Long getPodId() { - return podId; + return podId.getValue(); } public void setPodId(Long podId) { - this.podId = podId; + this.podId.setValue(podId); } public String getPodName() { @@ -418,11 +419,11 @@ public class HostResponse extends BaseResponse { } public Long getClusterId() { - return clusterId; + return clusterId.getValue(); } public void setClusterId(Long clusterId) { - this.clusterId = clusterId; + this.clusterId.setValue(clusterId); } public String getClusterName() { diff --git a/api/src/com/cloud/api/response/HypervisorCapabilitiesResponse.java b/api/src/com/cloud/api/response/HypervisorCapabilitiesResponse.java index fe968369159..8ec43db45f7 100644 --- a/api/src/com/cloud/api/response/HypervisorCapabilitiesResponse.java +++ b/api/src/com/cloud/api/response/HypervisorCapabilitiesResponse.java @@ -18,13 +18,14 @@ package com.cloud.api.response; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; public class HypervisorCapabilitiesResponse extends BaseResponse { @SerializedName(ApiConstants.ID) @Param(description="the ID of the hypervisor capabilities row") - private Long id; + private IdentityProxy id = new IdentityProxy("hypervisor_capabilities"); @SerializedName(ApiConstants.HYPERVISOR_VERSION) @Param(description="the hypervisor version") private String hypervisorVersion; @@ -46,11 +47,11 @@ public class HypervisorCapabilitiesResponse extends BaseResponse { } public Long getId() { - return id; + return id.getValue(); } public void setId(Long id) { - this.id = id; + this.id.setValue(id); } diff --git a/api/src/com/cloud/api/response/IPAddressResponse.java b/api/src/com/cloud/api/response/IPAddressResponse.java index 7bc9ebacd31..4b0d4b7da40 100644 --- a/api/src/com/cloud/api/response/IPAddressResponse.java +++ b/api/src/com/cloud/api/response/IPAddressResponse.java @@ -20,13 +20,14 @@ package com.cloud.api.response; import java.util.Date; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; @SuppressWarnings("unused") public class IPAddressResponse extends BaseResponse implements ControlledEntityResponse { @SerializedName(ApiConstants.ID) @Param(description="public IP address id") - private Long id; + private IdentityProxy id = new IdentityProxy("user_ip_address"); @SerializedName(ApiConstants.IP_ADDRESS) @Param(description="public IP address") private String ipAddress; @@ -35,7 +36,7 @@ public class IPAddressResponse extends BaseResponse implements ControlledEntityR private Date allocated; @SerializedName(ApiConstants.ZONE_ID) @Param(description="the ID of the zone the public IP address belongs to") - private Long zoneId; + private IdentityProxy zoneId = new IdentityProxy("data_center"); @SerializedName("zonename") @Param(description="the name of the zone the public IP address belongs to") private String zoneName; @@ -47,13 +48,13 @@ public class IPAddressResponse extends BaseResponse implements ControlledEntityR private String accountName; @SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id of the ipaddress") - private Long projectId; + private IdentityProxy projectId = new IdentityProxy("projects"); @SerializedName(ApiConstants.PROJECT) @Param(description="the project name of the address") private String projectName; @SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain ID the public IP address is associated with") - private Long domainId; + private IdentityProxy domainId = new IdentityProxy("domain"); @SerializedName(ApiConstants.DOMAIN) @Param(description="the domain the public IP address is associated with") private String domainName; @@ -62,7 +63,7 @@ public class IPAddressResponse extends BaseResponse implements ControlledEntityR private Boolean forVirtualNetwork; @SerializedName(ApiConstants.VLAN_ID) @Param(description="the ID of the VLAN associated with the IP address") - private Long vlanId; + private IdentityProxy vlanId = new IdentityProxy("vlan"); @SerializedName("vlanname") @Param(description="the VLAN associated with the IP address") private String vlanName; @@ -71,7 +72,7 @@ public class IPAddressResponse extends BaseResponse implements ControlledEntityR private Boolean staticNat; @SerializedName(ApiConstants.VIRTUAL_MACHINE_ID) @Param(description="virutal machine id the ip address is assigned to (not null only for static nat Ip)") - private Long virtualMachineId; + private IdentityProxy virtualMachineId = new IdentityProxy("vm_instance"); @SerializedName("virtualmachinename") @Param(description="virutal machine name the ip address is assigned to (not null only for static nat Ip)") private String virtualMachineName; @@ -80,16 +81,16 @@ public class IPAddressResponse extends BaseResponse implements ControlledEntityR private String virtualMachineDisplayName; @SerializedName("associatednetworkid") @Param(description="the ID of the Network associated with the IP address") - private Long associatedNetworkId; + private IdentityProxy associatedNetworkId = new IdentityProxy("networks"); @SerializedName(ApiConstants.NETWORK_ID) @Param(description="the ID of the Network where ip belongs to") - private Long networkId; + private IdentityProxy networkId = new IdentityProxy("networks"); @SerializedName(ApiConstants.STATE) @Param(description="State of the ip address. Can be: Allocatin, Allocated and Releasing") private String state; @SerializedName(ApiConstants.JOB_ID) @Param(description="shows the current pending asynchronous job ID. This tag is not returned if no current pending jobs are acting on the volume") - private Long jobId; + private IdentityProxy jobId = new IdentityProxy("async_job"); @SerializedName(ApiConstants.JOB_STATUS) @Param(description="shows the current pending asynchronous job status") private Integer jobStatus; @@ -103,7 +104,7 @@ public class IPAddressResponse extends BaseResponse implements ControlledEntityR } public void setZoneId(Long zoneId) { - this.zoneId = zoneId; + this.zoneId.setValue(zoneId); } public void setZoneName(String zoneName) { @@ -121,7 +122,7 @@ public class IPAddressResponse extends BaseResponse implements ControlledEntityR @Override public void setDomainId(Long domainId) { - this.domainId = domainId; + this.domainId.setValue(domainId); } @Override @@ -134,7 +135,7 @@ public class IPAddressResponse extends BaseResponse implements ControlledEntityR } public void setVlanId(Long vlanId) { - this.vlanId = vlanId; + this.vlanId.setValue(vlanId); } public void setVlanName(String vlanName) { @@ -146,15 +147,15 @@ public class IPAddressResponse extends BaseResponse implements ControlledEntityR } public void setAssociatedNetworkId(Long networkId) { - this.associatedNetworkId = networkId; + this.associatedNetworkId.setValue(networkId); } public void setNetworkId(Long networkId) { - this.networkId = networkId; + this.networkId.setValue(networkId); } public void setVirtualMachineId(Long virtualMachineId) { - this.virtualMachineId = virtualMachineId; + this.virtualMachineId.setValue(virtualMachineId); } public void setVirtualMachineName(String virtualMachineName) { @@ -166,11 +167,11 @@ public class IPAddressResponse extends BaseResponse implements ControlledEntityR } public Long getId() { - return id; + return id.getValue(); } public void setId(Long id) { - this.id = id; + this.id.setValue(id); } public void setState(String state) { @@ -184,12 +185,12 @@ public class IPAddressResponse extends BaseResponse implements ControlledEntityR @Override public Long getJobId() { - return jobId; + return jobId.getValue(); } @Override public void setJobId(Long jobId) { - this.jobId = jobId; + this.jobId.setValue(jobId); } @Override @@ -204,7 +205,7 @@ public class IPAddressResponse extends BaseResponse implements ControlledEntityR @Override public void setProjectId(Long projectId) { - this.projectId = projectId; + this.projectId.setValue(projectId); } @Override diff --git a/api/src/com/cloud/api/response/IngressRuleResponse.java b/api/src/com/cloud/api/response/IngressRuleResponse.java index 9fa12f3ee09..2a29e5b18f7 100644 --- a/api/src/com/cloud/api/response/IngressRuleResponse.java +++ b/api/src/com/cloud/api/response/IngressRuleResponse.java @@ -18,12 +18,13 @@ package com.cloud.api.response; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; public class IngressRuleResponse extends BaseResponse { @SerializedName("ruleid") @Param(description="the id of the ingress rule") - private Long ruleId; + private IdentityProxy ruleId = new IdentityProxy("security_ingress_rule"); @SerializedName("protocol") @Param(description="the protocol of the ingress rule") private String protocol; @@ -50,11 +51,11 @@ public class IngressRuleResponse extends BaseResponse { private String cidr; public Long getRuleId() { - return ruleId; + return ruleId.getValue(); } public void setRuleId(Long ruleId) { - this.ruleId = ruleId; + this.ruleId.setValue(ruleId); } public String getProtocol() { diff --git a/api/src/com/cloud/api/response/InstanceGroupResponse.java b/api/src/com/cloud/api/response/InstanceGroupResponse.java index 3d393427b42..bdacd0940f8 100644 --- a/api/src/com/cloud/api/response/InstanceGroupResponse.java +++ b/api/src/com/cloud/api/response/InstanceGroupResponse.java @@ -21,13 +21,14 @@ package com.cloud.api.response; import java.util.Date; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; @SuppressWarnings("unused") public class InstanceGroupResponse extends BaseResponse implements ControlledEntityResponse{ @SerializedName(ApiConstants.ID) @Param(description="the id of the instance group") - private Long id; + private IdentityProxy id = new IdentityProxy("instance_group"); @SerializedName(ApiConstants.NAME) @Param(description="the name of the instance group") private String name; @@ -39,19 +40,19 @@ public class InstanceGroupResponse extends BaseResponse implements ControlledEnt private String accountName; @SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id of the group") - private Long projectId; + private IdentityProxy projectId = new IdentityProxy("projects"); @SerializedName(ApiConstants.PROJECT) @Param(description="the project name of the group") private String projectName; @SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain ID of the instance group") - private Long domainId; + private IdentityProxy domainId = new IdentityProxy("domain"); @SerializedName(ApiConstants.DOMAIN) @Param(description="the domain name of the instance group") private String domainName; public void setId(Long id) { - this.id = id; + this.id.setValue(id); } public void setName(String name) { @@ -69,7 +70,7 @@ public class InstanceGroupResponse extends BaseResponse implements ControlledEnt @Override public void setDomainId(Long domainId) { - this.domainId = domainId; + this.domainId.setValue(domainId); } @Override @@ -79,7 +80,7 @@ public class InstanceGroupResponse extends BaseResponse implements ControlledEnt @Override public void setProjectId(Long projectId) { - this.projectId = projectId; + this.projectId.setValue(projectId); } @Override diff --git a/api/src/com/cloud/api/response/LoadBalancerResponse.java b/api/src/com/cloud/api/response/LoadBalancerResponse.java index db4d69f98c6..7323f024e18 100644 --- a/api/src/com/cloud/api/response/LoadBalancerResponse.java +++ b/api/src/com/cloud/api/response/LoadBalancerResponse.java @@ -18,6 +18,7 @@ package com.cloud.api.response; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; @@ -25,7 +26,7 @@ import com.google.gson.annotations.SerializedName; public class LoadBalancerResponse extends BaseResponse implements ControlledEntityResponse { @SerializedName(ApiConstants.ID) @Param(description = "the load balancer rule ID") - private Long id; + private IdentityProxy id = new IdentityProxy("firewall_rules"); @SerializedName(ApiConstants.NAME) @Param(description = "the name of the load balancer") @@ -37,7 +38,7 @@ public class LoadBalancerResponse extends BaseResponse implements ControlledEnti @SerializedName(ApiConstants.PUBLIC_IP_ID) @Param(description = "the public ip address id") - private Long publicIpId; + private IdentityProxy publicIpId = new IdentityProxy("user_ip_address"); @SerializedName(ApiConstants.PUBLIC_IP) @Param(description = "the public ip address") @@ -63,14 +64,14 @@ public class LoadBalancerResponse extends BaseResponse implements ControlledEnti private String accountName; @SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id of the load balancer") - private Long projectId; + private IdentityProxy projectId = new IdentityProxy("projects"); @SerializedName(ApiConstants.PROJECT) @Param(description="the project name of the load balancer") private String projectName; @SerializedName(ApiConstants.DOMAIN_ID) @Param(description = "the domain ID of the load balancer rule") - private Long domainId; + private IdentityProxy domainId = new IdentityProxy("domain"); @SerializedName(ApiConstants.DOMAIN) @Param(description = "the domain of the load balancer rule") @@ -82,10 +83,10 @@ public class LoadBalancerResponse extends BaseResponse implements ControlledEnti @SerializedName(ApiConstants.ZONE_ID) @Param(description = "the id of the zone the rule belongs to") - private Long zoneId; + private IdentityProxy zoneId = new IdentityProxy("data_center"); public void setId(Long id) { - this.id = id; + this.id.setValue(id); } public void setName(String name) { @@ -121,7 +122,7 @@ public class LoadBalancerResponse extends BaseResponse implements ControlledEnti } public void setDomainId(Long domainId) { - this.domainId = domainId; + this.domainId.setValue(domainId); } public void setDomainName(String domainName) { @@ -133,16 +134,16 @@ public class LoadBalancerResponse extends BaseResponse implements ControlledEnti } public void setPublicIpId(Long publicIpId) { - this.publicIpId = publicIpId; + this.publicIpId.setValue(publicIpId); } public void setZoneId(Long zoneId) { - this.zoneId = zoneId; + this.zoneId.setValue(zoneId); } @Override public void setProjectId(Long projectId) { - this.projectId = projectId; + this.projectId.setValue(projectId); } @Override diff --git a/api/src/com/cloud/api/response/NetworkOfferingResponse.java b/api/src/com/cloud/api/response/NetworkOfferingResponse.java index fadce919991..a84351b0605 100644 --- a/api/src/com/cloud/api/response/NetworkOfferingResponse.java +++ b/api/src/com/cloud/api/response/NetworkOfferingResponse.java @@ -21,12 +21,13 @@ package com.cloud.api.response; import java.util.Date; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; public class NetworkOfferingResponse extends BaseResponse{ @SerializedName("id") @Param(description="the id of the network offering") - private Long id; + private IdentityProxy id = new IdentityProxy("network_offerings"); @SerializedName("name") @Param(description="the name of the network offering") private String name; @@ -65,11 +66,11 @@ public class NetworkOfferingResponse extends BaseResponse{ private Boolean redundantRouter; public Long getId() { - return id; + return id.getValue(); } public void setId(Long id) { - this.id = id; + this.id.setValue(id); } public String getName() { diff --git a/api/src/com/cloud/api/response/NetworkResponse.java b/api/src/com/cloud/api/response/NetworkResponse.java index f998cfc706b..d44c21f222d 100644 --- a/api/src/com/cloud/api/response/NetworkResponse.java +++ b/api/src/com/cloud/api/response/NetworkResponse.java @@ -21,6 +21,7 @@ package com.cloud.api.response; import java.util.List; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; @@ -28,7 +29,7 @@ import com.google.gson.annotations.SerializedName; public class NetworkResponse extends BaseResponse implements ControlledEntityResponse{ @SerializedName(ApiConstants.ID) @Param(description="the id of the network") - private Long id; + private IdentityProxy id = new IdentityProxy("networks"); @SerializedName(ApiConstants.NAME) @Param(description="the name of the network") private String name; @@ -55,10 +56,10 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes private String endIp; @SerializedName(ApiConstants.ZONE_ID) @Param(description="zone id of the network") - private Long zoneId; + private IdentityProxy zoneId = new IdentityProxy("data_center"); @SerializedName("networkofferingid") @Param(description="network offering id the network is created from") - private Long networkOfferingId; + private IdentityProxy networkOfferingId = new IdentityProxy("network_offerings"); @SerializedName("networkofferingname") @Param(description="name of the network offering the network is created from") private String networkOfferingName; @@ -79,7 +80,7 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes private String state; @SerializedName("related") @Param(description="related to what other network configuration") - private Long related; + private IdentityProxy related = new IdentityProxy("networks"); @SerializedName("broadcasturi") @Param(description="broadcast uri of the network") private String broadcastUri; @@ -100,13 +101,13 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes private String accountName; @SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id of the ipaddress") - private Long projectId; + private IdentityProxy projectId = new IdentityProxy("projects"); @SerializedName(ApiConstants.PROJECT) @Param(description="the project name of the address") private String projectName; @SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain id of the network owner") - private Long domainId; + private IdentityProxy domainId = new IdentityProxy("domain"); @SerializedName(ApiConstants.DOMAIN) @Param(description="the domain name of the network owner") private String domain; @@ -127,7 +128,7 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes private String tags; public void setId(Long id) { - this.id = id; + this.id.setValue(id); } public void setName(String name) { @@ -151,11 +152,11 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes } public void setZoneId(Long zoneId) { - this.zoneId = zoneId; + this.zoneId.setValue(zoneId); } public void setNetworkOfferingId(Long networkOfferingId) { - this.networkOfferingId = networkOfferingId; + this.networkOfferingId.setValue(networkOfferingId); } public void setState(String state) { @@ -163,7 +164,7 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes } public void setRelated(Long related) { - this.related = related; + this.related.setValue(related); } public void setBroadcastUri(String broadcastUri) { @@ -187,7 +188,7 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes } public void setDomainId(Long domainId) { - this.domainId = domainId; + this.domainId.setValue(domainId); } public void setNetworkOfferingName(String networkOfferingName) { @@ -261,7 +262,7 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes @Override public void setProjectId(Long projectId) { - this.projectId = projectId; + this.projectId.setValue(projectId); } @Override diff --git a/api/src/com/cloud/api/response/PodResponse.java b/api/src/com/cloud/api/response/PodResponse.java index 3fb81eeefe0..267979f03d4 100755 --- a/api/src/com/cloud/api/response/PodResponse.java +++ b/api/src/com/cloud/api/response/PodResponse.java @@ -19,18 +19,19 @@ package com.cloud.api.response; import java.util.List; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; public class PodResponse extends BaseResponse { @SerializedName("id") @Param(description="the ID of the Pod") - private Long id; + private IdentityProxy id = new IdentityProxy("host_pod_ref"); @SerializedName("name") @Param(description="the name of the Pod") private String name; @SerializedName("zoneid") @Param(description="the Zone ID of the Pod") - private Long zoneId; + private IdentityProxy zoneId = new IdentityProxy("data_center"); @SerializedName("zonename") @Param(description="the Zone name of the Pod") private String zoneName; @@ -54,11 +55,11 @@ public class PodResponse extends BaseResponse { private List capacitites; public Long getId() { - return id; + return id.getValue(); } public void setId(Long id) { - this.id = id; + this.id.setValue(id); } public String getName() { @@ -70,11 +71,11 @@ public class PodResponse extends BaseResponse { } public Long getZoneId() { - return zoneId; + return zoneId.getValue(); } public void setZoneId(Long zoneId) { - this.zoneId = zoneId; + this.zoneId.setValue(zoneId); } public String getZoneName() { diff --git a/api/src/com/cloud/api/response/ProjectInvitationResponse.java b/api/src/com/cloud/api/response/ProjectInvitationResponse.java index fb9182df5d2..15655f98501 100644 --- a/api/src/com/cloud/api/response/ProjectInvitationResponse.java +++ b/api/src/com/cloud/api/response/ProjectInvitationResponse.java @@ -1,22 +1,23 @@ package com.cloud.api.response; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; @SuppressWarnings("unused") public class ProjectInvitationResponse extends BaseResponse implements ControlledEntityResponse{ @SerializedName(ApiConstants.ID) @Param(description="the id of the invitation") - private Long id; + private IdentityProxy id = new IdentityProxy("project_invitations"); @SerializedName(ApiConstants.PROJECT_ID) @Param(description="the id of the project") - private Long projectId; + private IdentityProxy projectId = new IdentityProxy("projects"); @SerializedName(ApiConstants.PROJECT) @Param(description="the name of the project") private String projectName; @SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain id the project belongs to") - private Long domainId; + private IdentityProxy domainId = new IdentityProxy("domain"); @SerializedName(ApiConstants.DOMAIN) @Param(description="the domain name where the project belongs to") private String domainName; @@ -31,11 +32,11 @@ public class ProjectInvitationResponse extends BaseResponse implements Controlle private String invitationState; public void setId(Long id) { - this.id = id; + this.id.setValue(id); } public void setProjectId(Long projectId) { - this.projectId = projectId; + this.projectId.setValue(projectId); } public void setProjectName(String projectName) { @@ -43,7 +44,7 @@ public class ProjectInvitationResponse extends BaseResponse implements Controlle } public void setDomainId(Long domainId) { - this.domainId = domainId; + this.domainId.setValue(domainId); } public void setDomainName(String domain) { diff --git a/api/src/com/cloud/api/response/ProjectResponse.java b/api/src/com/cloud/api/response/ProjectResponse.java index 719333a9d9d..2d9a89ea5dd 100644 --- a/api/src/com/cloud/api/response/ProjectResponse.java +++ b/api/src/com/cloud/api/response/ProjectResponse.java @@ -19,6 +19,7 @@ package com.cloud.api.response; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; @@ -26,7 +27,7 @@ import com.google.gson.annotations.SerializedName; public class ProjectResponse extends BaseResponse{ @SerializedName(ApiConstants.ID) @Param(description="the id of the project") - private Long id; + private IdentityProxy id = new IdentityProxy("projects"); @SerializedName(ApiConstants.NAME) @Param(description="the name of the project") private String name; @@ -35,7 +36,7 @@ public class ProjectResponse extends BaseResponse{ private String displaytext; @SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain id the project belongs to") - private Long domainId; + private IdentityProxy domainId = new IdentityProxy("domain"); @SerializedName(ApiConstants.DOMAIN) @Param(description="the domain name where the project belongs to") private String domain; @@ -47,7 +48,7 @@ public class ProjectResponse extends BaseResponse{ private String state; public void setId(Long id) { - this.id = id; + this.id.setValue(id); } public void setName(String name) { @@ -59,7 +60,7 @@ public class ProjectResponse extends BaseResponse{ } public void setDomainId(Long domainId) { - this.domainId = domainId; + this.domainId.setValue(domainId); } public void setDomain(String domain) { diff --git a/api/src/com/cloud/api/response/RemoteAccessVpnResponse.java b/api/src/com/cloud/api/response/RemoteAccessVpnResponse.java index 03d283678be..2b6903c9612 100644 --- a/api/src/com/cloud/api/response/RemoteAccessVpnResponse.java +++ b/api/src/com/cloud/api/response/RemoteAccessVpnResponse.java @@ -18,6 +18,7 @@ package com.cloud.api.response; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; @@ -25,7 +26,7 @@ import com.google.gson.annotations.SerializedName; public class RemoteAccessVpnResponse extends BaseResponse implements ControlledEntityResponse{ @SerializedName(ApiConstants.PUBLIC_IP_ID) @Param(description="the public ip address of the vpn server") - private Long publicIpId; + private IdentityProxy publicIpId = new IdentityProxy("user_ip_adddress"); @SerializedName(ApiConstants.PUBLIC_IP) @Param(description="the public ip address of the vpn server") private String publicIp; @@ -40,13 +41,13 @@ public class RemoteAccessVpnResponse extends BaseResponse implements ControlledE private String accountName; @SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id of the vpn") - private Long projectId; + private IdentityProxy projectId = new IdentityProxy("projects"); @SerializedName(ApiConstants.PROJECT) @Param(description="the project name of the vpn") private String projectName; @SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain id of the account of the remote access vpn") - private long domainId; + private IdentityProxy domainId = new IdentityProxy("domain"); @SerializedName(ApiConstants.DOMAIN) @Param(description="the domain name of the account of the remote access vpn") private String domainName; @@ -71,7 +72,7 @@ public class RemoteAccessVpnResponse extends BaseResponse implements ControlledE } public void setDomainId(Long domainId) { - this.domainId = domainId; + this.domainId.setValue(domainId); } public void setDomainName(String name) { @@ -83,12 +84,12 @@ public class RemoteAccessVpnResponse extends BaseResponse implements ControlledE } public void setPublicIpId(Long publicIpId) { - this.publicIpId = publicIpId; + this.publicIpId.setValue(publicIpId); } @Override public void setProjectId(Long projectId) { - this.projectId = projectId; + this.projectId.setValue(projectId); } @Override diff --git a/api/src/com/cloud/api/response/ResourceCountResponse.java b/api/src/com/cloud/api/response/ResourceCountResponse.java index 930ef23b285..2948a5c36b5 100644 --- a/api/src/com/cloud/api/response/ResourceCountResponse.java +++ b/api/src/com/cloud/api/response/ResourceCountResponse.java @@ -18,6 +18,7 @@ package com.cloud.api.response; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; @@ -27,14 +28,14 @@ public class ResourceCountResponse extends BaseResponse implements ControlledEnt private String accountName; @SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id for which resource count's are updated") - private Long projectId; + private IdentityProxy projectId = new IdentityProxy("projects"); @SerializedName(ApiConstants.PROJECT) @Param(description="the project name for which resource count's are updated") private String projectName; @SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain ID for which resource count's are updated") - private Long domainId; + private IdentityProxy domainId = new IdentityProxy("domain"); @SerializedName(ApiConstants.DOMAIN) @Param(description="the domain name for which resource count's are updated") private String domainName; @@ -52,7 +53,7 @@ public class ResourceCountResponse extends BaseResponse implements ControlledEnt @Override public void setDomainId(Long domainId) { - this.domainId = domainId; + this.domainId.setValue(domainId); } @Override @@ -70,7 +71,7 @@ public class ResourceCountResponse extends BaseResponse implements ControlledEnt @Override public void setProjectId(Long projectId) { - this.projectId = projectId; + this.projectId.setValue(projectId); } @Override diff --git a/api/src/com/cloud/api/response/ResourceLimitResponse.java b/api/src/com/cloud/api/response/ResourceLimitResponse.java index f754cfe03e0..96aaa8a707a 100644 --- a/api/src/com/cloud/api/response/ResourceLimitResponse.java +++ b/api/src/com/cloud/api/response/ResourceLimitResponse.java @@ -18,6 +18,7 @@ package com.cloud.api.response; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; @@ -27,7 +28,7 @@ public class ResourceLimitResponse extends BaseResponse implements ControlledEnt private String accountName; @SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain ID of the resource limit") - private Long domainId; + private IdentityProxy domainId = new IdentityProxy("domain"); @SerializedName(ApiConstants.DOMAIN) @Param(description="the domain name of the resource limit") private String domainName; @@ -39,7 +40,7 @@ public class ResourceLimitResponse extends BaseResponse implements ControlledEnt private Long max; @SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id of the resource limit") - private Long projectId; + private IdentityProxy projectId = new IdentityProxy("projects"); @SerializedName(ApiConstants.PROJECT) @Param(description="the project name of the resource limit") private String projectName; @@ -56,7 +57,7 @@ public class ResourceLimitResponse extends BaseResponse implements ControlledEnt @Override public void setDomainId(Long domainId) { - this.domainId = domainId; + this.domainId.setValue(domainId); } @Override @@ -74,6 +75,6 @@ public class ResourceLimitResponse extends BaseResponse implements ControlledEnt @Override public void setProjectId(Long projectId) { - this.projectId = projectId; + this.projectId.setValue(projectId); } } diff --git a/api/src/com/cloud/api/response/SecurityGroupResponse.java b/api/src/com/cloud/api/response/SecurityGroupResponse.java index 1c162f2e61f..6ecfa2a2729 100644 --- a/api/src/com/cloud/api/response/SecurityGroupResponse.java +++ b/api/src/com/cloud/api/response/SecurityGroupResponse.java @@ -20,13 +20,14 @@ package com.cloud.api.response; import java.util.List; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; @SuppressWarnings("unused") public class SecurityGroupResponse extends BaseResponse implements ControlledEntityResponse{ @SerializedName(ApiConstants.ID) @Param(description="the ID of the security group") - private Long id; + private IdentityProxy id = new IdentityProxy("security_group"); @SerializedName(ApiConstants.NAME) @Param(description="the name of the security group") private String name; @@ -38,19 +39,19 @@ public class SecurityGroupResponse extends BaseResponse implements ControlledEnt private String accountName; @SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id of the group") - private Long projectId; + private IdentityProxy projectId = new IdentityProxy("projects"); @SerializedName(ApiConstants.PROJECT) @Param(description="the project name of the group") private String projectName; @SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain ID of the security group") - private Long domainId; + private IdentityProxy domainId = new IdentityProxy("domain"); @SerializedName(ApiConstants.DOMAIN) @Param(description="the domain name of the security group") private String domainName; @SerializedName(ApiConstants.JOB_ID) @Param(description="shows the current pending asynchronous job ID. This tag is not returned if no current pending jobs are acting on the volume") - private Long jobId; + private IdentityProxy jobId = new IdentityProxy("async_job"); @SerializedName(ApiConstants.JOB_STATUS) @Param(description="shows the current pending asynchronous job status") private Integer jobStatus; @@ -62,11 +63,11 @@ public class SecurityGroupResponse extends BaseResponse implements ControlledEnt private List egressRules; public void setId(Long id) { - this.id = id; + this.id.setValue(id); } public Long getId() { - return id; + return id.getValue(); } public void setName(String name) { @@ -82,7 +83,7 @@ public class SecurityGroupResponse extends BaseResponse implements ControlledEnt } public void setDomainId(Long domainId) { - this.domainId = domainId; + this.domainId.setValue(domainId); } public void setDomainName(String domainName) { @@ -104,12 +105,12 @@ public class SecurityGroupResponse extends BaseResponse implements ControlledEnt @Override public Long getJobId() { - return jobId; + return jobId.getValue(); } @Override public void setJobId(Long jobId) { - this.jobId = jobId; + this.jobId.setValue(jobId); } @Override @@ -149,7 +150,7 @@ public class SecurityGroupResponse extends BaseResponse implements ControlledEnt @Override public void setProjectId(Long projectId) { - this.projectId = projectId; + this.projectId.setValue(projectId); } @Override diff --git a/api/src/com/cloud/api/response/ServiceOfferingResponse.java b/api/src/com/cloud/api/response/ServiceOfferingResponse.java index 0fa897fa78c..3f5b8ec456e 100644 --- a/api/src/com/cloud/api/response/ServiceOfferingResponse.java +++ b/api/src/com/cloud/api/response/ServiceOfferingResponse.java @@ -20,12 +20,13 @@ package com.cloud.api.response; import java.util.Date; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; public class ServiceOfferingResponse extends BaseResponse { @SerializedName("id") @Param(description="the id of the service offering") - private Long id; + private IdentityProxy id = new IdentityProxy("disk_offering"); @SerializedName("name") @Param(description="the name of the service offering") private String name; @@ -58,7 +59,7 @@ public class ServiceOfferingResponse extends BaseResponse { private String tags; @SerializedName("domainid") @Param(description="the domain id of the service offering") - private Long domainId; + private IdentityProxy domainId = new IdentityProxy("domain"); @SerializedName(ApiConstants.DOMAIN) @Param(description="Domain name for the offering") private String domain; @@ -80,11 +81,11 @@ public class ServiceOfferingResponse extends BaseResponse { public Long getId() { - return id; + return id.getValue(); } public void setId(Long id) { - this.id = id; + this.id.setValue(id); } public String getName() { @@ -195,11 +196,11 @@ public class ServiceOfferingResponse extends BaseResponse { } public Long getDomainId() { - return domainId; + return domainId.getValue(); } public void setDomainId(Long domainId) { - this.domainId = domainId; + this.domainId.setValue(domainId); } public String getDomain() { diff --git a/api/src/com/cloud/api/response/SnapshotPolicyResponse.java b/api/src/com/cloud/api/response/SnapshotPolicyResponse.java index e015f1bfda5..af6ff04b473 100644 --- a/api/src/com/cloud/api/response/SnapshotPolicyResponse.java +++ b/api/src/com/cloud/api/response/SnapshotPolicyResponse.java @@ -17,15 +17,16 @@ */ package com.cloud.api.response; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; public class SnapshotPolicyResponse extends BaseResponse { @SerializedName("id") @Param(description="the ID of the snapshot policy") - private Long id; + private IdentityProxy id = new IdentityProxy("snapshot_policy"); @SerializedName("volumeid") @Param(description="the ID of the disk volume") - private Long volumeId; + private IdentityProxy volumeId = new IdentityProxy("volumes"); @SerializedName("schedule") @Param(description="time the snapshot is scheduled to be taken.") private String schedule; @@ -40,19 +41,19 @@ public class SnapshotPolicyResponse extends BaseResponse { private String timezone; public Long getId() { - return id; + return id.getValue(); } public void setId(Long id) { - this.id = id; + this.id.setValue(id); } public Long getVolumeId() { - return volumeId; + return volumeId.getValue(); } public void setVolumeId(Long volumeId) { - this.volumeId = volumeId; + this.volumeId.setValue(volumeId); } public String getSchedule() { diff --git a/api/src/com/cloud/api/response/SnapshotResponse.java b/api/src/com/cloud/api/response/SnapshotResponse.java index 1dab2e43be2..028816c2e29 100644 --- a/api/src/com/cloud/api/response/SnapshotResponse.java +++ b/api/src/com/cloud/api/response/SnapshotResponse.java @@ -20,6 +20,7 @@ package com.cloud.api.response; import java.util.Date; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.cloud.storage.Snapshot; import com.google.gson.annotations.SerializedName; @@ -28,7 +29,7 @@ import com.google.gson.annotations.SerializedName; public class SnapshotResponse extends BaseResponse implements ControlledEntityResponse { @SerializedName(ApiConstants.ID) @Param(description = "ID of the snapshot") - private Long id; + private IdentityProxy id = new IdentityProxy("snapshots"); @SerializedName(ApiConstants.ACCOUNT) @Param(description = "the account associated with the snapshot") @@ -36,14 +37,14 @@ public class SnapshotResponse extends BaseResponse implements ControlledEntityRe @SerializedName(ApiConstants.DOMAIN_ID) @Param(description = "the domain ID of the snapshot's account") - private Long domainId; + private IdentityProxy domainId = new IdentityProxy("domain"); @SerializedName(ApiConstants.DOMAIN) @Param(description = "the domain name of the snapshot's account") private String domainName; @SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id of the snapshot") - private Long projectId; + private IdentityProxy projectId = new IdentityProxy("projects"); @SerializedName(ApiConstants.PROJECT) @Param(description="the project name of the snapshot") private String projectName; @@ -54,7 +55,7 @@ public class SnapshotResponse extends BaseResponse implements ControlledEntityRe @SerializedName(ApiConstants.VOLUME_ID) @Param(description = "ID of the disk volume") - private Long volumeId; + private IdentityProxy volumeId = new IdentityProxy("volumes"); @SerializedName(ApiConstants.VOLUME_NAME) @Param(description = "name of the disk volume") @@ -74,7 +75,7 @@ public class SnapshotResponse extends BaseResponse implements ControlledEntityRe @SerializedName(ApiConstants.JOB_ID) @Param(description = "the job ID associated with the snapshot. This is only displayed if the snapshot listed is part of a currently running asynchronous job.") - private Long jobId; + private IdentityProxy jobId = new IdentityProxy("async_job"); @SerializedName(ApiConstants.JOB_STATUS) @Param(description = "the job status associated with the snapshot. This is only displayed if the snapshot listed is part of a currently running asynchronous job.") @@ -94,11 +95,11 @@ public class SnapshotResponse extends BaseResponse implements ControlledEntityRe } private Long getId() { - return id; + return id.getValue(); } public void setId(Long id) { - this.id = id; + this.id.setValue(id); } public String getAccountName() { @@ -110,11 +111,11 @@ public class SnapshotResponse extends BaseResponse implements ControlledEntityRe } public Long getDomainId() { - return domainId; + return domainId.getValue(); } public void setDomainId(Long domainId) { - this.domainId = domainId; + this.domainId.setValue(domainId); } public void setDomainName(String domainName) { @@ -126,7 +127,7 @@ public class SnapshotResponse extends BaseResponse implements ControlledEntityRe } public void setVolumeId(Long volumeId) { - this.volumeId = volumeId; + this.volumeId.setValue(volumeId); } public void setVolumeName(String volumeName) { @@ -147,12 +148,12 @@ public class SnapshotResponse extends BaseResponse implements ControlledEntityRe @Override public Long getJobId() { - return jobId; + return jobId.getValue(); } @Override public void setJobId(Long jobId) { - this.jobId = jobId; + this.jobId.setValue(jobId); } @Override @@ -175,7 +176,7 @@ public class SnapshotResponse extends BaseResponse implements ControlledEntityRe @Override public void setProjectId(Long projectId) { - this.projectId = projectId; + this.projectId.setValue(projectId); } @Override diff --git a/api/src/com/cloud/api/response/StoragePoolResponse.java b/api/src/com/cloud/api/response/StoragePoolResponse.java index a1639408ac3..157635f239c 100755 --- a/api/src/com/cloud/api/response/StoragePoolResponse.java +++ b/api/src/com/cloud/api/response/StoragePoolResponse.java @@ -20,22 +20,23 @@ package com.cloud.api.response; import java.util.Date; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.cloud.storage.StoragePoolStatus; import com.google.gson.annotations.SerializedName; public class StoragePoolResponse extends BaseResponse { @SerializedName("id") @Param(description="the ID of the storage pool") - private Long id; + private IdentityProxy id = new IdentityProxy("storage_pool"); @SerializedName("zoneid") @Param(description="the Zone ID of the storage pool") - private Long zoneId; + private IdentityProxy zoneId = new IdentityProxy("data_center"); @SerializedName("zonename") @Param(description="the Zone name of the storage pool") private String zoneName; @SerializedName("podid") @Param(description="the Pod ID of the storage pool") - private Long podId; + private IdentityProxy podId = new IdentityProxy("host_pod_ref"); @SerializedName("podname") @Param(description="the Pod name of the storage pool") private String podName; @@ -56,7 +57,7 @@ public class StoragePoolResponse extends BaseResponse { private String type; @SerializedName("clusterid") @Param(description="the ID of the cluster for the storage pool") - private Long clusterId; + private IdentityProxy clusterId = new IdentityProxy("cluster"); @SerializedName("clustername") @Param(description="the name of the cluster for the storage pool") private String clusterName; @@ -77,7 +78,7 @@ public class StoragePoolResponse extends BaseResponse { private StoragePoolStatus state; @SerializedName(ApiConstants.JOB_ID) @Param(description="shows the current pending asynchronous job ID. This tag is not returned if no current pending jobs are acting on the storage pool") - private Long jobId; + private IdentityProxy jobId = new IdentityProxy("async_job"); @SerializedName("jobstatus") @Param(description="shows the current pending asynchronous job status") private Integer jobStatus; @@ -89,12 +90,12 @@ public class StoragePoolResponse extends BaseResponse { @Override public Long getJobId() { - return jobId; + return jobId.getValue(); } @Override public void setJobId(Long jobId) { - this.jobId = jobId; + this.jobId.setValue(jobId); } @Override @@ -108,19 +109,19 @@ public class StoragePoolResponse extends BaseResponse { } public Long getId() { - return id; + return id.getValue(); } public void setId(Long id) { - this.id = id; + this.id.setValue(id); } public Long getZoneId() { - return zoneId; + return zoneId.getValue(); } public void setZoneId(Long zoneId) { - this.zoneId = zoneId; + this.zoneId.setValue(zoneId); } public String getZoneName() { @@ -132,11 +133,11 @@ public class StoragePoolResponse extends BaseResponse { } public Long getPodId() { - return podId; + return podId.getValue(); } public void setPodId(Long podId) { - this.podId = podId; + this.podId.setValue(podId); } public String getPodName() { @@ -188,11 +189,11 @@ public class StoragePoolResponse extends BaseResponse { } public Long getClusterId() { - return clusterId; + return clusterId.getValue(); } public void setClusterId(Long clusterId) { - this.clusterId = clusterId; + this.clusterId.setValue(clusterId); } public String getClusterName() { diff --git a/api/src/com/cloud/api/response/SystemVmInstanceResponse.java b/api/src/com/cloud/api/response/SystemVmInstanceResponse.java index b517e72e832..b308380d42e 100644 --- a/api/src/com/cloud/api/response/SystemVmInstanceResponse.java +++ b/api/src/com/cloud/api/response/SystemVmInstanceResponse.java @@ -17,6 +17,7 @@ */ package com.cloud.api.response; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; @@ -25,7 +26,7 @@ import com.google.gson.annotations.SerializedName; */ public class SystemVmInstanceResponse extends BaseResponse { @SerializedName("id") @Param(description="the ID of the system VM") - private Long id; + private IdentityProxy id = new IdentityProxy("vm_instance"); @SerializedName("systemvmtype") @Param(description="the system VM type") private String systemVmType; @@ -34,7 +35,7 @@ public class SystemVmInstanceResponse extends BaseResponse { private String name; @SerializedName("hostid") @Param(description="the host ID for the system VM") - private Long hostId; + private IdentityProxy hostId = new IdentityProxy("host"); @SerializedName("state") @Param(description="the state of the system VM") private String state; @@ -48,11 +49,11 @@ public class SystemVmInstanceResponse extends BaseResponse { } public Long getId() { - return id; + return id.getValue(); } public void setId(Long id) { - this.id = id; + this.id.setValue(id); } public String getSystemVmType() { @@ -72,11 +73,11 @@ public class SystemVmInstanceResponse extends BaseResponse { } public Long getHostId() { - return hostId; + return hostId.getValue(); } public void setHostId(Long hostId) { - this.hostId = hostId; + this.hostId.setValue(hostId); } public String getState() { diff --git a/api/src/com/cloud/api/response/SystemVmResponse.java b/api/src/com/cloud/api/response/SystemVmResponse.java index dc599aabfde..e493c330f7e 100644 --- a/api/src/com/cloud/api/response/SystemVmResponse.java +++ b/api/src/com/cloud/api/response/SystemVmResponse.java @@ -20,24 +20,25 @@ package com.cloud.api.response; import java.util.Date; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; public class SystemVmResponse extends BaseResponse { @SerializedName("id") @Param(description="the ID of the system VM") - private String id; + private IdentityProxy id = new IdentityProxy("vm_instance"); @SerializedName("systemvmtype") @Param(description="the system VM type") private String systemVmType; @SerializedName("jobid") @Param(description="the job ID associated with the system VM. This is only displayed if the router listed is part of a currently running asynchronous job.") - private Long jobId; + private IdentityProxy jobId = new IdentityProxy("async_job"); @SerializedName("jobstatus") @Param(description="the job status associated with the system VM. This is only displayed if the router listed is part of a currently running asynchronous job.") private Integer jobStatus; @SerializedName("zoneid") @Param(description="the Zone ID for the system VM") - private Long zoneId; + private IdentityProxy zoneId = new IdentityProxy("data_center"); @SerializedName("zonename") @Param(description="the Zone name for the system VM") private String zoneName; @@ -58,10 +59,10 @@ public class SystemVmResponse extends BaseResponse { private String name; @SerializedName("podid") @Param(description="the Pod ID for the system VM") - private Long podId; + private IdentityProxy podId = new IdentityProxy("host_pod_ref"); @SerializedName("hostid") @Param(description="the host ID for the system VM") - private Long hostId; + private IdentityProxy hostId = new IdentityProxy("host"); @SerializedName("hostname") @Param(description="the hostname for the system VM") private String hostName; @@ -94,7 +95,7 @@ public class SystemVmResponse extends BaseResponse { private String publicNetmask; @SerializedName("templateid") @Param(description="the template ID for the system VM") - private Long templateId; + private IdentityProxy templateId = new IdentityProxy("vm_template"); @SerializedName("created") @Param(description="the date and time the system VM was created") private Date created; @@ -108,7 +109,6 @@ public class SystemVmResponse extends BaseResponse { private Long objectId; public Long getObjectId() { - // return getId(); return objectId; } @@ -116,12 +116,12 @@ public class SystemVmResponse extends BaseResponse { this.objectId = objectId; } - public String getId() { - return id; + public Long getId() { + return id.getValue(); } - public void setId(String id) { - this.id = id; + public void setId(Long id) { + this.id.setValue(id); } public String getSystemVmType() { @@ -133,11 +133,11 @@ public class SystemVmResponse extends BaseResponse { } public Long getJobId() { - return jobId; + return jobId.getValue(); } public void setJobId(Long jobId) { - this.jobId = jobId; + this.jobId.setValue(jobId); } public Integer getJobStatus() { @@ -149,11 +149,11 @@ public class SystemVmResponse extends BaseResponse { } public Long getZoneId() { - return zoneId; + return zoneId.getValue(); } public void setZoneId(Long zoneId) { - this.zoneId = zoneId; + this.zoneId.setValue(zoneId); } public String getZoneName() { @@ -205,19 +205,19 @@ public class SystemVmResponse extends BaseResponse { } public Long getPodId() { - return podId; + return podId.getValue(); } public void setPodId(Long podId) { - this.podId = podId; + this.podId.setValue(podId); } public Long getHostId() { - return hostId; + return hostId.getValue(); } public void setHostId(Long hostId) { - this.hostId = hostId; + this.hostId.setValue(hostId); } public String getHostName() { @@ -277,11 +277,11 @@ public class SystemVmResponse extends BaseResponse { } public Long getTemplateId() { - return templateId; + return templateId.getValue(); } public void setTemplateId(Long templateId) { - this.templateId = templateId; + this.templateId.setValue(templateId); } public Date getCreated() { diff --git a/api/src/com/cloud/api/response/TemplatePermissionsResponse.java b/api/src/com/cloud/api/response/TemplatePermissionsResponse.java index a859e9a181e..d0789c9a574 100644 --- a/api/src/com/cloud/api/response/TemplatePermissionsResponse.java +++ b/api/src/com/cloud/api/response/TemplatePermissionsResponse.java @@ -20,29 +20,30 @@ package com.cloud.api.response; import java.util.List; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; @SuppressWarnings("unused") public class TemplatePermissionsResponse extends BaseResponse { @SerializedName(ApiConstants.ID) @Param(description="the template ID") - private Long id; + private IdentityProxy id = new IdentityProxy("vm_template"); @SerializedName(ApiConstants.IS_PUBLIC) @Param(description="true if this template is a public template, false otherwise") private Boolean publicTemplate; @SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the ID of the domain to which the template belongs") - private Long domainId; + private IdentityProxy domainId = new IdentityProxy("domain"); @SerializedName(ApiConstants.ACCOUNT) @Param(description="the list of accounts the template is available for") private List accountNames; @SerializedName(ApiConstants.PROJECT_IDS) @Param(description="the list of projects the template is available for") - private List projectIds; + private List projectIds; public void setId(Long id) { - this.id = id; + this.id.setValue(id); } public void setPublicTemplate(Boolean publicTemplate) { @@ -50,14 +51,14 @@ public class TemplatePermissionsResponse extends BaseResponse { } public void setDomainId(Long domainId) { - this.domainId = domainId; + this.domainId.setValue(domainId); } public void setAccountNames(List accountNames) { this.accountNames = accountNames; } - public void setProjectIds(List projectIds) { + public void setProjectIds(List projectIds) { this.projectIds = projectIds; } } diff --git a/api/src/com/cloud/api/response/TemplateResponse.java b/api/src/com/cloud/api/response/TemplateResponse.java index 1171faace5b..3a35fd6d62c 100755 --- a/api/src/com/cloud/api/response/TemplateResponse.java +++ b/api/src/com/cloud/api/response/TemplateResponse.java @@ -20,6 +20,7 @@ package com.cloud.api.response; import java.util.Date; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.cloud.storage.Storage.ImageFormat; import com.google.gson.annotations.SerializedName; @@ -27,7 +28,7 @@ import com.google.gson.annotations.SerializedName; @SuppressWarnings("unused") public class TemplateResponse extends BaseResponse implements ControlledEntityResponse { @SerializedName(ApiConstants.ID) @Param(description="the template ID") - private long id; + private IdentityProxy id = new IdentityProxy("vm_template"); @SerializedName(ApiConstants.NAME) @Param(description="the template name") private String name; @@ -65,19 +66,19 @@ public class TemplateResponse extends BaseResponse implements ControlledEntityRe private boolean crossZones; @SerializedName(ApiConstants.OS_TYPE_ID) @Param(description="the ID of the OS type for this template.") - private Long osTypeId; + private IdentityProxy osTypeId = new IdentityProxy("guest_os"); @SerializedName("ostypename") @Param(description="the name of the OS type for this template.") private String osTypeName; @SerializedName(ApiConstants.ACCOUNT_ID) @Param(description="the account id to which the template belongs") - private Long accountId; + private IdentityProxy accountId = new IdentityProxy("account"); @SerializedName(ApiConstants.ACCOUNT) @Param(description="the account name to which the template belongs") private String account; @SerializedName(ApiConstants.ZONE_ID) @Param(description="the ID of the zone for this template") - private Long zoneId; + private IdentityProxy zoneId = new IdentityProxy("data_center"); @SerializedName("zonename") @Param(description="the name of the zone for this template") private String zoneName; @@ -95,7 +96,7 @@ public class TemplateResponse extends BaseResponse implements ControlledEntityRe private String hypervisor; @SerializedName(ApiConstants.JOB_ID) @Param(description="shows the current pending asynchronous job ID. This tag is not returned if no current pending jobs are acting on the template") - private Long jobId; + private IdentityProxy jobId = new IdentityProxy("async_job"); @SerializedName(ApiConstants.JOB_STATUS) @Param(description="shows the current pending asynchronous job status") private Integer jobStatus; @@ -104,7 +105,7 @@ public class TemplateResponse extends BaseResponse implements ControlledEntityRe private String domainName; @SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the ID of the domain to which the template belongs") - private Long domainId; + private IdentityProxy domainId = new IdentityProxy("domain"); @SerializedName(ApiConstants.IS_EXTRACTABLE) @Param(description="true if the template is extractable, false otherwise") private Boolean extractable; @@ -113,10 +114,10 @@ public class TemplateResponse extends BaseResponse implements ControlledEntityRe private String checksum; @SerializedName("sourcetemplateid") @Param(description="the template ID of the parent template if present") - private Long sourcetemplateId; + private IdentityProxy sourcetemplateId = new IdentityProxy("vm_template"); @SerializedName(ApiConstants.HOST_ID) @Param(description="the ID of the secondary storage host for the template") - private Long hostId; + private IdentityProxy hostId = new IdentityProxy("host"); @SerializedName("hostname") @Param(description="the name of the secondary storage host for the template") private String hostName; @@ -125,7 +126,7 @@ public class TemplateResponse extends BaseResponse implements ControlledEntityRe private String templateTag; @SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id of the template") - private Long projectId; + private IdentityProxy projectId = new IdentityProxy("projects"); @SerializedName(ApiConstants.PROJECT) @Param(description="the project name of the template") private String projectName; @@ -136,11 +137,11 @@ public class TemplateResponse extends BaseResponse implements ControlledEntityRe } public Long getId() { - return id; + return id.getValue(); } public void setZoneId(Long zoneId) { - this.zoneId = zoneId; + this.zoneId.setValue(zoneId); } public void setZoneName(String zoneName) { @@ -148,7 +149,7 @@ public class TemplateResponse extends BaseResponse implements ControlledEntityRe } public void setAccountId(Long accountId) { - this.accountId = accountId; + this.accountId.setValue(accountId); } public void setAccountName(String account) { @@ -156,7 +157,7 @@ public class TemplateResponse extends BaseResponse implements ControlledEntityRe } public void setOsTypeId(Long osTypeId) { - this.osTypeId = osTypeId; + this.osTypeId.setValue(osTypeId); } public void setOsTypeName(String osTypeName) { @@ -164,7 +165,7 @@ public class TemplateResponse extends BaseResponse implements ControlledEntityRe } public void setId(long id) { - this.id = id; + this.id.setValue(id); } public void setName(String name) { @@ -228,11 +229,11 @@ public class TemplateResponse extends BaseResponse implements ControlledEntityRe } public Long getJobId() { - return jobId; + return jobId.getValue(); } public void setJobId(Long jobId) { - this.jobId = jobId; + this.jobId.setValue(jobId); } public Integer getJobStatus() { @@ -250,7 +251,7 @@ public class TemplateResponse extends BaseResponse implements ControlledEntityRe @Override public void setDomainId(Long domainId) { - this.domainId = domainId; + this.domainId.setValue(domainId); } public void setExtractable(Boolean extractable) { @@ -262,11 +263,11 @@ public class TemplateResponse extends BaseResponse implements ControlledEntityRe } public void setSourceTemplateId(Long sourcetemplateId) { - this.sourcetemplateId = sourcetemplateId; + this.sourcetemplateId.setValue(sourcetemplateId); } public void setHostId(Long hostId) { - this.hostId = hostId; + this.hostId.setValue(hostId); } public void setHostName(String hostName) { @@ -279,7 +280,7 @@ public class TemplateResponse extends BaseResponse implements ControlledEntityRe @Override public void setProjectId(Long projectId) { - this.projectId = projectId; + this.projectId.setValue(projectId); } @Override diff --git a/api/src/com/cloud/api/response/UserResponse.java b/api/src/com/cloud/api/response/UserResponse.java index b8fecc09b09..76293601ff6 100644 --- a/api/src/com/cloud/api/response/UserResponse.java +++ b/api/src/com/cloud/api/response/UserResponse.java @@ -20,12 +20,13 @@ package com.cloud.api.response; import java.util.Date; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; public class UserResponse extends BaseResponse { @SerializedName("id") @Param(description="the user ID") - private Long id; + private IdentityProxy id = new IdentityProxy("user"); @SerializedName("username") @Param(description="the user name") private String username; @@ -52,7 +53,7 @@ public class UserResponse extends BaseResponse { private Short accountType; @SerializedName("domainid") @Param(description="the domain ID of the user") - private Long domainId; + private IdentityProxy domainId = new IdentityProxy("domain"); @SerializedName("domain") @Param(description="the domain name of the user") private String domainName; @@ -67,11 +68,11 @@ public class UserResponse extends BaseResponse { private String secretKey; public Long getId() { - return id; + return id.getValue(); } public void setId(Long id) { - this.id = id; + this.id.setValue(id); } public String getUsername() { @@ -139,11 +140,11 @@ public class UserResponse extends BaseResponse { } public Long getDomainId() { - return domainId; + return domainId.getValue(); } public void setDomainId(Long domainId) { - this.domainId = domainId; + this.domainId.setValue(domainId); } public String getDomainName() { diff --git a/api/src/com/cloud/api/response/UserVmResponse.java b/api/src/com/cloud/api/response/UserVmResponse.java index 1c67796a0e5..99bfaf0c82e 100755 --- a/api/src/com/cloud/api/response/UserVmResponse.java +++ b/api/src/com/cloud/api/response/UserVmResponse.java @@ -21,13 +21,14 @@ import java.util.Date; import java.util.List; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; @SuppressWarnings("unused") public class UserVmResponse extends BaseResponse implements ControlledEntityResponse { @SerializedName(ApiConstants.ID) @Param(description="the ID of the virtual machine") - private String id; + private IdentityProxy id = new IdentityProxy("vm_instance"); @SerializedName(ApiConstants.NAME) @Param(description="the name of the virtual machine") private String name; @@ -42,13 +43,13 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp private String accountName; @SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id of the vm") - private Long projectId; + private IdentityProxy projectId = new IdentityProxy("projects"); @SerializedName(ApiConstants.PROJECT) @Param(description="the project name of the vm") private String projectName; @SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the ID of the domain in which the virtual machine exists") - private Long domainId; + private IdentityProxy domainId = new IdentityProxy("domain"); @SerializedName(ApiConstants.DOMAIN) @Param(description="the name of the domain in which the virtual machine exists") private String domainName; @@ -63,25 +64,25 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp private Boolean haEnable; @SerializedName(ApiConstants.GROUP_ID) @Param(description="the group ID of the virtual machine") - private Long groupId; + private IdentityProxy groupId = new IdentityProxy("instance_group"); @SerializedName(ApiConstants.GROUP) @Param(description="the group name of the virtual machine") private String group; @SerializedName(ApiConstants.ZONE_ID) @Param(description="the ID of the availablility zone for the virtual machine") - private Long zoneId; + private IdentityProxy zoneId = new IdentityProxy("data_center"); @SerializedName("zonename") @Param(description="the name of the availability zone for the virtual machine") private String zoneName; @SerializedName(ApiConstants.HOST_ID) @Param(description="the ID of the host for the virtual machine") - private Long hostId; + private IdentityProxy hostId = new IdentityProxy("host"); @SerializedName("hostname") @Param(description="the name of the host for the virtual machine") private String hostName; @SerializedName(ApiConstants.TEMPLATE_ID) @Param(description="the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file.") - private Long templateId; + private IdentityProxy templateId = new IdentityProxy("vm_template"); @SerializedName("templatename") @Param(description="the name of the template for the virtual machine") private String templateName; @@ -93,7 +94,7 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp private Boolean passwordEnabled; @SerializedName("isoid") @Param(description="the ID of the ISO attached to the virtual machine") - private Long isoId; + private IdentityProxy isoId = new IdentityProxy("vm_template"); @SerializedName("isoname") @Param(description="the name of the ISO attached to the virtual machine") private String isoName; @@ -102,7 +103,7 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp private String isoDisplayText; @SerializedName("serviceofferingid") @Param(description="the ID of the service offering of the virtual machine") - private Long serviceOfferingId; + private IdentityProxy serviceOfferingId = new IdentityProxy("disk_offering"); @SerializedName("serviceofferingname") @Param(description="the name of the service offering of the virtual machine") private String serviceOfferingName; @@ -129,7 +130,7 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp private Long networkKbsWrite; @SerializedName("guestosid") @Param(description="Os type ID of the virtual machine") - private Long guestOsId; + private IdentityProxy guestOsId = new IdentityProxy("guest_os"); @SerializedName("rootdeviceid") @Param(description="device ID of the root volume") private Long rootDeviceId; @@ -144,7 +145,7 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp private String password; @SerializedName(ApiConstants.JOB_ID) @Param(description="shows the current pending asynchronous job ID. This tag is not returned if no current pending jobs are acting on the virtual machine") - private Long jobId; + private IdentityProxy jobId = new IdentityProxy("async_job"); @SerializedName("jobstatus") @Param(description="shows the current pending asynchronous job status") private Integer jobStatus; @@ -160,12 +161,12 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp this.hypervisor = hypervisor; } - public void setId(String id) { - this.id = id; + public void setId(Long id) { + this.id.setValue(id); } - public String getId() { - return id; + public Long getId() { + return this.id.getValue(); } public void setName(String name) { @@ -185,7 +186,7 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp } public void setDomainId(Long domainId) { - this.domainId = domainId; + this.domainId.setValue(domainId); } public void setDomainName(String domainName) { @@ -205,7 +206,7 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp } public void setGroupId(Long groupId) { - this.groupId = groupId; + this.groupId.setValue(groupId); } public void setGroup(String group) { @@ -213,7 +214,7 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp } public void setZoneId(Long zoneId) { - this.zoneId = zoneId; + this.zoneId.setValue(zoneId); } public void setZoneName(String zoneName) { @@ -221,7 +222,7 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp } public void setHostId(Long hostId) { - this.hostId = hostId; + this.hostId.setValue(hostId); } public void setHostName(String hostName) { @@ -229,7 +230,7 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp } public void setTemplateId(Long templateId) { - this.templateId = templateId; + this.templateId.setValue(templateId); } public void setTemplateName(String templateName) { @@ -245,7 +246,7 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp } public void setIsoId(Long isoId) { - this.isoId = isoId; + this.isoId.setValue(isoId); } public void setIsoName(String isoName) { @@ -257,7 +258,7 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp } public void setServiceOfferingId(Long serviceOfferingId) { - this.serviceOfferingId = serviceOfferingId; + this.serviceOfferingId.setValue(serviceOfferingId); } public void setServiceOfferingName(String serviceOfferingName) { @@ -289,7 +290,7 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp } public void setGuestOsId(Long guestOsId) { - this.guestOsId = guestOsId; + this.guestOsId.setValue(guestOsId); } public void setRootDeviceId(Long rootDeviceId) { @@ -305,7 +306,7 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp } public void setJobId(Long jobId) { - this.jobId = jobId; + this.jobId.setValue(jobId); } public void setJobStatus(Integer jobStatus) { @@ -326,7 +327,7 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp @Override public void setProjectId(Long projectId) { - this.projectId = projectId; + this.projectId.setValue(projectId); } @Override diff --git a/api/src/com/cloud/api/response/VlanIpRangeResponse.java b/api/src/com/cloud/api/response/VlanIpRangeResponse.java index 7effb13307e..41f17bac88c 100644 --- a/api/src/com/cloud/api/response/VlanIpRangeResponse.java +++ b/api/src/com/cloud/api/response/VlanIpRangeResponse.java @@ -18,19 +18,20 @@ package com.cloud.api.response; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; @SuppressWarnings("unused") public class VlanIpRangeResponse extends BaseResponse implements ControlledEntityResponse{ @SerializedName(ApiConstants.ID) @Param(description="the ID of the VLAN IP range") - private Long id; + private IdentityProxy id = new IdentityProxy("vlan"); @SerializedName("forvirtualnetwork") @Param(description="the virtual network for the VLAN IP range") private Boolean forVirtualNetwork; @SerializedName(ApiConstants.ZONE_ID) @Param(description="the Zone ID of the VLAN IP range") - private Long zoneId; + private IdentityProxy zoneId = new IdentityProxy("data_center"); @SerializedName(ApiConstants.VLAN) @Param(description="the ID or VID of the VLAN.") private String vlan; @@ -39,13 +40,13 @@ public class VlanIpRangeResponse extends BaseResponse implements ControlledEntit private String accountName; @SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain ID of the VLAN IP range") - private Long domainId; + private IdentityProxy domainId = new IdentityProxy("domain"); @SerializedName(ApiConstants.DOMAIN) @Param(description="the domain name of the VLAN IP range") private String domainName; @SerializedName(ApiConstants.POD_ID) @Param(description="the Pod ID for the VLAN IP range") - private Long podId; + private IdentityProxy podId = new IdentityProxy("host_pod_ref"); @SerializedName("podname") @Param(description="the Pod name for the VLAN IP range") private String podName; @@ -66,16 +67,16 @@ public class VlanIpRangeResponse extends BaseResponse implements ControlledEntit private String endIp; @SerializedName(ApiConstants.NETWORK_ID) @Param(description="the network id of vlan range") - private Long networkId; + private IdentityProxy networkId = new IdentityProxy("networks"); @SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id of the vlan range") - private Long projectId; + private IdentityProxy projectId = new IdentityProxy("projects"); @SerializedName(ApiConstants.PROJECT) @Param(description="the project name of the vlan range") private String projectName; public void setId(Long id) { - this.id = id; + this.id.setValue(id); } public void setForVirtualNetwork(Boolean forVirtualNetwork) { @@ -83,7 +84,7 @@ public class VlanIpRangeResponse extends BaseResponse implements ControlledEntit } public void setZoneId(Long zoneId) { - this.zoneId = zoneId; + this.zoneId.setValue(zoneId); } public void setVlan(String vlan) { @@ -95,7 +96,7 @@ public class VlanIpRangeResponse extends BaseResponse implements ControlledEntit } public void setDomainId(Long domainId) { - this.domainId = domainId; + this.domainId.setValue(domainId); } public void setDomainName(String domainName) { @@ -103,7 +104,7 @@ public class VlanIpRangeResponse extends BaseResponse implements ControlledEntit } public void setPodId(Long podId) { - this.podId = podId; + this.podId.setValue(podId); } public void setPodName(String podName) { @@ -131,12 +132,12 @@ public class VlanIpRangeResponse extends BaseResponse implements ControlledEntit } public void setNetworkId(Long networkId) { - this.networkId = networkId; + this.networkId.setValue(networkId); } @Override public void setProjectId(Long projectId) { - this.projectId = projectId; + this.projectId.setValue(projectId); } @Override diff --git a/api/src/com/cloud/api/response/VolumeResponse.java b/api/src/com/cloud/api/response/VolumeResponse.java index 5d117f65151..74a68d6612d 100755 --- a/api/src/com/cloud/api/response/VolumeResponse.java +++ b/api/src/com/cloud/api/response/VolumeResponse.java @@ -20,6 +20,7 @@ package com.cloud.api.response; import java.util.Date; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; @@ -27,11 +28,11 @@ import com.google.gson.annotations.SerializedName; public class VolumeResponse extends BaseResponse implements ControlledEntityResponse{ @SerializedName(ApiConstants.ID) @Param(description = "ID of the disk volume") - private Long id; + private IdentityProxy id = new IdentityProxy("volumes"); @SerializedName(ApiConstants.JOB_ID) @Param(description = "shows the current pending asynchronous job ID. This tag is not returned if no current pending jobs are acting on the volume") - private Long jobId; + private IdentityProxy jobId = new IdentityProxy("async_job"); @SerializedName(ApiConstants.JOB_STATUS) @Param(description = "shows the current pending asynchronous job status") @@ -43,7 +44,7 @@ public class VolumeResponse extends BaseResponse implements ControlledEntityResp @SerializedName(ApiConstants.ZONE_ID) @Param(description = "ID of the availability zone") - private Long zoneId; + private IdentityProxy zoneId = new IdentityProxy("data_center"); @SerializedName("zonename") @Param(description = "name of the availability zone") @@ -59,7 +60,7 @@ public class VolumeResponse extends BaseResponse implements ControlledEntityResp @SerializedName(ApiConstants.VIRTUAL_MACHINE_ID) @Param(description = "id of the virtual machine") - private Long virtualMachineId; + private IdentityProxy virtualMachineId = new IdentityProxy("vm_instance"); @SerializedName("vmname") @Param(description = "name of the virtual machine") @@ -90,14 +91,14 @@ public class VolumeResponse extends BaseResponse implements ControlledEntityResp private String accountName; @SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id of the vpn") - private Long projectId; + private IdentityProxy projectId = new IdentityProxy("projects"); @SerializedName(ApiConstants.PROJECT) @Param(description="the project name of the vpn") private String projectName; @SerializedName(ApiConstants.DOMAIN_ID) @Param(description = "the ID of the domain associated with the disk volume") - private Long domainId; + private IdentityProxy domainId = new IdentityProxy("domain"); @SerializedName(ApiConstants.DOMAIN) @Param(description = "the domain associated with the disk volume") @@ -113,7 +114,7 @@ public class VolumeResponse extends BaseResponse implements ControlledEntityResp @SerializedName(ApiConstants.DISK_OFFERING_ID) @Param(description = "ID of the disk offering") - private Long diskOfferingId; + private IdentityProxy diskOfferingId = new IdentityProxy("disk_offering"); @SerializedName("diskofferingname") @Param(description = "name of the disk offering") @@ -129,7 +130,7 @@ public class VolumeResponse extends BaseResponse implements ControlledEntityResp @SerializedName(ApiConstants.SNAPSHOT_ID) @Param(description = "ID of the snapshot from which this volume was created") - private Long snapshotId; + private IdentityProxy snapshotId = new IdentityProxy("snapshots"); @SerializedName("attached") @Param(description = "the date the volume was attached to a VM instance") @@ -141,7 +142,7 @@ public class VolumeResponse extends BaseResponse implements ControlledEntityResp @SerializedName(ApiConstants.SERVICE_OFFERING_ID) @Param(description = "ID of the service offering for root disk") - private Long serviceOfferingId; + private IdentityProxy serviceOfferingId = new IdentityProxy("disk_offering"); @SerializedName("serviceofferingname") @Param(description = "name of the service offering for root disk") @@ -162,12 +163,12 @@ public class VolumeResponse extends BaseResponse implements ControlledEntityResp @Override public Long getJobId() { - return jobId; + return jobId.getValue(); } @Override public void setJobId(Long jobId) { - this.jobId = jobId; + this.jobId.setValue(jobId); } @Override @@ -189,11 +190,11 @@ public class VolumeResponse extends BaseResponse implements ControlledEntityResp } public Long getId() { - return id; + return id.getValue(); } public void setId(Long id) { - this.id = id; + this.id.setValue(id); } public void setName(String name) { @@ -201,7 +202,7 @@ public class VolumeResponse extends BaseResponse implements ControlledEntityResp } public void setZoneId(Long zoneId) { - this.zoneId = zoneId; + this.zoneId.setValue(zoneId); } public void setZoneName(String zoneName) { @@ -217,7 +218,7 @@ public class VolumeResponse extends BaseResponse implements ControlledEntityResp } public void setVirtualMachineId(Long virtualMachineId) { - this.virtualMachineId = virtualMachineId; + this.virtualMachineId.setValue(virtualMachineId); } public void setVirtualMachineName(String virtualMachineName) { @@ -245,7 +246,7 @@ public class VolumeResponse extends BaseResponse implements ControlledEntityResp } public void setDomainId(Long domainId) { - this.domainId = domainId; + this.domainId.setValue(domainId); } public void setDomainName(String domainName) { @@ -261,7 +262,7 @@ public class VolumeResponse extends BaseResponse implements ControlledEntityResp } public void setDiskOfferingId(Long diskOfferingId) { - this.diskOfferingId = diskOfferingId; + this.diskOfferingId.setValue(diskOfferingId); } public void setDiskOfferingName(String diskOfferingName) { @@ -277,7 +278,7 @@ public class VolumeResponse extends BaseResponse implements ControlledEntityResp } public void setSnapshotId(Long snapshotId) { - this.snapshotId = snapshotId; + this.snapshotId.setValue(snapshotId); } public void setAttached(Date attached) { @@ -285,7 +286,7 @@ public class VolumeResponse extends BaseResponse implements ControlledEntityResp } public void setServiceOfferingId(Long serviceOfferingId) { - this.serviceOfferingId = serviceOfferingId; + this.serviceOfferingId.setValue(serviceOfferingId); } public void setServiceOfferingName(String serviceOfferingName) { @@ -306,7 +307,7 @@ public class VolumeResponse extends BaseResponse implements ControlledEntityResp @Override public void setProjectId(Long projectId) { - this.projectId = projectId; + this.projectId.setValue(projectId); } @Override diff --git a/api/src/com/cloud/api/response/VpnUsersResponse.java b/api/src/com/cloud/api/response/VpnUsersResponse.java index 0754bbabbf7..18b12c9d011 100644 --- a/api/src/com/cloud/api/response/VpnUsersResponse.java +++ b/api/src/com/cloud/api/response/VpnUsersResponse.java @@ -18,13 +18,14 @@ package com.cloud.api.response; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; @SuppressWarnings("unused") public class VpnUsersResponse extends BaseResponse implements ControlledEntityResponse{ @SerializedName(ApiConstants.ID) @Param(description="the vpn userID") - private Long id; + private IdentityProxy id = new IdentityProxy("vpn_users"); @SerializedName(ApiConstants.USERNAME) @Param(description="the username of the vpn user") private String userName; @@ -33,20 +34,20 @@ public class VpnUsersResponse extends BaseResponse implements ControlledEntityRe private String accountName; @SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain id of the account of the remote access vpn") - private long domainId; + private IdentityProxy domainId = new IdentityProxy("domain"); @SerializedName(ApiConstants.DOMAIN) @Param(description="the domain name of the account of the remote access vpn") private String domainName; @SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id of the vpn") - private Long projectId; + private IdentityProxy projectId = new IdentityProxy("projects"); @SerializedName(ApiConstants.PROJECT) @Param(description="the project name of the vpn") private String projectName; public void setId(Long id) { - this.id = id; + this.id.setValue(id); } public void setUserName(String name) { @@ -58,7 +59,7 @@ public class VpnUsersResponse extends BaseResponse implements ControlledEntityRe } public void setDomainId(Long domainId) { - this.domainId = domainId; + this.domainId.setValue(domainId); } public void setDomainName(String name) { @@ -67,7 +68,7 @@ public class VpnUsersResponse extends BaseResponse implements ControlledEntityRe @Override public void setProjectId(Long projectId) { - this.projectId = projectId; + this.projectId.setValue(projectId); } @Override diff --git a/api/src/com/cloud/api/response/ZoneResponse.java b/api/src/com/cloud/api/response/ZoneResponse.java index 210d57d044d..98ffc080e63 100755 --- a/api/src/com/cloud/api/response/ZoneResponse.java +++ b/api/src/com/cloud/api/response/ZoneResponse.java @@ -20,12 +20,13 @@ package com.cloud.api.response; import java.util.List; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; public class ZoneResponse extends BaseResponse { @SerializedName(ApiConstants.ID) @Param(description="Zone id") - private Long id; + private IdentityProxy id = new IdentityProxy("data_center"); @SerializedName(ApiConstants.NAME) @Param(description="Zone name") private String name; @@ -83,11 +84,11 @@ public class ZoneResponse extends BaseResponse { private List capacitites; public Long getId() { - return id; + return id.getValue(); } public void setId(Long id) { - this.id = id; + this.id.setValue(id); } public String getName() { diff --git a/api/src/com/cloud/projects/Project.java b/api/src/com/cloud/projects/Project.java index 04fd60099cb..63f2c4ed95e 100644 --- a/api/src/com/cloud/projects/Project.java +++ b/api/src/com/cloud/projects/Project.java @@ -19,9 +19,10 @@ package com.cloud.projects; import java.util.Date; +import com.cloud.api.Identity; import com.cloud.domain.PartOf; -public interface Project extends PartOf{ +public interface Project extends PartOf, Identity { public enum State {Active, Disabled, Suspended} String getDisplayText(); diff --git a/core/src/com/cloud/alert/AlertVO.java b/core/src/com/cloud/alert/AlertVO.java index 878993dbbae..fb1ec35d994 100755 --- a/core/src/com/cloud/alert/AlertVO.java +++ b/core/src/com/cloud/alert/AlertVO.java @@ -19,6 +19,7 @@ package com.cloud.alert; import java.util.Date; +import java.util.UUID; import javax.persistence.Column; import javax.persistence.Entity; @@ -29,11 +30,12 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import com.cloud.api.Identity; import com.cloud.utils.db.GenericDao; @Entity @Table(name="alert") -public class AlertVO implements Alert{ +public class AlertVO implements Alert, Identity { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column(name="id") @@ -66,11 +68,17 @@ public class AlertVO implements Alert{ @Temporal(TemporalType.TIMESTAMP) @Column(name="resolved", updatable=true, nullable=true) - private Date resolved; + private Date resolved; + + @Column(name="uuid") + private String uuid; - public AlertVO() {} + public AlertVO() { + this.uuid = UUID.randomUUID().toString(); + } public AlertVO(Long id) { this.id = id; + this.uuid = UUID.randomUUID().toString(); } @Override @@ -153,5 +161,14 @@ public class AlertVO implements Alert{ public void setResolved(Date resolved) { this.resolved = resolved; + } + + @Override + public String getUuid() { + return this.uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; } } diff --git a/core/src/com/cloud/event/EventVO.java b/core/src/com/cloud/event/EventVO.java index 236c66a54a2..76eec027e2b 100644 --- a/core/src/com/cloud/event/EventVO.java +++ b/core/src/com/cloud/event/EventVO.java @@ -19,6 +19,7 @@ package com.cloud.event; import java.util.Date; +import java.util.UUID; import javax.persistence.Column; import javax.persistence.Entity; @@ -32,13 +33,14 @@ import javax.persistence.SecondaryTable; import javax.persistence.Table; import javax.persistence.Transient; +import com.cloud.api.Identity; import com.cloud.utils.db.GenericDao; @Entity @Table(name="event") @SecondaryTable(name="account", pkJoinColumns={@PrimaryKeyJoinColumn(name="account_id", referencedColumnName="id")}) -public class EventVO implements Event { +public class EventVO implements Event, Identity { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column(name="id") @@ -79,7 +81,10 @@ public class EventVO implements Event { private long startId; @Column(name="parameters", length=1024) - private String parameters; + private String parameters; + + @Column(name="uuid") + private String uuid; @Transient private int totalSize; @@ -88,7 +93,8 @@ public class EventVO implements Event { public static final String LEVEL_WARN = "WARN"; public static final String LEVEL_ERROR = "ERROR"; - public EventVO() { + public EventVO() { + this.uuid = UUID.randomUUID().toString(); } public long getId() { @@ -181,5 +187,14 @@ public class EventVO implements Event { } public void setParameters(String parameters) { this.parameters = parameters; + } + + @Override + public String getUuid() { + return this.uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; } } diff --git a/core/src/com/cloud/host/HostVO.java b/core/src/com/cloud/host/HostVO.java index ecfbf347fdc..ed1e2563bf4 100755 --- a/core/src/com/cloud/host/HostVO.java +++ b/core/src/com/cloud/host/HostVO.java @@ -20,6 +20,7 @@ package com.cloud.host; import java.util.Date; import java.util.List; import java.util.Map; +import java.util.UUID; import javax.persistence.Column; import javax.persistence.DiscriminatorColumn; @@ -37,6 +38,7 @@ import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.Transient; +import com.cloud.api.Identity; import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.resource.ResourceState; import com.cloud.storage.Storage.StoragePoolType; @@ -47,7 +49,7 @@ import com.cloud.utils.db.GenericDao; @Table(name="host") @Inheritance(strategy=InheritanceType.TABLE_PER_CLASS) @DiscriminatorColumn(name="type", discriminatorType=DiscriminatorType.STRING, length=32) -public class HostVO implements Host { +public class HostVO implements Host, Identity { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column(name="id") @@ -137,7 +139,10 @@ public class HostVO implements Host { @Column(name="update_count", updatable = true, nullable=false) protected long updated; // This field should be updated everytime the state is updated. There's no set method in the vo object because it is done with in the dao code. - + + @Column(name="uuid") + private String uuid; + // This is a delayed load value. If the value is null, // then this field has not been loaded yet. // Call host dao to load it. @@ -363,10 +368,12 @@ public class HostVO implements Host { this.status = Status.Creating; this.totalMemory = 0; this.dom0MinMemory = 0; - this.resourceState = ResourceState.Creating; + this.resourceState = ResourceState.Creating; + this.uuid = UUID.randomUUID().toString(); } protected HostVO() { + this.uuid = UUID.randomUUID().toString(); } public HostVO(long id, @@ -400,6 +407,7 @@ public class HostVO implements Host { this.parent = parent; this.totalSize = totalSize; this.fsType = fsType; + this.uuid = UUID.randomUUID().toString(); } public HostVO(long id, @@ -457,6 +465,7 @@ public class HostVO implements Host { this.disconnectedOn = disconnectedOn; this.dom0MinMemory = dom0MinMemory; this.storageUrl = url; + this.uuid = UUID.randomUUID().toString(); } public void setPodId(Long podId) { @@ -711,4 +720,13 @@ public class HostVO implements Host { updated++; return updated; } + + @Override + public String getUuid() { + return this.uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } } diff --git a/core/src/com/cloud/hypervisor/HypervisorCapabilitiesVO.java b/core/src/com/cloud/hypervisor/HypervisorCapabilitiesVO.java index a552655d649..9740889b782 100644 --- a/core/src/com/cloud/hypervisor/HypervisorCapabilitiesVO.java +++ b/core/src/com/cloud/hypervisor/HypervisorCapabilitiesVO.java @@ -17,6 +17,8 @@ */ package com.cloud.hypervisor; +import java.util.UUID; + import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EnumType; @@ -26,12 +28,13 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; +import com.cloud.api.Identity; import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.utils.NumbersUtil; @Entity @Table(name="hypervisor_capabilities") -public class HypervisorCapabilitiesVO implements HypervisorCapabilities{ +public class HypervisorCapabilitiesVO implements HypervisorCapabilities, Identity { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column(name="id") @@ -50,8 +53,11 @@ public class HypervisorCapabilitiesVO implements HypervisorCapabilities{ @Column(name="security_group_enabled") private boolean securityGroupEnabled; + @Column(name="uuid") + private String uuid; protected HypervisorCapabilitiesVO() { + this.uuid = UUID.randomUUID().toString(); } public HypervisorCapabilitiesVO(HypervisorType hypervisorType, String hypervisorVersion, Long maxGuestsLimit, boolean securityGroupEnabled) { @@ -59,6 +65,7 @@ public class HypervisorCapabilitiesVO implements HypervisorCapabilities{ this.hypervisorVersion = hypervisorVersion; this.maxGuestsLimit = maxGuestsLimit; this.securityGroupEnabled = securityGroupEnabled; + this.uuid = UUID.randomUUID().toString(); } /** @@ -127,6 +134,15 @@ public class HypervisorCapabilitiesVO implements HypervisorCapabilities{ @Override public int hashCode() { return NumbersUtil.hash(id); + } + + @Override + public String getUuid() { + return this.uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; } @Override diff --git a/core/src/com/cloud/network/VpnUserVO.java b/core/src/com/cloud/network/VpnUserVO.java index 9bd869e5985..5ac4870060f 100644 --- a/core/src/com/cloud/network/VpnUserVO.java +++ b/core/src/com/cloud/network/VpnUserVO.java @@ -18,6 +18,8 @@ package com.cloud.network; +import java.util.UUID; + import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EnumType; @@ -26,10 +28,12 @@ import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; + +import com.cloud.api.Identity; @Entity @Table(name=("vpn_users")) -public class VpnUserVO implements VpnUser { +public class VpnUserVO implements VpnUser, Identity { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column(name="id") @@ -50,8 +54,13 @@ public class VpnUserVO implements VpnUser { @Column(name="state") @Enumerated(value=EnumType.STRING) private State state; - - public VpnUserVO() { } + + @Column(name="uuid") + private String uuid; + + public VpnUserVO() { + this.uuid = UUID.randomUUID().toString(); + } public VpnUserVO(long accountId, long domainId, String userName, String password) { this.accountId = accountId; @@ -59,6 +68,7 @@ public class VpnUserVO implements VpnUser { this.username = userName; this.password = password; this.state = State.Add; + this.uuid = UUID.randomUUID().toString(); } @Override @@ -107,5 +117,14 @@ public class VpnUserVO implements VpnUser { @Override public String toString() { return new StringBuilder("VpnUser[").append(id).append("-").append(username).append("-").append(accountId).append("]").toString(); + } + + @Override + public String getUuid() { + return this.uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; } } diff --git a/core/src/com/cloud/network/security/IngressRuleVO.java b/core/src/com/cloud/network/security/IngressRuleVO.java index aeb1170e101..4931a26f3a8 100644 --- a/core/src/com/cloud/network/security/IngressRuleVO.java +++ b/core/src/com/cloud/network/security/IngressRuleVO.java @@ -18,6 +18,8 @@ package com.cloud.network.security; +import java.util.UUID; + import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EnumType; @@ -27,12 +29,13 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; +import com.cloud.api.Identity; import com.cloud.async.AsyncInstanceCreateStatus; import com.google.gson.annotations.Expose; @Entity @Table(name = ("security_ingress_rule")) -public class IngressRuleVO implements IngressRule { +public class IngressRuleVO implements IngressRule, Identity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") @@ -61,7 +64,11 @@ public class IngressRuleVO implements IngressRule { @Enumerated(value = EnumType.STRING) private AsyncInstanceCreateStatus createStatus; + @Column(name = "uuid") + private String uuid; + public IngressRuleVO() { + this.uuid = UUID.randomUUID().toString(); } public IngressRuleVO(long securityGroupId, int fromPort, int toPort, String protocol, long allowedNetworkId) { @@ -70,6 +77,7 @@ public class IngressRuleVO implements IngressRule { this.endPort = toPort; this.protocol = protocol; this.allowedNetworkId = allowedNetworkId; + this.uuid = UUID.randomUUID().toString(); } public IngressRuleVO(long securityGroupId, int fromPort, int toPort, String protocol, String allowedIpCidr) { @@ -78,6 +86,7 @@ public class IngressRuleVO implements IngressRule { this.endPort = toPort; this.protocol = protocol; this.allowedSourceIpCidr = allowedIpCidr; + this.uuid = UUID.randomUUID().toString(); } @Override @@ -123,4 +132,13 @@ public class IngressRuleVO implements IngressRule { public String getAllowedSourceIpCidr() { return allowedSourceIpCidr; } + + @Override + public String getUuid() { + return this.uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } } diff --git a/core/src/com/cloud/network/security/SecurityGroupVO.java b/core/src/com/cloud/network/security/SecurityGroupVO.java index 9a3cf09b9b0..cd06072d47a 100644 --- a/core/src/com/cloud/network/security/SecurityGroupVO.java +++ b/core/src/com/cloud/network/security/SecurityGroupVO.java @@ -18,6 +18,8 @@ package com.cloud.network.security; +import java.util.UUID; + import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; @@ -25,9 +27,11 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; +import com.cloud.api.Identity; + @Entity @Table(name = ("security_group")) -public class SecurityGroupVO implements SecurityGroup { +public class SecurityGroupVO implements SecurityGroup, Identity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") @@ -45,7 +49,11 @@ public class SecurityGroupVO implements SecurityGroup { @Column(name = "account_id") private long accountId; + @Column(name = "uuid") + private String uuid; + public SecurityGroupVO() { + this.uuid = UUID.randomUUID().toString(); } public SecurityGroupVO(String name, String description, long domainId, long accountId) { @@ -53,6 +61,7 @@ public class SecurityGroupVO implements SecurityGroup { this.description = description; this.domainId = domainId; this.accountId = accountId; + this.uuid = UUID.randomUUID().toString(); } @Override @@ -79,4 +88,13 @@ public class SecurityGroupVO implements SecurityGroup { public long getAccountId() { return accountId; } + + @Override + public String getUuid() { + return this.uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } } diff --git a/core/src/com/cloud/storage/DiskOfferingVO.java b/core/src/com/cloud/storage/DiskOfferingVO.java index c8cf7420b16..94056a3aaa5 100644 --- a/core/src/com/cloud/storage/DiskOfferingVO.java +++ b/core/src/com/cloud/storage/DiskOfferingVO.java @@ -20,6 +20,7 @@ package com.cloud.storage; import java.util.Date; import java.util.List; +import java.util.UUID; import javax.persistence.Column; import javax.persistence.DiscriminatorColumn; @@ -35,6 +36,7 @@ import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.Transient; +import com.cloud.api.Identity; import com.cloud.offering.DiskOffering; import com.cloud.utils.db.GenericDao; @@ -42,7 +44,7 @@ import com.cloud.utils.db.GenericDao; @Table(name="disk_offering") @Inheritance(strategy=InheritanceType.JOINED) @DiscriminatorColumn(name="type", discriminatorType=DiscriminatorType.STRING, length=32) -public class DiskOfferingVO implements DiskOffering { +public class DiskOfferingVO implements DiskOffering, Identity { public enum Type { Disk, Service @@ -92,8 +94,12 @@ public class DiskOfferingVO implements DiskOffering { @Column(name="customized") private boolean customized; + + @Column(name="uuid") + private String uuid; - public DiskOfferingVO() { + public DiskOfferingVO() { + this.uuid = UUID.randomUUID().toString(); } public DiskOfferingVO(Long domainId, String name, String displayText, long diskSize, String tags, boolean isCustomized) { @@ -106,6 +112,7 @@ public class DiskOfferingVO implements DiskOffering { this.type = Type.Disk; this.useLocalStorage = false; this.customized = isCustomized; + this.uuid = UUID.randomUUID().toString(); } public DiskOfferingVO(String name, String displayText, boolean mirrored, String tags, boolean recreatable, boolean useLocalStorage, boolean systemUse, boolean customized) { @@ -118,6 +125,7 @@ public class DiskOfferingVO implements DiskOffering { this.useLocalStorage = useLocalStorage; this.systemUse = systemUse; this.customized = customized; + this.uuid = UUID.randomUUID().toString(); } //domain specific offerings constructor (null domainId implies public offering) @@ -131,6 +139,7 @@ public class DiskOfferingVO implements DiskOffering { this.systemUse = systemUse; this.customized = customized; this.domainId = domainId; + this.uuid = UUID.randomUUID().toString(); } @Override @@ -282,5 +291,14 @@ public class DiskOfferingVO implements DiskOffering { public void setRemoved(Date removed) { this.removed = removed; + } + + @Override + public String getUuid() { + return this.uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; } } diff --git a/core/src/com/cloud/storage/GuestOSCategoryVO.java b/core/src/com/cloud/storage/GuestOSCategoryVO.java index ae0f0242565..180a9d0dc69 100644 --- a/core/src/com/cloud/storage/GuestOSCategoryVO.java +++ b/core/src/com/cloud/storage/GuestOSCategoryVO.java @@ -17,6 +17,8 @@ */ package com.cloud.storage; +import java.util.UUID; + import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; @@ -24,9 +26,11 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; +import com.cloud.api.Identity; + @Entity @Table(name="guest_os_category") -public class GuestOSCategoryVO implements GuestOsCategory{ +public class GuestOSCategoryVO implements GuestOsCategory, Identity { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column(name="id") @@ -35,6 +39,9 @@ public class GuestOSCategoryVO implements GuestOsCategory{ @Column(name="name") String name; + @Column(name="uuid") + String uuid = UUID.randomUUID().toString(); + @Override public long getId() { return id; @@ -49,5 +56,13 @@ public class GuestOSCategoryVO implements GuestOsCategory{ public void setName(String name) { this.name = name; } + + @Override + public String getUuid() { + return this.uuid; + } -} \ No newline at end of file + public void setUuid(String uuid) { + this.uuid = uuid; + } +} diff --git a/core/src/com/cloud/storage/GuestOSVO.java b/core/src/com/cloud/storage/GuestOSVO.java index 1e5db2f49ce..0f8b1d194e1 100644 --- a/core/src/com/cloud/storage/GuestOSVO.java +++ b/core/src/com/cloud/storage/GuestOSVO.java @@ -17,6 +17,8 @@ */ package com.cloud.storage; +import java.util.UUID; + import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; @@ -24,9 +26,11 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; +import com.cloud.api.Identity; + @Entity @Table(name="guest_os") -public class GuestOSVO implements GuestOS { +public class GuestOSVO implements GuestOS, Identity { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column(name="id") @@ -41,6 +45,9 @@ public class GuestOSVO implements GuestOS { @Column(name="display_name") String displayName; + @Column(name="uuid") + String uuid = UUID.randomUUID().toString(); + @Override public long getId() { return id; @@ -71,4 +78,13 @@ public class GuestOSVO implements GuestOS { public void setDisplayName(String displayName) { this.displayName = displayName; } + + @Override + public String getUuid() { + return this.uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } } diff --git a/core/src/com/cloud/storage/SnapshotPolicyVO.java b/core/src/com/cloud/storage/SnapshotPolicyVO.java index bd1688a5958..afefd5cae0b 100644 --- a/core/src/com/cloud/storage/SnapshotPolicyVO.java +++ b/core/src/com/cloud/storage/SnapshotPolicyVO.java @@ -18,6 +18,8 @@ package com.cloud.storage; +import java.util.UUID; + import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; @@ -25,12 +27,13 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; +import com.cloud.api.Identity; import com.cloud.storage.snapshot.SnapshotPolicy; import com.cloud.utils.DateUtil.IntervalType; @Entity @Table(name="snapshot_policy") -public class SnapshotPolicyVO implements SnapshotPolicy { +public class SnapshotPolicyVO implements SnapshotPolicy, Identity { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @@ -54,8 +57,13 @@ public class SnapshotPolicyVO implements SnapshotPolicy { @Column(name="active") boolean active = false; + + @Column(name="uuid") + String uuid; - public SnapshotPolicyVO() { } + public SnapshotPolicyVO() { + this.uuid = UUID.randomUUID().toString(); + } public SnapshotPolicyVO(long volumeId, String schedule, String timezone, IntervalType intvType, int maxSnaps) { this.volumeId = volumeId; @@ -64,6 +72,7 @@ public class SnapshotPolicyVO implements SnapshotPolicy { this.interval = (short)intvType.ordinal(); this.maxSnaps = maxSnaps; this.active = true; + this.uuid = UUID.randomUUID().toString(); } public long getId() { @@ -112,5 +121,14 @@ public class SnapshotPolicyVO implements SnapshotPolicy { public void setActive(boolean active) { this.active = active; + } + + @Override + public String getUuid() { + return this.uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; } } diff --git a/core/src/com/cloud/storage/SnapshotVO.java b/core/src/com/cloud/storage/SnapshotVO.java index 79d35da35b7..63d9780447c 100644 --- a/core/src/com/cloud/storage/SnapshotVO.java +++ b/core/src/com/cloud/storage/SnapshotVO.java @@ -19,6 +19,7 @@ package com.cloud.storage; import java.util.Date; +import java.util.UUID; import javax.persistence.Column; import javax.persistence.Entity; @@ -29,13 +30,14 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; +import com.cloud.api.Identity; import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.utils.db.GenericDao; import com.google.gson.annotations.Expose; @Entity @Table(name="snapshots") -public class SnapshotVO implements Snapshot { +public class SnapshotVO implements Snapshot, Identity { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @@ -105,7 +107,12 @@ public class SnapshotVO implements Snapshot { @Column(name="version") String version; - public SnapshotVO() { } + @Column(name="uuid") + String uuid; + + public SnapshotVO() { + this.uuid = UUID.randomUUID().toString(); + } public SnapshotVO(long dcId, long accountId, long domainId, Long volumeId, Long diskOfferingId, String path, String name, short snapshotType, String typeDescription, long size, HypervisorType hypervisorType ) { this.dataCenterId = dcId; @@ -122,8 +129,8 @@ public class SnapshotVO implements Snapshot { this.prevSnapshotId = 0; this.hypervisorType = hypervisorType; this.version = "2.2"; + this.uuid = UUID.randomUUID().toString(); } - @Override public Long getId() { @@ -275,5 +282,13 @@ public class SnapshotVO implements Snapshot { } return null; } - + + @Override + public String getUuid() { + return this.uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } } diff --git a/core/src/com/cloud/storage/StoragePoolVO.java b/core/src/com/cloud/storage/StoragePoolVO.java index fe474fb9462..83590a9e23f 100644 --- a/core/src/com/cloud/storage/StoragePoolVO.java +++ b/core/src/com/cloud/storage/StoragePoolVO.java @@ -18,6 +18,7 @@ package com.cloud.storage; import java.util.Date; +import java.util.UUID; import javax.persistence.Column; import javax.persistence.Entity; @@ -30,6 +31,7 @@ import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.Transient; +import com.cloud.api.Identity; import com.cloud.storage.Storage.StoragePoolType; import com.cloud.utils.db.GenericDao; @@ -39,7 +41,7 @@ import com.cloud.utils.db.GenericDao; */ @Entity @Table(name="storage_pool") -public class StoragePoolVO implements StoragePool { +public class StoragePoolVO implements StoragePool, Identity { @Id @TableGenerator(name="storage_pool_sq", table="sequence", pkColumnName="name", valueColumnName="value", pkColumnValue="storage_pool_seq", allocationSize=1) @Column(name="id", updatable=false, nullable = false) @@ -104,7 +106,7 @@ public class StoragePoolVO implements StoragePool { public String getUuid() { return uuid; } - + @Override public StoragePoolType getPoolType() { return poolType; @@ -205,6 +207,7 @@ public class StoragePoolVO implements StoragePool { this.port = port; this.path = path; this.setStatus(StoragePoolStatus.Up); + this.uuid = UUID.randomUUID().toString(); } public void setStatus(StoragePoolStatus status) diff --git a/core/src/com/cloud/storage/VMTemplateVO.java b/core/src/com/cloud/storage/VMTemplateVO.java index df548dc34c7..203aae2ba71 100755 --- a/core/src/com/cloud/storage/VMTemplateVO.java +++ b/core/src/com/cloud/storage/VMTemplateVO.java @@ -32,6 +32,7 @@ import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.Transient; +import com.cloud.api.Identity; import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.storage.Storage.ImageFormat; import com.cloud.storage.Storage.TemplateType; @@ -40,7 +41,7 @@ import com.cloud.utils.db.GenericDao; @Entity @Table(name="vm_template") -public class VMTemplateVO implements VirtualMachineTemplate { +public class VMTemplateVO implements VirtualMachineTemplate, Identity { @Id @TableGenerator(name="vm_template_sq", table="sequence", pkColumnName="name", valueColumnName="value", pkColumnValue="vm_template_seq", allocationSize=1) @Column(name="id", nullable = false) @@ -117,6 +118,10 @@ public class VMTemplateVO implements VirtualMachineTemplate { @Column(name="template_tag") private String templateTag; + + @Column(name="uuid") + private String uuid; + @Override public String getUniqueName() { @@ -127,7 +132,8 @@ public class VMTemplateVO implements VirtualMachineTemplate { this.uniqueName = uniqueName; } - protected VMTemplateVO() { + protected VMTemplateVO() { + this.uuid = UUID.randomUUID().toString(); } /** @@ -135,11 +141,13 @@ public class VMTemplateVO implements VirtualMachineTemplate { */ public VMTemplateVO(long id, String name, ImageFormat format, boolean isPublic, boolean featured, boolean isExtractable, TemplateType type, String url, boolean requiresHvm, int bits, long accountId, String cksum, String displayText, boolean enablePassword, long guestOSId, boolean bootable, HypervisorType hyperType) { this(id, generateUniqueName(id, accountId, name), name, format, isPublic, featured, isExtractable, type, url, null, requiresHvm, bits, accountId, cksum, displayText, enablePassword, guestOSId, bootable, hyperType); + this.uuid = UUID.randomUUID().toString(); } public VMTemplateVO(long id, String name, ImageFormat format, boolean isPublic, boolean featured, boolean isExtractable, TemplateType type, String url, boolean requiresHvm, int bits, long accountId, String cksum, String displayText, boolean enablePassword, long guestOSId, boolean bootable, HypervisorType hyperType, String templateTag) { this(id, name, format, isPublic, featured, isExtractable, type, url, requiresHvm, bits, accountId, cksum, displayText, enablePassword, guestOSId, bootable, hyperType); this.templateTag = templateTag; + this.uuid = UUID.randomUUID().toString(); } public VMTemplateVO(Long id, String uniqueName, String name, ImageFormat format, boolean isPublic, boolean featured, TemplateType type, String url, Date created, boolean requiresHvm, int bits, long accountId, String cksum, String displayText, boolean enablePassword, long guestOSId, boolean bootable, HypervisorType hyperType) { @@ -161,17 +169,20 @@ public class VMTemplateVO implements VirtualMachineTemplate { this.guestOSId = guestOSId; this.bootable = bootable; this.hypervisorType = hyperType; + this.uuid = UUID.randomUUID().toString(); } // Has an extra attribute - isExtractable public VMTemplateVO(Long id, String uniqueName, String name, ImageFormat format, boolean isPublic, boolean featured, boolean isExtractable, TemplateType type, String url, Date created, boolean requiresHvm, int bits, long accountId, String cksum, String displayText, boolean enablePassword, long guestOSId, boolean bootable, HypervisorType hyperType) { this(id, uniqueName, name, format, isPublic, featured, type, url, created, requiresHvm, bits, accountId, cksum, displayText, enablePassword, guestOSId, bootable, hyperType); this.extractable = isExtractable; + this.uuid = UUID.randomUUID().toString(); } public VMTemplateVO(Long id, String uniqueName, String name, ImageFormat format, boolean isPublic, boolean featured, boolean isExtractable, TemplateType type, String url, Date created, boolean requiresHvm, int bits, long accountId, String cksum, String displayText, boolean enablePassword, long guestOSId, boolean bootable, HypervisorType hyperType, String templateTag) { this(id, uniqueName, name, format, isPublic, featured, isExtractable, type, url, created, requiresHvm, bits, accountId, cksum, displayText, enablePassword, guestOSId, bootable, hyperType); this.templateTag = templateTag; + this.uuid = UUID.randomUUID().toString(); } @Override @@ -381,6 +392,15 @@ public class VMTemplateVO implements VirtualMachineTemplate { public long getDomainId() { return -1; } + + @Override + public String getUuid() { + return this.uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } @Override public boolean equals(Object that) { diff --git a/core/src/com/cloud/storage/VolumeVO.java b/core/src/com/cloud/storage/VolumeVO.java index 523feb31323..c80194acf34 100755 --- a/core/src/com/cloud/storage/VolumeVO.java +++ b/core/src/com/cloud/storage/VolumeVO.java @@ -18,6 +18,7 @@ package com.cloud.storage; import java.util.Date; +import java.util.UUID; import javax.persistence.Column; import javax.persistence.Entity; @@ -31,13 +32,14 @@ import javax.persistence.TableGenerator; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import com.cloud.api.Identity; import com.cloud.storage.Storage.StoragePoolType; import com.cloud.utils.NumbersUtil; import com.cloud.utils.db.GenericDao; @Entity @Table(name = "volumes") -public class VolumeVO implements Volume { +public class VolumeVO implements Volume, Identity { @Id @TableGenerator(name = "volume_sq", table = "sequence", pkColumnName = "name", valueColumnName = "value", pkColumnValue = "volume_seq", allocationSize = 1) @GeneratedValue(strategy = GenerationType.TABLE) @@ -127,6 +129,9 @@ public class VolumeVO implements Volume { @Column(name = "chain_info") String chainInfo; + @Column(name = "uuid") + String uuid; + // Real Constructor public VolumeVO(Type type, String name, long dcId, long domainId, long accountId, long diskOfferingId, long size) { this.volumeType = type; @@ -137,6 +142,7 @@ public class VolumeVO implements Volume { this.size = size; this.diskOfferingId = diskOfferingId; this.state = State.Allocated; + this.uuid = UUID.randomUUID().toString(); } public VolumeVO(String name, long dcId, long podId, long accountId, long domainId, Long instanceId, String folder, String path, long size, Volume.Type vType) { @@ -152,6 +158,7 @@ public class VolumeVO implements Volume { this.volumeType = vType; this.state = Volume.State.Allocated; this.recreatable = false; + this.uuid = UUID.randomUUID().toString(); } // Copy Constructor @@ -167,6 +174,7 @@ public class VolumeVO implements Volume { this.chainInfo = that.getChainInfo(); this.templateId = that.getTemplateId(); this.deviceId = that.getDeviceId(); + this.uuid = UUID.randomUUID().toString(); } @Override @@ -421,4 +429,13 @@ public class VolumeVO implements Volume { return false; } } + + @Override + public String getUuid() { + return this.uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } } diff --git a/core/src/com/cloud/user/AccountVO.java b/core/src/com/cloud/user/AccountVO.java index 4fd2ecf78dc..9c986d360e0 100644 --- a/core/src/com/cloud/user/AccountVO.java +++ b/core/src/com/cloud/user/AccountVO.java @@ -19,6 +19,7 @@ package com.cloud.user; import java.util.Date; +import java.util.UUID; import javax.persistence.Column; import javax.persistence.Entity; @@ -29,11 +30,12 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; +import com.cloud.api.Identity; import com.cloud.utils.db.GenericDao; @Entity @Table(name="account") -public class AccountVO implements Account { +public class AccountVO implements Account, Identity { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column(name="id") @@ -60,12 +62,17 @@ public class AccountVO implements Account { @Column(name="network_domain") private String networkDomain; + + @Column(name="uuid") + private String uuid; - - public AccountVO() {} + public AccountVO() { + this.uuid = UUID.randomUUID().toString(); + } public AccountVO(long id) { this.id = id; + this.uuid = UUID.randomUUID().toString(); } public AccountVO(String accountName, long domainId, String networkDomain, short type) { @@ -74,6 +81,7 @@ public class AccountVO implements Account { this.networkDomain = networkDomain; this.type = type; this.state = State.enabled; + this.uuid = UUID.randomUUID().toString(); } public void setNeedsCleanup(boolean value) { @@ -148,5 +156,13 @@ public class AccountVO implements Account { public void setNetworkDomain(String networkDomain) { this.networkDomain = networkDomain; } - + + @Override + public String getUuid() { + return this.uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } } diff --git a/core/src/com/cloud/user/UserVO.java b/core/src/com/cloud/user/UserVO.java index dcd7578c059..c781f19350e 100644 --- a/core/src/com/cloud/user/UserVO.java +++ b/core/src/com/cloud/user/UserVO.java @@ -20,6 +20,7 @@ package com.cloud.user; import java.util.Date; import java.util.TimeZone; +import java.util.UUID; import javax.persistence.Column; import javax.persistence.Entity; @@ -30,6 +31,7 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; +import com.cloud.api.Identity; import com.cloud.user.Account.State; import com.cloud.utils.db.GenericDao; @@ -41,7 +43,7 @@ import com.cloud.utils.db.GenericDao; */ @Entity @Table(name = "user") -public class UserVO implements User { +public class UserVO implements User, Identity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") @@ -89,12 +91,17 @@ public class UserVO implements User { @Column(name="is_registered") boolean registered; + + @Column(name="uuid") + private String uuid; public UserVO() { + this.uuid = UUID.randomUUID().toString(); } public UserVO(long id) { this.id = id; + this.uuid = UUID.randomUUID().toString(); } public UserVO(long accountId, String username, String password, String firstName, String lastName, String email, String timezone) { @@ -106,6 +113,7 @@ public class UserVO implements User { this.email = email; this.timezone = timezone; this.state = State.enabled; + this.uuid = UUID.randomUUID().toString(); } @Override @@ -246,4 +254,13 @@ public class UserVO implements User { public String toString() { return new StringBuilder("User[").append(id).append("-").append(username).append("]").toString(); } + + @Override + public String getUuid() { + return this.uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } } diff --git a/core/src/com/cloud/vm/InstanceGroupVO.java b/core/src/com/cloud/vm/InstanceGroupVO.java index 14ec1a50507..9194971897a 100644 --- a/core/src/com/cloud/vm/InstanceGroupVO.java +++ b/core/src/com/cloud/vm/InstanceGroupVO.java @@ -19,6 +19,7 @@ package com.cloud.vm; import java.util.Date; +import java.util.UUID; import javax.persistence.Column; import javax.persistence.Entity; @@ -29,13 +30,14 @@ import javax.persistence.PrimaryKeyJoinColumn; import javax.persistence.SecondaryTable; import javax.persistence.Table; +import com.cloud.api.Identity; import com.cloud.utils.db.GenericDao; @Entity @Table(name="instance_group") @SecondaryTable(name="account", pkJoinColumns={@PrimaryKeyJoinColumn(name="account_id", referencedColumnName="id")}) -public class InstanceGroupVO implements InstanceGroup { +public class InstanceGroupVO implements InstanceGroup, Identity { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column(name="id") @@ -55,10 +57,14 @@ public class InstanceGroupVO implements InstanceGroup { @Column(name=GenericDao.CREATED_COLUMN) private Date created; + + @Column(name="uuid") + private String uuid; public InstanceGroupVO(String name, long accountId) { this.name = name; this.accountId = accountId; + this.uuid = UUID.randomUUID().toString(); } protected InstanceGroupVO() { @@ -96,4 +102,12 @@ public class InstanceGroupVO implements InstanceGroup { this.name = name; } + @Override + public String getUuid() { + return this.uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } } diff --git a/server/src/com/cloud/api/ApiDispatcher.java b/server/src/com/cloud/api/ApiDispatcher.java index 03e67243de2..3658adefc87 100755 --- a/server/src/com/cloud/api/ApiDispatcher.java +++ b/server/src/com/cloud/api/ApiDispatcher.java @@ -290,7 +290,15 @@ public class ApiDispatcher { listParam.add(Integer.valueOf(token)); break; case LONG: - listParam.add(Long.valueOf(token)); + { + Long val = null; + if(identityMapper != null) + val = s_instance._identityDao.getIdentityId(identityMapper, token); + else + val = Long.valueOf(token); + + listParam.add(val); + } break; case SHORT: listParam.add(Short.valueOf(token)); diff --git a/server/src/com/cloud/api/ApiResponseGsonHelper.java b/server/src/com/cloud/api/ApiResponseGsonHelper.java index 852e52c3664..bc70888d6c4 100644 --- a/server/src/com/cloud/api/ApiResponseGsonHelper.java +++ b/server/src/com/cloud/api/ApiResponseGsonHelper.java @@ -33,6 +33,7 @@ public class ApiResponseGsonHelper { s_gBuilder.setVersion(1.3); s_gBuilder.registerTypeAdapter(ResponseObject.class, new ResponseObjectTypeAdapter()); s_gBuilder.registerTypeAdapter(String.class, new EncodedStringTypeAdapter()); + s_gBuilder.registerTypeAdapter(IdentityProxy.class, new IdentityTypeAdapter()); } public static GsonBuilder getBuilder() { diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java index 76cb730c7a0..c2a1779dd01 100755 --- a/server/src/com/cloud/api/ApiResponseHelper.java +++ b/server/src/com/cloud/api/ApiResponseHelper.java @@ -1267,11 +1267,7 @@ public class ApiResponseHelper implements ResponseGenerator { SystemVmResponse vmResponse = new SystemVmResponse(); if (vm.getType() == Type.SecondaryStorageVm || vm.getType() == Type.ConsoleProxy) { // SystemVm vm = (SystemVm) systemVM; - - if(vm.getUuid() != null && !vm.getUuid().isEmpty()) - vmResponse.setId(vm.getUuid()); - else - vmResponse.setId(String.valueOf(vm.getId())); + vmResponse.setId(vm.getId()); vmResponse.setObjectId(vm.getId()); vmResponse.setSystemVmType(vm.getType().toString().toLowerCase()); vmResponse.setZoneId(vm.getDataCenterIdToDeployIn()); @@ -1873,11 +1869,7 @@ public class ApiResponseHelper implements ResponseGenerator { jobResponse.setAccountId(job.getAccountId()); jobResponse.setCmd(job.getCmd()); jobResponse.setCreated(job.getCreated()); - - if(job.getUuid() != null && !job.getUuid().isEmpty()) - jobResponse.setId(job.getUuid()); - else - jobResponse.setId(String.valueOf(job.getId())); + jobResponse.setId(job.getId()); if (job.getInstanceType() != null && job.getInstanceId() != null) { jobResponse.setJobInstanceType(job.getInstanceType().toString()); @@ -2134,7 +2126,7 @@ public class ApiResponseHelper implements ResponseGenerator { } //Set accounts - List projectIds = new ArrayList(); + List projectIds = new ArrayList(); List regularAccounts = new ArrayList(); for (String accountName : accountNames) { Account account = ApiDBUtils.findAccountByNameDomain(accountName, templateOwner.getDomainId()); @@ -2143,7 +2135,11 @@ public class ApiResponseHelper implements ResponseGenerator { } else { //convert account to projectIds Project project = ApiDBUtils.findProjectByProjectAccountId(account.getId()); - projectIds.add(project.getId()); + + if(project.getUuid() != null && !project.getUuid().isEmpty()) + projectIds.add(project.getUuid()); + else + projectIds.add(String.valueOf(project.getId())); } } @@ -2164,10 +2160,7 @@ public class ApiResponseHelper implements ResponseGenerator { AsyncJobResult result = ApiDBUtils._asyncMgr.queryAsyncJobResult(cmd); AsyncJobResponse response = new AsyncJobResponse(); - if(result.getUuid() != null && !result.getUuid().isEmpty()) - response.setId(result.getUuid()); - else - response.setId(String.valueOf(result.getJobId())); + response.setId(result.getJobId()); response.setJobStatus(result.getJobStatus()); response.setJobProcStatus(result.getProcessStatus()); response.setJobResultCode(result.getResultCode()); @@ -2543,10 +2536,7 @@ public class ApiResponseHelper implements ResponseGenerator { public UserVmResponse newUserVmResponse(UserVmData userVmData, boolean caller_is_admin){ UserVmResponse userVmResponse = new UserVmResponse(); userVmResponse.setHypervisor(userVmData.getHypervisor()); - if(userVmData.getUuid() != null && !userVmData.getUuid().isEmpty()) - userVmResponse.setId(userVmData.getUuid()); - else - userVmResponse.setId(String.valueOf(userVmData.getId())); + userVmResponse.setId(userVmData.getId()); userVmResponse.setName(userVmData.getName()); userVmResponse.setDisplayName(userVmData.getDisplayName()); userVmResponse.setIpAddress(userVmData.getIpAddress()); diff --git a/server/src/com/cloud/api/commands/AddExternalFirewallCmd.java b/server/src/com/cloud/api/commands/AddExternalFirewallCmd.java index c42a2f988b1..b27800f28a7 100644 --- a/server/src/com/cloud/api/commands/AddExternalFirewallCmd.java +++ b/server/src/com/cloud/api/commands/AddExternalFirewallCmd.java @@ -23,6 +23,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -45,6 +46,7 @@ public class AddExternalFirewallCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="data_center") @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, required = true, description="Zone in which to add the external firewall appliance.") private Long zoneId; diff --git a/server/src/com/cloud/api/commands/AddExternalLoadBalancerCmd.java b/server/src/com/cloud/api/commands/AddExternalLoadBalancerCmd.java index 5ec3ace41e7..8826ec28473 100644 --- a/server/src/com/cloud/api/commands/AddExternalLoadBalancerCmd.java +++ b/server/src/com/cloud/api/commands/AddExternalLoadBalancerCmd.java @@ -23,6 +23,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -44,6 +45,7 @@ public class AddExternalLoadBalancerCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="data_center") @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, required = true, description="Zone in which to add the external load balancer appliance.") private Long zoneId; diff --git a/server/src/com/cloud/api/commands/AddTrafficMonitorCmd.java b/server/src/com/cloud/api/commands/AddTrafficMonitorCmd.java index c6e0e1ff125..1698626ac6b 100644 --- a/server/src/com/cloud/api/commands/AddTrafficMonitorCmd.java +++ b/server/src/com/cloud/api/commands/AddTrafficMonitorCmd.java @@ -23,6 +23,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -45,6 +46,7 @@ public class AddTrafficMonitorCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="data_center") @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, required = true, description="Zone in which to add the external firewall appliance.") private Long zoneId; diff --git a/server/src/com/cloud/api/commands/DeleteExternalFirewallCmd.java b/server/src/com/cloud/api/commands/DeleteExternalFirewallCmd.java index 330870d7841..cca5f894daa 100644 --- a/server/src/com/cloud/api/commands/DeleteExternalFirewallCmd.java +++ b/server/src/com/cloud/api/commands/DeleteExternalFirewallCmd.java @@ -23,6 +23,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -42,6 +43,7 @@ public class DeleteExternalFirewallCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="host") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required = true, description="Id of the external firewall appliance.") private Long id; diff --git a/server/src/com/cloud/api/commands/DeleteExternalLoadBalancerCmd.java b/server/src/com/cloud/api/commands/DeleteExternalLoadBalancerCmd.java index 6e751f6d3aa..0432ce8bba9 100644 --- a/server/src/com/cloud/api/commands/DeleteExternalLoadBalancerCmd.java +++ b/server/src/com/cloud/api/commands/DeleteExternalLoadBalancerCmd.java @@ -23,6 +23,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -42,6 +43,7 @@ public class DeleteExternalLoadBalancerCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="host") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required = true, description="Id of the external loadbalancer appliance.") private Long id; diff --git a/server/src/com/cloud/api/commands/DeleteNetworkDeviceCmd.java b/server/src/com/cloud/api/commands/DeleteNetworkDeviceCmd.java index 6aa071fc78d..810fb5e7f77 100644 --- a/server/src/com/cloud/api/commands/DeleteNetworkDeviceCmd.java +++ b/server/src/com/cloud/api/commands/DeleteNetworkDeviceCmd.java @@ -4,6 +4,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -27,6 +28,7 @@ public class DeleteNetworkDeviceCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="host") @Parameter(name = ApiConstants.ID, type = CommandType.LONG, required=true, description = "Id of network device to delete") private Long id; diff --git a/server/src/com/cloud/api/commands/DeleteTrafficMonitorCmd.java b/server/src/com/cloud/api/commands/DeleteTrafficMonitorCmd.java index d834206ddb2..cf8618b1457 100644 --- a/server/src/com/cloud/api/commands/DeleteTrafficMonitorCmd.java +++ b/server/src/com/cloud/api/commands/DeleteTrafficMonitorCmd.java @@ -23,6 +23,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -42,6 +43,7 @@ public class DeleteTrafficMonitorCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="host") @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required = true, description="Id of the Traffic Monitor Host.") private Long id; diff --git a/server/src/com/cloud/api/commands/GenerateUsageRecordsCmd.java b/server/src/com/cloud/api/commands/GenerateUsageRecordsCmd.java index 86835979fb7..889281aa1dd 100644 --- a/server/src/com/cloud/api/commands/GenerateUsageRecordsCmd.java +++ b/server/src/com/cloud/api/commands/GenerateUsageRecordsCmd.java @@ -25,6 +25,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; @@ -42,6 +43,7 @@ public class GenerateUsageRecordsCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="List events for the specified domain.") private Long domainId; diff --git a/server/src/com/cloud/api/commands/GetUsageRecordsCmd.java b/server/src/com/cloud/api/commands/GetUsageRecordsCmd.java index 7010805a16d..fc6bb9b7f8b 100644 --- a/server/src/com/cloud/api/commands/GetUsageRecordsCmd.java +++ b/server/src/com/cloud/api/commands/GetUsageRecordsCmd.java @@ -31,6 +31,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.ApiDBUtils; import com.cloud.api.BaseListCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.response.ListResponse; @@ -54,6 +55,7 @@ public class GetUsageRecordsCmd extends BaseListCmd { @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="List usage records for the specified user.") private String accountName; + @IdentityMapper(entityTableName="domain") @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="List usage records for the specified domain.") private Long domainId; @@ -63,9 +65,11 @@ public class GetUsageRecordsCmd extends BaseListCmd { @Parameter(name=ApiConstants.START_DATE, type=CommandType.DATE, required=true, description="Start date range for usage record query. Use yyyy-MM-dd as the date format, e.g. startDate=2009-06-01.") private Date startDate; + @IdentityMapper(entityTableName="account") @Parameter(name=ApiConstants.ACCOUNT_ID, type=CommandType.LONG, description="List usage records for the specified account") private Long accountId; + @IdentityMapper(entityTableName="projects") @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="List usage records for specified project") private Long projectId; diff --git a/server/src/com/cloud/api/commands/ListExternalFirewallsCmd.java b/server/src/com/cloud/api/commands/ListExternalFirewallsCmd.java index dfa20209f5d..ec5cd6532e3 100644 --- a/server/src/com/cloud/api/commands/ListExternalFirewallsCmd.java +++ b/server/src/com/cloud/api/commands/ListExternalFirewallsCmd.java @@ -26,6 +26,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.response.ListResponse; @@ -44,6 +45,7 @@ public class ListExternalFirewallsCmd extends BaseListCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="data_center") @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, required = true, description="zone Id") private long zoneId; diff --git a/server/src/com/cloud/api/commands/ListExternalLoadBalancersCmd.java b/server/src/com/cloud/api/commands/ListExternalLoadBalancersCmd.java index 069f61deddc..294ab86ebaf 100644 --- a/server/src/com/cloud/api/commands/ListExternalLoadBalancersCmd.java +++ b/server/src/com/cloud/api/commands/ListExternalLoadBalancersCmd.java @@ -26,6 +26,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.response.HostResponse; @@ -45,6 +46,7 @@ public class ListExternalLoadBalancersCmd extends BaseListCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="data_center") @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="zone Id") private long zoneId; diff --git a/server/src/com/cloud/api/commands/ListTrafficMonitorsCmd.java b/server/src/com/cloud/api/commands/ListTrafficMonitorsCmd.java index b9508c32497..a88793073d7 100644 --- a/server/src/com/cloud/api/commands/ListTrafficMonitorsCmd.java +++ b/server/src/com/cloud/api/commands/ListTrafficMonitorsCmd.java @@ -26,6 +26,7 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; +import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.response.ListResponse; @@ -45,6 +46,7 @@ public class ListTrafficMonitorsCmd extends BaseListCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @IdentityMapper(entityTableName="data_center") @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, required = true, description="zone Id") private long zoneId; diff --git a/server/src/com/cloud/dc/ClusterVO.java b/server/src/com/cloud/dc/ClusterVO.java index 3bb649ae7e2..4c841c625ab 100644 --- a/server/src/com/cloud/dc/ClusterVO.java +++ b/server/src/com/cloud/dc/ClusterVO.java @@ -18,6 +18,7 @@ package com.cloud.dc; import java.util.Date; +import java.util.UUID; import javax.persistence.Column; import javax.persistence.Entity; @@ -28,6 +29,7 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; +import com.cloud.api.Identity; import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.org.Cluster; import com.cloud.org.Managed.ManagedState; @@ -37,7 +39,7 @@ import com.cloud.utils.db.GenericDao; @Entity @Table(name="cluster") -public class ClusterVO implements Cluster { +public class ClusterVO implements Cluster, Identity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @@ -73,10 +75,15 @@ public class ClusterVO implements Cluster { @Column(name=GenericDao.REMOVED_COLUMN) private Date removed; + + @Column(name="uuid") + String uuid; public ClusterVO() { clusterType = Cluster.ClusterType.CloudManaged; allocationState = Grouping.AllocationState.Enabled; + + this.uuid = UUID.randomUUID().toString(); } public ClusterVO(long dataCenterId, long podId, String name) { @@ -86,6 +93,7 @@ public class ClusterVO implements Cluster { this.clusterType = Cluster.ClusterType.CloudManaged; this.allocationState = Grouping.AllocationState.Enabled; this.managedState = ManagedState.Managed; + this.uuid = UUID.randomUUID().toString(); } public long getId() { @@ -170,4 +178,12 @@ public class ClusterVO implements Cluster { this.name = name; } + @Override + public String getUuid() { + return this.uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } } diff --git a/server/src/com/cloud/dc/DataCenterVO.java b/server/src/com/cloud/dc/DataCenterVO.java index d8900b9460d..c89a6815802 100644 --- a/server/src/com/cloud/dc/DataCenterVO.java +++ b/server/src/com/cloud/dc/DataCenterVO.java @@ -20,6 +20,7 @@ package com.cloud.dc; import java.util.Date; import java.util.Map; +import java.util.UUID; import javax.persistence.Column; import javax.persistence.Entity; @@ -32,6 +33,7 @@ import javax.persistence.Table; import javax.persistence.TableGenerator; import javax.persistence.Transient; +import com.cloud.api.Identity; import com.cloud.network.Network.Provider; import com.cloud.org.Grouping; import com.cloud.utils.NumbersUtil; @@ -39,7 +41,7 @@ import com.cloud.utils.db.GenericDao; @Entity @Table(name="data_center") -public class DataCenterVO implements DataCenter { +public class DataCenterVO implements DataCenter, Identity { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @@ -126,6 +128,9 @@ public class DataCenterVO implements DataCenter { @Column(name="allocation_state") @Enumerated(value=EnumType.STRING) AllocationState allocationState; + + @Column(name="uuid") + private String uuid; @Override public String getDnsProvider() { @@ -175,7 +180,8 @@ public class DataCenterVO implements DataCenter { public DataCenterVO(long id, String name, String description, String dns1, String dns2, String dns3, String dns4, String vnet, String guestCidr, String domain, Long domainId, NetworkType zoneType, String zoneToken, String domainSuffix) { this(name, description, dns1, dns2, dns3, dns4, vnet, guestCidr, domain, domainId, zoneType, false, zoneToken, domainSuffix); this.id = id; - this.allocationState = Grouping.AllocationState.Enabled; + this.allocationState = Grouping.AllocationState.Enabled; + this.uuid = UUID.randomUUID().toString(); } public DataCenterVO(String name, String description, String dns1, String dns2, String dns3, String dns4, String vnet, String guestCidr, String domain, Long domainId, NetworkType zoneType, boolean securityGroupEnabled, String zoneToken, String domainSuffix) { @@ -210,6 +216,7 @@ public class DataCenterVO implements DataCenter { this.zoneToken = zoneToken; this.domain = domainSuffix; + this.uuid = UUID.randomUUID().toString(); } @Override @@ -408,4 +415,13 @@ public class DataCenterVO implements DataCenter { public Date getRemoved() { return removed; } + + @Override + public String getUuid() { + return this.uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } } diff --git a/server/src/com/cloud/dc/HostPodVO.java b/server/src/com/cloud/dc/HostPodVO.java index e9939547212..97ce2b1308d 100644 --- a/server/src/com/cloud/dc/HostPodVO.java +++ b/server/src/com/cloud/dc/HostPodVO.java @@ -19,6 +19,7 @@ package com.cloud.dc; import java.util.Date; +import java.util.UUID; import javax.persistence.Column; import javax.persistence.Entity; @@ -29,13 +30,14 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; +import com.cloud.api.Identity; import com.cloud.org.Grouping; import com.cloud.utils.NumbersUtil; import com.cloud.utils.db.GenericDao; @Entity @Table(name = "host_pod_ref") -public class HostPodVO implements Pod { +public class HostPodVO implements Pod, Identity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) long id; @@ -68,6 +70,8 @@ public class HostPodVO implements Pod { @Column(name=GenericDao.REMOVED_COLUMN) private Date removed; + @Column(name = "uuid") + private String uuid; public HostPodVO(String name, long dcId, String gateway, String cidrAddress, int cidrSize, String description) { this.name = name; @@ -77,13 +81,15 @@ public class HostPodVO implements Pod { this.cidrSize = cidrSize; this.description = description; this.allocationState = Grouping.AllocationState.Enabled; - this.externalDhcp = false; + this.externalDhcp = false; + this.uuid = UUID.randomUUID().toString(); } /* * public HostPodVO(String name, long dcId) { this(null, name, dcId); } */ protected HostPodVO() { + this.uuid = UUID.randomUUID().toString(); } @Override @@ -179,5 +185,14 @@ public class HostPodVO implements Pod { public Date getRemoved() { return removed; + } + + @Override + public String getUuid() { + return this.uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; } } diff --git a/server/src/com/cloud/dc/VlanVO.java b/server/src/com/cloud/dc/VlanVO.java index 9981e0275f4..42ed4b6767d 100644 --- a/server/src/com/cloud/dc/VlanVO.java +++ b/server/src/com/cloud/dc/VlanVO.java @@ -18,6 +18,8 @@ package com.cloud.dc; +import java.util.UUID; + import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EnumType; @@ -27,9 +29,11 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; +import com.cloud.api.Identity; + @Entity @Table(name="vlan") -public class VlanVO implements Vlan { +public class VlanVO implements Vlan, Identity { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @@ -57,6 +61,9 @@ public class VlanVO implements Vlan { @Column(name="vlan_type") @Enumerated(EnumType.STRING) VlanType vlanType; + + @Column(name="uuid") + String uuid; public VlanVO(VlanType vlanType, String vlanTag, String vlanGateway, String vlanNetmask, long dataCenterId, String ipRange, Long networkId) { this.vlanType = vlanType; @@ -66,10 +73,11 @@ public class VlanVO implements Vlan { this.dataCenterId = dataCenterId; this.ipRange = ipRange; this.networkId = networkId; + this.uuid = UUID.randomUUID().toString(); } public VlanVO() { - + this.uuid = UUID.randomUUID().toString(); } public long getId() { @@ -107,4 +115,13 @@ public class VlanVO implements Vlan { public void setNetworkId(Long networkId) { this.networkId = networkId; } + + @Override + public String getUuid() { + return this.uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } } diff --git a/server/src/com/cloud/domain/DomainVO.java b/server/src/com/cloud/domain/DomainVO.java index 05c0d4e4b21..853e44dc867 100644 --- a/server/src/com/cloud/domain/DomainVO.java +++ b/server/src/com/cloud/domain/DomainVO.java @@ -19,6 +19,7 @@ package com.cloud.domain; import java.util.Date; +import java.util.UUID; import javax.persistence.Column; import javax.persistence.Entity; @@ -27,11 +28,12 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; +import com.cloud.api.Identity; import com.cloud.utils.db.GenericDao; @Entity @Table(name="domain") -public class DomainVO implements Domain { +public class DomainVO implements Domain, Identity { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column(name="id") @@ -66,12 +68,16 @@ public class DomainVO implements Domain { @Column(name="network_domain") private String networkDomain; + + @Column(name="uuid") + private String uuid; public DomainVO() {} public DomainVO(long id, String name, long owner, Long parentId, String networkDomain) { this(name, owner, parentId, networkDomain); this.id = id; + this.uuid = UUID.randomUUID().toString(); } public DomainVO(String name, long owner, Long parentId, String networkDomain) { @@ -82,7 +88,7 @@ public class DomainVO implements Domain { this.level = 0; this.state = Domain.State.Active; this.networkDomain = networkDomain; - + this.uuid = UUID.randomUUID().toString(); } @Override @@ -186,6 +192,15 @@ public class DomainVO implements Domain { public void setNetworkDomain(String domainSuffix) { this.networkDomain = domainSuffix; + } + + @Override + public String getUuid() { + return this.uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; } } diff --git a/server/src/com/cloud/identity/dao/IdentityDaoImpl.java b/server/src/com/cloud/identity/dao/IdentityDaoImpl.java new file mode 100644 index 00000000000..db9cda80cfa --- /dev/null +++ b/server/src/com/cloud/identity/dao/IdentityDaoImpl.java @@ -0,0 +1,120 @@ +/** + * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. + * + * This software is licensed under the GNU General Public License v3 or later. + * + * It is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +package com.cloud.identity.dao; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; + +import javax.ejb.Local; + +import org.apache.log4j.Logger; + +import com.cloud.api.IdentityMapper; +import com.cloud.utils.db.DB; +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.Transaction; + +@Local(value={IdentityDao.class}) +public class IdentityDaoImpl extends GenericDaoBase implements IdentityDao { + private static final Logger s_logger = Logger.getLogger(IdentityDaoImpl.class); + + public IdentityDaoImpl() { + } + + @DB + public Long getIdentityId(IdentityMapper mapper, String identityString) { + assert(mapper.entityTableName() != null); + assert(identityString != null); + + PreparedStatement pstmt = null; + Transaction txn = Transaction.open(Transaction.CLOUD_DB); + try { + try { + pstmt = txn.prepareAutoCloseStatement( + String.format("SELECT id FROM `%s` WHERE id=? OR uuid=?", mapper.entityTableName()) + + // TODO : after graceful period, use following line turn on more secure check + // String.format("SELECT id FROM %s WHERE (id=? AND uuid IS NULL) OR uuid=?", mapper.entityTableName()) + ); + + long id = 0; + try { + // TODO : use regular expression to determine + id = Long.parseLong(identityString); + } catch(NumberFormatException e) { + // this could happen when it is a uuid string, so catch and ignore it + } + + pstmt.setLong(1, id); + pstmt.setString(2, identityString); + + ResultSet rs = pstmt.executeQuery(); + if(rs.next()) { + return rs.getLong(1); + } + } catch (SQLException e) { + s_logger.error("Unexpected exception ", e); + } + } finally { + txn.close(); + } + return null; + } + + @DB + public String getIdentityUuid(String tableName, String identityString) { + assert(tableName != null); + assert(identityString != null); + + PreparedStatement pstmt = null; + Transaction txn = Transaction.open(Transaction.CLOUD_DB); + try { + try { + pstmt = txn.prepareAutoCloseStatement( + String.format("SELECT uuid FROM %s WHERE id=? OR uuid=?", tableName) + // String.format("SELECT uuid FROM %s WHERE (id=? AND uuid IS NULL) OR uuid=?", tableName) + ); + + long id = 0; + try { + // TODO : use regular expression to determine + id = Long.parseLong(identityString); + } catch(NumberFormatException e) { + // this could happen when it is a uuid string, so catch and ignore it + } + + pstmt.setLong(1, id); + pstmt.setString(2, identityString); + + ResultSet rs = pstmt.executeQuery(); + if(rs.next()) { + String uuid = rs.getString(1); + if(uuid != null && !uuid.isEmpty()) + return uuid; + return identityString; + } + } catch (SQLException e) { + s_logger.error("Unexpected exception ", e); + } + } finally { + txn.close(); + } + return null; + } +} diff --git a/server/src/com/cloud/network/IPAddressVO.java b/server/src/com/cloud/network/IPAddressVO.java index aa50c1dd938..d445a57d641 100644 --- a/server/src/com/cloud/network/IPAddressVO.java +++ b/server/src/com/cloud/network/IPAddressVO.java @@ -19,6 +19,7 @@ package com.cloud.network; import java.util.Date; +import java.util.UUID; import javax.persistence.Column; import javax.persistence.Entity; @@ -31,6 +32,7 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import com.cloud.api.Identity; import com.cloud.utils.net.Ip; /** @@ -39,7 +41,7 @@ import com.cloud.utils.net.Ip; */ @Entity @Table(name=("user_ip_address")) -public class IPAddressVO implements IpAddress { +public class IPAddressVO implements IpAddress, Identity { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column(name="id") @@ -86,8 +88,12 @@ public class IPAddressVO implements IpAddress { @Column(name="network_id") private Long associatedWithNetworkId; + + @Column(name="uuid") + private String uuid; - protected IPAddressVO() { + protected IPAddressVO() { + this.uuid = UUID.randomUUID().toString(); } @Override @@ -105,6 +111,7 @@ public class IPAddressVO implements IpAddress { this.allocatedTime = null; this.state = State.Free; this.macAddress = macAddress; + this.uuid = UUID.randomUUID().toString(); } public long getMacAddress() { @@ -229,5 +236,13 @@ public class IPAddressVO implements IpAddress { public void setSourceNetworkId(Long sourceNetworkId) { this.sourceNetworkId = sourceNetworkId; } - + + @Override + public String getUuid() { + return this.uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } } diff --git a/server/src/com/cloud/network/NetworkVO.java b/server/src/com/cloud/network/NetworkVO.java index 94bc3f003df..42c08eda889 100644 --- a/server/src/com/cloud/network/NetworkVO.java +++ b/server/src/com/cloud/network/NetworkVO.java @@ -21,6 +21,7 @@ import java.net.URI; import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.UUID; import javax.persistence.CollectionTable; import javax.persistence.Column; @@ -35,6 +36,7 @@ import javax.persistence.Table; import javax.persistence.TableGenerator; import javax.persistence.Transient; +import com.cloud.api.Identity; import com.cloud.network.Networks.BroadcastDomainType; import com.cloud.network.Networks.Mode; import com.cloud.network.Networks.TrafficType; @@ -48,7 +50,7 @@ import com.cloud.utils.net.NetUtils; */ @Entity @Table(name="networks") -public class NetworkVO implements Network { +public class NetworkVO implements Network, Identity { @Id @TableGenerator(name="networks_sq", table="sequence", pkColumnName="name", valueColumnName="value", pkColumnValue="networks_seq", allocationSize=1) @Column(name="id") @@ -150,8 +152,12 @@ public class NetworkVO implements Network { @Column(name="tag") @CollectionTable(name="network_tags", joinColumns=@JoinColumn(name="network_id")) List tags; + + @Column(name="uuid") + String uuid; public NetworkVO() { + this.uuid = UUID.randomUUID().toString(); } /** @@ -176,6 +182,7 @@ public class NetworkVO implements Network { } this.id = -1; this.guestType = guestType; + this.uuid = UUID.randomUUID().toString(); } public NetworkVO(long id, Network that, long offeringId, long dataCenterId, String guruName, long domainId, long accountId, long related, String name, String displayText, Boolean isShared, boolean isDefault, boolean isSecurityGroupEnabled, boolean isDomainSpecific, String networkDomain) { @@ -190,6 +197,7 @@ public class NetworkVO implements Network { if (state == null) { state = State.Allocated; } + this.uuid = UUID.randomUUID().toString(); } /** @@ -220,6 +228,7 @@ public class NetworkVO implements Network { this.isDefault = isDefault; this.isDomainSpecific = isDomainSpecific; this.networkDomain = networkDomain; + this.uuid = UUID.randomUUID().toString(); } @Override @@ -483,4 +492,13 @@ public class NetworkVO implements Network { buf.append(id).append("|").append(trafficType.toString()).append("|").append(networkOfferingId).append("]"); return buf.toString(); } + + @Override + public String getUuid() { + return this.uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } } diff --git a/server/src/com/cloud/network/rules/FirewallRuleVO.java b/server/src/com/cloud/network/rules/FirewallRuleVO.java index deebfb35f1c..9cb6fff2e49 100644 --- a/server/src/com/cloud/network/rules/FirewallRuleVO.java +++ b/server/src/com/cloud/network/rules/FirewallRuleVO.java @@ -35,6 +35,7 @@ import javax.persistence.InheritanceType; import javax.persistence.Table; import javax.persistence.Transient; +import com.cloud.api.Identity; import com.cloud.network.dao.FirewallRulesCidrsDaoImpl; import com.cloud.utils.component.ComponentLocator; import com.cloud.utils.db.GenericDao; @@ -44,7 +45,7 @@ import com.cloud.utils.net.NetUtils; @Table(name="firewall_rules") @Inheritance(strategy=InheritanceType.JOINED) @DiscriminatorColumn(name="purpose", discriminatorType=DiscriminatorType.STRING, length=32) -public class FirewallRuleVO implements FirewallRule { +public class FirewallRuleVO implements FirewallRule, Identity { protected final FirewallRulesCidrsDaoImpl _firewallRulesCidrsDao = ComponentLocator.inject(FirewallRulesCidrsDaoImpl.class); @Id @@ -104,6 +105,8 @@ public class FirewallRuleVO implements FirewallRule { @Transient List sourceCidrs; + @Column(name="uuid") + String uuid; public void setSourceCidrList(List sourceCidrs) { this.sourceCidrs=sourceCidrs; @@ -181,6 +184,7 @@ public class FirewallRuleVO implements FirewallRule { } protected FirewallRuleVO() { + this.uuid = UUID.randomUUID().toString(); } public FirewallRuleVO(String xId, long ipAddressId, Integer portStart, Integer portEnd, String protocol, long networkId, long accountId, long domainId, Purpose purpose, List sourceCidrs, Integer icmpCode, Integer icmpType, Long related) { @@ -206,6 +210,7 @@ public class FirewallRuleVO implements FirewallRule { } this.related = related; + this.uuid = UUID.randomUUID().toString(); } public FirewallRuleVO(String xId, long ipAddressId, int port, String protocol, long networkId, long accountId, long domainId, Purpose purpose, List sourceCidrs, Integer icmpCode, Integer icmpType, Long related) { @@ -232,4 +237,12 @@ public class FirewallRuleVO implements FirewallRule { return related; } + @Override + public String getUuid() { + return this.uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } } diff --git a/server/src/com/cloud/offerings/NetworkOfferingVO.java b/server/src/com/cloud/offerings/NetworkOfferingVO.java index da6c2a8a696..b700c0579df 100644 --- a/server/src/com/cloud/offerings/NetworkOfferingVO.java +++ b/server/src/com/cloud/offerings/NetworkOfferingVO.java @@ -18,6 +18,7 @@ package com.cloud.offerings; import java.util.Date; +import java.util.UUID; import javax.persistence.Column; import javax.persistence.Entity; @@ -28,6 +29,7 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; +import com.cloud.api.Identity; import com.cloud.network.Network.GuestIpType; import com.cloud.network.Networks.TrafficType; import com.cloud.offering.NetworkOffering; @@ -35,7 +37,7 @@ import com.cloud.utils.db.GenericDao; @Entity @Table(name="network_offerings") -public class NetworkOfferingVO implements NetworkOffering { +public class NetworkOfferingVO implements NetworkOffering, Identity { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @@ -119,6 +121,9 @@ public class NetworkOfferingVO implements NetworkOffering { @Column(name="redundant_router") boolean redundantRouter; + @Column(name="uuid") + String uuid; + @Override public String getDisplayText() { return displayText; @@ -362,6 +367,7 @@ public class NetworkOfferingVO implements NetworkOffering { this.guestType = guestIpType; this.redundantRouter = isRedundantRouterEnabled; this.uniqueName = name; + this.uuid = UUID.randomUUID().toString(); } /** @@ -378,4 +384,13 @@ public class NetworkOfferingVO implements NetworkOffering { StringBuilder buf = new StringBuilder("[Network Offering ["); return buf.append(id).append("-").append(trafficType).append("-").append(name).append("]").toString(); } + + @Override + public String getUuid() { + return this.uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } } diff --git a/server/src/com/cloud/projects/ProjectInvitationVO.java b/server/src/com/cloud/projects/ProjectInvitationVO.java index 5d612ef342f..26d14ed0f40 100644 --- a/server/src/com/cloud/projects/ProjectInvitationVO.java +++ b/server/src/com/cloud/projects/ProjectInvitationVO.java @@ -1,6 +1,7 @@ package com.cloud.projects; import java.util.Date; +import java.util.UUID; import javax.persistence.Column; import javax.persistence.Entity; @@ -11,11 +12,12 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; +import com.cloud.api.Identity; import com.cloud.utils.db.GenericDao; @Entity @Table(name="project_invitations") -public class ProjectInvitationVO implements ProjectInvitation{ +public class ProjectInvitationVO implements ProjectInvitation, Identity { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column(name="id") @@ -43,8 +45,11 @@ public class ProjectInvitationVO implements ProjectInvitation{ @Column(name=GenericDao.CREATED_COLUMN) private Date created; + @Column(name="uuid") + private String uuid; protected ProjectInvitationVO(){ + this.uuid = UUID.randomUUID().toString(); } public ProjectInvitationVO(long projectId, Long accountId, Long domainId, String email, String token) { @@ -53,6 +58,7 @@ public class ProjectInvitationVO implements ProjectInvitation{ this.projectId = projectId; this.email = email; this.token = token; + this.uuid = UUID.randomUUID().toString(); } @Override @@ -105,5 +111,13 @@ public class ProjectInvitationVO implements ProjectInvitation{ public Long getDomainId() { return domainId; } - + + @Override + public String getUuid() { + return this.uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } } diff --git a/server/src/com/cloud/projects/ProjectVO.java b/server/src/com/cloud/projects/ProjectVO.java index 02c74ba6e82..41359a74d3d 100644 --- a/server/src/com/cloud/projects/ProjectVO.java +++ b/server/src/com/cloud/projects/ProjectVO.java @@ -18,6 +18,7 @@ package com.cloud.projects; import java.util.Date; +import java.util.UUID; import javax.persistence.Column; import javax.persistence.Entity; @@ -28,11 +29,12 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; +import com.cloud.api.Identity; import com.cloud.utils.db.GenericDao; @Entity @Table(name="projects") -public class ProjectVO implements Project{ +public class ProjectVO implements Project, Identity { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column(name="id") @@ -60,7 +62,11 @@ public class ProjectVO implements Project{ @Column(name=GenericDao.REMOVED_COLUMN) private Date removed; + @Column(name="uuid") + private String uuid; + protected ProjectVO(){ + this.uuid = UUID.randomUUID().toString(); } public ProjectVO(String name, String displayText, long domainId, long projectAccountId) { @@ -69,6 +75,7 @@ public class ProjectVO implements Project{ this.projectAccountId = projectAccountId; this.domainId = domainId; this.state = State.Disabled; + this.uuid = UUID.randomUUID().toString(); } @Override @@ -145,4 +152,13 @@ public class ProjectVO implements Project{ this.state = state; } + @Override + public String getUuid() { + return this.uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + } diff --git a/server/src/com/cloud/server/api/response/ExternalFirewallResponse.java b/server/src/com/cloud/server/api/response/ExternalFirewallResponse.java index b5dad30080c..22a4e4b35f9 100644 --- a/server/src/com/cloud/server/api/response/ExternalFirewallResponse.java +++ b/server/src/com/cloud/server/api/response/ExternalFirewallResponse.java @@ -20,6 +20,7 @@ package com.cloud.server.api.response; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.api.response.BaseResponse; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; @@ -27,10 +28,10 @@ import com.google.gson.annotations.SerializedName; public class ExternalFirewallResponse extends BaseResponse { @SerializedName(ApiConstants.ID) @Param(description="the ID of the external firewall") - private Long id; + private IdentityProxy id = new IdentityProxy("host"); @SerializedName(ApiConstants.ZONE_ID) @Param(description="the zone ID of the external firewall") - private Long zoneId; + private IdentityProxy zoneId = new IdentityProxy("data_center"); @SerializedName(ApiConstants.IP_ADDRESS) @Param(description="the management IP address of the external firewall") private String ipAddress; @@ -60,19 +61,19 @@ public class ExternalFirewallResponse extends BaseResponse { private String timeout; public Long getId() { - return id; + return id.getValue(); } public void setId(Long id) { - this.id = id; + this.id.setValue(id); } public Long getZoneId() { - return zoneId; + return zoneId.getValue(); } public void setZoneId(Long zoneId) { - this.zoneId = zoneId; + this.zoneId.setValue(zoneId); } public String getIpAddress() { diff --git a/server/src/com/cloud/server/api/response/ExternalLoadBalancerResponse.java b/server/src/com/cloud/server/api/response/ExternalLoadBalancerResponse.java index 5d5baa68b0c..4d8835a2fd8 100644 --- a/server/src/com/cloud/server/api/response/ExternalLoadBalancerResponse.java +++ b/server/src/com/cloud/server/api/response/ExternalLoadBalancerResponse.java @@ -20,6 +20,7 @@ package com.cloud.server.api.response; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.api.response.BaseResponse; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; @@ -27,10 +28,10 @@ import com.google.gson.annotations.SerializedName; public class ExternalLoadBalancerResponse extends BaseResponse { @SerializedName(ApiConstants.ID) @Param(description="the ID of the external load balancer") - private Long id; + private IdentityProxy id = new IdentityProxy("host"); @SerializedName(ApiConstants.ZONE_ID) @Param(description="the zone ID of the external load balancer") - private Long zoneId; + private IdentityProxy zoneId = new IdentityProxy("data_center"); @SerializedName(ApiConstants.IP_ADDRESS) @Param(description="the management IP address of the external load balancer") private String ipAddress; @@ -48,19 +49,19 @@ public class ExternalLoadBalancerResponse extends BaseResponse { private String numRetries; public Long getId() { - return id; + return id.getValue(); } public void setId(Long id) { - this.id = id; + this.id.setValue(id); } public Long getZoneId() { - return zoneId; + return zoneId.getValue(); } public void setZoneId(Long zoneId) { - this.zoneId = zoneId; + this.zoneId.setValue(zoneId); } public String getIpAddress() { diff --git a/server/src/com/cloud/server/api/response/NetworkDeviceResponse.java b/server/src/com/cloud/server/api/response/NetworkDeviceResponse.java index e650ce653d0..11947897e33 100644 --- a/server/src/com/cloud/server/api/response/NetworkDeviceResponse.java +++ b/server/src/com/cloud/server/api/response/NetworkDeviceResponse.java @@ -1,6 +1,7 @@ package com.cloud.server.api.response; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.api.response.BaseResponse; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; @@ -8,13 +9,13 @@ import com.google.gson.annotations.SerializedName; public class NetworkDeviceResponse extends BaseResponse { @SerializedName(ApiConstants.ID) @Param(description = "the ID of the network device") - private Long id; + private IdentityProxy id = new IdentityProxy("host"); public Long getId() { - return id; + return id.getValue(); } public void setId(Long id) { - this.id = id; + this.id.setValue(id); } } diff --git a/server/src/com/cloud/server/api/response/UsageRecordResponse.java b/server/src/com/cloud/server/api/response/UsageRecordResponse.java index fcd06c593e1..f467114f943 100644 --- a/server/src/com/cloud/server/api/response/UsageRecordResponse.java +++ b/server/src/com/cloud/server/api/response/UsageRecordResponse.java @@ -20,6 +20,7 @@ package com.cloud.server.api.response; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.api.response.BaseResponse; import com.cloud.api.response.ControlledEntityResponse; import com.cloud.serializer.Param; @@ -31,22 +32,22 @@ public class UsageRecordResponse extends BaseResponse implements ControlledEntit private String accountName; @SerializedName(ApiConstants.ACCOUNT_ID) @Param(description="the user account Id") - private Long accountId; + private IdentityProxy accountId = new IdentityProxy("account"); @SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id of the ipaddress") - private Long projectId; + private IdentityProxy projectId = new IdentityProxy("projects"); @SerializedName(ApiConstants.PROJECT) @Param(description="the project name of the address") private String projectName; @SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain ID number") - private Long domainId; + private IdentityProxy domainId = new IdentityProxy("domain"); @SerializedName(ApiConstants.DOMAIN) @Param(description="the domain the public IP address is associated with") private String domainName; @SerializedName(ApiConstants.ZONE_ID) @Param(description="the zone ID number") - private Long zoneId; + private IdentityProxy zoneId = new IdentityProxy("data_center"); @SerializedName(ApiConstants.DESCRIPTION) @Param(description="description of account, including account name, service offering, and template") private String description; @@ -61,16 +62,16 @@ public class UsageRecordResponse extends BaseResponse implements ControlledEntit private String rawUsage; @SerializedName(ApiConstants.VIRTUAL_MACHINE_ID) @Param(description="virtual machine ID number") - private Long virtualMachineId; + private IdentityProxy virtualMachineId = new IdentityProxy("vm_instance"); @SerializedName(ApiConstants.NAME) @Param(description="virtual machine name") private String vmName; @SerializedName("offeringid") @Param(description="service offering ID number") - private Long serviceOfferingId; + private IdentityProxy serviceOfferingId = new IdentityProxy("disk_offering"); @SerializedName(ApiConstants.TEMPLATE_ID) @Param(description="template ID number") - private Long templateId; + private IdentityProxy templateId = new IdentityProxy("vm_template"); @SerializedName("usageid") @Param(description="id of the usage entity") private Long usageId; @@ -105,16 +106,16 @@ public class UsageRecordResponse extends BaseResponse implements ControlledEntit } public void setAccountId(Long accountId) { - this.accountId = accountId; + this.accountId.setValue(accountId); } @Override public void setDomainId(Long domainId) { - this.domainId = domainId; + this.domainId.setValue(domainId); } public void setZoneId(Long zoneId) { - this.zoneId = zoneId; + this.zoneId.setValue(zoneId); } public void setDescription(String description) { @@ -134,7 +135,7 @@ public class UsageRecordResponse extends BaseResponse implements ControlledEntit } public void setVirtualMachineId(Long virtualMachineId) { - this.virtualMachineId = virtualMachineId; + this.virtualMachineId.setValue(virtualMachineId); } public void setVmName(String vmName) { @@ -142,11 +143,11 @@ public class UsageRecordResponse extends BaseResponse implements ControlledEntit } public void setServiceOfferingId(Long serviceOfferingId) { - this.serviceOfferingId = serviceOfferingId; + this.serviceOfferingId.setValue(serviceOfferingId); } public void setTemplateId(Long templateId) { - this.templateId = templateId; + this.templateId.setValue(templateId); } public void setUsageId(Long usageId) { @@ -187,7 +188,7 @@ public class UsageRecordResponse extends BaseResponse implements ControlledEntit @Override public void setProjectId(Long projectId) { - this.projectId = projectId; + this.projectId.setValue(projectId); } @Override diff --git a/setup/db/create-schema.sql b/setup/db/create-schema.sql index 416fcd72a39..3e352462f3a 100755 --- a/setup/db/create-schema.sql +++ b/setup/db/create-schema.sql @@ -160,6 +160,7 @@ CREATE TABLE `cloud`.`op_networks`( CREATE TABLE `cloud`.`networks` ( `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', `name` varchar(255) COMMENT 'name for this network', + `uuid` varchar(40), `display_text` varchar(255) COMMENT 'display text for this network', `traffic_type` varchar(32) NOT NULL COMMENT 'type of traffic going through this network', `broadcast_domain_type` varchar(32) NOT NULL COMMENT 'type of broadcast domain used', @@ -193,6 +194,7 @@ CREATE TABLE `cloud`.`networks` ( CONSTRAINT `fk_networks__related` FOREIGN KEY(`related`) REFERENCES `networks`(`id`) ON DELETE CASCADE, CONSTRAINT `fk_networks__account_id` FOREIGN KEY(`account_id`) REFERENCES `account`(`id`), CONSTRAINT `fk_networks__domain_id` FOREIGN KEY(`domain_id`) REFERENCES `domain`(`id`), + CONSTRAINT `uc_networks__uuid` UNIQUE (`uuid`), INDEX `i_networks__removed`(`removed`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; @@ -247,6 +249,7 @@ CREATE TABLE `cloud`.`nics` ( CREATE TABLE `cloud`.`network_offerings` ( `id` bigint unsigned NOT NULL UNIQUE AUTO_INCREMENT COMMENT 'id', `name` varchar(64) NOT NULL COMMENT 'name of the network offering', + `uuid` varchar(40), `unique_name` varchar(64) NOT NULL UNIQUE COMMENT 'unique name of the network offering', `display_text` varchar(255) NOT NULL COMMENT 'text to display to users', `nw_rate` smallint unsigned COMMENT 'network rate throttle mbits/s', @@ -273,12 +276,14 @@ CREATE TABLE `cloud`.`network_offerings` ( `redundant_router` int(1) unsigned NOT NULL DEFAULT 0 COMMENT 'true if network offering provides redundant routers', PRIMARY KEY (`id`), INDEX `i_network_offerings__system_only`(`system_only`), - INDEX `i_network_offerings__removed`(`removed`) + INDEX `i_network_offerings__removed`(`removed`), + CONSTRAINT `uc_network_offerings__uuid` UNIQUE (`uuid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `cloud`.`cluster` ( `id` bigint unsigned NOT NULL UNIQUE AUTO_INCREMENT COMMENT 'id', `name` varchar(255) COMMENT 'name for the cluster', + `uuid` varchar(40) COMMENT 'uuid is different with following guid, while the later one is generated by hypervisor resource', `guid` varchar(255) UNIQUE DEFAULT NULL COMMENT 'guid for the cluster', `pod_id` bigint unsigned NOT NULL COMMENT 'pod id', `data_center_id` bigint unsigned NOT NULL COMMENT 'data center id', @@ -292,7 +297,8 @@ CREATE TABLE `cloud`.`cluster` ( CONSTRAINT `fk_cluster__pod_id` FOREIGN KEY (`pod_id`) REFERENCES `cloud`.`host_pod_ref`(`id`), UNIQUE `i_cluster__pod_id__name`(`pod_id`, `name`), INDEX `i_cluster__allocation_state`(`allocation_state`), - INDEX `i_cluster__removed`(`removed`) + INDEX `i_cluster__removed`(`removed`), + CONSTRAINT `uc_cluster__uuid` UNIQUE (`uuid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `cloud`.`cluster_details` ( @@ -386,6 +392,7 @@ CREATE TABLE `cloud`.`volumes` ( `instance_id` bigint unsigned NULL COMMENT 'vm instance it belongs to. foreign key to vm_instance table', `device_id` bigint unsigned NULL COMMENT 'which device inside vm instance it is ', `name` varchar(255) COMMENT 'A user specified name for the volume', + `uuid` varchar(40), `size` bigint unsigned NOT NULL COMMENT 'total size', `folder` varchar(255) COMMENT 'The folder where the volume is saved', `path` varchar(255) COMMENT 'Path', @@ -418,7 +425,8 @@ CREATE TABLE `cloud`.`volumes` ( CONSTRAINT `fk_volumes__instance_id` FOREIGN KEY `fk_volumes__instance_id` (`instance_id`) REFERENCES `vm_instance` (`id`) ON DELETE CASCADE, INDEX `i_volumes__instance_id`(`instance_id`), INDEX `i_volumes__state`(`state`), - INDEX `i_volumes__update_count`(`update_count`) + INDEX `i_volumes__update_count`(`update_count`), + CONSTRAINT `uc_volumes__uuid` UNIQUE (`uuid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `cloud`.`snapshots` ( @@ -431,6 +439,7 @@ CREATE TABLE `cloud`.`snapshots` ( `status` varchar(32) COMMENT 'snapshot creation status', `path` varchar(255) COMMENT 'Path', `name` varchar(255) NOT NULL COMMENT 'snapshot name', + `uuid` varchar(40), `snapshot_type` int(4) NOT NULL COMMENT 'type of snapshot, e.g. manual, recurring', `type_description` varchar(25) COMMENT 'description of the type of snapshot, e.g. manual, recurring', `size` bigint unsigned NOT NULL COMMENT 'original disk size of snapshot', @@ -442,11 +451,13 @@ CREATE TABLE `cloud`.`snapshots` ( `prev_snap_id` bigint unsigned COMMENT 'Id of the most recent snapshot', `hypervisor_type` varchar(32) NOT NULL COMMENT 'hypervisor that the snapshot was taken under', `version` varchar(32) COMMENT 'snapshot version', - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `uc_snapshots__uuid` UNIQUE (`uuid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `cloud`.`vlan` ( `id` bigint unsigned NOT NULL UNIQUE AUTO_INCREMENT, + `uuid` varchar(40), `vlan_id` varchar(255), `vlan_gateway` varchar(255), `vlan_netmask` varchar(255), @@ -455,8 +466,9 @@ CREATE TABLE `cloud`.`vlan` ( `data_center_id` bigint unsigned NOT NULL, `network_id` bigint unsigned NOT NULL COMMENT 'id of corresponding network offering', PRIMARY KEY (`id`), - #CONSTRAINT `fk_vlan__network_id` FOREIGN KEY (`network_id`) REFERENCES `networks`(`id`), - CONSTRAINT `fk_vlan__data_center_id` FOREIGN KEY (`data_center_id`) REFERENCES `data_center`(`id`) + CONSTRAINT `fk_vlan__network_id` FOREIGN KEY (`network_id`) REFERENCES `networks`(`id`), + CONSTRAINT `fk_vlan__data_center_id` FOREIGN KEY (`data_center_id`) REFERENCES `data_center`(`id`), + CONSTRAINT `uc_vlan__uuid` UNIQUE (`uuid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `cloud`.`pod_vlan_map` ( @@ -484,6 +496,7 @@ CREATE TABLE `cloud`.`account_vlan_map` ( CREATE TABLE `cloud`.`data_center` ( `id` bigint unsigned NOT NULL UNIQUE AUTO_INCREMENT, `name` varchar(255), + `uuid` varchar(40), `description` varchar(255), `dns1` varchar(255) NOT NULL, `dns2` varchar(255), @@ -514,7 +527,8 @@ CREATE TABLE `cloud`.`data_center` ( INDEX `i_data_center__domain_id`(`domain_id`), INDEX `i_data_center__allocation_state`(`allocation_state`), INDEX `i_data_center__zone_token`(`zone_token`), - INDEX `i_data_center__removed`(`removed`) + INDEX `i_data_center__removed`(`removed`), + CONSTRAINT `uc_data_center__uuid` UNIQUE (`uuid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `cloud`.`op_dc_ip_address_alloc` ( @@ -551,6 +565,7 @@ CREATE TABLE `cloud`.`op_dc_link_local_ip_address_alloc` ( CREATE TABLE `cloud`.`host_pod_ref` ( `id` bigint unsigned NOT NULL UNIQUE auto_increment, `name` varchar(255), + `uuid` varchar(40), `data_center_id` bigint unsigned NOT NULL, `gateway` varchar(255) NOT NULL COMMENT 'gateway for the pod', `cidr_address` varchar(15) NOT NULL COMMENT 'CIDR address for the pod', @@ -563,7 +578,8 @@ CREATE TABLE `cloud`.`host_pod_ref` ( UNIQUE KEY (`name`, `data_center_id`), INDEX `i_host_pod_ref__data_center_id`(`data_center_id`), INDEX `i_host_pod_ref__allocation_state`(`allocation_state`), - INDEX `i_host_pod_ref__removed`(`removed`) + INDEX `i_host_pod_ref__removed`(`removed`), + CONSTRAINT `uc_host_pod_ref__uuid` UNIQUE (`uuid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; @@ -582,6 +598,7 @@ CREATE TABLE `cloud`.`op_dc_vnet_alloc` ( CREATE TABLE `cloud`.`firewall_rules` ( `id` bigint unsigned NOT NULL auto_increment COMMENT 'id', + `uuid` varchar(40), `ip_address_id` bigint unsigned NOT NULL COMMENT 'id of the corresponding ip address', `start_port` int(10) COMMENT 'starting port of a port range', `end_port` int(10) COMMENT 'end port of a port range', @@ -602,7 +619,8 @@ CREATE TABLE `cloud`.`firewall_rules` ( CONSTRAINT `fk_firewall_rules__account_id` FOREIGN KEY(`account_id`) REFERENCES `account`(`id`) ON DELETE CASCADE, CONSTRAINT `fk_firewall_rules__domain_id` FOREIGN KEY(`domain_id`) REFERENCES `domain`(`id`) ON DELETE CASCADE, CONSTRAINT `fk_firewall_rules__related` FOREIGN KEY(`related`) REFERENCES `firewall_rules`(`id`) ON DELETE CASCADE, - INDEX `i_firewall_rules__purpose`(`purpose`) + INDEX `i_firewall_rules__purpose`(`purpose`), + CONSTRAINT `uc_firewall_rules__uuid` UNIQUE (`uuid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `cloud`.`firewall_rules_cidrs` ( @@ -662,6 +680,7 @@ CREATE TABLE `cloud`.`port_forwarding_rules` ( CREATE TABLE `cloud`.`host` ( `id` bigint unsigned NOT NULL auto_increment, `name` varchar(255) NOT NULL, + `uuid` varchar(40) COMMENT 'this uuid is different with guid below, the later one is used by hypervisor resource', `status` varchar(32) NOT NULL, `type` varchar(32) NOT NULL, `private_ip_address` char(40) NOT NULL, @@ -710,7 +729,8 @@ CREATE TABLE `cloud`.`host` ( INDEX `i_host__data_center_id`(`data_center_id`), CONSTRAINT `fk_host__pod_id` FOREIGN KEY (`pod_id`) REFERENCES `host_pod_ref` (`id`) ON DELETE CASCADE, INDEX `i_host__pod_id`(`pod_id`), - CONSTRAINT `fk_host__cluster_id` FOREIGN KEY (`cluster_id`) REFERENCES `cloud`.`cluster`(`id`) + CONSTRAINT `fk_host__cluster_id` FOREIGN KEY (`cluster_id`) REFERENCES `cloud`.`cluster`(`id`), + CONSTRAINT `uc_host__uuid` UNIQUE (`uuid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `cloud`.`op_host` ( @@ -756,6 +776,7 @@ CREATE TABLE `cloud`.`host_tags` ( CREATE TABLE `cloud`.`user` ( `id` bigint unsigned NOT NULL auto_increment, + `uuid` varchar(40), `username` varchar(255) NOT NULL, `password` varchar(255) NOT NULL, `account_id` bigint unsigned NOT NULL, @@ -775,11 +796,13 @@ CREATE TABLE `cloud`.`user` ( INDEX `i_user__secret_key_removed`(`secret_key`, `removed`), UNIQUE `i_user__api_key`(`api_key`), CONSTRAINT `fk_user__account_id` FOREIGN KEY `fk_user__account_id` (`account_id`) REFERENCES `account` (`id`) ON DELETE CASCADE, - INDEX `i_user__account_id`(`account_id`) + INDEX `i_user__account_id`(`account_id`), + CONSTRAINT `uc_user__uuid` UNIQUE (`uuid`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; CREATE TABLE `cloud`.`event` ( `id` bigint unsigned NOT NULL auto_increment, + `uuid` varchar(40), `type` varchar(32) NOT NULL, `state` varchar(32) NOT NULL DEFAULT 'Completed', `description` varchar(1024) NOT NULL, @@ -789,11 +812,13 @@ CREATE TABLE `cloud`.`event` ( `level` varchar(16) NOT NULL, `start_id` bigint unsigned NOT NULL DEFAULT 0, `parameters` varchar(1024) NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `uc_event__uuid` UNIQUE (`uuid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `cloud`.`user_ip_address` ( `id` bigint unsigned NOT NULL UNIQUE auto_increment, + `uuid` varchar(40), `account_id` bigint unsigned NULL, `domain_id` bigint unsigned NULL, `public_ip_address` char(40) NOT NULL, @@ -815,6 +840,7 @@ CREATE TABLE `cloud`.`user_ip_address` ( CONSTRAINT `fk_user_ip_address__vm_id` FOREIGN KEY (`vm_id`) REFERENCES `vm_instance`(`id`), CONSTRAINT `fk_user_ip_address__vlan_db_id` FOREIGN KEY (`vlan_db_id`) REFERENCES `vlan`(`id`) ON DELETE CASCADE, CONSTRAINT `fk_user_ip_address__data_center_id` FOREIGN KEY (`data_center_id`) REFERENCES `data_center`(`id`) ON DELETE CASCADE, + CONSTRAINT `uc_user_ip_address__uuid` UNIQUE (`uuid`), INDEX `i_user_ip_address__allocated`(`allocated`), INDEX `i_user_ip_address__source_nat`(`source_nat`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; @@ -842,6 +868,7 @@ CREATE TABLE `cloud`.`vm_template` ( `id` bigint unsigned NOT NULL auto_increment, `unique_name` varchar(255) NOT NULL, `name` varchar(255) NOT NULL, + `uuid` varchar(40), `public` int(1) unsigned NOT NULL, `featured` int(1) unsigned NOT NULL, `type` varchar(32) NULL, @@ -864,13 +891,14 @@ CREATE TABLE `cloud`.`vm_template` ( `source_template_id` bigint unsigned COMMENT 'Id of the original template, if this template is created from snapshot', `template_tag` varchar(255) COMMENT 'template tag', PRIMARY KEY (`id`), - INDEX `i_vm_template__removed`(`removed`) + INDEX `i_vm_template__removed`(`removed`), + CONSTRAINT `uc_vm_template__uuid` UNIQUE (`uuid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `cloud`.`vm_instance` ( `id` bigint unsigned UNIQUE NOT NULL, `name` varchar(255) NOT NULL, - `uuid` varchar(255), + `uuid` varchar(40), `instance_name` varchar(255) NOT NULL COMMENT 'name of the vm instance running on the hosts', `state` varchar(32) NOT NULL, `vm_template_id` bigint unsigned, @@ -1056,6 +1084,7 @@ CREATE TABLE `cloud`.`domain` ( `id` bigint unsigned NOT NULL auto_increment, `parent` bigint unsigned, `name` varchar(255), + `uuid` varchar(40), `owner` bigint unsigned NOT NULL, `path` varchar(255) NOT NULL, `level` int(10) NOT NULL DEFAULT 0, @@ -1068,12 +1097,14 @@ CREATE TABLE `cloud`.`domain` ( PRIMARY KEY (`id`), UNIQUE (parent, name, removed), INDEX `i_domain__path`(`path`), - INDEX `i_domain__removed`(`removed`) + INDEX `i_domain__removed`(`removed`), + CONSTRAINT `uc_domain__uuid` UNIQUE (`uuid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `cloud`.`account` ( `id` bigint unsigned NOT NULL auto_increment, `account_name` varchar(100) COMMENT 'an account name set by the creator of the account, defaults to username for single accounts', + `uuid` varchar(40), `type` int(1) unsigned NOT NULL, `domain_id` bigint unsigned, `state` varchar(10) NOT NULL default 'enabled', @@ -1081,7 +1112,8 @@ CREATE TABLE `cloud`.`account` ( `cleanup_needed` tinyint(1) NOT NULL default '0', `network_domain` varchar(255), PRIMARY KEY (`id`), - INDEX i_account__removed(`removed`) + INDEX i_account__removed(`removed`), + CONSTRAINT `uc_account__uuid` UNIQUE (`uuid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `cloud`.`resource_limit` ( @@ -1126,6 +1158,7 @@ CREATE TABLE `cloud`.`op_host_capacity` ( CREATE TABLE `cloud`.`alert` ( `id` bigint unsigned NOT NULL auto_increment, + `uuid` varchar(40), `type` int(1) unsigned NOT NULL, `cluster_id` bigint unsigned, `pod_id` bigint unsigned, @@ -1135,7 +1168,8 @@ CREATE TABLE `cloud`.`alert` ( `created` DATETIME NULL COMMENT 'when this alert type was created', `last_sent` DATETIME NULL COMMENT 'Last time the alert was sent', `resolved` DATETIME NULL COMMENT 'when the alert status was resolved (available memory no longer at critical level, etc.)', - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `uc_alert__uuid` UNIQUE (`uuid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `cloud`.`async_job` ( @@ -1161,7 +1195,7 @@ CREATE TABLE `cloud`.`async_job` ( `last_updated` datetime COMMENT 'date created', `last_polled` datetime COMMENT 'date polled', `removed` datetime COMMENT 'date removed', - `uuid` varchar(255), + `uuid` varchar(40), PRIMARY KEY (`id`), INDEX `i_async_job__removed`(`removed`), INDEX `i_async__user_id`(`user_id`), @@ -1221,6 +1255,7 @@ CREATE TABLE `cloud`.`disk_offering` ( `id` bigint unsigned NOT NULL auto_increment, `domain_id` bigint unsigned, `name` varchar(255) NOT NULL, + `uuid` varchar(40), `display_text` varchar(4096) NULL COMMENT 'Descrianaption text set by the admin for display purpose only', `disk_size` bigint unsigned NOT NULL COMMENT 'disk space in byte', `type` varchar(32) COMMENT 'inheritted by who?', @@ -1233,7 +1268,8 @@ CREATE TABLE `cloud`.`disk_offering` ( `removed` datetime COMMENT 'date removed', `created` datetime COMMENT 'date the disk offering was created', PRIMARY KEY (`id`), - INDEX `i_disk_offering__removed`(`removed`) + INDEX `i_disk_offering__removed`(`removed`), + CONSTRAINT `uc_disk_offering__uuid` UNIQUE (`uuid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `cloud`.`service_offering` ( @@ -1280,6 +1316,7 @@ CREATE TABLE `cloud`.`remote_access_vpn` ( CREATE TABLE `cloud`.`vpn_users` ( `id` bigint unsigned NOT NULL UNIQUE auto_increment, + `uuid` varchar(40), `owner_id` bigint unsigned NOT NULL, `domain_id` bigint unsigned NOT NULL, `username` varchar(255) NOT NULL, @@ -1289,7 +1326,8 @@ CREATE TABLE `cloud`.`vpn_users` ( CONSTRAINT `fk_vpn_users__owner_id` FOREIGN KEY (`owner_id`) REFERENCES `account`(`id`) ON DELETE CASCADE, CONSTRAINT `fk_vpn_users__domain_id` FOREIGN KEY (`domain_id`) REFERENCES `domain`(`id`) ON DELETE CASCADE, INDEX `i_vpn_users_username`(`username`), - UNIQUE `i_vpn_users__account_id__username`(`owner_id`, `username`) + UNIQUE `i_vpn_users__account_id__username`(`owner_id`, `username`), + CONSTRAINT `uc_vpn_users__uuid` UNIQUE (`uuid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `cloud`.`storage_pool` ( @@ -1362,8 +1400,10 @@ CREATE TABLE `cloud`.`guest_os` ( `id` bigint unsigned NOT NULL auto_increment, `category_id` bigint unsigned NOT NULL, `name` varchar(255), + `uuid` varchar(40), `display_name` varchar(255) NOT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `uc_guest_os__uuid` UNIQUE (`uuid`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; CREATE TABLE `cloud`.`guest_os_hypervisor` ( @@ -1377,16 +1417,20 @@ CREATE TABLE `cloud`.`guest_os_hypervisor` ( CREATE TABLE `cloud`.`guest_os_category` ( `id` bigint unsigned NOT NULL auto_increment, `name` varchar(255) NOT NULL, - PRIMARY KEY (`id`) + `uuid` varchar(40), + PRIMARY KEY (`id`), + CONSTRAINT `uc_guest_os_category__uuid` UNIQUE (`uuid`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; CREATE TABLE `cloud`.`hypervisor_capabilities` ( `id` bigint unsigned NOT NULL auto_increment, + `uuid` varchar(40), `hypervisor_type` varchar(32) NOT NULL, `hypervisor_version` varchar(32), `max_guests_limit` bigint unsigned DEFAULT 50, `security_group_enabled` int(1) unsigned DEFAULT 1 COMMENT 'Is security group supported', - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `uc_hypervisor_capabilities__uuid` UNIQUE (`uuid`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled) VALUES ('XenServer', 'default', 50, 1); @@ -1411,13 +1455,15 @@ CREATE TABLE `cloud`.`launch_permission` ( CREATE TABLE `cloud`.`snapshot_policy` ( `id` bigint unsigned NOT NULL auto_increment, + `uuid` varchar(40), `volume_id` bigint unsigned NOT NULL, `schedule` varchar(100) NOT NULL COMMENT 'schedule time of execution', `timezone` varchar(100) NOT NULL COMMENT 'the timezone in which the schedule time is specified', `interval` int(4) NOT NULL default 4 COMMENT 'backup schedule, e.g. hourly, daily, etc.', `max_snaps` int(8) NOT NULL default 0 COMMENT 'maximum number of snapshots to maintain', `active` tinyint(1) unsigned NOT NULL COMMENT 'Is the policy active', - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `uc_snapshot_policy__uuid` UNIQUE (`uuid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `cloud`.`snapshot_schedule` ( @@ -1444,15 +1490,18 @@ CREATE TABLE `cloud`.`op_pod_vlan_alloc` ( CREATE TABLE `cloud`.`security_group` ( `id` bigint unsigned NOT NULL auto_increment, `name` varchar(255) NOT NULL, + `uuid` varchar(40), `description` varchar(4096) NULL, `domain_id` bigint unsigned NOT NULL, `account_id` bigint unsigned NOT NULL, UNIQUE (`name`, `account_id`), - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `uc_security_group__uuid` UNIQUE (`uuid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `cloud`.`security_ingress_rule` ( `id` bigint unsigned NOT NULL auto_increment, + `uuid` varchar(40), `security_group_id` bigint unsigned NOT NULL, `start_port` varchar(10) default NULL, `end_port` varchar(10) default NULL, @@ -1460,7 +1509,8 @@ CREATE TABLE `cloud`.`security_ingress_rule` ( `allowed_network_id` bigint unsigned, `allowed_ip_cidr` varchar(44), `create_status` varchar(32) COMMENT 'rule creation status', - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `uc_security_ingress_rule__uuid` UNIQUE (`uuid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `cloud`.`security_egress_rule` ( @@ -1511,10 +1561,12 @@ CREATE TABLE `cloud`.`instance_group` ( `id` bigint unsigned NOT NULL UNIQUE auto_increment, `account_id` bigint unsigned NOT NULL COMMENT 'owner. foreign key to account table', `name` varchar(255) NOT NULL, + `uuid` varchar(40), `removed` datetime COMMENT 'date the group was removed', `created` datetime COMMENT 'date the group was created', PRIMARY KEY (`id`), - INDEX `i_instance_group__removed`(`removed`) + INDEX `i_instance_group__removed`(`removed`), + CONSTRAINT `uc_instance_group__uuid` UNIQUE (`uuid`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; CREATE TABLE `cloud`.`instance_group_vm_map` ( @@ -1694,6 +1746,7 @@ CREATE TABLE `cloud`.`op_host_transfer` ( CREATE TABLE `cloud`.`projects` ( `id` bigint unsigned NOT NULL auto_increment, `name` varchar(255) COMMENT 'project name', + `uuid` varchar(40), `display_text` varchar(255) COMMENT 'project name', `project_account_id` bigint unsigned NOT NULL, `domain_id` bigint unsigned NOT NULL, @@ -1703,7 +1756,8 @@ CREATE TABLE `cloud`.`projects` ( PRIMARY KEY (`id`), CONSTRAINT `fk_projects__project_account_id` FOREIGN KEY(`project_account_id`) REFERENCES `account`(`id`) ON DELETE CASCADE, CONSTRAINT `fk_projects__domain_id` FOREIGN KEY(`domain_id`) REFERENCES `domain`(`id`) ON DELETE CASCADE, - INDEX `i_projects__removed`(`removed`) + INDEX `i_projects__removed`(`removed`), + CONSTRAINT `uc_projects__uuid` UNIQUE (`uuid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; @@ -1724,6 +1778,7 @@ CREATE TABLE `cloud`.`project_account` ( CREATE TABLE `cloud`.`project_invitations` ( `id` bigint unsigned NOT NULL auto_increment, + `uuid` varchar(40), `project_id` bigint unsigned NOT NULL COMMENT 'project id', `account_id` bigint unsigned COMMENT 'account id', `domain_id` bigint unsigned COMMENT 'domain id', @@ -1737,7 +1792,8 @@ CREATE TABLE `cloud`.`project_invitations` ( CONSTRAINT `fk_project_invitations__project_id` FOREIGN KEY(`project_id`) REFERENCES `projects`(`id`) ON DELETE CASCADE, UNIQUE (`project_id`, `account_id`), UNIQUE (`project_id`, `email`), - UNIQUE (`project_id`, `token`) + UNIQUE (`project_id`, `token`), + CONSTRAINT `uc_project_invitations__uuid` UNIQUE (`uuid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/setup/db/db/schema-2213to30.sql b/setup/db/db/schema-2213to30.sql index da51ede9545..1f9afdce4ab 100755 --- a/setup/db/db/schema-2213to30.sql +++ b/setup/db/db/schema-2213to30.sql @@ -108,17 +108,103 @@ update configuration set name = 'cluster.memory.capacity.notificationthreshold' update configuration set name = 'zone.virtualnetwork.publicip.capacity.notificationthreshold' , category = 'Alert' where name = 'public.ip.capacity.threshold' ; update configuration set name = 'pod.privateip.capacity.notificationthreshold' , category = 'Alert' where name = 'private.ip.capacity.threshold' ; - ALTER TABLE `cloud`.`domain_router` ADD COLUMN `template_version` varchar(100) COMMENT 'template version' AFTER role; ALTER TABLE `cloud`.`domain_router` ADD COLUMN `scripts_version` varchar(100) COMMENT 'scripts version' AFTER template_version; ALTER TABLE `cloud`.`alert` ADD `cluster_id` bigint unsigned; +ALTER TABLE `cloud`.`vm_instance` ADD COLUMN `uuid` varchar(255); DELETE from `cloud`.`op_host_capacity` where capacity_type in (2,4,6); ALTER TABLE `cloud`.`user_statistics` ADD COLUMN `agg_bytes_received` bigint unsigned NOT NULL default '0'; ALTER TABLE `cloud`.`user_statistics` ADD COLUMN `agg_bytes_sent` bigint unsigned NOT NULL default '0'; ALTER TABLE `cloud`.`vm_instance` ADD COLUMN `uuid` varchar(255); +ALTER TABLE `cloud`.`vm_instance` ADD COLUMN `uuid` varchar(40); ALTER TABLE `cloud`.`vm_instance` ADD CONSTRAINT `uc_vm_instance_uuid` UNIQUE (`uuid`); -ALTER TABLE `cloud`.`async_job` ADD COLUMN `uuid` varchar(255); +ALTER TABLE `cloud`.`async_job` ADD COLUMN `uuid` varchar(40); ALTER TABLE `cloud`.`async_job` ADD CONSTRAINT `uc_async__uuid` UNIQUE (`uuid`); + +ALTER TABLE `cloud`.`domain` ADD COLUMN `uuid` varchar(40); +ALTER TABLE `cloud`.`domain` ADD CONSTRAINT `uc_domain__uuid` UNIQUE (`uuid`); + +ALTER TABLE `cloud`.`account` ADD COLUMN `uuid` varchar(40); +ALTER TABLE `cloud`.`account` ADD CONSTRAINT `uc_account__uuid` UNIQUE (`uuid`); + +ALTER TABLE `cloud`.`user` ADD COLUMN `uuid` varchar(40); +ALTER TABLE `cloud`.`user` ADD CONSTRAINT `uc_user__uuid` UNIQUE (`uuid`); + +ALTER TABLE `cloud`.`projects` ADD COLUMN `uuid` varchar(40); +ALTER TABLE `cloud`.`projects` ADD CONSTRAINT `uc_projects__uuid` UNIQUE (`uuid`); + +ALTER TABLE `cloud`.`project_invitations` ADD COLUMN `uuid` varchar(40); +ALTER TABLE `cloud`.`project_invitations` ADD CONSTRAINT `uc_project_invitations__uuid` UNIQUE (`uuid`); + +ALTER TABLE `cloud`.`data_center` ADD COLUMN `uuid` varchar(40); +ALTER TABLE `cloud`.`data_center` ADD CONSTRAINT `uc_data_center__uuid` UNIQUE (`uuid`); + +ALTER TABLE `cloud`.`host` ADD COLUMN `uuid` varchar(40); +ALTER TABLE `cloud`.`host` ADD CONSTRAINT `uc_host__uuid` UNIQUE (`uuid`); + +ALTER TABLE `cloud`.`vm_template` ADD COLUMN `uuid` varchar(40); +ALTER TABLE `cloud`.`vm_template` ADD CONSTRAINT `uc_vm_template__uuid` UNIQUE (`uuid`); + +ALTER TABLE `cloud`.`disk_offering` ADD COLUMN `uuid` varchar(40); +ALTER TABLE `cloud`.`disk_offering` ADD CONSTRAINT `uc_disk_offering__uuid` UNIQUE (`uuid`); + +ALTER TABLE `cloud`.`networks` ADD COLUMN `uuid` varchar(40); +ALTER TABLE `cloud`.`networks` ADD CONSTRAINT `uc_networks__uuid` UNIQUE (`uuid`); + +ALTER TABLE `cloud`.`security_group` ADD COLUMN `uuid` varchar(40); +ALTER TABLE `cloud`.`security_group` ADD CONSTRAINT `uc_security_group__uuid` UNIQUE (`uuid`); + +ALTER TABLE `cloud`.`instance_group` ADD COLUMN `uuid` varchar(40); +ALTER TABLE `cloud`.`instance_group` ADD CONSTRAINT `uc_instance_group__uuid` UNIQUE (`uuid`); + +ALTER TABLE `cloud`.`host_pod_ref` ADD COLUMN `uuid` varchar(40); +ALTER TABLE `cloud`.`host_pod_ref` ADD CONSTRAINT `uc_host_pod_ref__uuid` UNIQUE (`uuid`); + +ALTER TABLE `cloud`.`snapshots` ADD COLUMN `uuid` varchar(40); +ALTER TABLE `cloud`.`snapshots` ADD CONSTRAINT `uc_snapshots__uuid` UNIQUE (`uuid`); + +ALTER TABLE `cloud`.`snapshot_policy` ADD COLUMN `uuid` varchar(40); +ALTER TABLE `cloud`.`snapshot_policy` ADD CONSTRAINT `uc_snapshot_policy__uuid` UNIQUE (`uuid`); + +ALTER TABLE `cloud`.`volumes` ADD COLUMN `uuid` varchar(40); +ALTER TABLE `cloud`.`volumes` ADD CONSTRAINT `uc_volumes__uuid` UNIQUE (`uuid`); + +ALTER TABLE `cloud`.`vlan` ADD COLUMN `uuid` varchar(40); +ALTER TABLE `cloud`.`vlan` ADD CONSTRAINT `uc_vlan__uuid` UNIQUE (`uuid`); + +ALTER TABLE `cloud`.`user_ip_address` ADD COLUMN `uuid` varchar(40); +ALTER TABLE `cloud`.`user_ip_address` ADD CONSTRAINT `uc_user_ip_address__uuid` UNIQUE (`uuid`); + +ALTER TABLE `cloud`.`firewall_rules` ADD COLUMN `uuid` varchar(40); +ALTER TABLE `cloud`.`firewall_rules` ADD CONSTRAINT `uc_firewall_rules__uuid` UNIQUE (`uuid`); + +ALTER TABLE `cloud`.`cluster` ADD COLUMN `uuid` varchar(40); +ALTER TABLE `cloud`.`cluster` ADD CONSTRAINT `uc_cluster__uuid` UNIQUE (`uuid`); + +ALTER TABLE `cloud`.`security_ingress_rule` ADD COLUMN `uuid` varchar(40); +ALTER TABLE `cloud`.`security_ingress_rule` ADD CONSTRAINT `uc_security_ingress_rule__uuid` UNIQUE (`uuid`); + +ALTER TABLE `cloud`.`network_offerings` ADD COLUMN `uuid` varchar(40); +ALTER TABLE `cloud`.`network_offerings` ADD CONSTRAINT `uc_network_offerings__uuid` UNIQUE (`uuid`); + +ALTER TABLE `cloud`.`hypervisor_capabilities` ADD COLUMN `uuid` varchar(40); +ALTER TABLE `cloud`.`hypervisor_capabilities` ADD CONSTRAINT `uc_hypervisor_capabilities__uuid` UNIQUE (`uuid`); + +ALTER TABLE `cloud`.`vpn_users` ADD COLUMN `uuid` varchar(40); +ALTER TABLE `cloud`.`vpn_users` ADD CONSTRAINT `uc_vpn_users__uuid` UNIQUE (`uuid`); + +ALTER TABLE `cloud`.`event` ADD COLUMN `uuid` varchar(40); +ALTER TABLE `cloud`.`event` ADD CONSTRAINT `uc_event__uuid` UNIQUE (`uuid`); + +ALTER TABLE `cloud`.`alert` ADD COLUMN `uuid` varchar(40); +ALTER TABLE `cloud`.`alert` ADD CONSTRAINT `uc_alert__uuid` UNIQUE (`uuid`); + +ALTER TABLE `cloud`.`guest_os` ADD COLUMN `uuid` varchar(40); +ALTER TABLE `cloud`.`guest_os` ADD CONSTRAINT `uc_guest_os__uuid` UNIQUE (`uuid`); + +ALTER TABLE `cloud`.`guest_os_category` ADD COLUMN `uuid` varchar(40); +ALTER TABLE `cloud`.`guest_os_category` ADD CONSTRAINT `uc_guest_os_category__uuid` UNIQUE (`uuid`); + diff --git a/utils/src/com/cloud/utils/DateUtil.java b/utils/src/com/cloud/utils/DateUtil.java index 67a6536e2a3..66e0bd507f3 100644 --- a/utils/src/com/cloud/utils/DateUtil.java +++ b/utils/src/com/cloud/utils/DateUtil.java @@ -227,9 +227,8 @@ public class DateUtil { } return scheduleTime.getTime(); - } - - + } + // test only public static void main(String[] args) { TimeZone localTimezone = Calendar.getInstance().getTimeZone();