cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mc...@apache.org
Subject [48/50] [abbrv] Merge branch 'master' into rbac.
Date Fri, 17 Jan 2014 22:40:50 GMT
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/nat/CreateIpForwardingRuleCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/nat/CreateIpForwardingRuleCmd.java
index 4e78230,0917d52..201bd38
--- a/api/src/org/apache/cloudstack/api/command/user/nat/CreateIpForwardingRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/nat/CreateIpForwardingRuleCmd.java
@@@ -18,7 -18,8 +18,9 @@@ package org.apache.cloudstack.api.comma
  
  import java.util.List;
  
+ import org.apache.log4j.Logger;
+ 
 +import org.apache.cloudstack.acl.AclEntityType;
  import org.apache.cloudstack.api.APICommand;
  import org.apache.cloudstack.api.ApiCommandJobType;
  import org.apache.cloudstack.api.ApiConstants;
@@@ -124,7 -126,7 +127,7 @@@ public class CreateIpForwardingRuleCmd 
              StaticNatRule staticNatRule = _rulesService.buildStaticNatRule(rule, false);
              IpForwardingRuleResponse fwResponse = _responseGenerator.createIpForwardingRuleResponse(staticNatRule);
              fwResponse.setResponseName(getCommandName());
--            this.setResponseObject(fwResponse);
++            setResponseObject(fwResponse);
          } finally {
              if (!result || rule == null) {
  
@@@ -149,8 -152,8 +153,8 @@@
  
          try {
              StaticNatRule rule = _rulesService.createStaticNatRule(this, getOpenFirewall());
--            this.setEntityId(rule.getId());
--            this.setEntityUuid(rule.getUuid());
++            setEntityId(rule.getId());
++            setEntityUuid(rule.getUuid());
          } catch (NetworkRuleConflictException e) {
              s_logger.info("Unable to create Static Nat Rule due to ", e);
              throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, e.getMessage());
@@@ -176,7 -179,7 +180,7 @@@
      @Override
      public String getEventDescription() {
          IpAddress ip = _networkService.getIp(ipAddressId);
-         return  ("Applying an ipforwarding 1:1 NAT rule for Ip: "+ip.getAddress()+" with virtual machine:"+ this.getVirtualMachineId());
 -        return ("Applying an ipforwarding 1:1 NAT rule for Ip: " + ip.getAddress() + " with virtual machine:" + this.getVirtualMachineId());
++        return ("Applying an ipforwarding 1:1 NAT rule for Ip: " + ip.getAddress() + " with virtual machine:" + getVirtualMachineId());
      }
  
      private long getVirtualMachineId() {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkCmd.java
index ad196f2,c1e56ebd..98287be
--- a/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkCmd.java
@@@ -284,13 -295,14 +292,14 @@@ public class CreateNetworkCmd extends B
  
      @Override
      // an exception thrown by createNetwork() will be caught by the dispatcher.
-     public void execute() throws InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException{
+         public
+         void execute() throws InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException {
          Network result = _networkService.createGuestNetwork(this);
          if (result != null) {
 -            NetworkResponse response = _responseGenerator.createNetworkResponse(result);
 +            NetworkResponse response = _responseGenerator.createNetworkResponse(ResponseView.Restricted, result);
              response.setResponseName(getCommandName());
              setResponseObject(response);
-         }else {
+         } else {
              throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create network");
          }
      }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java
index 755b751,111fac3..a927a78
--- a/api/src/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java
@@@ -31,13 -28,15 +31,14 @@@ import org.apache.cloudstack.api.respon
  import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
  import org.apache.cloudstack.api.response.VpcResponse;
  import org.apache.cloudstack.api.response.ZoneResponse;
 -import org.apache.log4j.Logger;
  
  import com.cloud.network.Network;
+ import com.cloud.utils.Pair;
  
 -@APICommand(name = "listNetworks", description = "Lists all available networks.", responseObject = NetworkResponse.class)
 +@APICommand(name = "listNetworks", description = "Lists all available networks.", responseObject = NetworkResponse.class, responseView = ResponseView.Restricted)
  public class ListNetworksCmd extends BaseListTaggedResourcesCmd {
      public static final Logger s_logger = Logger.getLogger(ListNetworksCmd.class.getName());
-     private static final String _name = "listnetworksresponse";
+     private static final String Name = "listnetworksresponse";
  
      /////////////////////////////////////////////////////
      //////////////// API parameters /////////////////////
@@@ -151,17 -145,16 +147,16 @@@
      }
  
      @Override
-     public void execute(){
-         List<? extends Network> networks = _networkService.searchForNetworks(this);
+     public void execute() {
+         Pair<List<? extends Network>, Integer> networks = _networkService.searchForNetworks(this);
          ListResponse<NetworkResponse> response = new ListResponse<NetworkResponse>();
          List<NetworkResponse> networkResponses = new ArrayList<NetworkResponse>();
-         for (Network network : networks) {
+         for (Network network : networks.first()) {
 -            NetworkResponse networkResponse = _responseGenerator.createNetworkResponse(network);
 +            NetworkResponse networkResponse = _responseGenerator.createNetworkResponse(ResponseView.Restricted, network);
              networkResponses.add(networkResponse);
          }
- 
-         response.setResponses(networkResponses);
+         response.setResponses(networkResponses, networks.second());
          response.setResponseName(getCommandName());
 -        this.setResponseObject(response);
 +        setResponseObject(response);
      }
  }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java
index a08b931,2091102..ba0ae32
--- a/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java
@@@ -47,30 -46,30 +47,31 @@@ public class UpdateNetworkCmd extends B
      /////////////////////////////////////////////////////
      //////////////// API parameters /////////////////////
      /////////////////////////////////////////////////////
 -    @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = NetworkResponse.class, required = true, description = "the ID of the network")
 -    private Long id;
 +    @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = NetworkResponse.class,
 +            required=true, description="the ID of the network")
 +    protected Long id;
  
-     @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the new name for the network")
+     @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the new name for the network")
      private String name;
  
-     @Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, description="the new display text for the network")
+     @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, description = "the new display text for the network")
      private String displayText;
  
-     @Parameter(name=ApiConstants.NETWORK_DOMAIN, type=CommandType.STRING, description="network domain")
+     @Parameter(name = ApiConstants.NETWORK_DOMAIN, type = CommandType.STRING, description = "network domain")
      private String networkDomain;
  
-     @Parameter(name=ApiConstants.CHANGE_CIDR, type=CommandType.BOOLEAN, description="Force update even if cidr type is different")
+     @Parameter(name = ApiConstants.CHANGE_CIDR, type = CommandType.BOOLEAN, description = "Force update even if cidr type is different")
      private Boolean changeCidr;
  
-     @Parameter(name=ApiConstants.NETWORK_OFFERING_ID, type=CommandType.UUID, entityType = NetworkOfferingResponse.class,
-             description="network offering ID")
+     @Parameter(name = ApiConstants.NETWORK_OFFERING_ID, type = CommandType.UUID, entityType = NetworkOfferingResponse.class, description = "network offering ID")
      private Long networkOfferingId;
  
-     @Parameter(name=ApiConstants.GUEST_VM_CIDR, type=CommandType.STRING, description="CIDR for Guest VMs,Cloudstack allocates IPs to Guest VMs only from this CIDR")
+     @Parameter(name = ApiConstants.GUEST_VM_CIDR, type = CommandType.STRING, description = "CIDR for Guest VMs,Cloudstack allocates IPs to Guest VMs only from this CIDR")
      private String guestVmCidr;
  
-     @Parameter(name=ApiConstants.DISPLAY_NETWORK, type=CommandType.BOOLEAN, description="an optional field, whether to the display the network to the end user or not.")
+     @Parameter(name = ApiConstants.DISPLAY_NETWORK,
+                type = CommandType.BOOLEAN,
+                description = "an optional field, whether to the display the network to the end user or not.")
      private Boolean displayNetwork;
  
      /////////////////////////////////////////////////////
@@@ -139,14 -139,14 +141,14 @@@
              throw new InvalidParameterValueException("Couldn't find network by id");
          }
  
