You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by mc...@apache.org on 2014/01/17 23:40:51 UTC
[49/50] [abbrv] Merge branch 'master' into rbac.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/com/cloud/event/EventTypes.java
----------------------------------------------------------------------
diff --cc api/src/com/cloud/event/EventTypes.java
index 0ccea74,e88f010..fa4d342
--- a/api/src/com/cloud/event/EventTypes.java
+++ b/api/src/com/cloud/event/EventTypes.java
@@@ -433,10 -434,9 +434,9 @@@ public class EventTypes
public static final String EVENT_HOST_RESERVATION_RELEASE = "HOST.RESERVATION.RELEASE";
// Dedicated guest vlan range
- public static final String EVENT_GUEST_VLAN_RANGE_DEDICATE = "GUESTVLANRANGE.DEDICATE";
- public static final String EVENT_DEDICATED_GUEST_VLAN_RANGE_RELEASE = "GUESTVLANRANGE.RELEASE";
+ public static final String EVENT_GUEST_VLAN_RANGE_DEDICATE = "GUESTVLANRANGE.DEDICATE";
+ public static final String EVENT_DEDICATED_GUEST_VLAN_RANGE_RELEASE = "GUESTVLANRANGE.RELEASE";
-
public static final String EVENT_PORTABLE_IP_RANGE_CREATE = "PORTABLE.IP.RANGE.CREATE";
public static final String EVENT_PORTABLE_IP_RANGE_DELETE = "PORTABLE.IP.RANGE.DELETE";
public static final String EVENT_PORTABLE_IP_TRANSFER = "PORTABLE.IP.TRANSFER";
@@@ -446,20 -446,9 +446,20 @@@
public static final String EVENT_DEDICATE_RESOURCE_RELEASE = "DEDICATE.RESOURCE.RELEASE";
public static final String EVENT_CLEANUP_VM_RESERVATION = "VM.RESERVATION.CLEANUP";
-
+
public static final String EVENT_UCS_ASSOCIATED_PROFILE = "UCS.ASSOCIATEPROFILE";
+ public static final String EVENT_ACL_POLICY_CREATE = "ACLPOLICY.CREATE";
+ public static final String EVENT_ACL_POLICY_DELETE = "ACLPOLICY.DELETE";
+ public static final String EVENT_ACL_POLICY_GRANT = "ACLPOLICY.GRANT";
+ public static final String EVENT_ACL_POLICY_REVOKE = "ACLPOLICY.REVOKE";
-
++
+ public static final String EVENT_ACL_GROUP_UPDATE = "ACLGROUP.UPDATE";
+ public static final String EVENT_ACL_GROUP_CREATE = "ACLGROUP.CREATE";
+ public static final String EVENT_ACL_GROUP_DELETE = "ACLGROUP.DELETE";
+ public static final String EVENT_ACL_GROUP_GRANT = "ACLGROUP.GRANT";
+ public static final String EVENT_ACL_GROUP_REVOKE = "ACLGROUP.REVOKE";
+
// Object store migration
public static final String EVENT_MIGRATE_PREPARE_SECONDARY_STORAGE = "MIGRATE.PREPARE.SS";
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/com/cloud/network/NetworkProfile.java
----------------------------------------------------------------------
diff --cc api/src/com/cloud/network/NetworkProfile.java
index 025b8d2,1b66c7c..c77b765
--- a/api/src/com/cloud/network/NetworkProfile.java
+++ b/api/src/com/cloud/network/NetworkProfile.java
@@@ -269,18 -266,13 +268,18 @@@ public class NetworkProfile implements
trafficType = type;
}
- @Override
- public String getIp6Gateway() {
- return ip6Gateway;
- }
+ @Override
+ public String getIp6Gateway() {
+ return ip6Gateway;
+ }
- @Override
- public String getIp6Cidr() {
- return ip6Cidr;
- }
+ @Override
+ public String getIp6Cidr() {
+ return ip6Cidr;
+ }
+
+ @Override
+ public AclEntityType getEntityType() {
+ return AclEntityType.Network;
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/com/cloud/network/vpc/StaticRouteProfile.java
----------------------------------------------------------------------
diff --cc api/src/com/cloud/network/vpc/StaticRouteProfile.java
index e3bbc68,05cff49..e4942a0
--- a/api/src/com/cloud/network/vpc/StaticRouteProfile.java
+++ b/api/src/com/cloud/network/vpc/StaticRouteProfile.java
@@@ -32,20 -30,19 +32,19 @@@ public class StaticRouteProfile impleme
String netmask;
String ipAddress;
-
public StaticRouteProfile(StaticRoute staticRoute, VpcGateway gateway) {
-- this.id = staticRoute.getId();
-- this.uuid = staticRoute.getUuid();
-- this.targetCidr = staticRoute.getCidr();
-- this.accountId = staticRoute.getAccountId();
-- this.domainId = staticRoute.getDomainId();
-- this.gatewayId = staticRoute.getVpcGatewayId();
-- this.state = staticRoute.getState();
-- this.vpcId = staticRoute.getVpcId();
-- this.vlanTag = gateway.getBroadcastUri();
++ id = staticRoute.getId();
++ uuid = staticRoute.getUuid();
++ targetCidr = staticRoute.getCidr();
++ accountId = staticRoute.getAccountId();
++ domainId = staticRoute.getDomainId();
++ gatewayId = staticRoute.getVpcGatewayId();
++ state = staticRoute.getState();
++ vpcId = staticRoute.getVpcId();
++ vlanTag = gateway.getBroadcastUri();
this.gateway = gateway.getGateway();
-- this.netmask = gateway.getNetmask();
-- this.ipAddress = gateway.getIp4Address();
++ netmask = gateway.getNetmask();
++ ipAddress = gateway.getIp4Address();
}
@Override
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/com/cloud/storage/VolumeApiService.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/com/cloud/user/Account.java
----------------------------------------------------------------------
diff --cc api/src/com/cloud/user/Account.java
index a558cfb,99ef954..b912e51
--- a/api/src/com/cloud/user/Account.java
+++ b/api/src/com/cloud/user/Account.java
@@@ -22,16 -22,15 +22,13 @@@ import org.apache.cloudstack.acl.Contro
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
-
public interface Account extends ControlledEntity, InternalIdentity, Identity {
- public enum Type {
- Normal, Admin, DomainAdmin, CustomerCare, Project
- }
+
+
public enum State {
- disabled,
- enabled,
- locked
+ disabled, enabled, locked
}
-
public static final short ACCOUNT_TYPE_NORMAL = 0;
public static final short ACCOUNT_TYPE_ADMIN = 1;
public static final short ACCOUNT_TYPE_DOMAIN_ADMIN = 2;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/com/cloud/user/AccountService.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/com/cloud/user/ResourceLimitService.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/acl/AclEntityType.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/acl/AclEntityType.java
index 2546709,0000000..5c60ede
mode 100644,000000..100644
--- a/api/src/org/apache/cloudstack/acl/AclEntityType.java
+++ b/api/src/org/apache/cloudstack/acl/AclEntityType.java
@@@ -1,41 -1,0 +1,43 @@@
+package org.apache.cloudstack.acl;
+
+public enum AclEntityType {
+ // currently supported entity, to be added one by one after we support acl on the entity
+ VirtualMachine,
+ Volume,
+ ResourceTag,
+ Account,
+ AffinityGroup,
+ AutoScalePolicy,
+ AutoScaleVmGroup,
+ AutoScaleVmProfile,
+ Condition,
+ Vpc,
+ VpcGateway,
+ VpnUser,
+ VMSnapshot,
+ VirtualMachineTemplate,
+ UserIpv6Address,
+ StaticRoute,
+ SSHKeyPair,
+ Snapshot,
+ Site2SiteVpnGateway,
+ Site2SiteVpnConnection,
+ Site2SiteCustomerGateway,
+ SecurityGroup,
+ RemoteAccessVpn,
+ PublicIpAddress,
+ ProjectInvitation,
+ NicSecondaryIp,
+ NicIpAlias,
+ Network,
+ IpAddress,
+ InstanceGroup,
+ GlobalLoadBalancerRule,
+ FirewallRule,
+ Event,
+ AsyncJob,
+ AclPolicy,
- AclGroup;
++ AclGroup,
++ MonitorService,
++ SSLCert
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/acl/ControlledEntity.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/acl/ControlledEntity.java
index 5b95927,5957576..29a857f
--- a/api/src/org/apache/cloudstack/acl/ControlledEntity.java
+++ b/api/src/org/apache/cloudstack/acl/ControlledEntity.java
@@@ -26,9 -26,7 +26,8 @@@ import com.cloud.user.OwnedBy
*/
public interface ControlledEntity extends OwnedBy, PartOf {
public enum ACLType {
- Account,
- Domain
+ Account, Domain
}
+ AclEntityType getEntityType();
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/acl/RoleType.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/acl/RoleType.java
index 7306bc1,8505256..90e3d1e
--- a/api/src/org/apache/cloudstack/acl/RoleType.java
+++ b/api/src/org/apache/cloudstack/acl/RoleType.java
@@@ -18,12 -18,8 +18,7 @@@ package org.apache.cloudstack.acl
// Enum for default roles in CloudStack
public enum RoleType {
--
- User(8),
- Admin(1),
- DomainAdmin(4),
- ResourceAdmin(2),
- Unknown(0);
+ Admin(1), ResourceAdmin(2), DomainAdmin(4), User(8), Unknown(0);
private int mask;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/acl/SecurityChecker.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/acl/SecurityChecker.java
index d467307,ab3f7c5..80fc14b
--- a/api/src/org/apache/cloudstack/acl/SecurityChecker.java
+++ b/api/src/org/apache/cloudstack/acl/SecurityChecker.java
@@@ -74,33 -69,11 +74,33 @@@ public interface SecurityChecker extend
* object that the account is trying to access.
* @param accessType
* TODO
- * @return true if access allowed. false if this adapter cannot provide permission.
+ * @return true if access allowed. false if this adapter cannot provide
+ * permission.
* @throws PermissionDeniedException
- * if this adapter is suppose to authenticate ownership and the check failed.
+ * if this adapter is suppose to authenticate ownership and the
+ * check failed.
+ */
+ boolean checkAccess(Account caller, ControlledEntity entity, AccessType accessType)
+ throws PermissionDeniedException;
+
+ /**
+ * Checks if the account can access the object.
- *
++ *
+ * @param caller
+ * account to check against.
+ * @param entity
+ * object that the account is trying to access.
+ * @param accessType
+ * TODO
+ * @param action
+ * name of the API
+ * @return true if access allowed. false if this adapter cannot provide
+ * permission.
+ * @throws PermissionDeniedException
+ * if this adapter is suppose to authenticate ownership and the
+ * check failed.
*/
- boolean checkAccess(Account caller, ControlledEntity entity, AccessType accessType) throws PermissionDeniedException;
+ boolean checkAccess(Account caller, ControlledEntity entity, AccessType accessType, String action) throws PermissionDeniedException;
/**
* Checks if the user belongs to an account that can access the object.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/ACL.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/ACL.java
index 733ef87,4955120..96ed54a
--- a/api/src/org/apache/cloudstack/api/ACL.java
+++ b/api/src/org/apache/cloudstack/api/ACL.java
@@@ -30,8 -30,7 +30,9 @@@ public @interface ACL
AccessType accessType() default AccessType.ListEntry;
+ String pointerToEntity() default "";
+
boolean checkKeyAccess() default false;
+
boolean checkValueAccess() default false;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/APICommand.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/APICommand.java
index eaadf62,5587a48..ce795b1
--- a/api/src/org/apache/cloudstack/api/APICommand.java
+++ b/api/src/org/apache/cloudstack/api/APICommand.java
@@@ -23,11 -23,9 +23,11 @@@ import java.lang.annotation.RetentionPo
import java.lang.annotation.Target;
import org.apache.cloudstack.acl.RoleType;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.acl.AclEntityType;
@Retention(RetentionPolicy.RUNTIME)
- @Target({ TYPE })
+ @Target({TYPE})
public @interface APICommand {
Class<? extends BaseResponse> responseObject();
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/ApiConstants.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/ApiConstants.java
index 50a2bfd,287fff3..7517630
--- a/api/src/org/apache/cloudstack/api/ApiConstants.java
+++ b/api/src/org/apache/cloudstack/api/ApiConstants.java
@@@ -543,8 -546,9 +563,10 @@@ public class ApiConstants
public static final String EXPUNGE = "expunge";
public static final String FOR_DISPLAY = "fordisplay";
public static final String PASSIVE = "passive";
+ public static final String VERSION = "version";
+ public static final String START = "start";
+
public enum HostDetails {
all, capacity, events, stats, min;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/BaseCmd.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/BaseListTemplateOrIsoPermissionsCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/BaseListTemplateOrIsoPermissionsCmd.java
index 06039b4,48c1e02..d149dff
--- a/api/src/org/apache/cloudstack/api/BaseListTemplateOrIsoPermissionsCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseListTemplateOrIsoPermissionsCmd.java
@@@ -26,10 -26,10 +26,11 @@@ import org.apache.cloudstack.api.respon
import com.cloud.template.VirtualMachineTemplate;
import com.cloud.user.Account;
-public class BaseListTemplateOrIsoPermissionsCmd extends BaseCmd {
+public abstract class BaseListTemplateOrIsoPermissionsCmd extends BaseCmd {
- public Logger s_logger = getLogger();
- protected String s_name = "listtemplatepermissionsresponse";
+ public Logger logger = getLogger();
+ protected static final String s_name = "listtemplatepermissionsresponse";
+
+
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@@@ -59,6 -58,10 +59,10 @@@
return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
}
+ protected Logger getLogger() {
- return Logger.getLogger(BaseUpdateTemplateOrIsoPermissionsCmd.class);
++ return Logger.getLogger(BaseListTemplateOrIsoPermissionsCmd.class);
+ }
+
@Override
public String getCommandName() {
return s_name;
@@@ -72,14 -75,14 +76,11 @@@
return "templateOrIso";
}
- protected Logger getLogger() {
- return Logger.getLogger(BaseUpdateTemplateOrIsoPermissionsCmd.class.getName());
- }
- @Override
- public void execute() {
- List<String> accountNames = _templateService.listTemplatePermissions(this);
- Account account = CallContext.current().getCallingAccount();
- boolean isAdmin = (isAdmin(account.getType()));
+ protected void executeWithView(ResponseView view) {
+ List<String> accountNames = _templateService.listTemplatePermissions(this);
- TemplatePermissionsResponse response = _responseGenerator.createTemplatePermissionsResponse(accountNames, id, isAdmin);
+ TemplatePermissionsResponse response = _responseGenerator.createTemplatePermissionsResponse(view, accountNames, id);
response.setResponseName(getCommandName());
setResponseObject(response);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/ResponseGenerator.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/ResponseGenerator.java
index e47773e,1cb5388..034e76f
--- a/api/src/org/apache/cloudstack/api/ResponseGenerator.java
+++ b/api/src/org/apache/cloudstack/api/ResponseGenerator.java
@@@ -281,11 -284,13 +283,11 @@@ public interface ResponseGenerator
RemoteAccessVpnResponse createRemoteAccessVpnResponse(RemoteAccessVpn vpn);
- List<TemplateResponse> createTemplateResponses(long templateId, Long zoneId, boolean readyOnly);
-
- List<TemplateResponse> createTemplateResponses(long templateId, Long snapshotId, Long volumeId, boolean readyOnly);
+ List<TemplateResponse> createTemplateResponses(ResponseView view, long templateId, Long zoneId, boolean readyOnly);
- //ListResponse<SecurityGroupResponse> createSecurityGroupResponses(List<? extends SecurityGroupRules> networkGroups);
+ List<TemplateResponse> createTemplateResponses(ResponseView view, long templateId, Long snapshotId, Long volumeId, boolean readyOnly);
- SecurityGroupResponse createSecurityGroupResponseFromSecurityGroupRule(List<? extends SecurityRule> SecurityRules);
+ SecurityGroupResponse createSecurityGroupResponseFromSecurityGroupRule(List<? extends SecurityRule> securityRules);
SecurityGroupResponse createSecurityGroupResponse(SecurityGroup group);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/ResponseObject.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java
index 539cddd,c5a2d1a..6a76644
--- a/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java
@@@ -162,14 -170,15 +171,15 @@@ public class CreateAccountCmd extends B
}
@Override
- public void execute(){
- CallContext.current().setEventDetails("Account Name: "+getAccountName()+", Domain Id:"+getDomainId());
- UserAccount userAccount = _accountService.createUserAccount(getUsername(), getPassword(), getFirstName(), getLastName(), getEmail(), getTimeZone(), getAccountName(), getAccountType(),
+ public void execute() {
+ CallContext.current().setEventDetails("Account Name: " + getAccountName() + ", Domain Id:" + getDomainId());
+ UserAccount userAccount =
+ _accountService.createUserAccount(getUsername(), getPassword(), getFirstName(), getLastName(), getEmail(), getTimeZone(), getAccountName(), getAccountType(),
getDomainId(), getNetworkDomain(), getDetails(), getAccountUUID(), getUserUUID());
if (userAccount != null) {
- AccountResponse response = _responseGenerator.createUserAccountResponse(userAccount);
+ AccountResponse response = _responseGenerator.createUserAccountResponse(ResponseView.Full, userAccount);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a user account");
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java
index c47ea24,6fdbefe..bc6bfa5
--- a/api/src/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java
@@@ -117,15 -115,15 +116,15 @@@ public class DisableAccountCmd extends
}
@Override
- public void execute() throws ConcurrentOperationException, ResourceUnavailableException{
- CallContext.current().setEventDetails("Account Name: "+getAccountName()+", Domain Id:"+getDomainId());
+ public void execute() throws ConcurrentOperationException, ResourceUnavailableException {
+ CallContext.current().setEventDetails("Account Name: " + getAccountName() + ", Domain Id:" + getDomainId());
Account result = _regionService.disableAccount(this);
- if (result != null) {
- AccountResponse response = _responseGenerator.createAccountResponse(result);
+ if (result != null){
+ AccountResponse response = _responseGenerator.createAccountResponse(ResponseView.Full, result);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
- throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, lockRequested == true ? "Failed to lock account" : "Failed to disable account" );
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, lockRequested == true ? "Failed to lock account" : "Failed to disable account");
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java
index 82ba9cc,59d6acd..8f97d23
--- a/api/src/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java
@@@ -95,12 -93,12 +94,12 @@@ public class EnableAccountCmd extends B
}
@Override
- public void execute(){
+ public void execute() {
Account result = _regionService.enableAccount(this);
- if (result != null) {
- AccountResponse response = _responseGenerator.createAccountResponse(result);
+ if (result != null){
+ AccountResponse response = _responseGenerator.createAccountResponse(ResponseView.Full, result);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to enable account");
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java
index 6d4e403,a8cf63f..f5038d5
--- a/api/src/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java
@@@ -125,12 -125,12 +126,12 @@@ public class UpdateAccountCmd extends B
}
@Override
- public void execute(){
+ public void execute() {
Account result = _regionService.updateAccount(this);
- if (result != null) {
- AccountResponse response = _responseGenerator.createAccountResponse(result);
+ if (result != null){
+ AccountResponse response = _responseGenerator.createAccountResponse(ResponseView.Full, result);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update account");
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/admin/iso/ListIsosCmdByAdmin.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/admin/iso/ListIsosCmdByAdmin.java
index 660084a,0000000..6d87bcd
mode 100644,000000..100644
--- a/api/src/org/apache/cloudstack/api/command/admin/iso/ListIsosCmdByAdmin.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/iso/ListIsosCmdByAdmin.java
@@@ -1,27 -1,0 +1,26 @@@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.admin.iso;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.command.user.iso.ListIsosCmd;
+import org.apache.cloudstack.api.response.TemplateResponse;
+
+@APICommand(name = "listIsos", description = "Lists all available ISO files.", responseObject = TemplateResponse.class, responseView = ResponseView.Full)
+public class ListIsosCmdByAdmin extends ListIsosCmd {
-
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworksCmdByAdmin.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/admin/network/ListNetworksCmdByAdmin.java
index 7363be9,0000000..3c31e68
mode 100644,000000..100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworksCmdByAdmin.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworksCmdByAdmin.java
@@@ -1,50 -1,0 +1,50 @@@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.admin.network;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.command.user.network.ListNetworksCmd;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.NetworkResponse;
+
+import com.cloud.network.Network;
++import com.cloud.utils.Pair;
+
+@APICommand(name = "listNetworks", description = "Lists all available networks.", responseObject = NetworkResponse.class, responseView = ResponseView.Full)
+public class ListNetworksCmdByAdmin extends ListNetworksCmd {
+ public static final Logger s_logger = Logger.getLogger(ListNetworksCmdByAdmin.class.getName());
+
+ @Override
+ public void execute(){
- List<? extends Network> networks = _networkService.searchForNetworks(this);
++ 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(ResponseView.Full, network);
+ networkResponses.add(networkResponse);
+ }
-
- response.setResponses(networkResponses);
++ response.setResponses(networkResponses, networks.second());
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkCmdByAdmin.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkCmdByAdmin.java
index bd2a370,0000000..cab88d4
mode 100644,000000..100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkCmdByAdmin.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkCmdByAdmin.java
@@@ -1,63 -1,0 +1,63 @@@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.admin.network;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.command.user.network.UpdateNetworkCmd;
+import org.apache.cloudstack.api.response.NetworkResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.network.Network;
+import com.cloud.user.Account;
+import com.cloud.user.User;
+
+@APICommand(name = "updateNetwork", description = "Updates a network", responseObject = NetworkResponse.class, responseView = ResponseView.Full)
+public class UpdateNetworkCmdByAdmin extends UpdateNetworkCmd {
+ public static final Logger s_logger = Logger.getLogger(UpdateNetworkCmdByAdmin.class.getName());
+
+
+ @Override
+ public void execute() throws InsufficientCapacityException, ConcurrentOperationException{
+ User callerUser = _accountService.getActiveUser(CallContext.current().getCallingUserId());
+ Account callerAccount = _accountService.getActiveAccountById(callerUser.getAccountId());
+ Network network = _networkService.getNetwork(id);
+ if (network == null) {
+ throw new InvalidParameterValueException("Couldn't find network by id");
+ }
+
+ Network result = _networkService.updateGuestNetwork(getId(), getNetworkName(), getDisplayText(), callerAccount,
+ callerUser, getNetworkDomain(), getNetworkOfferingId(), getChangeCidr(), getGuestVmCidr(), getDisplayNetwork());
-
++
+
+ if (result != null) {
+ NetworkResponse response = _responseGenerator.createNetworkResponse(ResponseView.Full, result);
+ response.setResponseName(getCommandName());
+ 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/admin/template/PrepareTemplateCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/admin/template/PrepareTemplateCmd.java
index 06cc6e0,16761ba..086abf5
--- a/api/src/org/apache/cloudstack/api/command/admin/template/PrepareTemplateCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/template/PrepareTemplateCmd.java
@@@ -82,10 -86,9 +87,9 @@@ public class PrepareTemplateCmd extend
ListResponse<TemplateResponse> response = new ListResponse<TemplateResponse>();
VirtualMachineTemplate vmTemplate = _templateService.prepareTemplate(templateId, zoneId);
- List<TemplateResponse> templateResponses = _responseGenerator.createTemplateResponses(vmTemplate, zoneId, true);
+ List<TemplateResponse> templateResponses = _responseGenerator.createTemplateResponses(ResponseView.Full, vmTemplate, zoneId, true);
response.setResponses(templateResponses);
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/admin/user/CreateUserCmd.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/admin/vm/AssignVMCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/admin/vm/AssignVMCmd.java
index 96823f0,c9b5c9f..654f4ef
--- a/api/src/org/apache/cloudstack/api/command/admin/vm/AssignVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/vm/AssignVMCmd.java
@@@ -26,9 -25,7 +25,8 @@@ import org.apache.cloudstack.api.ApiCon
import org.apache.cloudstack.api.ApiErrorCode;
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.command.user.vm.DeployVMCmd;
import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.api.response.NetworkResponse;
import org.apache.cloudstack.api.response.SecurityGroupResponse;
@@@ -37,8 -34,11 +35,11 @@@ import org.apache.cloudstack.api.respon
import com.cloud.user.Account;
import com.cloud.uservm.UserVm;
- @APICommand(name = "assignVirtualMachine", description="Change ownership of a VM from one account to another. This API is available for Basic zones with security groups and Advanced zones with guest networks. A root administrator can reassign a VM from any account to any other account in any domain. A domain administrator can reassign a VM to any account in the same domain.", responseObject=UserVmResponse.class, since="3.0.0")
+ @APICommand(name = "assignVirtualMachine",
+ description = "Change ownership of a VM from one account to another. This API is available for Basic zones with security groups and Advanced zones with guest networks. A root administrator can reassign a VM from any account to any other account in any domain. A domain administrator can reassign a VM to any account in the same domain.",
+ responseObject = UserVmResponse.class,
+ since = "3.0.0")
-public class AssignVMCmd extends BaseCmd {
+public class AssignVMCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(AssignVMCmd.class.getName());
private static final String s_name = "assignvirtualmachineresponse";
@@@ -102,16 -112,16 +113,16 @@@
}
@Override
- public void execute(){
+ public void execute() {
try {
- UserVm userVm = _userVmService.moveVMToUser(this);
- if (userVm == null){
- throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to move vm");
- }
+ UserVm userVm = _userVmService.moveVMToUser(this);
+ if (userVm == null) {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to move vm");
+ }
- UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", userVm).get(0);
+ UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Full, "virtualmachine", userVm).get(0);
- response.setResponseName(DeployVMCmd.getResultObjectName());
- setResponseObject(response);
- }catch (Exception e){
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+ } catch (Exception e) {
e.printStackTrace();
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to move vm " + e.getMessage());
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/admin/vm/MigrateVMCmd.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/admin/vm/MigrateVirtualMachineWithVolumeCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/admin/vm/MigrateVirtualMachineWithVolumeCmd.java
index 5cb62c7,90918bf..1c32a25
--- a/api/src/org/apache/cloudstack/api/command/admin/vm/MigrateVirtualMachineWithVolumeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/vm/MigrateVirtualMachineWithVolumeCmd.java
@@@ -54,16 -55,24 +56,24 @@@ public class MigrateVirtualMachineWithV
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.HOST_ID, type=CommandType.UUID, entityType=HostResponse.class,
- required=true, description="Destination Host ID to migrate VM to.")
+ @Parameter(name = ApiConstants.HOST_ID,
+ type = CommandType.UUID,
+ entityType = HostResponse.class,
+ required = true,
+ description = "Destination Host ID to migrate VM to.")
private Long hostId;
- @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType=UserVmResponse.class,
- required=true, description="the ID of the virtual machine")
+ @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID,
+ type = CommandType.UUID,
+ entityType = UserVmResponse.class,
+ required = true,
+ description = "the ID of the virtual machine")
private Long virtualMachineId;
- @Parameter(name = ApiConstants.MIGRATE_TO, type = CommandType.MAP, required=false,
+ @Parameter(name = ApiConstants.MIGRATE_TO,
+ type = CommandType.MAP,
+ required = false,
- description = "Map of pool to which each volume should be migrated (volume/pool pair)")
+ description = "Map of pool to which each volume should be migrated (volume/pool pair)")
private Map migrateVolumeTo;
/////////////////////////////////////////////////////
@@@ -134,13 -143,12 +144,12 @@@
throw new InvalidParameterValueException("Unable to find the host to migrate the VM, host id =" + getHostId());
}
- try{
- VirtualMachine migratedVm = _userVmService.migrateVirtualMachineWithVolume(getVirtualMachineId(),
- destinationHost, getVolumeToPool());
+ try {
+ VirtualMachine migratedVm = _userVmService.migrateVirtualMachineWithVolume(getVirtualMachineId(), destinationHost, getVolumeToPool());
if (migratedVm != null) {
- UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", (UserVm)migratedVm).get(0);
+ UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Full, "virtualmachine", (UserVm)migratedVm).get(0);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to migrate vm");
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/admin/vm/RecoverVMCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/admin/vm/RecoverVMCmd.java
index 0e04742,abf5168..765c318
--- a/api/src/org/apache/cloudstack/api/command/admin/vm/RecoverVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/vm/RecoverVMCmd.java
@@@ -73,12 -71,12 +72,12 @@@ public class RecoverVMCmd extends BaseC
}
@Override
- public void execute() throws ResourceAllocationException{
+ public void execute() throws ResourceAllocationException {
UserVm result = _userVmService.recoverVirtualMachine(this);
- if (result != null) {
- UserVmResponse recoverVmResponse = _responseGenerator.createUserVmResponse("virtualmachine", result).get(0);
+ if (result != null){
+ UserVmResponse recoverVmResponse = _responseGenerator.createUserVmResponse(ResponseView.Full, "virtualmachine", result).get(0);
recoverVmResponse.setResponseName(getCommandName());
- this.setResponseObject(recoverVmResponse);
+ setResponseObject(recoverVmResponse);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to recover vm");
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/admin/volume/ListVolumesCmdByAdmin.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/admin/volume/ListVolumesCmdByAdmin.java
index a8741fd,0000000..1cd54d1
mode 100644,000000..100644
--- a/api/src/org/apache/cloudstack/api/command/admin/volume/ListVolumesCmdByAdmin.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/volume/ListVolumesCmdByAdmin.java
@@@ -1,63 -1,0 +1,63 @@@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.admin.volume;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.acl.RoleType;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.command.user.volume.ListVolumesCmd;
+import org.apache.cloudstack.api.response.PodResponse;
+import org.apache.cloudstack.api.response.StoragePoolResponse;
+import org.apache.cloudstack.api.response.VolumeResponse;
+
+
+
+@APICommand(name = "listVolumes", description = "Lists all volumes.", responseObject = VolumeResponse.class, responseView = ResponseView.Full)
+public class ListVolumesCmdByAdmin extends ListVolumesCmd {
+ public static final Logger s_logger = Logger.getLogger(ListVolumesCmdByAdmin.class.getName());
+
+ @Parameter(name=ApiConstants.POD_ID, type=CommandType.UUID, entityType=PodResponse.class,
+ description="the pod id the disk volume belongs to")
+ private Long podId;
+
+
+ @Parameter(name=ApiConstants.STORAGE_ID, type=CommandType.UUID, entityType=StoragePoolResponse.class,
+ description="the ID of the storage pool, available to ROOT admin only", since="4.3", authorized = { RoleType.Admin })
+ private Long storageId;
+
-
++
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+
+ @Override
+ public Long getPodId() {
+ return podId;
+ }
+
+
+ @Override
+ public Long getStorageId() {
+ return storageId;
+ }
-
++
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/admin/volume/MigrateVolumeCmdByAdmin.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/admin/volume/MigrateVolumeCmdByAdmin.java
index c58a233,0000000..44a08e8
mode 100644,000000..100644
--- a/api/src/org/apache/cloudstack/api/command/admin/volume/MigrateVolumeCmdByAdmin.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/volume/MigrateVolumeCmdByAdmin.java
@@@ -1,47 -1,0 +1,47 @@@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.admin.volume;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.command.user.volume.MigrateVolumeCmd;
+import org.apache.cloudstack.api.response.VolumeResponse;
+
+import com.cloud.storage.Volume;
+
+
+@APICommand(name = "migrateVolume", description = "Migrate volume", responseObject = VolumeResponse.class, since = "3.0.0", responseView = ResponseView.Full)
+public class MigrateVolumeCmdByAdmin extends MigrateVolumeCmd {
+
+
+ @Override
+ public void execute(){
- Volume result;
++ Volume result;
+
- result = _volumeService.migrateVolume(this);
- if (result != null) {
++ result = _volumeService.migrateVolume(this);
++ if (result != null) {
+ VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Full, result);
- response.setResponseName(getCommandName());
- setResponseObject(response);
- } else {
- throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to migrate volume");
- }
++ response.setResponseName(getCommandName());
++ setResponseObject(response);
++ } else {
++ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to migrate volume");
++ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/admin/volume/ResizeVolumeCmdByAdmin.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/admin/volume/ResizeVolumeCmdByAdmin.java
index 21bbdbb,0000000..d1d253c
mode 100644,000000..100644
--- a/api/src/org/apache/cloudstack/api/command/admin/volume/ResizeVolumeCmdByAdmin.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/volume/ResizeVolumeCmdByAdmin.java
@@@ -1,47 -1,0 +1,47 @@@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.admin.volume;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.command.user.volume.ResizeVolumeCmd;
+import org.apache.cloudstack.api.response.VolumeResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.storage.Volume;
+
+
+@APICommand(name = "resizeVolume", description = "Resizes a volume", responseObject = VolumeResponse.class, responseView = ResponseView.Full)
+public class ResizeVolumeCmdByAdmin extends ResizeVolumeCmd {
+
+ @Override
+ public void execute() throws ResourceAllocationException{
+ CallContext.current().setEventDetails("Volume Id: " + getEntityId() + " to size " + getSize() + "G");
- Volume volume = _volumeService.resizeVolume(this);
- if (volume != null) {
++ Volume volume = _volumeService.resizeVolume(this);
++ if (volume != null) {
+ VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Full, volume);
+ //FIXME - have to be moved to ApiResponseHelper
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to resize volume");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/admin/volume/UpdateVolumeCmdByAdmin.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/admin/volume/UpdateVolumeCmdByAdmin.java
index f1afc3f,0000000..7e2acc5
mode 100644,000000..100644
--- a/api/src/org/apache/cloudstack/api/command/admin/volume/UpdateVolumeCmdByAdmin.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/volume/UpdateVolumeCmdByAdmin.java
@@@ -1,44 -1,0 +1,44 @@@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.admin.volume;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.command.user.volume.UpdateVolumeCmd;
+import org.apache.cloudstack.api.response.VolumeResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.storage.Volume;
+
+@APICommand(name = "updateVolume", description = "Updates the volume.", responseObject = VolumeResponse.class, responseView = ResponseView.Full)
+public class UpdateVolumeCmdByAdmin extends UpdateVolumeCmd {
+
+ @Override
+ public void execute(){
+ CallContext.current().setEventDetails("Volume Id: "+getId());
- Volume result = _volumeService.updateVolume(getId(), getPath(), getState(), getStorageId(), getDisplayVolume());
++ Volume result = _volumeService.updateVolume(getId(), getPath(), getState(), getStorageId(), getDisplayVolume(), getCustomId(), getEntityOwnerId());
+ if (result != null) {
+ VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Full, result);
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update volume");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/admin/zone/CreateZoneCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/admin/zone/CreateZoneCmd.java
index 3532422,0846102..10ae55d
--- a/api/src/org/apache/cloudstack/api/command/admin/zone/CreateZoneCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/zone/CreateZoneCmd.java
@@@ -164,13 -165,13 +166,13 @@@ public class CreateZoneCmd extends Base
}
@Override
- public void execute(){
- CallContext.current().setEventDetails("Zone Name: "+getZoneName());
+ public void execute() {
+ CallContext.current().setEventDetails("Zone Name: " + getZoneName());
DataCenter result = _configService.createZone(this);
- if (result != null) {
- ZoneResponse response = _responseGenerator.createZoneResponse(result, false);
+ if (result != null){
+ ZoneResponse response = _responseGenerator.createZoneResponse(ResponseView.Full, result, false);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a zone");
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/admin/zone/MarkDefaultZoneForAccountCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/admin/zone/MarkDefaultZoneForAccountCmd.java
index 6f50623,fe2bc6a..5589e79
--- a/api/src/org/apache/cloudstack/api/command/admin/zone/MarkDefaultZoneForAccountCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/zone/MarkDefaultZoneForAccountCmd.java
@@@ -102,14 -110,13 +111,14 @@@ public class MarkDefaultZoneForAccountC
}
@Override
- public void execute(){
- Account result = _configService.markDefaultZone(getAccountName(),getDomainId(), getDefaultZoneId());
+ public void execute() {
+ Account result = _configService.markDefaultZone(getAccountName(), getDomainId(), getDefaultZoneId());
if (result != null) {
- AccountResponse response = _responseGenerator.createAccountResponse(result);
+ AccountResponse response = _responseGenerator.createAccountResponse(ResponseView.Full, result);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
- } else {
+ setResponseObject(response);
+ }
+ else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to mark the account with the default zone");
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/admin/zone/UpdateZoneCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/admin/zone/UpdateZoneCmd.java
index c7c95d2,f0074c5..3a36d80
--- a/api/src/org/apache/cloudstack/api/command/admin/zone/UpdateZoneCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/zone/UpdateZoneCmd.java
@@@ -176,13 -176,13 +177,13 @@@ public class UpdateZoneCmd extends Base
}
@Override
- public void execute(){
- CallContext.current().setEventDetails("Zone Id: "+getId());
+ public void execute() {
+ CallContext.current().setEventDetails("Zone Id: " + getId());
DataCenter result = _configService.editZone(this);
if (result != null) {
- ZoneResponse response = _responseGenerator.createZoneResponse(result, false);
+ ZoneResponse response = _responseGenerator.createZoneResponse(ResponseView.Full, result, false);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update zone; internal error.");
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/account/ListAccountsCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/account/ListAccountsCmd.java
index 96b4590,bc93d21..b1a8d3e
--- a/api/src/org/apache/cloudstack/api/command/user/account/ListAccountsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/account/ListAccountsCmd.java
@@@ -87,9 -85,9 +87,9 @@@ public class ListAccountsCmd extends Ba
}
@Override
- public void execute(){
+ public void execute() {
ListResponse<AccountResponse> response = _queryService.searchForAccounts(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/address/AssociateIPAddrCmd.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/address/ListPublicIpAddressesCmd.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/affinitygroup/CreateAffinityGroupCmd.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/affinitygroup/DeleteAffinityGroupCmd.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/affinitygroup/UpdateVMAffinityGroupCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/affinitygroup/UpdateVMAffinityGroupCmd.java
index 53e86e1,7bb1c5b..27c45fa
--- a/api/src/org/apache/cloudstack/api/command/user/affinitygroup/UpdateVMAffinityGroupCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/affinitygroup/UpdateVMAffinityGroupCmd.java
@@@ -43,9 -42,10 +43,8 @@@ import com.cloud.exception.ResourceUnav
import com.cloud.user.Account;
import com.cloud.uservm.UserVm;
-
-@APICommand(name = "updateVMAffinityGroup",
- description = "Updates the affinity/anti-affinity group associations of a virtual machine. The VM has to be stopped and restarted for the "
- + "new properties to take effect.",
- responseObject = UserVmResponse.class)
+@APICommand(name = "updateVMAffinityGroup", description = "Updates the affinity/anti-affinity group associations of a virtual machine. The VM has to be stopped and restarted for the "
+ + "new properties to take effect.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted)
public class UpdateVMAffinityGroupCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(UpdateVMAffinityGroupCmd.class.getName());
private static final String s_name = "updatevirtualmachineresponse";
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/firewall/CreateEgressFirewallRuleCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/firewall/CreateEgressFirewallRuleCmd.java
index 75e87ab,778a18b..e0bee6b
--- a/api/src/org/apache/cloudstack/api/command/user/firewall/CreateEgressFirewallRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/firewall/CreateEgressFirewallRuleCmd.java
@@@ -216,9 -220,9 +221,9 @@@ public class CreateEgressFirewallRuleCm
@Override
public long getDomainId() {
- Network network =_networkService.getNetwork(networkId);
+ Network network = _networkService.getNetwork(networkId);
- return network.getDomainId();
- }
+ return network.getDomainId();
+ }
@Override
public void create() {
@@@ -244,10 -248,10 +249,10 @@@
}
}
- if (getVpcId() != null ){
+ if (getVpcId() != null) {
- throw new InvalidParameterValueException("Unable to create firewall rule for the network id=" + networkId +
- " as firewall egress rule can be created only for non vpc networks.");
- }
+ throw new InvalidParameterValueException("Unable to create firewall rule for the network id=" + networkId +
+ " as firewall egress rule can be created only for non vpc networks.");
+ }
try {
FirewallRule result = _firewallService.createEgressFirewallRule(this);
@@@ -266,11 -270,10 +271,10 @@@
@Override
public String getEventDescription() {
- Network network = _networkService.getNetwork(networkId);
- return ("Creating firewall rule for network: " + network + " for protocol:" + this.getProtocol());
+ Network network = _networkService.getNetwork(networkId);
+ return ("Creating firewall rule for network: " + network + " for protocol:" + this.getProtocol());
}
-
@Override
public long getAccountId() {
Network network = _networkService.getNetwork(networkId);
@@@ -284,10 -287,9 +288,9 @@@
@Override
public Long getSyncObjId() {
- return getNetworkId();
+ return getNetworkId();
}
-
@Override
public Integer getIcmpCode() {
if (icmpCode != null) {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java
index 53ba0fe,44aa26f..c522709
--- a/api/src/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.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;
@@@ -257,7 -261,7 +262,7 @@@ public class CreateFirewallRuleCmd exte
@Override
public String getEventDescription() {
IpAddress ip = _networkService.getIp(ipAddressId);
-- return ("Creating firewall rule for Ip: " + ip.getAddress() + " for protocol:" + this.getProtocol());
++ return ("Creating firewall rule for Ip: " + ip.getAddress() + " for protocol:" + getProtocol());
}
@Override
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java
index 1ebe3d4,89dc077..14324df
--- a/api/src/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.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;
@@@ -54,50 -53,68 +54,68 @@@ public class CreatePortForwardingRuleCm
// ////////////// API parameters /////////////////////
// ///////////////////////////////////////////////////
- @Parameter(name = ApiConstants.IP_ADDRESS_ID, type = CommandType.UUID, entityType = IPAddressResponse.class,
+ @Parameter(name = ApiConstants.IP_ADDRESS_ID,
+ type = CommandType.UUID,
+ entityType = IPAddressResponse.class,
- required = true,
- description = "the IP address id of the port forwarding rule")
+ required = true,
+ description = "the IP address id of the port forwarding rule")
private Long ipAddressId;
- @Parameter(name = ApiConstants.PRIVATE_START_PORT, type = CommandType.INTEGER, required = true,
+ @Parameter(name = ApiConstants.PRIVATE_START_PORT,
+ type = CommandType.INTEGER,
+ required = true,
- description = "the starting port of port forwarding rule's private port range")
+ description = "the starting port of port forwarding rule's private port range")
private Integer privateStartPort;
- @Parameter(name = ApiConstants.PROTOCOL, type = CommandType.STRING, required = true,
+ @Parameter(name = ApiConstants.PROTOCOL,
+ type = CommandType.STRING,
+ required = true,
- description = "the protocol for the port fowarding rule. Valid values are TCP or UDP.")
+ description = "the protocol for the port fowarding rule. Valid values are TCP or UDP.")
private String protocol;
- @Parameter(name = ApiConstants.PRIVATE_END_PORT, type = CommandType.INTEGER, required = false, description = "the ending port of port forwarding rule's private port range")
+ @Parameter(name = ApiConstants.PRIVATE_END_PORT,
+ type = CommandType.INTEGER,
+ required = false,
+ description = "the ending port of port forwarding rule's private port range")
private Integer privateEndPort;
- @Parameter(name = ApiConstants.PUBLIC_START_PORT, type = CommandType.INTEGER, required = true,
+ @Parameter(name = ApiConstants.PUBLIC_START_PORT,
+ type = CommandType.INTEGER,
+ required = true,
- description = "the starting port of port forwarding rule's public port range")
+ description = "the starting port of port forwarding rule's public port range")
private Integer publicStartPort;
- @Parameter(name = ApiConstants.PUBLIC_END_PORT, type = CommandType.INTEGER, required = false, description = "the ending port of port forwarding rule's private port range")
+ @Parameter(name = ApiConstants.PUBLIC_END_PORT,
+ type = CommandType.INTEGER,
+ required = false,
+ description = "the ending port of port forwarding rule's private port range")
private Integer publicEndPort;
- @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, entityType = UserVmResponse.class,
+ @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID,
+ type = CommandType.UUID,
+ entityType = UserVmResponse.class,
- required = true,
- description = "the ID of the virtual machine for the port forwarding rule")
+ required = true,
+ description = "the ID of the virtual machine for the port forwarding rule")
private Long virtualMachineId;
- @Parameter(name = ApiConstants.CIDR_LIST, type = CommandType.LIST, collectionType = CommandType.STRING,
- description = "the cidr list to forward traffic from")
+ @Parameter(name = ApiConstants.CIDR_LIST, type = CommandType.LIST, collectionType = CommandType.STRING, description = "the cidr list to forward traffic from")
private List<String> cidrlist;
- @Parameter(name = ApiConstants.OPEN_FIREWALL, type = CommandType.BOOLEAN,
- description = "if true, firewall rule for source/end pubic port is automatically created; " +
- "if false - firewall rule has to be created explicitely. If not specified 1) defaulted to false when PF" +
- " rule is being created for VPC guest network 2) in all other cases defaulted to true")
+ @Parameter(name = ApiConstants.OPEN_FIREWALL, type = CommandType.BOOLEAN, description = "if true, firewall rule for source/end pubic port is automatically created; "
+ + "if false - firewall rule has to be created explicitely. If not specified 1) defaulted to false when PF"
+ + " rule is being created for VPC guest network 2) in all other cases defaulted to true")
private Boolean openFirewall;
- @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.UUID, entityType = NetworkResponse.class,
- description="The network of the vm the Port Forwarding rule will be created for. " +
- "Required when public Ip address is not associated with any Guest network yet (VPC case)")
+ @Parameter(name = ApiConstants.NETWORK_ID,
+ type = CommandType.UUID,
+ entityType = NetworkResponse.class,
+ description = "The network of the vm the Port Forwarding rule will be created for. "
+ + "Required when public Ip address is not associated with any Guest network yet (VPC case)")
private Long networkId;
- @Parameter(name = ApiConstants.VM_GUEST_IP, type = CommandType.STRING, required = false,
+ @Parameter(name = ApiConstants.VM_GUEST_IP,
+ type = CommandType.STRING,
+ required = false,
- description = "VM guest nic Secondary ip address for the port forwarding rule")
+ description = "VM guest nic Secondary ip address for the port forwarding rule")
private String vmSecondaryIp;
// ///////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/iso/AttachIsoCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/iso/AttachIsoCmd.java
index b5f28e8,d38c816..d5e53a1
--- a/api/src/org/apache/cloudstack/api/command/user/iso/AttachIsoCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/iso/AttachIsoCmd.java
@@@ -44,15 -43,16 +44,14 @@@ public class AttachIsoCmd extends BaseA
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = TemplateResponse.class,
- required=true, description="the ID of the ISO file")
- @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TemplateResponse.class, required = true, description = "the ID of the ISO file")
- private Long id;
++ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TemplateResponse.class,
++ required = true, description = "the ID of the ISO file")
+ protected Long id;
- @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType = UserVmResponse.class,
- required=true, description="the ID of the virtual machine")
- @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID,
- type = CommandType.UUID,
- entityType = UserVmResponse.class,
- required = true,
- description = "the ID of the virtual machine")
- private Long virtualMachineId;
++ @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, entityType = UserVmResponse.class,
++ required = true, description = "the ID of the virtual machine")
+ protected Long virtualMachineId;
-
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/iso/DetachIsoCmd.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java
index 01b7669,95b771f..af674eb
--- a/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java
@@@ -115,12 -119,12 +120,13 @@@ public class ListIsosCmd extends BaseLi
public boolean listInReadyState() {
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(getIsoFilter());
- 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);
if (!onlyReady) {
if (isReady() != null && isReady().booleanValue() != onlyReady) {
@@@ -146,9 -150,9 +152,9 @@@
}
@Override
- public void execute(){
+ public void execute() {
ListResponse<TemplateResponse> response = _queryService.listIsos(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/iso/RegisterIsoCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/iso/RegisterIsoCmd.java
index 9d39ee2,29e3d67..b78eeb6
--- a/api/src/org/apache/cloudstack/api/command/user/iso/RegisterIsoCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/iso/RegisterIsoCmd.java
@@@ -48,54 -47,67 +48,64 @@@ public class RegisterIsoCmd extends Bas
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.BOOTABLE, type=CommandType.BOOLEAN, description="true if this ISO is bootable. If not passed explicitly its assumed to be true")
+ @Parameter(name = ApiConstants.BOOTABLE, type = CommandType.BOOLEAN, description = "true if this ISO is bootable. If not passed explicitly its assumed to be true")
private Boolean bootable;
- @Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, required=true, description="the display text of the ISO. 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 ISO. This is usually used for display purposes.",
+ length = 4096)
private String displayText;
- @Parameter(name=ApiConstants.IS_FEATURED, type=CommandType.BOOLEAN, description="true if you want this ISO to be featured")
+ @Parameter(name = ApiConstants.IS_FEATURED, type = CommandType.BOOLEAN, description = "true if you want this ISO to be featured")
private Boolean featured;
- @Parameter(name=ApiConstants.IS_PUBLIC, type=CommandType.BOOLEAN, description="true if you want to register the ISO to be publicly available to all users, false otherwise.")
+ @Parameter(name = ApiConstants.IS_PUBLIC,
+ type = CommandType.BOOLEAN,
+ description = "true if you want to register the ISO to be publicly available to all users, false otherwise.")
private Boolean publicIso;
- @Parameter(name=ApiConstants.IS_EXTRACTABLE, type=CommandType.BOOLEAN, description="true if the iso or its derivatives are extractable; default is false")
+ @Parameter(name = ApiConstants.IS_EXTRACTABLE, type = CommandType.BOOLEAN, description = "true if the iso or its derivatives are extractable; default is false")
private Boolean extractable;
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="the name of the ISO")
+ @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "the name of the ISO")
private String isoName;
- @Parameter(name=ApiConstants.OS_TYPE_ID, type=CommandType.UUID, entityType = GuestOSResponse.class,
- 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")
+ @Parameter(name = ApiConstants.OS_TYPE_ID,
+ type = CommandType.UUID,
+ entityType = GuestOSResponse.class,
+ 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")
+ @Parameter(name = ApiConstants.URL, type = CommandType.STRING, required = true, description = "the URL to where the ISO is currently being hosted")
private String url;
- @Parameter(name = ApiConstants.ZONE_ID,
- type = CommandType.UUID,
- entityType = ZoneResponse.class,
- required = true,
- description = "the ID of the zone you wish to register the ISO to.")
- private Long zoneId;
+ @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = ZoneResponse.class,
+ required=true, description="the ID of the zone you wish to register the ISO to.")
+ 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 account name. Must be used with domainId.")
+ @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "an optional account name. Must be used with domainId.")
private String accountName;
- @Parameter(name=ApiConstants.CHECKSUM, type=CommandType.STRING, description="the MD5 checksum value of this ISO")
+ @Parameter(name = ApiConstants.CHECKSUM, type = CommandType.STRING, description = "the MD5 checksum value of this ISO")
private String checksum;
- @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.UUID, entityType = ProjectResponse.class,
- description="Register iso for the project")
+ @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "Register iso for the project")
private Long projectId;
- @Parameter(name=ApiConstants.IMAGE_STORE_UUID, type=CommandType.STRING,
- description="Image store uuid")
+ @Parameter(name = ApiConstants.IMAGE_STORE_UUID, type = CommandType.STRING, description = "Image store uuid")
private String imageStoreUuid;
- @Parameter(name = ApiConstants.IS_DYNAMICALLY_SCALABLE, type = CommandType.BOOLEAN, description = "true if iso 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 iso contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory")
protected Boolean isDynamicallyScalable;
/////////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoCmd.java
index 69e95a0,6a471c9..b77a913
--- a/api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoCmd.java
@@@ -67,12 -66,12 +67,12 @@@ public class UpdateIsoCmd extends BaseU
}
@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.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update iso");
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRuleInstancesCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRuleInstancesCmd.java
index be6a5d6,2a39e1a..ec9801b
--- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRuleInstancesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRuleInstancesCmd.java
@@@ -33,9 -32,11 +33,9 @@@ import org.apache.cloudstack.api.respon
import com.cloud.uservm.UserVm;
import com.cloud.utils.Pair;
-@APICommand(name = "listLoadBalancerRuleInstances",
- description = "List all virtual machine instances that are assigned to a load balancer rule.",
- responseObject = UserVmResponse.class)
+@APICommand(name = "listLoadBalancerRuleInstances", description = "List all virtual machine instances that are assigned to a load balancer rule.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted)
public class ListLoadBalancerRuleInstancesCmd extends BaseListCmd {
- public static final Logger s_logger = Logger.getLogger (ListLoadBalancerRuleInstancesCmd.class.getName());
+ public static final Logger s_logger = Logger.getLogger(ListLoadBalancerRuleInstancesCmd.class.getName());
private static final String s_name = "listloadbalancerruleinstancesresponse";
@@@ -72,17 -78,17 +77,17 @@@
}
@Override
- public void execute(){
+ public void execute() {
- Pair<List<? extends UserVm>, List<String>> vmServiceMap = _lbService.listLoadBalancerInstances(this);
+ Pair<List<? extends UserVm>, List<String>> vmServiceMap = _lbService.listLoadBalancerInstances(this);
List<? extends UserVm> result = vmServiceMap.first();
- List<String> serviceStates = vmServiceMap.second();
+ List<String> serviceStates = vmServiceMap.second();
ListResponse<UserVmResponse> response = new ListResponse<UserVmResponse>();
List<UserVmResponse> vmResponses = new ArrayList<UserVmResponse>();
if (result != null) {
- vmResponses = _responseGenerator.createUserVmResponse("loadbalancerruleinstance", result.toArray(new UserVm[result.size()]));
+ vmResponses = _responseGenerator.createUserVmResponse(ResponseView.Restricted, "loadbalancerruleinstance", result.toArray(new UserVm[result.size()]));
}
- for (int i=0;i<result.size(); i++) {
+ for (int i = 0; i < result.size(); i++) {
vmResponses.get(i).setServiceState(serviceStates.get(i));
}
response.setResponses(vmResponses);