You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ml...@apache.org on 2013/01/10 01:48:36 UTC
[34/52] [partial] Summary: Fixes for api_refactoring
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListSupportedNetworkServicesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListSupportedNetworkServicesCmd.java b/api/src/com/cloud/api/commands/ListSupportedNetworkServicesCmd.java
deleted file mode 100644
index ef949da..0000000
--- a/api/src/com/cloud/api/commands/ListSupportedNetworkServicesCmd.java
+++ /dev/null
@@ -1,115 +0,0 @@
-// 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 com.cloud.api.commands;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-
-import com.cloud.api.ApiConstants;
-import com.cloud.api.BaseListCmd;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.response.ListResponse;
-import com.cloud.api.response.ServiceResponse;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.network.Network;
-import com.cloud.network.Network.Service;
-import com.cloud.user.Account;
-
-
-@Implementation(description="Lists all network services provided by CloudStack or for the given Provider.", responseObject=ServiceResponse.class, since="3.0.0")
-public class ListSupportedNetworkServicesCmd extends BaseListCmd {
- public static final Logger s_logger = Logger.getLogger(ListSupportedNetworkServicesCmd.class.getName());
- private static final String _name = "listsupportednetworkservicesresponse";
-
- @Parameter(name=ApiConstants.PROVIDER, type=CommandType.STRING, description="network service provider name")
- private String providerName;
-
- @Parameter(name=ApiConstants.SERVICE, type=CommandType.STRING, description="network service name to list providers and capabilities of")
- private String serviceName;
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
-
- public void setProviderName(String providerName) {
- this.providerName = providerName;
- }
-
- public String getProviderName() {
- return providerName;
- }
-
-
- public String getServiceName() {
- return serviceName;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
- @Override
- public String getCommandName() {
- return _name;
- }
-
- @Override
- public long getEntityOwnerId() {
- return Account.ACCOUNT_ID_SYSTEM;
- }
-
- @Override
- public void execute(){
- List<? extends Network.Service> services;
- if(getServiceName() != null){
- Network.Service service = null;
- if(serviceName != null){
- service = Network.Service.getService(serviceName);
- if(service == null){
- throw new InvalidParameterValueException("Invalid Network Service=" + serviceName);
- }
- }
- List<Network.Service> serviceList = new ArrayList<Network.Service>();
- serviceList.add(service);
- services = serviceList;
- }else{
- services = _networkService.listNetworkServices(getProviderName());
- }
-
- ListResponse<ServiceResponse> response = new ListResponse<ServiceResponse>();
- List<ServiceResponse> servicesResponses = new ArrayList<ServiceResponse>();
- for (Network.Service service : services) {
- //skip gateway service
- if (service == Service.Gateway) {
- continue;
- }
- ServiceResponse serviceResponse = _responseGenerator.createNetworkServiceResponse(service);
- servicesResponses.add(serviceResponse);
- }
-
- response.setResponses(servicesResponses);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListSwiftsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListSwiftsCmd.java b/api/src/com/cloud/api/commands/ListSwiftsCmd.java
deleted file mode 100644
index 587ceee..0000000
--- a/api/src/com/cloud/api/commands/ListSwiftsCmd.java
+++ /dev/null
@@ -1,84 +0,0 @@
-// 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 com.cloud.api.commands;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-
-import com.cloud.api.ApiConstants;
-import com.cloud.api.BaseListCmd;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.response.HostResponse;
-import com.cloud.api.response.ListResponse;
-import com.cloud.api.response.SwiftResponse;
-import com.cloud.storage.Swift;
-import com.cloud.user.Account;
-
-@Implementation(description = "List Swift.", responseObject = HostResponse.class, since="3.0.0")
-public class ListSwiftsCmd extends BaseListCmd {
- public static final Logger s_logger = Logger.getLogger(ListSwiftsCmd.class.getName());
- private static final String s_name = "listswiftsresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @Parameter(name = ApiConstants.ID, type = CommandType.LONG, description = "the id of the swift")
- private Long id;
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- public Long getId() {
- return id;
- }
-
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public long getEntityOwnerId() {
- return Account.ACCOUNT_ID_SYSTEM;
- }
-
- @Override
- public void execute(){
- List<? extends Swift> result = _resourceService.listSwifts(this);
- ListResponse<SwiftResponse> response = new ListResponse<SwiftResponse>();
- List<SwiftResponse> swiftResponses = new ArrayList<SwiftResponse>();
-
- if (result != null) {
- SwiftResponse swiftResponse = null;
- for (Swift swift : result) {
- swiftResponse = _responseGenerator.createSwiftResponse(swift);
- swiftResponse.setResponseName(getCommandName());
- swiftResponse.setObjectName("swift");
- swiftResponses.add(swiftResponse);
- }
- }
- response.setResponses(swiftResponses);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListSystemVMsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListSystemVMsCmd.java b/api/src/com/cloud/api/commands/ListSystemVMsCmd.java
deleted file mode 100644
index 4439197..0000000
--- a/api/src/com/cloud/api/commands/ListSystemVMsCmd.java
+++ /dev/null
@@ -1,138 +0,0 @@
-// 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 com.cloud.api.commands;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-
-import com.cloud.api.ApiConstants;
-import com.cloud.api.BaseListCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.response.ListResponse;
-import com.cloud.api.response.SystemVmResponse;
-import com.cloud.async.AsyncJob;
-import com.cloud.utils.Pair;
-import com.cloud.vm.VirtualMachine;
-
-@Implementation(description="List system virtual machines.", responseObject=SystemVmResponse.class)
-public class ListSystemVMsCmd extends BaseListCmd {
- public static final Logger s_logger = Logger.getLogger(ListSystemVMsCmd.class.getName());
-
- private static final String s_name = "listsystemvmsresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="host")
- @Parameter(name=ApiConstants.HOST_ID, type=CommandType.LONG, description="the host ID of the system VM")
- private Long hostId;
-
- @IdentityMapper(entityTableName="vm_instance")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the ID of the system VM")
- private Long id;
-
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the system VM")
- private String systemVmName;
-
- @IdentityMapper(entityTableName="host_pod_ref")
- @Parameter(name=ApiConstants.POD_ID, type=CommandType.LONG, description="the Pod ID of the system VM")
- private Long podId;
-
- @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="the state of the system VM")
- private String state;
-
- @Parameter(name=ApiConstants.SYSTEM_VM_TYPE, type=CommandType.STRING, description="the system VM type. Possible types are \"consoleproxy\" and \"secondarystoragevm\".")
- private String systemVmType;
-
- @IdentityMapper(entityTableName="data_center")
- @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the Zone ID of the system VM")
- private Long zoneId;
-
- @IdentityMapper(entityTableName="storage_pool")
- @Parameter(name=ApiConstants.STORAGE_ID, type=CommandType.LONG, description="the storage ID where vm's volumes belong to", since="3.0.1")
- private Long storageId;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Long getHostId() {
- return hostId;
- }
-
- public Long getId() {
- return id;
- }
-
- public String getSystemVmName() {
- return systemVmName;
- }
-
- public Long getPodId() {
- return podId;
- }
-
- public String getState() {
- return state;
- }
-
- public String getSystemVmType() {
- return systemVmType;
- }
-
- public Long getZoneId() {
- return zoneId;
- }
-
- public Long getStorageId() {
- return storageId;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- public AsyncJob.Type getInstanceType() {
- return AsyncJob.Type.SystemVm;
- }
-
- @Override
- public void execute(){
- Pair<List<? extends VirtualMachine>, Integer> systemVMs = _mgr.searchForSystemVm(this);
- ListResponse<SystemVmResponse> response = new ListResponse<SystemVmResponse>();
- List<SystemVmResponse> vmResponses = new ArrayList<SystemVmResponse>();
- for (VirtualMachine systemVM : systemVMs.first()) {
- SystemVmResponse vmResponse = _responseGenerator.createSystemVmResponse(systemVM);
- vmResponse.setObjectName("systemvm");
- vmResponses.add(vmResponse);
- }
-
- response.setResponses(vmResponses, systemVMs.second());
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListTagsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListTagsCmd.java b/api/src/com/cloud/api/commands/ListTagsCmd.java
deleted file mode 100644
index b832b42..0000000
--- a/api/src/com/cloud/api/commands/ListTagsCmd.java
+++ /dev/null
@@ -1,96 +0,0 @@
-// 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 com.cloud.api.commands;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.cloud.api.ApiConstants;
-import com.cloud.api.BaseListProjectAndAccountResourcesCmd;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.response.ListResponse;
-import com.cloud.api.response.ResourceTagResponse;
-import com.cloud.server.ResourceTag;
-import com.cloud.utils.Pair;
-
-@Implementation(description = "List resource tag(s)", responseObject = ResourceTagResponse.class, since = "Burbank")
-public class ListTagsCmd extends BaseListProjectAndAccountResourcesCmd{
- private static final String s_name = "listtagsresponse";
-
- @Parameter(name=ApiConstants.RESOURCE_TYPE, type=CommandType.STRING, description="list by resource type")
- private String resourceType;
-
- @Parameter(name=ApiConstants.RESOURCE_ID, type=CommandType.STRING, description="list by resource id")
- private String resourceId;
-
- @Parameter(name=ApiConstants.KEY, type=CommandType.STRING, description="list by key")
- private String key;
-
- @Parameter(name=ApiConstants.VALUE, type=CommandType.STRING, description="list by value")
- private String value;
-
- @Parameter(name=ApiConstants.CUSTOMER, type=CommandType.STRING, description="list by customer name")
- private String customer;
-
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public void execute() {
-
- Pair<List<? extends ResourceTag>, Integer> tags = _taggedResourceService.listTags(this);
- ListResponse<ResourceTagResponse> response = new ListResponse<ResourceTagResponse>();
- List<ResourceTagResponse> tagResponses = new ArrayList<ResourceTagResponse>();
- for (ResourceTag tag : tags.first()) {
- ResourceTagResponse tagResponse = _responseGenerator.createResourceTagResponse(tag, false);
- tagResponses.add(tagResponse);
- }
- response.setResponses(tagResponses, tags.second());
-
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-
- public String getResourceType() {
- return resourceType;
- }
-
- public String getResourceId() {
- return resourceId;
- }
-
- public String getKey() {
- return key;
- }
-
- public String getValue() {
- return value;
- }
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- public String getCustomer() {
- return customer;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListTemplateOrIsoPermissionsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListTemplateOrIsoPermissionsCmd.java b/api/src/com/cloud/api/commands/ListTemplateOrIsoPermissionsCmd.java
deleted file mode 100644
index cacb41f..0000000
--- a/api/src/com/cloud/api/commands/ListTemplateOrIsoPermissionsCmd.java
+++ /dev/null
@@ -1,95 +0,0 @@
-// 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 com.cloud.api.commands;
-
-import java.util.List;
-
-import org.apache.log4j.Logger;
-
-import com.cloud.api.ApiConstants;
-import com.cloud.api.BaseCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.response.TemplatePermissionsResponse;
-import com.cloud.template.VirtualMachineTemplate;
-import com.cloud.user.Account;
-import com.cloud.user.UserContext;
-
-@Implementation(description="List template visibility and all accounts that have permissions to view this template.", responseObject=TemplatePermissionsResponse.class)
-public class ListTemplateOrIsoPermissionsCmd extends BaseCmd {
- public Logger s_logger = getLogger();
- protected String s_name = "listtemplatepermissionsresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="vm_template")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the template ID")
- private Long id;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Long getId() {
- return id;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
- @Override
- public long getEntityOwnerId() {
- VirtualMachineTemplate template = _entityMgr.findById(VirtualMachineTemplate.class, getId());
- if (template != null) {
- return template.getAccountId();
- }
-
- return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
- }
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- protected boolean templateIsCorrectType(VirtualMachineTemplate template) {
- return true;
- }
-
- public String getMediaType() {
- return "templateOrIso";
- }
-
- protected Logger getLogger() {
- return Logger.getLogger(UpdateTemplateOrIsoPermissionsCmd.class.getName());
- }
-
- @Override
- public void execute(){
- List<String> accountNames = _templateService.listTemplatePermissions(this);
-
- Account account = UserContext.current().getCaller();
- boolean isAdmin = (isAdmin(account.getType()));
-
- TemplatePermissionsResponse response = _responseGenerator.createTemplatePermissionsResponse(accountNames, id, isAdmin);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListTemplatePermissionsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListTemplatePermissionsCmd.java b/api/src/com/cloud/api/commands/ListTemplatePermissionsCmd.java
deleted file mode 100644
index af90df9..0000000
--- a/api/src/com/cloud/api/commands/ListTemplatePermissionsCmd.java
+++ /dev/null
@@ -1,42 +0,0 @@
-// 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 com.cloud.api.commands;
-
-import org.apache.log4j.Logger;
-
-import com.cloud.storage.Storage.ImageFormat;
-import com.cloud.template.VirtualMachineTemplate;
-
-public class ListTemplatePermissionsCmd extends ListTemplateOrIsoPermissionsCmd {
- protected String getResponseName() {
- return "listtemplatepermissionsresponse";
- }
-
- @Override
- public String getMediaType() {
- return "template";
- }
-
- @Override
- protected Logger getLogger() {
- return Logger.getLogger(ListTemplatePermissionsCmd.class.getName());
- }
-
- protected boolean templateIsCorrectType(VirtualMachineTemplate template) {
- return !template.getFormat().equals(ImageFormat.ISO);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListTemplatesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListTemplatesCmd.java b/api/src/com/cloud/api/commands/ListTemplatesCmd.java
deleted file mode 100755
index 6e1e0b4..0000000
--- a/api/src/com/cloud/api/commands/ListTemplatesCmd.java
+++ /dev/null
@@ -1,134 +0,0 @@
-// 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 com.cloud.api.commands;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.log4j.Logger;
-
-import com.cloud.api.ApiConstants;
-import com.cloud.api.BaseListTaggedResourcesCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.response.ListResponse;
-import com.cloud.api.response.TemplateResponse;
-import com.cloud.async.AsyncJob;
-import com.cloud.template.VirtualMachineTemplate.TemplateFilter;
-import com.cloud.user.Account;
-import com.cloud.user.UserContext;
-import com.cloud.utils.Pair;
-
-@Implementation(description="List all public, private, and privileged templates.", responseObject=TemplateResponse.class)
-public class ListTemplatesCmd extends BaseListTaggedResourcesCmd {
- public static final Logger s_logger = Logger.getLogger(ListTemplatesCmd.class.getName());
-
- private static final String s_name = "listtemplatesresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @Parameter(name=ApiConstants.HYPERVISOR, type=CommandType.STRING, description="the hypervisor for which to restrict the search")
- private String hypervisor;
-
- @IdentityMapper(entityTableName="vm_template")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the template ID")
- private Long id;
-
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the template name")
- private String templateName;
-
- @Parameter(name=ApiConstants.TEMPLATE_FILTER, type=CommandType.STRING, required=true, description="possible values are \"featured\", \"self\", \"self-executable\", \"executable\", and \"community\"." +
- "* featured-templates that are featured and are public" +
- "* self-templates that have been registered/created by the owner" +
- "* selfexecutable-templates that have been registered/created by the owner that can be used to deploy a new VM" +
- "* executable-all templates that can be used to deploy a new VM* community-templates that are public.")
- private String templateFilter;
-
- @IdentityMapper(entityTableName="data_center")
- @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="list templates by zoneId")
- private Long zoneId;
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public String getHypervisor() {
- return hypervisor;
- }
-
- public Long getId() {
- return id;
- }
-
- public String getTemplateName() {
- return templateName;
- }
-
- public String getTemplateFilter() {
- return templateFilter;
- }
-
- public Long getZoneId() {
- return zoneId;
- }
-
- public boolean listInReadyState() {
-
- Account account = UserContext.current().getCaller();
- // 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);
- // 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);
- return onlyReady;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- public AsyncJob.Type getInstanceType() {
- return AsyncJob.Type.Template;
- }
-
- @Override
- public void execute(){
- Set<Pair<Long, Long>> templateZonePairSet = _mgr.listTemplates(this);
-
- ListResponse<TemplateResponse> response = new ListResponse<TemplateResponse>();
- List<TemplateResponse> templateResponses = new ArrayList<TemplateResponse>();
-
- for (Pair<Long, Long> template : templateZonePairSet) {
- List<TemplateResponse> responses = new ArrayList<TemplateResponse>();
- responses = _responseGenerator.createTemplateResponses(template.first().longValue(), template.second(), listInReadyState());
- templateResponses.addAll(responses);
- }
-
- response.setResponses(templateResponses);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListTrafficTypeImplementorsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListTrafficTypeImplementorsCmd.java b/api/src/com/cloud/api/commands/ListTrafficTypeImplementorsCmd.java
deleted file mode 100755
index 8b6bde4..0000000
--- a/api/src/com/cloud/api/commands/ListTrafficTypeImplementorsCmd.java
+++ /dev/null
@@ -1,86 +0,0 @@
-// 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 com.cloud.api.commands;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-
-import com.cloud.api.ApiConstants;
-import com.cloud.api.BaseListCmd;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.ServerApiException;
-import com.cloud.api.response.ListResponse;
-import com.cloud.api.response.TrafficTypeImplementorResponse;
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InsufficientCapacityException;
-import com.cloud.exception.ResourceAllocationException;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.network.Networks.TrafficType;
-import com.cloud.user.Account;
-import com.cloud.utils.Pair;
-
-@Implementation(description="Lists implementors of implementor of a network traffic type or implementors of all network traffic types", responseObject=TrafficTypeImplementorResponse.class, since="3.0.0")
-public class ListTrafficTypeImplementorsCmd extends BaseListCmd {
- public static final Logger s_logger = Logger.getLogger(ListTrafficTypeImplementorsCmd.class);
- private static final String _name = "listtraffictypeimplementorsresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.TRAFFIC_TYPE, type=CommandType.STRING, description="Optional. The network traffic type, if specified, return its implementor. Otherwise, return all traffic types with their implementor")
- private String trafficType;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public String getTrafficType() {
- return trafficType;
- }
-
- @Override
- public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
- ResourceAllocationException {
- List<Pair<TrafficType, String>> results = _networkService.listTrafficTypeImplementor(this);
- ListResponse<TrafficTypeImplementorResponse> response = new ListResponse<TrafficTypeImplementorResponse>();
- List<TrafficTypeImplementorResponse> responses= new ArrayList<TrafficTypeImplementorResponse>();
- for (Pair<TrafficType, String> r : results) {
- TrafficTypeImplementorResponse p = new TrafficTypeImplementorResponse();
- p.setTrafficType(r.first().toString());
- p.setImplementor(r.second());
- p.setObjectName("traffictypeimplementorresponse");
- responses.add(p);
- }
-
- response.setResponses(responses);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-
- @Override
- public long getEntityOwnerId() {
- return Account.ACCOUNT_ID_SYSTEM;
- }
-
- @Override
- public String getCommandName() {
- return _name;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListTrafficTypesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListTrafficTypesCmd.java b/api/src/com/cloud/api/commands/ListTrafficTypesCmd.java
deleted file mode 100755
index 671d406..0000000
--- a/api/src/com/cloud/api/commands/ListTrafficTypesCmd.java
+++ /dev/null
@@ -1,88 +0,0 @@
-// 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 com.cloud.api.commands;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-
-import com.cloud.api.ApiConstants;
-import com.cloud.api.BaseListCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.response.ListResponse;
-import com.cloud.api.response.ProviderResponse;
-import com.cloud.api.response.TrafficTypeResponse;
-import com.cloud.network.PhysicalNetworkTrafficType;
-import com.cloud.user.Account;
-import com.cloud.utils.Pair;
-
-
-@Implementation(description="Lists traffic types of a given physical network.", responseObject=ProviderResponse.class, since="3.0.0")
-public class ListTrafficTypesCmd extends BaseListCmd {
- public static final Logger s_logger = Logger.getLogger(ListTrafficTypesCmd.class.getName());
- private static final String _name = "listtraffictypesresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
- @IdentityMapper(entityTableName="physical_network")
- @Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.LONG, required=true, description="the Physical Network ID")
- private Long physicalNetworkId;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public void setPhysicalNetworkId(Long physicalNetworkId) {
- this.physicalNetworkId = physicalNetworkId;
- }
-
- public Long getPhysicalNetworkId() {
- return physicalNetworkId;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
- @Override
- public String getCommandName() {
- return _name;
- }
-
- @Override
- public long getEntityOwnerId() {
- return Account.ACCOUNT_ID_SYSTEM;
- }
-
- @Override
- public void execute(){
- Pair<List<? extends PhysicalNetworkTrafficType>, Integer> trafficTypes = _networkService.listTrafficTypes(getPhysicalNetworkId());
- ListResponse<TrafficTypeResponse> response = new ListResponse<TrafficTypeResponse>();
- List<TrafficTypeResponse> trafficTypesResponses = new ArrayList<TrafficTypeResponse>();
- for (PhysicalNetworkTrafficType trafficType : trafficTypes.first()) {
- TrafficTypeResponse trafficTypeResponse = _responseGenerator.createTrafficTypeResponse(trafficType);
- trafficTypesResponses.add(trafficTypeResponse);
- }
-
- response.setResponses(trafficTypesResponses, trafficTypes.second());
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListUsersCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListUsersCmd.java b/api/src/com/cloud/api/commands/ListUsersCmd.java
deleted file mode 100644
index 03db56d..0000000
--- a/api/src/com/cloud/api/commands/ListUsersCmd.java
+++ /dev/null
@@ -1,100 +0,0 @@
-// 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 com.cloud.api.commands;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-
-import com.cloud.api.ApiConstants;
-import com.cloud.api.BaseListAccountResourcesCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.response.ListResponse;
-import com.cloud.api.response.UserResponse;
-import com.cloud.user.UserAccount;
-import com.cloud.utils.Pair;
-
-@Implementation(description="Lists user accounts", responseObject=UserResponse.class)
-public class ListUsersCmd extends BaseListAccountResourcesCmd {
- public static final Logger s_logger = Logger.getLogger(ListUsersCmd.class.getName());
-
- private static final String s_name = "listusersresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @Parameter(name=ApiConstants.ACCOUNT_TYPE, type=CommandType.LONG, description="List users by account type. Valid types include admin, domain-admin, read-only-admin, or user.")
- private Long accountType;
-
- @IdentityMapper(entityTableName="user")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="List user by ID.")
- private Long id;
-
- @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="List users by state of the user account.")
- private String state;
-
- @Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, description="List user by the username")
- private String username;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
-
- public Long getAccountType() {
- return accountType;
- }
-
- public Long getId() {
- return id;
- }
-
- public String getState() {
- return state;
- }
-
- public String getUsername() {
- return username;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public void execute(){
- Pair<List<? extends UserAccount>, Integer> result = _accountService.searchForUsers(this);
- ListResponse<UserResponse> response = new ListResponse<UserResponse>();
- List<UserResponse> userResponses = new ArrayList<UserResponse>();
- for (UserAccount user : result.first()) {
- UserResponse userResponse = _responseGenerator.createUserResponse(user);
- userResponses.add(userResponse);
- }
- response.setResponses(userResponses, result.second());
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListVMGroupsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListVMGroupsCmd.java b/api/src/com/cloud/api/commands/ListVMGroupsCmd.java
deleted file mode 100644
index 34a5e19..0000000
--- a/api/src/com/cloud/api/commands/ListVMGroupsCmd.java
+++ /dev/null
@@ -1,87 +0,0 @@
-// 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 com.cloud.api.commands;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-
-import com.cloud.api.ApiConstants;
-import com.cloud.api.BaseListProjectAndAccountResourcesCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.response.InstanceGroupResponse;
-import com.cloud.api.response.ListResponse;
-import com.cloud.utils.Pair;
-import com.cloud.vm.InstanceGroup;
-
-@Implementation(description="Lists vm groups", responseObject=InstanceGroupResponse.class)
-public class ListVMGroupsCmd extends BaseListProjectAndAccountResourcesCmd {
- public static final Logger s_logger = Logger.getLogger(ListVMGroupsCmd.class.getName());
-
- private static final String s_name = "listinstancegroupsresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="instance_group")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list instance groups by ID")
- private Long id;
-
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="list instance groups by name")
- private String groupName;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Long getId() {
- return id;
- }
-
- public String getGroupName() {
- return groupName;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public void execute(){
- Pair<List<? extends InstanceGroup>, Integer> groups = _mgr.searchForVmGroups(this);
- ListResponse<InstanceGroupResponse> response = new ListResponse<InstanceGroupResponse>();
- List<InstanceGroupResponse> responses = new ArrayList<InstanceGroupResponse>();
- for (InstanceGroup group : groups.first()) {
- InstanceGroupResponse groupResponse = _responseGenerator.createInstanceGroupResponse(group);
- groupResponse.setObjectName("instancegroup");
- responses.add(groupResponse);
- }
-
- response.setResponses(responses, groups.second());
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListVMsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListVMsCmd.java b/api/src/com/cloud/api/commands/ListVMsCmd.java
deleted file mode 100755
index 2f6f988..0000000
--- a/api/src/com/cloud/api/commands/ListVMsCmd.java
+++ /dev/null
@@ -1,217 +0,0 @@
-// 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 com.cloud.api.commands;
-
-import java.util.ArrayList;
-import java.util.EnumSet;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-
-import com.cloud.api.ApiConstants;
-import com.cloud.api.ApiConstants.VMDetails;
-import com.cloud.api.BaseListTaggedResourcesCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.response.ListResponse;
-import com.cloud.api.response.UserVmResponse;
-import com.cloud.async.AsyncJob;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.uservm.UserVm;
-import com.cloud.utils.Pair;
-
-
-@Implementation(description="List the virtual machines owned by the account.", responseObject=UserVmResponse.class)
-public class ListVMsCmd extends BaseListTaggedResourcesCmd {
- public static final Logger s_logger = Logger.getLogger(ListVMsCmd.class.getName());
-
- private static final String s_name = "listvirtualmachinesresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="instance_group")
- @Parameter(name=ApiConstants.GROUP_ID, type=CommandType.LONG, description="the group ID")
- private Long groupId;
-
- @IdentityMapper(entityTableName="host")
- @Parameter(name=ApiConstants.HOST_ID, type=CommandType.LONG, description="the host ID")
- private Long hostId;
-
- @IdentityMapper(entityTableName="vm_instance")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the ID of the virtual machine")
- private Long id;
-
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="name of the virtual machine")
- private String instanceName;
-
- @IdentityMapper(entityTableName="host_pod_ref")
- @Parameter(name=ApiConstants.POD_ID, type=CommandType.LONG, description="the pod ID")
- private Long podId;
-
- @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="state of the virtual machine")
- private String state;
-
- @IdentityMapper(entityTableName="data_center")
- @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the availability zone ID")
- private Long zoneId;
-
- @Parameter(name=ApiConstants.FOR_VIRTUAL_NETWORK, type=CommandType.BOOLEAN, description="list by network type; true if need to list vms using Virtual Network, false otherwise")
- private Boolean forVirtualNetwork;
-
- @IdentityMapper(entityTableName="networks")
- @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.LONG, description="list by network id")
- private Long networkId;
-
- @Parameter(name=ApiConstants.HYPERVISOR, type=CommandType.STRING, description="the target hypervisor for the template")
- private String hypervisor;
-
- @IdentityMapper(entityTableName="storage_pool")
- @Parameter(name=ApiConstants.STORAGE_ID, type=CommandType.LONG, description="the storage ID where vm's volumes belong to")
- private Long storageId;
-
- @Parameter(name=ApiConstants.DETAILS, type=CommandType.LIST, collectionType=CommandType.STRING, description="comma separated list of host details requested, " +
- "value can be a list of [all, group, nics, stats, secgrp, tmpl, servoff, iso, volume, min]. If no parameter is passed in, the details will be defaulted to all" )
- private List<String> viewDetails;
-
- @IdentityMapper(entityTableName="vm_template")
- @Parameter(name=ApiConstants.TEMPLATE_ID, type=CommandType.LONG, description="list vms by template")
- private Long templateId;
-
- @IdentityMapper(entityTableName="vm_template")
- @Parameter(name=ApiConstants.ISO_ID, type=CommandType.LONG, description="list vms by iso")
- private Long isoId;
-
- @IdentityMapper(entityTableName="vpc")
- @Parameter(name=ApiConstants.VPC_ID, type=CommandType.LONG, description="list vms by vpc")
- private Long vpcId;
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Long getGroupId() {
- return groupId;
- }
-
- public Long getHostId() {
- return hostId;
- }
-
- public Long getId() {
- return id;
- }
-
- public String getInstanceName() {
- return instanceName;
- }
-
- public Long getPodId() {
- return podId;
- }
-
- public String getState() {
- return state;
- }
-
- public Long getZoneId() {
- return zoneId;
- }
-
- public Boolean getForVirtualNetwork() {
- return forVirtualNetwork;
- }
-
- public void setForVirtualNetwork(Boolean forVirtualNetwork) {
- this.forVirtualNetwork = forVirtualNetwork;
- }
-
- public Long getNetworkId() {
- return networkId;
- }
-
- public String getHypervisor() {
- return hypervisor;
- }
-
- public Long getStorageId() {
- return storageId;
- }
-
- public Long getTemplateId() {
- return templateId;
- }
-
- public Long getIsoId() {
- return isoId;
- }
-
- public Long getVpcId(){
- return vpcId;
- }
-
- public EnumSet<VMDetails> getDetails() throws InvalidParameterValueException {
- EnumSet<VMDetails> dv;
- if (viewDetails==null || viewDetails.size() <=0){
- dv = EnumSet.of(VMDetails.all);
- }
- else {
- try {
- ArrayList<VMDetails> dc = new ArrayList<VMDetails>();
- for (String detail: viewDetails){
- dc.add(VMDetails.valueOf(detail));
- }
- dv = EnumSet.copyOf(dc);
- }
- catch (IllegalArgumentException e){
- throw new InvalidParameterValueException("The details parameter contains a non permitted value. The allowed values are " + EnumSet.allOf(VMDetails.class));
- }
- }
- return dv;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- public AsyncJob.Type getInstanceType() {
- return AsyncJob.Type.VirtualMachine;
- }
-
- @Override
- public void execute(){
- Pair<List<? extends UserVm>, Integer> result = _userVmService.searchForUserVMs(this);
- ListResponse<UserVmResponse> response = new ListResponse<UserVmResponse>();
- EnumSet<VMDetails> details = getDetails();
- List<UserVmResponse> vmResponses;
- if (details.contains(VMDetails.all)){ // for all use optimized version
- vmResponses = _responseGenerator.createUserVmResponse("virtualmachine", result.first().toArray(new UserVm[result.first().size()]));
- }
- else {
- vmResponses = _responseGenerator.createUserVmResponse("virtualmachine", getDetails(), result.first().toArray(new UserVm[result.first().size()]));
- }
- response.setResponses(vmResponses, result.second());
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListVPCOfferingsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListVPCOfferingsCmd.java b/api/src/com/cloud/api/commands/ListVPCOfferingsCmd.java
deleted file mode 100644
index 397c04a..0000000
--- a/api/src/com/cloud/api/commands/ListVPCOfferingsCmd.java
+++ /dev/null
@@ -1,116 +0,0 @@
-// 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 com.cloud.api.commands;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-
-import com.cloud.api.ApiConstants;
-import com.cloud.api.BaseListCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.response.ListResponse;
-import com.cloud.api.response.VpcOfferingResponse;
-import com.cloud.network.vpc.VpcOffering;
-
-@Implementation(description="Lists VPC offerings", responseObject=VpcOfferingResponse.class)
-public class ListVPCOfferingsCmd extends BaseListCmd{
- public static final Logger s_logger = Logger.getLogger(ListVPCOfferingsCmd.class.getName());
- private static final String _name = "listvpcofferingsresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
- @IdentityMapper(entityTableName="vpc_offerings")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list VPC offerings by id")
- private Long id;
-
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="list VPC offerings by name")
- private String vpcOffName;
-
- @Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, description="list VPC offerings by display text")
- private String displayText;
-
- @Parameter(name=ApiConstants.IS_DEFAULT, type=CommandType.BOOLEAN, description="true if need to list only default " +
- "VPC offerings. Default value is false")
- private Boolean isDefault;
-
- @Parameter(name=ApiConstants.SUPPORTED_SERVICES, type=CommandType.LIST, collectionType=CommandType.STRING,
- description="list VPC offerings supporting certain services")
- private List<String> supportedServices;
-
- @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="list VPC offerings by state")
- private String state;
-
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
- public Long getId() {
- return id;
- }
-
- public String getVpcOffName() {
- return vpcOffName;
- }
-
- public String getDisplayText() {
- return displayText;
- }
-
- public Boolean getIsDefault() {
- return isDefault;
- }
-
- public List<String> getSupportedServices() {
- return supportedServices;
- }
-
- public String getState() {
- return state;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public void execute(){
- List<? extends VpcOffering> offerings = _vpcService.listVpcOfferings(getId(), getVpcOffName(), getDisplayText(),
- getSupportedServices(), isDefault, this.getKeyword(), getState(), this.getStartIndex(), this.getPageSizeVal());
- ListResponse<VpcOfferingResponse> response = new ListResponse<VpcOfferingResponse>();
- List<VpcOfferingResponse> offeringResponses = new ArrayList<VpcOfferingResponse>();
- for (VpcOffering offering : offerings) {
- VpcOfferingResponse offeringResponse = _responseGenerator.createVpcOfferingResponse(offering);
- offeringResponses.add(offeringResponse);
- }
-
- response.setResponses(offeringResponses);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-
-
- @Override
- public String getCommandName() {
- return _name;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListVPCsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListVPCsCmd.java b/api/src/com/cloud/api/commands/ListVPCsCmd.java
deleted file mode 100644
index 6f9acc1..0000000
--- a/api/src/com/cloud/api/commands/ListVPCsCmd.java
+++ /dev/null
@@ -1,159 +0,0 @@
-// 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 com.cloud.api.commands;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-
-import com.cloud.api.ApiConstants;
-import com.cloud.api.BaseListTaggedResourcesCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.response.ListResponse;
-import com.cloud.api.response.VpcResponse;
-import com.cloud.network.vpc.Vpc;
-
-
-@Implementation(description="Lists VPCs", responseObject=VpcResponse.class)
-public class ListVPCsCmd extends BaseListTaggedResourcesCmd{
- public static final Logger s_logger = Logger.getLogger(ListVPCsCmd.class.getName());
- private static final String s_name = "listvpcsresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
- @IdentityMapper(entityTableName="vpc")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list VPC by id")
- private Long id;
-
- @IdentityMapper(entityTableName="data_center")
- @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="list by zone")
- private Long zoneId;
-
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="list by name of the VPC")
- private String vpcName;
-
- @Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, description="List by display text of " +
- "the VPC")
- private String displayText;
-
- @Parameter(name=ApiConstants.CIDR, type=CommandType.STRING, description="list by cidr of the VPC. All VPC " +
- "guest networks' cidrs should be within this CIDR")
- private String cidr;
-
- @IdentityMapper(entityTableName="vpc_offerings")
- @Parameter(name=ApiConstants.VPC_OFF_ID, type=CommandType.LONG, description="list by ID of the VPC offering")
- private Long VpcOffId;
-
- @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="list by account associated with the VPC. " +
- "Must be used with the domainId parameter.")
- private String accountName;
-
- @IdentityMapper(entityTableName="domain")
- @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="list by domain ID associated with the VPC. " +
- "If used with the account parameter returns the VPC associated with the account for the specified domain.")
- private Long domainId;
-
- @Parameter(name=ApiConstants.SUPPORTED_SERVICES, type=CommandType.LIST, collectionType=CommandType.STRING,
- description="list VPC supporting certain services")
- private List<String> supportedServices;
-
- @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="list VPCs by state")
- private String state;
-
- @Parameter(name=ApiConstants.RESTART_REQUIRED, type=CommandType.BOOLEAN, description="list VPCs by restartRequired option")
- private Boolean restartRequired;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public String getAccountName() {
- return accountName;
- }
-
- public Long getDomainId() {
- return domainId;
- }
-
- public Long getZoneId() {
- return zoneId;
- }
-
- public String getVpcName() {
- return vpcName;
- }
-
- public String getCidr() {
- return cidr;
- }
-
- public String getDisplayText() {
- return displayText;
- }
-
- public Long getVpcOffId() {
- return VpcOffId;
- }
-
- public Long getId() {
- return id;
- }
-
- public List<String> getSupportedServices() {
- return supportedServices;
- }
-
- public String getState() {
- return state;
- }
-
- public Boolean getRestartRequired() {
- return restartRequired;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public void execute() {
- List<? extends Vpc> vpcs = _vpcService.listVpcs(getId(), getVpcName(), getDisplayText(),
- getSupportedServices(), getCidr(), getVpcOffId(), getState(), getAccountName(), getDomainId(),
- this.getKeyword(), this.getStartIndex(), this.getPageSizeVal(), getZoneId(), this.isRecursive(),
- this.listAll(), getRestartRequired(), getTags(), getProjectId());
- ListResponse<VpcResponse> response = new ListResponse<VpcResponse>();
- List<VpcResponse> offeringResponses = new ArrayList<VpcResponse>();
- for (Vpc vpc : vpcs) {
- VpcResponse offeringResponse = _responseGenerator.createVpcResponse(vpc);
- offeringResponses.add(offeringResponse);
- }
-
- response.setResponses(offeringResponses);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListVirtualRouterElementsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListVirtualRouterElementsCmd.java b/api/src/com/cloud/api/commands/ListVirtualRouterElementsCmd.java
deleted file mode 100644
index 937a01e..0000000
--- a/api/src/com/cloud/api/commands/ListVirtualRouterElementsCmd.java
+++ /dev/null
@@ -1,109 +0,0 @@
-// 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 com.cloud.api.commands;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-
-import com.cloud.api.ApiConstants;
-import com.cloud.api.BaseListCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.PlugService;
-import com.cloud.api.ServerApiException;
-import com.cloud.api.response.ListResponse;
-import com.cloud.api.response.VirtualRouterProviderResponse;
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InsufficientCapacityException;
-import com.cloud.exception.ResourceAllocationException;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.network.VirtualRouterProvider;
-import com.cloud.network.element.VirtualRouterElementService;
-
-@Implementation(description="Lists all available virtual router elements.", responseObject=VirtualRouterProviderResponse.class)
-public class ListVirtualRouterElementsCmd extends BaseListCmd {
- public static final Logger s_logger = Logger.getLogger(ListNetworkOfferingsCmd.class.getName());
- private static final String _name = "listvirtualrouterelementsresponse";
-
- @PlugService
- private VirtualRouterElementService _service;
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
- @IdentityMapper(entityTableName = "virtual_router_providers")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list virtual router elements by id")
- private Long id;
-
- @IdentityMapper(entityTableName = "physical_network_service_providers")
- @Parameter(name=ApiConstants.NSP_ID, type=CommandType.LONG, description="list virtual router elements by network service provider id")
- private Long nspId;
-
- @Parameter(name=ApiConstants.ENABLED, type=CommandType.BOOLEAN, description="list network offerings by enabled state")
- private Boolean enabled;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public Long getId() {
- return id;
- }
-
- public void setNspId(Long nspId) {
- this.nspId = nspId;
- }
-
- public Long getNspId() {
- return nspId;
- }
-
- public void setEnabled(Boolean enabled) {
- this.enabled = enabled;
- }
-
- public Boolean getEnabled() {
- return enabled;
- }
-
- @Override
- public String getCommandName() {
- return _name;
- }
-
- @Override
- public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
- List<? extends VirtualRouterProvider> providers = _service.searchForVirtualRouterElement(this);
- ListResponse<VirtualRouterProviderResponse> response = new ListResponse<VirtualRouterProviderResponse>();
- List<VirtualRouterProviderResponse> providerResponses = new ArrayList<VirtualRouterProviderResponse>();
- for (VirtualRouterProvider provider : providers) {
- VirtualRouterProviderResponse providerResponse = _responseGenerator.createVirtualRouterProviderResponse(provider);
- providerResponses.add(providerResponse);
- }
- response.setResponses(providerResponses);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
-
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListVlanIpRangesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListVlanIpRangesCmd.java b/api/src/com/cloud/api/commands/ListVlanIpRangesCmd.java
deleted file mode 100644
index 5cefa65..0000000
--- a/api/src/com/cloud/api/commands/ListVlanIpRangesCmd.java
+++ /dev/null
@@ -1,149 +0,0 @@
-// 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 com.cloud.api.commands;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-
-import com.cloud.api.ApiConstants;
-import com.cloud.api.BaseListCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.response.ListResponse;
-import com.cloud.api.response.VlanIpRangeResponse;
-import com.cloud.dc.Vlan;
-import com.cloud.utils.Pair;
-
-@Implementation(description="Lists all VLAN IP ranges.", responseObject=VlanIpRangeResponse.class)
-public class ListVlanIpRangesCmd extends BaseListCmd {
- public static final Logger s_logger = Logger.getLogger(ListVlanIpRangesCmd.class.getName());
-
- private static final String s_name = "listvlaniprangesresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="the account with which the VLAN IP range is associated. Must be used with the domainId parameter.")
- private String accountName;
-
- @IdentityMapper(entityTableName="projects")
- @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="project who will own the VLAN")
- private Long projectId;
-
- @IdentityMapper(entityTableName="domain")
- @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="the domain ID with which the VLAN IP range is associated. If used with the account parameter, returns all VLAN IP ranges for that account in the specified domain.")
- private Long domainId;
-
- @IdentityMapper(entityTableName="vlan")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=false, description="the ID of the VLAN IP range")
- private Long id;
-
- @IdentityMapper(entityTableName="host_pod_ref")
- @Parameter(name=ApiConstants.POD_ID, type=CommandType.LONG, description="the Pod ID of the VLAN IP range")
- private Long podId;
-
- @Parameter(name=ApiConstants.VLAN, type=CommandType.STRING, description="the ID or VID of the VLAN. Default is an \"untagged\" VLAN.")
- private String vlan;
-
- @IdentityMapper(entityTableName="data_center")
- @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the Zone ID of the VLAN IP range")
- private Long zoneId;
-
- @IdentityMapper(entityTableName="networks")
- @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.LONG, description="network id of the VLAN IP range")
- private Long networkId;
-
- @Parameter(name=ApiConstants.FOR_VIRTUAL_NETWORK, type=CommandType.BOOLEAN, description="true if VLAN is of Virtual type, false if Direct")
- private Boolean forVirtualNetwork;
-
- @IdentityMapper(entityTableName="physical_network")
- @Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.LONG, description="physical network id of the VLAN IP range")
- private Long physicalNetworkId;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public String getAccountName() {
- return accountName;
- }
-
- public Long getDomainId() {
- return domainId;
- }
-
- public Long getId() {
- return id;
- }
-
- public Long getPodId() {
- return podId;
- }
-
- public String getVlan() {
- return vlan;
- }
-
- public Long getZoneId() {
- return zoneId;
- }
-
- public Long getNetworkId() {
- return networkId;
- }
-
- public Boolean getForVirtualNetwork() {
- return forVirtualNetwork;
- }
-
- public Long getProjectId() {
- return projectId;
- }
-
- public Long getPhysicalNetworkId() {
- return physicalNetworkId;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public void execute(){
- Pair<List<? extends Vlan>, Integer> vlans = _mgr.searchForVlans(this);
- ListResponse<VlanIpRangeResponse> response = new ListResponse<VlanIpRangeResponse>();
- List<VlanIpRangeResponse> vlanResponses = new ArrayList<VlanIpRangeResponse>();
- for (Vlan vlan : vlans.first()) {
- VlanIpRangeResponse vlanResponse = _responseGenerator.createVlanIpRangeResponse(vlan);
- vlanResponse.setObjectName("vlaniprange");
- vlanResponses.add(vlanResponse);
- }
-
- response.setResponses(vlanResponses, vlans.second());
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListVolumesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListVolumesCmd.java b/api/src/com/cloud/api/commands/ListVolumesCmd.java
deleted file mode 100755
index 7875c83..0000000
--- a/api/src/com/cloud/api/commands/ListVolumesCmd.java
+++ /dev/null
@@ -1,135 +0,0 @@
-// 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 com.cloud.api.commands;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-
-import com.cloud.api.ApiConstants;
-import com.cloud.api.BaseListTaggedResourcesCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.response.ListResponse;
-import com.cloud.api.response.VolumeResponse;
-import com.cloud.async.AsyncJob;
-import com.cloud.storage.Volume;
-import com.cloud.utils.Pair;
-
-
-@Implementation(description="Lists all volumes.", responseObject=VolumeResponse.class)
-public class ListVolumesCmd extends BaseListTaggedResourcesCmd {
- public static final Logger s_logger = Logger.getLogger(ListVolumesCmd.class.getName());
-
- private static final String s_name = "listvolumesresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="host")
- @Parameter(name=ApiConstants.HOST_ID, type=CommandType.LONG, description="list volumes on specified host")
- private Long hostId;
-
- @IdentityMapper(entityTableName="volumes")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the ID of the disk volume")
- private Long id;
-
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the disk volume")
- private String volumeName;
-
- @IdentityMapper(entityTableName="host_pod_ref")
- @Parameter(name=ApiConstants.POD_ID, type=CommandType.LONG, description="the pod id the disk volume belongs to")
- private Long podId;
-
- @Parameter(name=ApiConstants.TYPE, type=CommandType.STRING, description="the type of disk volume")
- private String type;
-
- @IdentityMapper(entityTableName="vm_instance")
- @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.LONG, description="the ID of the virtual machine")
- private Long virtualMachineId;
-
- @IdentityMapper(entityTableName="data_center")
- @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the ID of the availability zone")
- private Long zoneId;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
-
- public Long getHostId() {
- return hostId;
- }
-
- public Long getId() {
- return id;
- }
-
- public String getVolumeName() {
- return volumeName;
- }
-
- public Long getPodId() {
- return podId;
- }
-
- public String getType() {
- return type;
- }
-
- public Long getVirtualMachineId() {
- return virtualMachineId;
- }
-
- public Long getZoneId() {
- return zoneId;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public AsyncJob.Type getInstanceType() {
- return AsyncJob.Type.Volume;
- }
-
- @Override
- public void execute(){
- Pair<List<? extends Volume>, Integer> volumes = _storageService.searchForVolumes(this);
-
- ListResponse<VolumeResponse> response = new ListResponse<VolumeResponse>();
- List<VolumeResponse> volResponses = new ArrayList<VolumeResponse>();
- for (Volume volume : volumes.first()) {
- VolumeResponse volResponse = _responseGenerator.createVolumeResponse(volume);
- volResponse.setObjectName("volume");
- volResponses.add(volResponse);
- }
-
- response.setResponses(volResponses, volumes.second());
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListVpnConnectionsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListVpnConnectionsCmd.java b/api/src/com/cloud/api/commands/ListVpnConnectionsCmd.java
deleted file mode 100644
index c7d5523..0000000
--- a/api/src/com/cloud/api/commands/ListVpnConnectionsCmd.java
+++ /dev/null
@@ -1,92 +0,0 @@
-// 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 com.cloud.api.commands;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-
-import com.cloud.api.ApiConstants;
-import com.cloud.api.BaseListProjectAndAccountResourcesCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.response.ListResponse;
-import com.cloud.api.response.Site2SiteVpnConnectionResponse;
-import com.cloud.network.Site2SiteVpnConnection;
-import com.cloud.utils.Pair;
-
-@Implementation(description="Lists site to site vpn connection gateways", responseObject=Site2SiteVpnConnectionResponse.class)
-public class ListVpnConnectionsCmd extends BaseListProjectAndAccountResourcesCmd {
- public static final Logger s_logger = Logger.getLogger (ListVpnConnectionsCmd.class.getName());
-
- private static final String s_name = "listvpnconnectionsresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="s2s_vpn_connection")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="id of the vpn connection")
- private Long id;
-
- @IdentityMapper(entityTableName="vpc")
- @Parameter(name=ApiConstants.VPC_ID, type=CommandType.LONG, description="id of vpc")
- private Long vpcId;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
-
- public Long getId() {
- return id;
- }
-
- public Long getVpcId() {
- return vpcId;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public void execute(){
- Pair<List<? extends Site2SiteVpnConnection>, Integer> conns = _s2sVpnService.searchForVpnConnections(this);
- ListResponse<Site2SiteVpnConnectionResponse> response = new ListResponse<Site2SiteVpnConnectionResponse>();
- List<Site2SiteVpnConnectionResponse> connResponses = new ArrayList<Site2SiteVpnConnectionResponse>();
- for (Site2SiteVpnConnection conn : conns.first()) {
- if (conn == null) {
- continue;
- }
- Site2SiteVpnConnectionResponse site2SiteVpnConnectonRes = _responseGenerator.createSite2SiteVpnConnectionResponse(conn);
- site2SiteVpnConnectonRes.setObjectName("vpnconnection");
- connResponses.add(site2SiteVpnConnectonRes);
- }
-
- response.setResponses(connResponses, conns.second());
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-}