-         Network result = _networkService.updateGuestNetwork(getId(), getNetworkName(), getDisplayText(), callerAccount,
-                     callerUser, getNetworkDomain(), getNetworkOfferingId(), getChangeCidr(), getGuestVmCidr(), getDisplayNetwork());
-         
+         Network result =
+             _networkService.updateGuestNetwork(getId(), getNetworkName(), getDisplayText(), callerAccount, callerUser, getNetworkDomain(), getNetworkOfferingId(),
+                 getChangeCidr(), getGuestVmCidr(), getDisplayNetwork());
  
          if (result != null) {
 -            NetworkResponse response = _responseGenerator.createNetworkResponse(result);
 +            NetworkResponse response = _responseGenerator.createNetworkResponse(ResponseView.Full, result);
              response.setResponseName(getCommandName());
 -            this.setResponseObject(response);
 +            setResponseObject(response);
          } else {
              throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update network");
          }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceCountCmd.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupEgressCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupEgressCmd.java
index 2bf6b94,6a054a4..4272e27
--- a/api/src/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupEgressCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupEgressCmd.java
@@@ -22,9 -22,8 +22,11 @@@ import java.util.Iterator
  import java.util.List;
  import java.util.Map;
  
+ import org.apache.log4j.Logger;
+ 
 +import org.apache.cloudstack.acl.AclEntityType;
 +import org.apache.cloudstack.acl.SecurityChecker.AccessType;
 +import org.apache.cloudstack.api.ACL;
  import org.apache.cloudstack.api.APICommand;
  import org.apache.cloudstack.api.ApiCommandJobType;
  import org.apache.cloudstack.api.ApiConstants;
@@@ -77,21 -77,27 +77,24 @@@ public class AuthorizeSecurityGroupEgre
      @Parameter(name = ApiConstants.USER_SECURITY_GROUP_LIST, type = CommandType.MAP, description = "user to security group mapping")
      private Map userSecurityGroupList;
  
-     @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, description="an optional domainId for the security group. If the account parameter is used, domainId must also be used.", entityType = DomainResponse.class)
+     @Parameter(name = ApiConstants.DOMAIN_ID,
+                type = CommandType.UUID,
+                description = "an optional domainId for the security group. If the account parameter is used, domainId must also be used.",
+                entityType = DomainResponse.class)
      private Long domainId;
  
-     @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="an optional account for the security group. Must be used with domainId.")
+     @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "an optional account for the security group. Must be used with domainId.")
      private String accountName;
  
-     @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.UUID, description="an optional project of the security group", entityType=ProjectResponse.class)
+     @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, description = "an optional project of the security group", entityType = ProjectResponse.class)
      private Long projectId;
  
 -    @Parameter(name = ApiConstants.SECURITY_GROUP_ID,
 -               type = CommandType.UUID,
 -               description = "The ID of the security group. Mutually exclusive with securityGroupName parameter",
 -               entityType = SecurityGroupResponse.class)
 +    @ACL(accessType = AccessType.OperateEntry)
 +    @Parameter(name=ApiConstants.SECURITY_GROUP_ID, type=CommandType.UUID, description="The ID of the security group. Mutually exclusive with securityGroupName parameter", entityType=SecurityGroupResponse.class)
      private Long securityGroupId;
  
 -    @Parameter(name = ApiConstants.SECURITY_GROUP_NAME,
 -               type = CommandType.STRING,
 -               description = "The name of the security group. Mutually exclusive with securityGroupName parameter")
 +    @ACL(accessType = AccessType.OperateEntry)
 +    @Parameter(name=ApiConstants.SECURITY_GROUP_NAME, type=CommandType.STRING, description="The name of the security group. Mutually exclusive with securityGroupName parameter")
      private String securityGroupName;
  
      /////////////////////////////////////////////////////
@@@ -215,7 -221,7 +218,7 @@@
          List<? extends SecurityRule> egressRules = _securityGroupService.authorizeSecurityGroupEgress(this);
          if (egressRules != null && !egressRules.isEmpty()) {
              SecurityGroupResponse response = _responseGenerator.createSecurityGroupResponseFromSecurityGroupRule(egressRules);
--            this.setResponseObject(response);
++            setResponseObject(response);
          } else {
              throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to authorize security group egress rule(s)");
          }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupIngressCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupIngressCmd.java
index 3d84461,be91959..0653f60
--- a/api/src/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupIngressCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupIngressCmd.java
@@@ -22,9 -22,8 +22,11 @@@ import java.util.Iterator
  import java.util.List;
  import java.util.Map;
  
+ import org.apache.log4j.Logger;
+ 
 +import org.apache.cloudstack.acl.AclEntityType;
 +import org.apache.cloudstack.acl.SecurityChecker.AccessType;
 +import org.apache.cloudstack.api.ACL;
  import org.apache.cloudstack.api.APICommand;
  import org.apache.cloudstack.api.ApiCommandJobType;
  import org.apache.cloudstack.api.ApiConstants;
@@@ -77,21 -76,27 +77,24 @@@ public class AuthorizeSecurityGroupIngr
      @Parameter(name = ApiConstants.USER_SECURITY_GROUP_LIST, type = CommandType.MAP, description = "user to security group mapping")
      private Map userSecurityGroupList;
  
-     @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, description="an optional domainId for the security group. If the account parameter is used, domainId must also be used.", entityType = DomainResponse.class)
+     @Parameter(name = ApiConstants.DOMAIN_ID,
+                type = CommandType.UUID,
+                description = "an optional domainId for the security group. If the account parameter is used, domainId must also be used.",
+                entityType = DomainResponse.class)
      private Long domainId;
  
-     @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="an optional account for the security group. Must be used with domainId.")
+     @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "an optional account for the security group. Must be used with domainId.")
      private String accountName;
  
-     @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.UUID, description="an optional project of the security group", entityType=ProjectResponse.class)
+     @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, description = "an optional project of the security group", entityType = ProjectResponse.class)
      private Long projectId;
  
 -    @Parameter(name = ApiConstants.SECURITY_GROUP_ID,
 -               type = CommandType.UUID,
 -               description = "The ID of the security group. Mutually exclusive with securityGroupName parameter",
 -               entityType = SecurityGroupResponse.class)
 +    @ACL(accessType = AccessType.OperateEntry)
 +    @Parameter(name=ApiConstants.SECURITY_GROUP_ID, type=CommandType.UUID, description="The ID of the security group. Mutually exclusive with securityGroupName parameter", entityType=SecurityGroupResponse.class)
      private Long securityGroupId;
  
 -    @Parameter(name = ApiConstants.SECURITY_GROUP_NAME,
 -               type = CommandType.STRING,
 -               description = "The name of the security group. Mutually exclusive with securityGroupName parameter")
 +    @ACL(accessType = AccessType.OperateEntry)
 +    @Parameter(name=ApiConstants.SECURITY_GROUP_NAME, type=CommandType.STRING, description="The name of the security group. Mutually exclusive with securityGroupName parameter")
      private String securityGroupName;
  
      /////////////////////////////////////////////////////
@@@ -215,7 -220,7 +218,7 @@@
          List<? extends SecurityRule> ingressRules = _securityGroupService.authorizeSecurityGroupIngress(this);
          if (ingressRules != null && !ingressRules.isEmpty()) {
              SecurityGroupResponse response = _responseGenerator.createSecurityGroupResponseFromSecurityGroupRule(ingressRules);
--            this.setResponseObject(response);
++            setResponseObject(response);
          } else {
              throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to authorize security group ingress rule(s)");
          }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/securitygroup/CreateSecurityGroupCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/securitygroup/CreateSecurityGroupCmd.java
index 31b38e6,3b16821..4fb2033
--- a/api/src/org/apache/cloudstack/api/command/user/securitygroup/CreateSecurityGroupCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/securitygroup/CreateSecurityGroupCmd.java
@@@ -16,7 -16,8 +16,9 @@@
  // under the License.
  package org.apache.cloudstack.api.command.user.securitygroup;
  
+ import org.apache.log4j.Logger;
+ 
 +import org.apache.cloudstack.acl.AclEntityType;
  import org.apache.cloudstack.api.APICommand;
  import org.apache.cloudstack.api.ApiConstants;
  import org.apache.cloudstack.api.ApiErrorCode;
@@@ -117,7 -119,7 +120,7 @@@ public class CreateSecurityGroupCmd ext
          if (group != null) {
              SecurityGroupResponse response = _responseGenerator.createSecurityGroupResponse(group);
              response.setResponseName(getCommandName());
--            this.setResponseObject(response);
++            setResponseObject(response);
          } else {
              throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create security group");
          }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/securitygroup/DeleteSecurityGroupCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/securitygroup/DeleteSecurityGroupCmd.java
index cdc9dfb,0bcc144..ca26a97
--- a/api/src/org/apache/cloudstack/api/command/user/securitygroup/DeleteSecurityGroupCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/securitygroup/DeleteSecurityGroupCmd.java
@@@ -16,9 -16,8 +16,11 @@@
  // under the License.
  package org.apache.cloudstack.api.command.user.securitygroup;
  
+ import org.apache.log4j.Logger;
+ 
 +import org.apache.cloudstack.acl.AclEntityType;
 +import org.apache.cloudstack.acl.SecurityChecker.AccessType;
 +import org.apache.cloudstack.api.ACL;
  import org.apache.cloudstack.api.APICommand;
  import org.apache.cloudstack.api.ApiConstants;
  import org.apache.cloudstack.api.ApiErrorCode;
@@@ -45,23 -42,27 +45,25 @@@ public class DeleteSecurityGroupCmd ext
      //////////////// API parameters /////////////////////
      /////////////////////////////////////////////////////
  
-     @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="the account of the security group. Must be specified with domain ID")
+     @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "the account of the security group. Must be specified with domain ID")
      private String accountName;
  
-     @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, description="the domain ID of account owning the security group", entityType=DomainResponse.class)
+     @Parameter(name = ApiConstants.DOMAIN_ID,
+                type = CommandType.UUID,
+                description = "the domain ID of account owning the security group",
+                entityType = DomainResponse.class)
      private Long domainId;
  
-     @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.UUID, description="the project of the security group", entityType=ProjectResponse.class)
+     @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, description = "the project of the security group", entityType = ProjectResponse.class)
      private Long projectId;
  
 -    @Parameter(name = ApiConstants.ID,
 -               type = CommandType.UUID,
 -               description = "The ID of the security group. Mutually exclusive with name parameter",
 -               entityType = SecurityGroupResponse.class)
 +    @ACL(accessType = AccessType.OperateEntry)
 +    @Parameter(name=ApiConstants.ID, type=CommandType.UUID, description="The ID of the security group. Mutually exclusive with name parameter", entityType=SecurityGroupResponse.class)
      private Long id;
  
-     @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="The ID of the security group. Mutually exclusive with id parameter")
+     @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "The ID of the security group. Mutually exclusive with id parameter")
      private String name;
  
- 
      /////////////////////////////////////////////////////
      /////////////////// Accessors ///////////////////////
      /////////////////////////////////////////////////////
@@@ -124,7 -123,7 +124,7 @@@
              boolean result = _securityGroupService.deleteSecurityGroup(this);
              if (result) {
                  SuccessResponse response = new SuccessResponse(getCommandName());
--                this.setResponseObject(response);
++                setResponseObject(response);
              } else {
                  throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete security group");
              }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupEgressCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupEgressCmd.java
index aa61420,006aa7d..8ce2881
--- a/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupEgressCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupEgressCmd.java
@@@ -16,9 -16,8 +16,11 @@@
  // under the License.
  package org.apache.cloudstack.api.command.user.securitygroup;
  
+ import org.apache.log4j.Logger;
+ 
 +import org.apache.cloudstack.acl.AclEntityType;
 +import org.apache.cloudstack.acl.SecurityChecker.AccessType;
 +import org.apache.cloudstack.api.ACL;
  import org.apache.cloudstack.api.APICommand;
  import org.apache.cloudstack.api.ApiCommandJobType;
  import org.apache.cloudstack.api.ApiConstants;
@@@ -35,7 -33,10 +36,8 @@@ import com.cloud.network.security.Secur
  import com.cloud.network.security.SecurityRule;
  import com.cloud.user.Account;
  
 -@APICommand(name = "revokeSecurityGroupEgress",
 -            responseObject = SuccessResponse.class,
 -            description = "Deletes a particular egress rule from this security group",
 -            since = "3.0.0")
++
 +@APICommand(name = "revokeSecurityGroupEgress", responseObject = SuccessResponse.class, description = "Deletes a particular egress rule from this security group", since = "3.0.0", entityType = { AclEntityType.SecurityGroup })
  public class RevokeSecurityGroupEgressCmd extends BaseAsyncCmd {
      public static final Logger s_logger = Logger.getLogger(RevokeSecurityGroupEgressCmd.class.getName());
  
@@@ -98,7 -98,7 +100,7 @@@
          boolean result = _securityGroupService.revokeSecurityGroupEgress(this);
          if (result) {
              SuccessResponse response = new SuccessResponse(getCommandName());
--            this.setResponseObject(response);
++            setResponseObject(response);
          } else {
              throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to revoke security group egress rule");
          }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupIngressCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupIngressCmd.java
index 4077ef3,0858578..3342910
--- a/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupIngressCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupIngressCmd.java
@@@ -16,9 -16,8 +16,11 @@@
  // under the License.
  package org.apache.cloudstack.api.command.user.securitygroup;
  
+ import org.apache.log4j.Logger;
+ 
 +import org.apache.cloudstack.acl.AclEntityType;
 +import org.apache.cloudstack.acl.SecurityChecker.AccessType;
 +import org.apache.cloudstack.api.ACL;
  import org.apache.cloudstack.api.APICommand;
  import org.apache.cloudstack.api.ApiCommandJobType;
  import org.apache.cloudstack.api.ApiConstants;
@@@ -98,7 -95,7 +99,7 @@@ public class RevokeSecurityGroupIngress
          boolean result = _securityGroupService.revokeSecurityGroupIngress(this);
          if (result) {
              SuccessResponse response = new SuccessResponse(getCommandName());
--            this.setResponseObject(response);
++            setResponseObject(response);
          } else {
              throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to revoke security group ingress rule");
          }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java
index c28f57c,a0f307b..34dc175
--- a/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java
@@@ -16,7 -16,8 +16,9 @@@
  // under the License.
  package org.apache.cloudstack.api.command.user.snapshot;
  
+ import org.apache.log4j.Logger;
+ 
 +import org.apache.cloudstack.acl.AclEntityType;
  import org.apache.cloudstack.api.APICommand;
  import org.apache.cloudstack.api.ApiCommandJobType;
  import org.apache.cloudstack.api.ApiConstants;
@@@ -51,21 -50,29 +51,29 @@@ public class CreateSnapshotCmd extends 
      // ////////////// API parameters /////////////////////
      // ///////////////////////////////////////////////////
  
-     @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "The account of the snapshot. The account parameter must be used with the domainId parameter.")
+     @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;
  
-     @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class,
+     @Parameter(name = ApiConstants.DOMAIN_ID,
+                type = CommandType.UUID,
+                entityType = DomainResponse.class,
 -               description = "The domain ID of the snapshot. If used with the account parameter, specifies a domain for the account associated with the disk volume.")
 +            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;
  
-     @Parameter(name = ApiConstants.VOLUME_ID, type = CommandType.UUID, entityType = VolumeResponse.class,
-             required = true, description = "The ID of the disk volume")
+     @Parameter(name = ApiConstants.VOLUME_ID, type = CommandType.UUID, entityType = VolumeResponse.class, required = true, description = "The ID of the disk volume")
      private Long volumeId;
  
-     @Parameter(name = ApiConstants.POLICY_ID, type = CommandType.UUID, entityType = SnapshotPolicyResponse.class,
+     @Parameter(name = ApiConstants.POLICY_ID,
+                type = CommandType.UUID,
+                entityType = SnapshotPolicyResponse.class,
 -               description = "policy id of the snapshot, if this is null, then use MANUAL_POLICY.")
 +            description = "policy id of the snapshot, if this is null, then use MANUAL_POLICY.")
      private Long policyId;
  
+     @Parameter(name = ApiConstants.SNAPSHOT_QUIESCEVM, type = CommandType.BOOLEAN, required = false, description = "quiesce vm if true")
+     private Boolean quiescevm;
+ 
      private String syncObjectType = BaseAsyncCmd.snapshotHostSyncObject;
  
      // ///////////////////////////////////////////////////
@@@ -154,10 -168,10 +169,10 @@@
  
      @Override
      public void create() throws ResourceAllocationException {
--        Snapshot snapshot = this._volumeService.allocSnapshot(getVolumeId(), getPolicyId());
++        Snapshot snapshot = _volumeService.allocSnapshot(getVolumeId(), getPolicyId());
          if (snapshot != null) {
--            this.setEntityId(snapshot.getId());
--            this.setEntityUuid(snapshot.getUuid());
++            setEntityId(snapshot.getId());
++            setEntityUuid(snapshot.getUuid());
          } else {
              throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create snapshot");
          }
@@@ -166,14 -180,15 +181,15 @@@
      @Override
      public void execute() {
          s_logger.info("VOLSS: createSnapshotCmd starts:" + System.currentTimeMillis());
-         CallContext.current().setEventDetails("Volume Id: "+getVolumeId());
+         CallContext.current().setEventDetails("Volume Id: " + getVolumeId());
          Snapshot snapshot;
          try {
-             snapshot = _volumeService.takeSnapshot(this.getVolumeId(), this.getPolicyId(), this.getEntityId(), _accountService.getAccount(getEntityOwnerId()));
+             snapshot =
 -                _volumeService.takeSnapshot(this.getVolumeId(), this.getPolicyId(), this.getEntityId(), _accountService.getAccount(getEntityOwnerId()), getQuiescevm());
++                _volumeService.takeSnapshot(getVolumeId(), getPolicyId(), getEntityId(), _accountService.getAccount(getEntityOwnerId()), getQuiescevm());
              if (snapshot != null) {
                  SnapshotResponse response = _responseGenerator.createSnapshotResponse(snapshot);
                  response.setResponseName(getCommandName());
--                this.setResponseObject(response);
++                setResponseObject(response);
              } else {
                  throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create snapshot due to an internal error creating snapshot for volume " + volumeId);
              }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotCmd.java
index d313cdd,35caaff..95037cc
--- a/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotCmd.java
@@@ -16,9 -16,8 +16,11 @@@
  // under the License.
  package org.apache.cloudstack.api.command.user.snapshot;
  
+ import org.apache.log4j.Logger;
+ 
 +import org.apache.cloudstack.acl.AclEntityType;
 +import org.apache.cloudstack.acl.SecurityChecker.AccessType;
 +import org.apache.cloudstack.api.ACL;
  import org.apache.cloudstack.api.APICommand;
  import org.apache.cloudstack.api.ApiCommandJobType;
  import org.apache.cloudstack.api.ApiConstants;
@@@ -84,9 -79,10 +84,10 @@@ public class DeleteSnapshotCmd extends 
  
      @Override
      public String getEventDescription() {
 -        return "deleting snapshot: " + getId();
 +        return  "deleting snapshot: " + getId();
      }
  
+     @Override
      public ApiCommandJobType getInstanceType() {
          return ApiCommandJobType.Snapshot;
      }
@@@ -101,7 -98,7 +103,7 @@@
          boolean result = _snapshotService.deleteSnapshot(getId());
          if (result) {
              SuccessResponse response = new SuccessResponse(getCommandName());
--            this.setResponseObject(response);
++            setResponseObject(response);
          } else {
              throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete snapshot");
          }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java
index 1ff04e5,e4d566a..887ebb3
--- a/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java
@@@ -19,7 -19,8 +19,9 @@@ package org.apache.cloudstack.api.comma
  import java.util.ArrayList;
  import java.util.List;
  
+ import org.apache.log4j.Logger;
+ 
 +import org.apache.cloudstack.acl.AclEntityType;
  import org.apache.cloudstack.api.APICommand;
  import org.apache.cloudstack.api.ApiCommandJobType;
  import org.apache.cloudstack.api.ApiConstants;
@@@ -119,6 -117,6 +118,6 @@@ public class ListSnapshotsCmd extends B
          response.setResponses(snapshotResponses, result.second());
          response.setResponseName(getCommandName());
  
--        this.setResponseObject(response);
++        setResponseObject(response);
      }
  }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/snapshot/RevertSnapshotCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/snapshot/RevertSnapshotCmd.java
index 4d535b4,f11fa3f..f156a75
--- a/api/src/org/apache/cloudstack/api/command/user/snapshot/RevertSnapshotCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/RevertSnapshotCmd.java
@@@ -93,7 -86,7 +92,7 @@@ public class RevertSnapshotCmd extends 
          if (result) {
              SuccessResponse response = new SuccessResponse(getCommandName());
              response.setResponseName(getCommandName());
--            this.setResponseObject(response);
++            setResponseObject(response);
          } else {
              throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to revert snapshot");
          }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/ssh/DeleteSSHKeyPairCmd.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/template/CopyTemplateCmd.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java
index d21754c,0030a7e..d203fd4
--- a/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java
@@@ -82,28 -91,38 +91,36 @@@ import com.cloud.user.Account
      @Parameter(name = ApiConstants.REQUIRES_HVM, type = CommandType.BOOLEAN, description = "true if the template requres HVM, false otherwise")
      private Boolean requiresHvm;
  
-     @Parameter(name = ApiConstants.SNAPSHOT_ID, type = CommandType.UUID, entityType = SnapshotResponse.class,
+     @Parameter(name = ApiConstants.SNAPSHOT_ID,
+                type = CommandType.UUID,
+                entityType = SnapshotResponse.class,
 -               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;
 +            description = "the ID of the snapshot the template is being created from. Either this parameter, or volumeId has to be passed in")
 +    protected Long snapshotId;
  
-     @Parameter(name = ApiConstants.VOLUME_ID, type = CommandType.UUID, entityType = VolumeResponse.class,
+     @Parameter(name = ApiConstants.VOLUME_ID,
+                type = CommandType.UUID,
+                entityType = VolumeResponse.class,
 -               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;
 +            description = "the ID of the disk volume the template is being created from. Either this parameter, or snapshotId has to be passed in")
 +    protected Long volumeId;
  
 -    @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID,
 -               type = CommandType.UUID,
 -               entityType = UserVmResponse.class,
 -               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;
 +    @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType = UserVmResponse.class,
 +            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")
 +    protected Long vmId;
  
-     @Parameter(name=ApiConstants.URL, type=CommandType.STRING, description="Optional, only for baremetal hypervisor. The directory name where template stored on CIFS server")
+     @Parameter(name = ApiConstants.URL,
+                type = CommandType.STRING,
+                description = "Optional, only for baremetal hypervisor. The directory name where template stored on CIFS server")
      private String url;
  
-     @Parameter(name=ApiConstants.TEMPLATE_TAG, type=CommandType.STRING, description="the tag for this template.")
+     @Parameter(name = ApiConstants.TEMPLATE_TAG, type = CommandType.STRING, description = "the tag for this template.")
      private String templateTag;
  
-     @Parameter(name=ApiConstants.DETAILS, type=CommandType.MAP, description="Template details in key/value pairs.")
+     @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, description = "Template details in key/value pairs.")
      protected Map details;
  
-     @Parameter(name = ApiConstants.IS_DYNAMICALLY_SCALABLE, type = CommandType.BOOLEAN, description = "true if template contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory")
+     @Parameter(name = ApiConstants.IS_DYNAMICALLY_SCALABLE,
+                type = CommandType.BOOLEAN,
+                description = "true if template contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory")
      protected Boolean isDynamicallyScalable;
  
      // ///////////////////////////////////////////////////
@@@ -248,29 -267,29 +265,29 @@@
      @Override
      public void create() throws ResourceAllocationException {
          VirtualMachineTemplate template = null;
 -        template = this._templateService.createPrivateTemplateRecord(this, _accountService.getAccount(getEntityOwnerId()));
 +        template = _templateService.createPrivateTemplateRecord(this, _accountService.getAccount(getEntityOwnerId()));
          if (template != null) {
 -            this.setEntityId(template.getId());
 -            this.setEntityUuid(template.getUuid());
 +            setEntityId(template.getId());
 +            setEntityUuid(template.getUuid());
          } else {
-             throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,
-             "Failed to create a template");
+             throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a template");
          }
  
      }
  
      @Override
      public void execute() {
-         CallContext.current().setEventDetails("Template Id: "+getEntityId()+((getSnapshotId() == null) ? " from volume Id: " + getVolumeId() : " from snapshot Id: " + getSnapshotId()));
+         CallContext.current().setEventDetails(
+             "Template Id: " + getEntityId() + ((getSnapshotId() == null) ? " from volume Id: " + getVolumeId() : " from snapshot Id: " + getSnapshotId()));
          VirtualMachineTemplate template = null;
 -        template = this._templateService.createPrivateTemplate(this);
 +        template = _templateService.createPrivateTemplate(this);
  
-         if (template != null){
+         if (template != null) {
              List<TemplateResponse> templateResponses;
              if (isBareMetal()) {
 -                templateResponses = _responseGenerator.createTemplateResponses(template.getId(), vmId);
 +                templateResponses = _responseGenerator.createTemplateResponses(ResponseView.Restricted, template.getId(), vmId);
              } else {
 -                templateResponses = _responseGenerator.createTemplateResponses(template.getId(), snapshotId, volumeId, false);
 +                templateResponses = _responseGenerator.createTemplateResponses(ResponseView.Restricted, template.getId(), snapshotId, volumeId, false);
              }
              TemplateResponse response = new TemplateResponse();
              if (templateResponses != null && !templateResponses.isEmpty()) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
index 95c482e,d393c6a..6af904f
--- a/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
@@@ -93,12 -100,12 +101,13 @@@ public class ListTemplatesCmd extends B
  
          Account account = CallContext.current().getCallingAccount();
          // It is account specific if account is admin type and domainId and accountName are not null
 -        boolean isAccountSpecific = (account == null || isAdmin(account.getType())) && (getAccountName() != null) && (getDomainId() != null);
 +        boolean isAccountSpecific = (account == null || _accountService.isAdmin(account.getType()))
 +                && (getAccountName() != null) && (getDomainId() != null);
          // Show only those that are downloaded.
          TemplateFilter templateFilter = TemplateFilter.valueOf(getTemplateFilter());
-         boolean onlyReady = (templateFilter == TemplateFilter.featured) || (templateFilter == TemplateFilter.selfexecutable) || (templateFilter == TemplateFilter.sharedexecutable)
-         || (templateFilter == TemplateFilter.executable && isAccountSpecific) || (templateFilter == TemplateFilter.community);
+         boolean onlyReady =
+             (templateFilter == TemplateFilter.featured) || (templateFilter == TemplateFilter.selfexecutable) || (templateFilter == TemplateFilter.sharedexecutable) ||
+                 (templateFilter == TemplateFilter.executable && isAccountSpecific) || (templateFilter == TemplateFilter.community);
          return onlyReady;
      }
  
@@@ -117,9 -124,9 +126,9 @@@
      }
  
      @Override
-     public void execute(){
+     public void execute() {
          ListResponse<TemplateResponse> response = _queryService.listTemplates(this);
          response.setResponseName(getCommandName());
 -        this.setResponseObject(response);
 +        setResponseObject(response);
      }
  }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/template/RegisterTemplateCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/template/RegisterTemplateCmd.java
index 9575587,48ed6ea..1bb7cc8
--- a/api/src/org/apache/cloudstack/api/command/user/template/RegisterTemplateCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/template/RegisterTemplateCmd.java
@@@ -52,71 -51,92 +52,89 @@@ public class RegisterTemplateCmd extend
      //////////////// API parameters /////////////////////
      /////////////////////////////////////////////////////
  
-     @Parameter(name=ApiConstants.BITS, type=CommandType.INTEGER, description="32 or 64 bits support. 64 by default")
+     @Parameter(name = ApiConstants.BITS, type = CommandType.INTEGER, description = "32 or 64 bits support. 64 by default")
      private Integer bits;
  
-     @Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, required=true, description="the display text of the template. This is usually used for display purposes.", length=4096)
+     @Parameter(name = ApiConstants.DISPLAY_TEXT,
+                type = CommandType.STRING,
+                required = true,
+                description = "the display text of the template. This is usually used for display purposes.",
+                length = 4096)
      private String displayText;
  
-     @Parameter(name=ApiConstants.FORMAT, type=CommandType.STRING, required=true, description="the format for the template. Possible values include QCOW2, RAW, and VHD.")
+     @Parameter(name = ApiConstants.FORMAT,
+                type = CommandType.STRING,
+                required = true,
+                description = "the format for the template. Possible values include QCOW2, RAW, and VHD.")
      private String format;
  
-     @Parameter(name=ApiConstants.HYPERVISOR, type=CommandType.STRING, required=true, description="the target hypervisor for the template")
+     @Parameter(name = ApiConstants.HYPERVISOR, type = CommandType.STRING, required = true, description = "the target hypervisor for the template")
      private String hypervisor;
  
-     @Parameter(name=ApiConstants.IS_FEATURED, type=CommandType.BOOLEAN, description="true if this template is a featured template, false otherwise")
+     @Parameter(name = ApiConstants.IS_FEATURED, type = CommandType.BOOLEAN, description = "true if this template is a featured template, false otherwise")
      private Boolean featured;
  
-     @Parameter(name=ApiConstants.IS_PUBLIC, type=CommandType.BOOLEAN, description="true if the template is available to all accounts; default is true")
+     @Parameter(name = ApiConstants.IS_PUBLIC, type = CommandType.BOOLEAN, description = "true if the template is available to all accounts; default is true")
      private Boolean publicTemplate;
  
-     @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="the name of the template")
+     @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "the name of the template")
      private String templateName;
  
-     @Parameter(name=ApiConstants.OS_TYPE_ID, type=CommandType.UUID, entityType = GuestOSResponse.class,
-             required=true, description="the ID of the OS Type that best represents the OS of this template.")
+     @Parameter(name = ApiConstants.OS_TYPE_ID,
+                type = CommandType.UUID,
+                entityType = GuestOSResponse.class,
+                required = true,
+                description = "the ID of the OS Type that best represents the OS of this template.")
      private Long osTypeId;
  
-     @Parameter(name=ApiConstants.PASSWORD_ENABLED, type=CommandType.BOOLEAN, description="true if the template supports the password reset feature; default is false")
+     @Parameter(name = ApiConstants.PASSWORD_ENABLED,
+                type = CommandType.BOOLEAN,
+                description = "true if the template supports the password reset feature; default is false")
      private Boolean passwordEnabled;
  
-     @Parameter(name=ApiConstants.SSHKEY_ENABLED, type=CommandType.BOOLEAN, description="true if the template supports the sshkey upload feature; default is false")
+     @Parameter(name = ApiConstants.SSHKEY_ENABLED, type = CommandType.BOOLEAN, description = "true if the template supports the sshkey upload feature; default is false")
      private Boolean sshKeyEnabled;
  
-     @Parameter(name=ApiConstants.IS_EXTRACTABLE, type=CommandType.BOOLEAN, description="true if the template or its derivatives are extractable; default is false")
+     @Parameter(name = ApiConstants.IS_EXTRACTABLE, type = CommandType.BOOLEAN, description = "true if the template or its derivatives are extractable; default is false")
      private Boolean extractable;
  
-     @Parameter(name=ApiConstants.REQUIRES_HVM, type=CommandType.BOOLEAN, description="true if this template requires HVM")
+     @Parameter(name = ApiConstants.REQUIRES_HVM, type = CommandType.BOOLEAN, description = "true if this template requires HVM")
      private Boolean requiresHvm;
  
-     @Parameter(name=ApiConstants.URL, type=CommandType.STRING, required=true, description="the URL of where the template is hosted. Possible URL include http:// and https://")
+     @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;
  
 -    @Parameter(name = ApiConstants.ZONE_ID,
 -               type = CommandType.UUID,
 -               entityType = ZoneResponse.class,
 -               required = true,
 -               description = "the ID of the zone the template is to be hosted on")
 -    private Long zoneId;
 +    @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = ZoneResponse.class,
 +            required=true, description="the ID of the zone the template is to be hosted on")
 +    protected Long zoneId;
  
-     @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType = DomainResponse.class,
-             description="an optional domainId. If the account parameter is used, domainId must also be used.")
+     @Parameter(name = ApiConstants.DOMAIN_ID,
+                type = CommandType.UUID,
+                entityType = DomainResponse.class,
+                description = "an optional domainId. If the account parameter is used, domainId must also be used.")
      private Long domainId;
  
-     @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="an optional accountName. Must be used with domainId.")
+     @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "an optional accountName. Must be used with domainId.")
      private String accountName;
  
-     @Parameter(name=ApiConstants.CHECKSUM, type=CommandType.STRING, description="the MD5 checksum value of this template")
+     @Parameter(name = ApiConstants.CHECKSUM, type = CommandType.STRING, description = "the MD5 checksum value of this template")
      private String checksum;
  
-     @Parameter(name=ApiConstants.TEMPLATE_TAG, type=CommandType.STRING, description="the tag for this template.")
+     @Parameter(name = ApiConstants.TEMPLATE_TAG, type = CommandType.STRING, description = "the tag for this template.")
      private String templateTag;
  
-     @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.UUID, entityType = ProjectResponse.class,
-             description="Register template for the project")
+     @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "Register template for the project")
      private Long projectId;
  
-     @Parameter(name=ApiConstants.DETAILS, type=CommandType.MAP, description="Template details in key/value pairs.")
+     @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, description = "Template details in key/value pairs.")
      protected Map details;
  
-     @Parameter(name = ApiConstants.IS_DYNAMICALLY_SCALABLE, type = CommandType.BOOLEAN, description = "true if template contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory")
+     @Parameter(name = ApiConstants.IS_DYNAMICALLY_SCALABLE,
+                type = CommandType.BOOLEAN,
+                description = "true if template contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory")
      protected Boolean isDynamicallyScalable;
  
      @Parameter(name = ApiConstants.ROUTING, type = CommandType.BOOLEAN, description = "true if the template type is routing i.e., if template is used to deploy router")
@@@ -241,15 -260,15 +258,15 @@@
      }
  
      @Override
-     public void execute() throws ResourceAllocationException{
+     public void execute() throws ResourceAllocationException {
          try {
              VirtualMachineTemplate template = _templateService.registerTemplate(this);
-             if (template != null){
+             if (template != null) {
                  ListResponse<TemplateResponse> response = new ListResponse<TemplateResponse>();
 -                List<TemplateResponse> templateResponses = _responseGenerator.createTemplateResponses(template, zoneId, false);
 +                List<TemplateResponse> templateResponses = _responseGenerator.createTemplateResponses(ResponseView.Restricted, template, zoneId, false);
                  response.setResponses(templateResponses);
                  response.setResponseName(getCommandName());
 -                this.setResponseObject(response);
 +                setResponseObject(response);
              } else {
                  throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to register template");
              }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/template/UpdateTemplateCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/template/UpdateTemplateCmd.java
index f294b29,f80a4ee..f7a2ac2
--- a/api/src/org/apache/cloudstack/api/command/user/template/UpdateTemplateCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/template/UpdateTemplateCmd.java
@@@ -67,10 -66,10 +67,10 @@@ public class UpdateTemplateCmd extends 
      }
  
      @Override
-     public void execute(){
+     public void execute() {
          VirtualMachineTemplate result = _templateService.updateTemplate(this);
          if (result != null) {
 -            TemplateResponse response = _responseGenerator.createTemplateUpdateResponse(result);
 +            TemplateResponse response = _responseGenerator.createTemplateUpdateResponse(ResponseView.Restricted, result);
              response.setObjectName("template");
              response.setTemplateType(result.getTemplateType().toString());//Template can be either USER or ROUTING type
              response.setResponseName(getCommandName());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/vm/AddNicToVMCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/vm/AddNicToVMCmd.java
index b1b20e2,43efe16..5185aa5
--- a/api/src/org/apache/cloudstack/api/command/user/vm/AddNicToVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/AddNicToVMCmd.java
@@@ -40,8 -36,7 +40,7 @@@ import com.cloud.event.EventTypes
  import com.cloud.user.Account;
  import com.cloud.uservm.UserVm;
  
 -@APICommand(name = "addNicToVirtualMachine", description = "Adds VM to specified network by creating a NIC", responseObject = UserVmResponse.class)
 +@APICommand(name = "addNicToVirtualMachine", description = "Adds VM to specified network by creating a NIC", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = { AclEntityType.VirtualMachine })
- 
  public class AddNicToVMCmd extends BaseAsyncCmd {
      public static final Logger s_logger = Logger.getLogger(AddNicToVMCmd.class);
      private static final String s_name = "addnictovirtualmachineresponse";
@@@ -49,16 -44,14 +48,15 @@@
      /////////////////////////////////////////////////////
      //////////////// API parameters /////////////////////
      /////////////////////////////////////////////////////
 -
 -    @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, entityType = UserVmResponse.class, required = true, description = "Virtual Machine ID")
 +    @ACL(accessType = AccessType.OperateEntry)
 +    @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType=UserVmResponse.class,
 +            required=true, description="Virtual Machine ID")
      private Long vmId;
  
-     @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.UUID, entityType=NetworkResponse.class,
-             required=true, description="Network ID")
+     @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, required = true, description = "Network ID")
      private Long netId;
  
-     @Parameter(name=ApiConstants.IP_ADDRESS, type=CommandType.STRING, description="IP Address for the new network")
+     @Parameter(name = ApiConstants.IP_ADDRESS, type = CommandType.STRING, description = "IP Address for the new network")
      private String ipaddr;
  
      /////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
index f0a0ab8,eb19db4..e89f27d
--- a/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
@@@ -34,9 -31,8 +34,9 @@@ import org.apache.cloudstack.api.APICom
  import org.apache.cloudstack.api.ApiCommandJobType;
  import org.apache.cloudstack.api.ApiConstants;
  import org.apache.cloudstack.api.ApiErrorCode;
- import org.apache.cloudstack.api.BaseAsyncCreateCmd;
+ import org.apache.cloudstack.api.BaseAsyncCreateCustomIdCmd;
  import org.apache.cloudstack.api.Parameter;
 +import org.apache.cloudstack.api.ResponseObject.ResponseView;
  import org.apache.cloudstack.api.ServerApiException;
  import org.apache.cloudstack.api.response.DiskOfferingResponse;
  import org.apache.cloudstack.api.response.DomainResponse;
@@@ -68,9 -65,8 +68,8 @@@ import com.cloud.template.VirtualMachin
  import com.cloud.user.Account;
  import com.cloud.uservm.UserVm;
  
- 
 -@APICommand(name = "deployVirtualMachine", description = "Creates and automatically starts a virtual machine based on a service offering, disk offering, and template.", responseObject = UserVmResponse.class)
 +@APICommand(name = "deployVirtualMachine", description = "Creates and automatically starts a virtual machine based on a service offering, disk offering, and template.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = { AclEntityType.VirtualMachine })
- public class DeployVMCmd extends BaseAsyncCreateCmd {
+ public class DeployVMCmd extends BaseAsyncCreateCustomIdCmd {
      public static final Logger s_logger = Logger.getLogger(DeployVMCmd.class.getName());
  
      private static final String s_name = "deployvirtualmachineresponse";
@@@ -496,13 -495,15 +498,15 @@@
                  if (getNetworkIds() != null) {
                      throw new InvalidParameterValueException("Can't specify network Ids in Basic zone");
                  } else {
-                     vm = _userVmService.createBasicSecurityGroupVirtualMachine(zone, serviceOffering, template, getSecurityGroupIdList(), owner, name,
-                             displayName, diskOfferingId, size, group, getHypervisor(), getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, displayVm, keyboard, getAffinityGroupIdList());
+                     vm = _userVmService.createBasicSecurityGroupVirtualMachine(zone, serviceOffering, template, getSecurityGroupIdList(), owner, name, displayName, diskOfferingId,
+                             size, group, getHypervisor(), getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, displayVm, keyboard, getAffinityGroupIdList(),
+                             getDetails(), getCustomId());
                  }
              } else {
 -                if (zone.isSecurityGroupEnabled()) {
 +                if (zone.isSecurityGroupEnabled())  {
-                     vm = _userVmService.createAdvancedSecurityGroupVirtualMachine(zone, serviceOffering, template, getNetworkIds(), getSecurityGroupIdList(),
-                             owner, name, displayName, diskOfferingId, size, group, getHypervisor(), getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, displayVm, keyboard, getAffinityGroupIdList());
+                     vm = _userVmService.createAdvancedSecurityGroupVirtualMachine(zone, serviceOffering, template, getNetworkIds(), getSecurityGroupIdList(), owner, name,
+                             displayName, diskOfferingId, size, group, getHypervisor(), getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, displayVm, keyboard,
+                             getAffinityGroupIdList(), getDetails(), getCustomId());
  
                  } else {
                      if (getSecurityGroupIdList() != null && !getSecurityGroupIdList().isEmpty()) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/vm/DestroyVMCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/vm/DestroyVMCmd.java
index 30818cb,3c63e8d..f54b223
--- a/api/src/org/apache/cloudstack/api/command/user/vm/DestroyVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/DestroyVMCmd.java
@@@ -50,14 -48,13 +50,15 @@@ public class DestroyVMCmd extends BaseA
      //////////////// API parameters /////////////////////
      /////////////////////////////////////////////////////
  
 -    @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = UserVmResponse.class, required = true, description = "The ID of the virtual machine")
 +    @ACL(accessType = AccessType.OperateEntry)
 +    @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=UserVmResponse.class,
 +            required=true, description="The ID of the virtual machine")
      private Long id;
  
- 
-     @Parameter(name=ApiConstants.EXPUNGE, type=CommandType.BOOLEAN,
-             description="If true is passed, the vm is expunged immediately. False by default. Parameter can be passed to the call by ROOT/Domain admin only", since="4.2.1")
+     @Parameter(name = ApiConstants.EXPUNGE,
+                type = CommandType.BOOLEAN,
+                description = "If true is passed, the vm is expunged immediately. False by default. Parameter can be passed to the call by ROOT/Domain admin only",
+                since = "4.2.1")
      private Boolean expunge;
  
      /////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/vm/GetVMPasswordCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/vm/GetVMPasswordCmd.java
index 31f11a3,d0503d1..13570fd
--- a/api/src/org/apache/cloudstack/api/command/user/vm/GetVMPasswordCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/GetVMPasswordCmd.java
@@@ -18,9 -18,8 +18,11 @@@ package org.apache.cloudstack.api.comma
  
  import java.security.InvalidParameterException;
  
+ import org.apache.log4j.Logger;
+ 
 +import org.apache.cloudstack.acl.AclEntityType;
 +import org.apache.cloudstack.acl.SecurityChecker.AccessType;
 +import org.apache.cloudstack.api.ACL;
  import org.apache.cloudstack.api.APICommand;
  import org.apache.cloudstack.api.ApiConstants;
  import org.apache.cloudstack.api.BaseCmd;
@@@ -42,12 -39,9 +42,11 @@@ public class GetVMPasswordCmd extends B
      //////////////// API parameters /////////////////////
      /////////////////////////////////////////////////////
  
 -    @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = UserVmResponse.class, required = true, description = "The ID of the virtual machine")
 +    @ACL(accessType = AccessType.OperateEntry)
 +    @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=UserVmResponse.class
 +            , required=true, description="The ID of the virtual machine")
      private Long id;
  
- 
      /////////////////////////////////////////////////////
      /////////////////// Accessors ///////////////////////
      /////////////////////////////////////////////////////
@@@ -67,7 -60,7 +65,7 @@@
          if (passwd == null || passwd.equals(""))
              throw new InvalidParameterException("No password for VM with id '" + getId() + "' found.");
  
--        this.setResponseObject(new GetVMPasswordResponse(getCommandName(), passwd));
++        setResponseObject(new GetVMPasswordResponse(getCommandName(), passwd));
      }
  
      @Override

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java
index 1122a35,28637fb..3e2f43f
--- a/api/src/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java
@@@ -30,7 -29,7 +30,8 @@@ import org.apache.cloudstack.api.ApiCon
  import org.apache.cloudstack.api.ApiConstants.VMDetails;
  import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
  import org.apache.cloudstack.api.Parameter;
 +import org.apache.cloudstack.api.ResponseObject.ResponseView;
+ import org.apache.cloudstack.api.response.HostResponse;
  import org.apache.cloudstack.api.response.InstanceGroupResponse;
  import org.apache.cloudstack.api.response.IsoVmResponse;
  import org.apache.cloudstack.api.response.ListResponse;
@@@ -182,9 -211,9 +196,9 @@@ public class ListVMsCmd extends BaseLis
      }
  
      @Override
-     public void execute(){
+     public void execute() {
          ListResponse<UserVmResponse> response = _queryService.searchForUserVMs(this);
          response.setResponseName(getCommandName());
 -        this.setResponseObject(response);
 +        setResponseObject(response);
      }
  }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/vm/RebootVMCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/vm/RebootVMCmd.java
index a4efabc,7ac9138..6771448
--- a/api/src/org/apache/cloudstack/api/command/user/vm/RebootVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/RebootVMCmd.java
@@@ -99,15 -94,15 +99,14 @@@ public class RebootVMCmd extends BaseAs
      }
  
      @Override
-     public void execute() throws ResourceUnavailableException, InsufficientCapacityException{
-         CallContext.current().setEventDetails("Vm Id: "+getId());
+     public void execute() throws ResourceUnavailableException, InsufficientCapacityException {
+         CallContext.current().setEventDetails("Vm Id: " + getId());
          UserVm result;
          result = _userVmService.rebootVirtualMachine(this);
--
 -        if (result != null) {
 -            UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", result).get(0);
 +        if (result !=null){
 +            UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Restricted, "virtualmachine", result).get(0);
              response.setResponseName(getCommandName());
 -            this.setResponseObject(response);
 +            setResponseObject(response);
          } else {
              throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reboot vm instance");
          }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/vm/RemoveIpFromVmNicCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/vm/RemoveIpFromVmNicCmd.java
index 24eba05,2458247..b81b8a9
--- a/api/src/org/apache/cloudstack/api/command/user/vm/RemoveIpFromVmNicCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/RemoveIpFromVmNicCmd.java
@@@ -45,12 -45,16 +45,15 @@@ public class RemoveIpFromVmNicCmd exten
      /////////////////////////////////////////////////////
      //////////////// API parameters /////////////////////
      /////////////////////////////////////////////////////
-     @Parameter(name=ApiConstants.ID, type=CommandType.UUID, required = true, entityType = NicSecondaryIpResponse.class,
-             description="the ID of the secondary ip address to nic")
-             private Long id;
 -
+     @Parameter(name = ApiConstants.ID,
 -               type = CommandType.UUID,
 -               required = true,
 -               entityType = NicSecondaryIpResponse.class,
 -               description = "the ID of the secondary ip address to nic")
++            type = CommandType.UUID,
++            required = true,
++            entityType = NicSecondaryIpResponse.class,
++            description = "the ID of the secondary ip address to nic")
+     private Long id;
  
      // unexposed parameter needed for events logging
-     @Parameter(name=ApiConstants.ACCOUNT_ID, type=CommandType.UUID, expose=false)
+     @Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.UUID, expose = false)
      private Long ownerId;
  
      /////////////////////////////////////////////////////
@@@ -148,7 -152,7 +151,7 @@@
              boolean result = _networkService.releaseSecondaryIpFromNic(id);
              if (result) {
                  SuccessResponse response = new SuccessResponse(getCommandName());
--                this.setResponseObject(response);
++                setResponseObject(response);
              } else {
                  throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove secondary  ip address for the nic");
              }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/vm/RemoveNicFromVMCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/vm/RemoveNicFromVMCmd.java
index 3faa4de,92becb7..e04f8da
--- a/api/src/org/apache/cloudstack/api/command/user/vm/RemoveNicFromVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/RemoveNicFromVMCmd.java
@@@ -40,8 -36,7 +40,7 @@@ import com.cloud.event.EventTypes
  import com.cloud.user.Account;
  import com.cloud.uservm.UserVm;
  
 -@APICommand(name = "removeNicFromVirtualMachine", description = "Removes VM from specified network by deleting a NIC", responseObject = UserVmResponse.class)
 +@APICommand(name = "removeNicFromVirtualMachine", description = "Removes VM from specified network by deleting a NIC", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = { AclEntityType.VirtualMachine })
- 
  public class RemoveNicFromVMCmd extends BaseAsyncCmd {
      public static final Logger s_logger = Logger.getLogger(RemoveNicFromVMCmd.class);
      private static final String s_name = "removenicfromvirtualmachineresponse";
@@@ -49,13 -44,11 +48,12 @@@
      /////////////////////////////////////////////////////
      //////////////// API parameters /////////////////////
      /////////////////////////////////////////////////////
 -
 -    @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, entityType = UserVmResponse.class, required = true, description = "Virtual Machine ID")
 +    @ACL(accessType = AccessType.OperateEntry)
 +    @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType=UserVmResponse.class,
 +            required=true, description="Virtual Machine ID")
      private Long vmId;
  
-     @Parameter(name=ApiConstants.NIC_ID, type=CommandType.UUID, entityType=NicResponse.class,
-             required=true, description="NIC ID")
+     @Parameter(name = ApiConstants.NIC_ID, type = CommandType.UUID, entityType = NicResponse.class, required = true, description = "NIC ID")
      private Long nicId;
  
      /////////////////////////////////////////////////////
@@@ -90,10 -83,9 +88,9 @@@
  
      @Override
      public String getEventDescription() {
 -        return "Removing NIC " + getNicId() + " from user vm: " + getVmId();
 +        return  "Removing NIC " + getNicId() + " from user vm: " + getVmId();
      }
  
- 
      @Override
      public long getEntityOwnerId() {
          UserVm vm = _responseGenerator.findUserVmById(getVmId());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/vm/ResetVMPasswordCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/vm/ResetVMPasswordCmd.java
index bd8c148,df34120..3a1b5db
--- a/api/src/org/apache/cloudstack/api/command/user/vm/ResetVMPasswordCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/ResetVMPasswordCmd.java
@@@ -55,9 -49,9 +55,10 @@@ public class ResetVMPasswordCmd extend
      private Long id;
  
      // unexposed parameter needed for serializing/deserializing the command
 -    @Parameter(name = ApiConstants.PASSWORD, type = CommandType.STRING, expose = false)
 -    private String password;
 +    @Parameter(name=ApiConstants.PASSWORD, type=CommandType.STRING, expose=false)
 +    protected String password;
 +
+ 
      /////////////////////////////////////////////////////
      /////////////////// Accessors ///////////////////////
      /////////////////////////////////////////////////////
@@@ -114,14 -108,14 +115,14 @@@
      }
  
      @Override
-     public void execute() throws ResourceUnavailableException, InsufficientCapacityException{
+     public void execute() throws ResourceUnavailableException, InsufficientCapacityException {
          password = _mgr.generateRandomPassword();
-         CallContext.current().setEventDetails("Vm Id: "+getId());
+         CallContext.current().setEventDetails("Vm Id: " + getId());
          UserVm result = _userVmService.resetVMPassword(this, password);
 -        if (result != null) {
 -            UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", result).get(0);
 +        if (result != null){
 +            UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Restricted, "virtualmachine", result).get(0);
              response.setResponseName(getCommandName());
 -            this.setResponseObject(response);
 +            setResponseObject(response);
          } else {
              throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reset vm password");
          }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/vm/ResetVMSSHKeyCmd.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/vm/RestoreVMCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/vm/RestoreVMCmd.java
index ece6678,b69b364..1102c26
--- a/api/src/org/apache/cloudstack/api/command/user/vm/RestoreVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/RestoreVMCmd.java
@@@ -45,15 -44,15 +45,17 @@@ public class RestoreVMCmd extends BaseA
      public static final Logger s_logger = Logger.getLogger(RestoreVMCmd.class);
      private static final String s_name = "restorevmresponse";
  
 -    @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, entityType = UserVmResponse.class, required = true, description = "Virtual Machine ID")
 +    @ACL(accessType = AccessType.OperateEntry)
 +    @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType=UserVmResponse.class,
 +            required=true, description="Virtual Machine ID")
      private Long vmId;
  
-     @Parameter(name=ApiConstants.TEMPLATE_ID, type=CommandType.UUID, entityType = TemplateResponse.class, description="an optional template Id to restore vm from the new template. This can be an ISO id in case of restore vm deployed using ISO")
+     @Parameter(name = ApiConstants.TEMPLATE_ID,
+                type = CommandType.UUID,
+                entityType = TemplateResponse.class,
+                description = "an optional template Id to restore vm from the new template. This can be an ISO id in case of restore vm deployed using ISO")
      private Long templateId;
  
- 
      @Override
      public String getEventType() {
          return EventTypes.EVENT_VM_RESTORE;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java
index c34bac2,d234300..b3159ff
--- a/api/src/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java
@@@ -16,19 -16,19 +16,24 @@@
  // under the License.
  package org.apache.cloudstack.api.command.user.vm;
  
+ import java.util.Collection;
+ import java.util.HashMap;
+ import java.util.Iterator;
  import java.util.List;
+ import java.util.Map;
  
 +import org.apache.log4j.Logger;
 +
 +import org.apache.cloudstack.acl.AclEntityType;
 +import org.apache.cloudstack.acl.SecurityChecker.AccessType;
  import org.apache.cloudstack.api.ACL;
  import org.apache.cloudstack.api.APICommand;
  import org.apache.cloudstack.api.ApiConstants;
  import org.apache.cloudstack.api.ApiErrorCode;
  import org.apache.cloudstack.api.BaseAsyncCmd;
+ import org.apache.cloudstack.api.BaseCmd;
  import org.apache.cloudstack.api.Parameter;
 +import org.apache.cloudstack.api.ResponseObject.ResponseView;
  import org.apache.cloudstack.api.ServerApiException;
  import org.apache.cloudstack.api.response.ServiceOfferingResponse;
  import org.apache.cloudstack.api.response.SuccessResponse;
@@@ -51,16 -51,18 +56,18 @@@ public class ScaleVMCmd extends BaseAsy
      /////////////////////////////////////////////////////
      //////////////// API parameters /////////////////////
      /////////////////////////////////////////////////////
--
 -    @ACL
 -    @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = UserVmResponse.class, required = true, description = "The ID of the virtual machine")
 +    @ACL(accessType = AccessType.OperateEntry)
 +    @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=UserVmResponse.class,
 +            required=true, description="The ID of the virtual machine")
      private Long id;
  
 -    @ACL
 -    @Parameter(name = ApiConstants.SERVICE_OFFERING_ID, type = CommandType.UUID, entityType = ServiceOfferingResponse.class, required = true, description = "the ID of the service offering for the virtual machine")
 +    @Parameter(name=ApiConstants.SERVICE_OFFERING_ID, type=CommandType.UUID, entityType=ServiceOfferingResponse.class,
 +            required=true, description="the ID of the service offering for the virtual machine")
      private Long serviceOfferingId;
  
+     @Parameter(name = ApiConstants.DETAILS, type = BaseCmd.CommandType.MAP, description = "name value pairs of custom parameters for cpu,memory and cpunumber. example details[i].name=value")
+     private Map<String, String> details;
+ 
      /////////////////////////////////////////////////////
      /////////////////// Accessors ///////////////////////
      /////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/vm/StartVMCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/vm/StartVMCmd.java
index ebb4efe,4239a64..8fac9e1
--- a/api/src/org/apache/cloudstack/api/command/user/vm/StartVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/StartVMCmd.java
@@@ -53,14 -49,15 +53,16 @@@ public class StartVMCmd extends BaseAsy
      // ///////////////////////////////////////////////////
      // ////////////// API parameters /////////////////////
      // ///////////////////////////////////////////////////
--
 -    @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = UserVmResponse.class, required = true, description = "The ID of the virtual machine")
 +    @ACL(accessType = AccessType.OperateEntry)
 +    @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType=UserVmResponse.class,
 +            required = true, description = "The ID of the virtual machine")
      private Long id;
  
-     @Parameter(name=ApiConstants.HOST_ID, type=CommandType.UUID, entityType=HostResponse.class,
-             description="destination Host ID to deploy the VM to - parameter available for root admin only", since="3.0.1")
+     @Parameter(name = ApiConstants.HOST_ID,
+                type = CommandType.UUID,
+                entityType = HostResponse.class,
+                description = "destination Host ID to deploy the VM to - parameter available for root admin only",
+                since = "3.0.1")
      private Long hostId;
  
      // ///////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/vm/StopVMCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/vm/StopVMCmd.java
index 4468ac5,17f12f9..965e12c
--- a/api/src/org/apache/cloudstack/api/command/user/vm/StopVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/StopVMCmd.java
@@@ -47,13 -44,12 +47,13 @@@ public class StopVMCmd extends BaseAsyn
      // ////////////// API parameters /////////////////////
      // ///////////////////////////////////////////////////
  
 -    @ACL
 -    @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = UserVmResponse.class, required = true, description = "The ID of the virtual machine")
 +    @ACL(accessType = AccessType.OperateEntry)
 +    @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType=UserVmResponse.class,
 +            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 " +
-             "(vm is marked as Stopped even when command fails to be send to the backend).  The caller knows the VM is stopped.")
+     @Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, description = "Force stop the VM "
+         + "(vm is marked as Stopped even when command fails to be send to the backend).  The caller knows the VM is stopped.")
      private Boolean forced;
  
      // ///////////////////////////////////////////////////


Mime
View raw message