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
[35/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/ListPodsByCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListPodsByCmd.java b/api/src/com/cloud/api/commands/ListPodsByCmd.java
deleted file mode 100755
index 37b8e29..0000000
--- a/api/src/com/cloud/api/commands/ListPodsByCmd.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.response.ListResponse;
-import com.cloud.api.response.PodResponse;
-import com.cloud.dc.Pod;
-import com.cloud.utils.Pair;
-
-@Implementation(description="Lists all Pods.", responseObject=PodResponse.class)
-public class ListPodsByCmd extends BaseListCmd {
- public static final Logger s_logger = Logger.getLogger(ListPodsByCmd.class.getName());
-
- private static final String s_name = "listpodsresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="host_pod_ref")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list Pods by ID")
- private Long id;
-
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="list Pods by name")
- private String podName;
-
- @IdentityMapper(entityTableName="data_center")
- @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="list Pods by Zone ID")
- private Long zoneId;
-
- @Parameter(name=ApiConstants.ALLOCATION_STATE, type=CommandType.STRING, description="list pods by allocation state")
- private String allocationState;
-
- @Parameter(name=ApiConstants.SHOW_CAPACITIES, type=CommandType.BOOLEAN, description="flag to display the capacity of the pods")
- private Boolean showCapacities;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Long getId() {
- return id;
- }
-
- public String getPodName() {
- return podName;
- }
-
- public Long getZoneId() {
- return zoneId;
- }
-
- public String getAllocationState() {
- return allocationState;
- }
-
- public Boolean getShowCapacities() {
- return showCapacities;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public void execute(){
- Pair<List<? extends Pod>, Integer> result = _mgr.searchForPods(this);
- ListResponse<PodResponse> response = new ListResponse<PodResponse>();
- List<PodResponse> podResponses = new ArrayList<PodResponse>();
- for (Pod pod : result.first()) {
- PodResponse podResponse = _responseGenerator.createPodResponse(pod, showCapacities);
- podResponse.setObjectName("pod");
- podResponses.add(podResponse);
- }
-
- response.setResponses(podResponses, 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/ListPortForwardingRulesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListPortForwardingRulesCmd.java b/api/src/com/cloud/api/commands/ListPortForwardingRulesCmd.java
deleted file mode 100644
index 0315a12..0000000
--- a/api/src/com/cloud/api/commands/ListPortForwardingRulesCmd.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.BaseListTaggedResourcesCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.response.FirewallRuleResponse;
-import com.cloud.api.response.ListResponse;
-import com.cloud.network.rules.PortForwardingRule;
-import com.cloud.utils.Pair;
-
-@Implementation(description="Lists all port forwarding rules for an IP address.", responseObject=FirewallRuleResponse.class)
-public class ListPortForwardingRulesCmd extends BaseListTaggedResourcesCmd {
- public static final Logger s_logger = Logger.getLogger(ListPortForwardingRulesCmd.class.getName());
-
- private static final String s_name = "listportforwardingrulesresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="firewall_rules")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="Lists rule with the specified ID.")
- private Long id;
-
- @IdentityMapper(entityTableName="user_ip_address")
- @Parameter(name=ApiConstants.IP_ADDRESS_ID, type=CommandType.LONG, description="the id of IP address of the port forwarding services")
- private Long ipAddressId;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Long getIpAddressId() {
- return ipAddressId;
- }
-
- public Long getId() {
- return id;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public void execute(){
- Pair<List<? extends PortForwardingRule>, Integer> result = _rulesService.listPortForwardingRules(this);
- ListResponse<FirewallRuleResponse> response = new ListResponse<FirewallRuleResponse>();
- List<FirewallRuleResponse> fwResponses = new ArrayList<FirewallRuleResponse>();
-
- for (PortForwardingRule fwRule : result.first()) {
- FirewallRuleResponse ruleData = _responseGenerator.createPortForwardingRuleResponse(fwRule);
- ruleData.setObjectName("portforwardingrule");
- fwResponses.add(ruleData);
- }
- response.setResponses(fwResponses, 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/ListPrivateGatewaysCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListPrivateGatewaysCmd.java b/api/src/com/cloud/api/commands/ListPrivateGatewaysCmd.java
deleted file mode 100644
index 389df5e..0000000
--- a/api/src/com/cloud/api/commands/ListPrivateGatewaysCmd.java
+++ /dev/null
@@ -1,107 +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.PrivateGatewayResponse;
-import com.cloud.network.vpc.PrivateGateway;
-import com.cloud.utils.Pair;
-
-@Implementation(description="List private gateways", responseObject=PrivateGatewayResponse.class)
-public class ListPrivateGatewaysCmd extends BaseListProjectAndAccountResourcesCmd{
- public static final Logger s_logger = Logger.getLogger(ListPrivateGatewaysCmd.class.getName());
-
- private static final String s_name = "listprivategatewaysresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
- @IdentityMapper(entityTableName="vpc_gateways")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list private gateway by id")
- private Long id;
-
- @Parameter(name=ApiConstants.IP_ADDRESS, type=CommandType.STRING, description="list gateways by ip address")
- private String ipAddress;
-
- @Parameter(name=ApiConstants.VLAN, type=CommandType.STRING, description="list gateways by vlan")
- private String vlan;
-
- @IdentityMapper(entityTableName="vpc")
- @Parameter(name=ApiConstants.VPC_ID, type=CommandType.LONG, description="list gateways by vpc")
- private Long vpcId;
-
- @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="list gateways by state")
- private String state;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
-
- public String getVlan() {
- return vlan;
- }
-
- public String getIpAddress() {
- return ipAddress;
- }
-
- public Long getVpcId() {
- return vpcId;
- }
-
- public Long getId() {
- return id;
- }
-
- public String getState() {
- return state;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public void execute() {
- Pair<List<PrivateGateway>, Integer> gateways = _vpcService.listPrivateGateway(this);
- ListResponse<PrivateGatewayResponse> response = new ListResponse<PrivateGatewayResponse>();
- List<PrivateGatewayResponse> projectResponses = new ArrayList<PrivateGatewayResponse>();
- for (PrivateGateway gateway : gateways.first()) {
- PrivateGatewayResponse gatewayResponse = _responseGenerator.createPrivateGatewayResponse(gateway);
- projectResponses.add(gatewayResponse);
- }
- response.setResponses(projectResponses, gateways.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/ListProjectAccountsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListProjectAccountsCmd.java b/api/src/com/cloud/api/commands/ListProjectAccountsCmd.java
deleted file mode 100644
index 0883633..0000000
--- a/api/src/com/cloud/api/commands/ListProjectAccountsCmd.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.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.ProjectAccountResponse;
-import com.cloud.api.response.ProjectResponse;
-import com.cloud.projects.ProjectAccount;
-import com.cloud.user.Account;
-import com.cloud.utils.Pair;
-
-@Implementation(description="Lists project's accounts", responseObject=ProjectResponse.class, since="3.0.0")
-public class ListProjectAccountsCmd extends BaseListCmd {
- public static final Logger s_logger = Logger.getLogger(ListProjectAccountsCmd.class.getName());
-
- private static final String s_name = "listprojectaccountsresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="projects")
- @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, required=true, description="id of the project")
- private Long projectId;
-
- @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="list accounts of the project by account name")
- private String accountName;
-
- @Parameter(name=ApiConstants.ROLE, type=CommandType.STRING, description="list accounts of the project by role")
- private String role;
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public String getAccountName() {
- return accountName;
- }
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public long getEntityOwnerId() {
- //TODO - return project entity ownerId
-
- return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
- }
-
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public void execute(){
- Pair<List<? extends ProjectAccount>, Integer> projectAccounts = _projectService.listProjectAccounts(projectId,
- accountName, role, this.getStartIndex(), this.getPageSizeVal());
- ListResponse<ProjectAccountResponse> response = new ListResponse<ProjectAccountResponse>();
- List<ProjectAccountResponse> projectResponses = new ArrayList<ProjectAccountResponse>();
- for (ProjectAccount projectAccount : projectAccounts.first()) {
- ProjectAccountResponse projectAccountResponse = _responseGenerator.createProjectAccountResponse(projectAccount);
- projectResponses.add(projectAccountResponse);
- }
- response.setResponses(projectResponses, projectAccounts.second());
- response.setResponseName(getCommandName());
-
- this.setResponseObject(response);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListProjectInvitationsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListProjectInvitationsCmd.java b/api/src/com/cloud/api/commands/ListProjectInvitationsCmd.java
deleted file mode 100644
index fe69780..0000000
--- a/api/src/com/cloud/api/commands/ListProjectInvitationsCmd.java
+++ /dev/null
@@ -1,101 +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.ProjectInvitationResponse;
-import com.cloud.projects.ProjectInvitation;
-import com.cloud.utils.Pair;
-
-@Implementation(description = "Lists projects and provides detailed information for listed projects", responseObject = ProjectInvitationResponse.class, since = "3.0.0")
-public class ListProjectInvitationsCmd extends BaseListAccountResourcesCmd {
- public static final Logger s_logger = Logger.getLogger(ListProjectInvitationsCmd.class.getName());
- private static final String s_name = "listprojectinvitationsresponse";
-
- // ///////////////////////////////////////////////////
- // ////////////// API parameters /////////////////////
- // ///////////////////////////////////////////////////
- @IdentityMapper(entityTableName = "projects")
- @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.LONG, description = "list by project id")
- private Long projectId;
-
- @Parameter(name = ApiConstants.ACTIVE_ONLY, type = CommandType.BOOLEAN, description = "if true, list only active invitations - having Pending state and ones that are not timed out yet")
- private boolean activeOnly;
-
- @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "list invitations by state")
- private String state;
-
- @IdentityMapper(entityTableName = "project_invitations")
- @Parameter(name = ApiConstants.ID, type = CommandType.LONG, description = "list invitations by id")
- private Long id;
-
- // ///////////////////////////////////////////////////
- // ///////////////// Accessors ///////////////////////
- // ///////////////////////////////////////////////////
- public Long getProjectId() {
- return projectId;
- }
-
- public boolean isActiveOnly() {
- return activeOnly;
- }
-
- public String getState() {
- return state;
- }
-
- public Long getId() {
- return id;
- }
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- // ///////////////////////////////////////////////////
- // ///////////// API Implementation///////////////////
- // ///////////////////////////////////////////////////
-
- @Override
- public void execute() {
- Pair<List<? extends ProjectInvitation>, Integer> invites = _projectService.listProjectInvitations(id, projectId,
- this.getAccountName(), this.getDomainId(), state, activeOnly, this.getStartIndex(), this.getPageSizeVal(),
- this.isRecursive(), this.listAll());
- ListResponse<ProjectInvitationResponse> response = new ListResponse<ProjectInvitationResponse>();
- List<ProjectInvitationResponse> projectInvitationResponses = new ArrayList<ProjectInvitationResponse>();
- for (ProjectInvitation invite : invites.first()) {
- ProjectInvitationResponse projectResponse = _responseGenerator.createProjectInvitationResponse(invite);
- projectInvitationResponses.add(projectResponse);
- }
- response.setResponses(projectInvitationResponses, invites.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/ListProjectsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListProjectsCmd.java b/api/src/com/cloud/api/commands/ListProjectsCmd.java
deleted file mode 100644
index b7a04eb..0000000
--- a/api/src/com/cloud/api/commands/ListProjectsCmd.java
+++ /dev/null
@@ -1,124 +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.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-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.ProjectResponse;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.projects.Project;
-import com.cloud.utils.Pair;
-
-@Implementation(description="Lists projects and provides detailed information for listed projects", responseObject=ProjectResponse.class, since="3.0.0")
-public class ListProjectsCmd extends BaseListAccountResourcesCmd {
- public static final Logger s_logger = Logger.getLogger(ListProjectsCmd.class.getName());
- private static final String s_name = "listprojectsresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="projects")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list projects by project ID")
- private Long id;
-
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="list projects by name")
- private String name;
-
- @Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, description="list projects by display text")
- private String displayText;
-
- @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="list projects by state")
- private String state;
-
- @Parameter(name = ApiConstants.TAGS, type = CommandType.MAP, description = "List projects by tags (key/value pairs)")
- private Map tags;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Long getId() {
- return id;
- }
-
- public String getName() {
- return name;
- }
-
- public String getDisplayText() {
- return displayText;
- }
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- public Map<String, String> getTags() {
- Map<String, String> tagsMap = null;
- if (tags != null && !tags.isEmpty()) {
- tagsMap = new HashMap<String, String>();
- Collection<?> servicesCollection = tags.values();
- Iterator<?> iter = servicesCollection.iterator();
- while (iter.hasNext()) {
- HashMap<String, String> services = (HashMap<String, String>) iter.next();
- String key = services.get("key");
- String value = services.get("value");
- if (value == null) {
- throw new InvalidParameterValueException("No value is passed in for key " + key);
- }
- tagsMap.put(key, value);
- }
- }
- return tagsMap;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public void execute(){
- Pair<List<? extends Project>, Integer> projects = _projectService.listProjects(id, name, displayText, state,
- this.getAccountName(), this.getDomainId(), this.getKeyword(), this.getStartIndex(), this.getPageSizeVal(),
- this.listAll(), this.isRecursive(), getTags());
- ListResponse<ProjectResponse> response = new ListResponse<ProjectResponse>();
- List<ProjectResponse> projectResponses = new ArrayList<ProjectResponse>();
- for (Project project : projects.first()) {
- ProjectResponse projectResponse = _responseGenerator.createProjectResponse(project);
- projectResponses.add(projectResponse);
- }
- response.setResponses(projectResponses, projects.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/ListPublicIpAddressesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListPublicIpAddressesCmd.java b/api/src/com/cloud/api/commands/ListPublicIpAddressesCmd.java
deleted file mode 100644
index a49c5fe..0000000
--- a/api/src/com/cloud/api/commands/ListPublicIpAddressesCmd.java
+++ /dev/null
@@ -1,179 +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.IPAddressResponse;
-import com.cloud.api.response.ListResponse;
-import com.cloud.async.AsyncJob;
-import com.cloud.network.IpAddress;
-import com.cloud.utils.Pair;
-
-
-@Implementation(description="Lists all public ip addresses", responseObject=IPAddressResponse.class)
-public class ListPublicIpAddressesCmd extends BaseListTaggedResourcesCmd {
- public static final Logger s_logger = Logger.getLogger(ListPublicIpAddressesCmd.class.getName());
-
- private static final String s_name = "listpublicipaddressesresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @Parameter(name=ApiConstants.ALLOCATED_ONLY, type=CommandType.BOOLEAN, description="limits search results to allocated public IP addresses")
- private Boolean allocatedOnly;
-
- @Parameter(name=ApiConstants.FOR_VIRTUAL_NETWORK, type=CommandType.BOOLEAN, description="the virtual network for the IP address")
- private Boolean forVirtualNetwork;
-
- @IdentityMapper(entityTableName="user_ip_address")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="lists ip address by id")
- private Long id;
-
- @Parameter(name=ApiConstants.IP_ADDRESS, type=CommandType.STRING, description="lists the specified IP address")
- private String ipAddress;
-
- @IdentityMapper(entityTableName="vlan")
- @Parameter(name=ApiConstants.VLAN_ID, type=CommandType.LONG, description="lists all public IP addresses by VLAN ID")
- private Long vlanId;
-
- @IdentityMapper(entityTableName="data_center")
- @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="lists all public IP addresses by Zone ID")
- private Long zoneId;
-
- @Parameter(name=ApiConstants.FOR_LOAD_BALANCING, type=CommandType.BOOLEAN, description="list only ips used for load balancing")
- private Boolean forLoadBalancing;
-
- @IdentityMapper(entityTableName="physical_network")
- @Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.LONG, description="lists all public IP addresses by physical network id")
- private Long physicalNetworkId;
-
- @IdentityMapper(entityTableName="networks")
- @Parameter(name=ApiConstants.ASSOCIATED_NETWORK_ID, type=CommandType.LONG, description="lists all public IP addresses associated to the network specified")
- private Long associatedNetworkId;
-
- @Parameter(name=ApiConstants.IS_SOURCE_NAT, type=CommandType.BOOLEAN, description="list only source nat ip addresses")
- private Boolean isSourceNat;
-
- @Parameter(name=ApiConstants.IS_STATIC_NAT, type=CommandType.BOOLEAN, description="list only static nat ip addresses")
- private Boolean isStaticNat;
-
- @IdentityMapper(entityTableName="vpc")
- @Parameter(name=ApiConstants.VPC_ID, type=CommandType.LONG, description="List ips belonging to the VPC")
- private Long vpcId;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
- public Long getId() {
- return id;
- }
-
- public Boolean isAllocatedOnly() {
- return allocatedOnly;
- }
-
- public Boolean isForVirtualNetwork() {
- return forVirtualNetwork;
- }
-
- public String getIpAddress() {
- return ipAddress;
- }
-
- public Long getVlanId() {
- return vlanId;
- }
-
- public Long getZoneId() {
- return zoneId;
- }
-
- public Long getPhysicalNetworkId() {
- return physicalNetworkId;
- }
-
- public Long getAssociatedNetworkId() {
- return associatedNetworkId;
- }
-
- public Boolean getIsSourceNat() {
- return isSourceNat;
- }
-
- public Boolean getIsStaticNat() {
- return isStaticNat;
- }
-
- public Long getVpcId() {
- return vpcId;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public void execute(){
- Pair<List<? extends IpAddress>, Integer> result = _mgr.searchForIPAddresses(this);
- ListResponse<IPAddressResponse> response = new ListResponse<IPAddressResponse>();
- List<IPAddressResponse> ipAddrResponses = new ArrayList<IPAddressResponse>();
- for (IpAddress ipAddress : result.first()) {
- IPAddressResponse ipResponse = _responseGenerator.createIPAddressResponse(ipAddress);
- ipResponse.setObjectName("publicipaddress");
- ipAddrResponses.add(ipResponse);
- }
-
- response.setResponses(ipAddrResponses, result.second());
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-
- public AsyncJob.Type getInstanceType() {
- return AsyncJob.Type.IpAddress;
- }
-
-
- public Boolean isForLoadBalancing() {
- return forLoadBalancing;
- }
-
- public Boolean getAllocatedOnly() {
- return allocatedOnly;
- }
-
- public Boolean getForVirtualNetwork() {
- return forVirtualNetwork;
- }
-
- public Boolean getForLoadBalancing() {
- return forLoadBalancing;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListRecurringSnapshotScheduleCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListRecurringSnapshotScheduleCmd.java b/api/src/com/cloud/api/commands/ListRecurringSnapshotScheduleCmd.java
index 7583cc0..41f28f9 100644
--- a/api/src/com/cloud/api/commands/ListRecurringSnapshotScheduleCmd.java
+++ b/api/src/com/cloud/api/commands/ListRecurringSnapshotScheduleCmd.java
@@ -19,15 +19,15 @@ package com.cloud.api.commands;
import java.util.ArrayList;
import java.util.List;
-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.SnapshotScheduleResponse;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseListCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.SnapshotScheduleResponse;
import com.cloud.storage.snapshot.SnapshotSchedule;
-@Implementation(description="Lists recurring snapshot schedule", responseObject=SnapshotScheduleResponse.class)
+@APICommand(description="Lists recurring snapshot schedule", responseObject=SnapshotScheduleResponse.class)
public class ListRecurringSnapshotScheduleCmd extends BaseListCmd {
private static final String s_name = "listrecurringsnapshotscheduleresponse";
@@ -61,20 +61,14 @@ public class ListRecurringSnapshotScheduleCmd extends BaseListCmd {
public String getCommandName() {
return s_name;
}
-
+
@Override
public void execute(){
List<? extends SnapshotSchedule> snapshotSchedules = _snapshotService.findRecurringSnapshotSchedule(this);
ListResponse<SnapshotScheduleResponse> response = new ListResponse<SnapshotScheduleResponse>();
List<SnapshotScheduleResponse> snapshotScheduleResponses = new ArrayList<SnapshotScheduleResponse>();
for (SnapshotSchedule snapshotSchedule : snapshotSchedules) {
- SnapshotScheduleResponse snapSchedResponse = new SnapshotScheduleResponse();
- snapSchedResponse.setId(snapshotSchedule.getId());
- snapSchedResponse.setVolumeId(snapshotSchedule.getVolumeId());
- snapSchedResponse.setSnapshotPolicyId(snapshotSchedule.getPolicyId());
- snapSchedResponse.setScheduled(snapshotSchedule.getScheduledTimestamp());
-
- snapSchedResponse.setObjectName("snapshot");
+ SnapshotScheduleResponse snapSchedResponse = _responseGenerator.createSnapshotScheduleResponse(snapshotSchedule);
snapshotScheduleResponses.add(snapSchedResponse);
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListRemoteAccessVpnsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListRemoteAccessVpnsCmd.java b/api/src/com/cloud/api/commands/ListRemoteAccessVpnsCmd.java
deleted file mode 100644
index 9dd1644..0000000
--- a/api/src/com/cloud/api/commands/ListRemoteAccessVpnsCmd.java
+++ /dev/null
@@ -1,80 +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.RemoteAccessVpnResponse;
-import com.cloud.network.RemoteAccessVpn;
-import com.cloud.utils.Pair;
-
-@Implementation(description="Lists remote access vpns", responseObject=RemoteAccessVpnResponse.class)
-public class ListRemoteAccessVpnsCmd extends BaseListProjectAndAccountResourcesCmd {
- public static final Logger s_logger = Logger.getLogger (ListRemoteAccessVpnsCmd.class.getName());
-
- private static final String s_name = "listremoteaccessvpnsresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="user_ip_address")
- @Parameter(name=ApiConstants.PUBLIC_IP_ID, type=CommandType.LONG, required=true, description="public ip address id of the vpn server")
- private Long publicIpId;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
-
- public Long getPublicIpId() {
- return publicIpId;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public void execute(){
- Pair<List<? extends RemoteAccessVpn>, Integer> vpns = _ravService.searchForRemoteAccessVpns(this);
- ListResponse<RemoteAccessVpnResponse> response = new ListResponse<RemoteAccessVpnResponse>();
- List<RemoteAccessVpnResponse> vpnResponses = new ArrayList<RemoteAccessVpnResponse>();
- if (vpns.first() != null && !vpns.first().isEmpty()) {
- for (RemoteAccessVpn vpn : vpns.first()) {
- vpnResponses.add(_responseGenerator.createRemoteAccessVpnResponse(vpn));
- }
- }
- response.setResponses(vpnResponses, vpns.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/ListResourceLimitsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListResourceLimitsCmd.java b/api/src/com/cloud/api/commands/ListResourceLimitsCmd.java
deleted file mode 100644
index 58d03b3..0000000
--- a/api/src/com/cloud/api/commands/ListResourceLimitsCmd.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.BaseListProjectAndAccountResourcesCmd;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.response.ListResponse;
-import com.cloud.api.response.ResourceLimitResponse;
-import com.cloud.configuration.ResourceLimit;
-
-@Implementation(description="Lists resource limits.", responseObject=ResourceLimitResponse.class)
-public class ListResourceLimitsCmd extends BaseListProjectAndAccountResourcesCmd {
- public static final Logger s_logger = Logger.getLogger(ListResourceLimitsCmd.class.getName());
-
- private static final String s_name = "listresourcelimitsresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="Lists resource limits by ID.")
- private Long id;
-
- @Parameter(name=ApiConstants.RESOURCE_TYPE, type=CommandType.INTEGER, description="Type of resource to update. Values are 0, 1, 2, 3, and 4. 0 - Instance. Number of instances a user can create. " +
- "1 - IP. Number of public IP addresses a user can own. " +
- "2 - Volume. Number of disk volumes a user can create." +
- "3 - Snapshot. Number of snapshots a user can create." +
- "4 - Template. Number of templates that a user can register/create.")
- private Integer resourceType;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Long getId() {
- return id;
- }
-
- public Integer getResourceType() {
- return resourceType;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public void execute(){
- List<? extends ResourceLimit> result = _resourceLimitService.searchForLimits(id, finalyzeAccountId(this.getAccountName(), this.getDomainId(), this.getProjectId(), false), this.getDomainId(), resourceType, this.getStartIndex(), this.getPageSizeVal());
- ListResponse<ResourceLimitResponse> response = new ListResponse<ResourceLimitResponse>();
- List<ResourceLimitResponse> limitResponses = new ArrayList<ResourceLimitResponse>();
- for (ResourceLimit limit : result) {
- ResourceLimitResponse resourceLimitResponse = _responseGenerator.createResourceLimitResponse(limit);
- resourceLimitResponse.setObjectName("resourcelimit");
- limitResponses.add(resourceLimitResponse);
- }
-
- response.setResponses(limitResponses);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListRoutersCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListRoutersCmd.java b/api/src/com/cloud/api/commands/ListRoutersCmd.java
deleted file mode 100644
index 8bf9ba8..0000000
--- a/api/src/com/cloud/api/commands/ListRoutersCmd.java
+++ /dev/null
@@ -1,146 +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.DomainRouterResponse;
-import com.cloud.api.response.ListResponse;
-import com.cloud.async.AsyncJob;
-import com.cloud.network.router.VirtualRouter;
-import com.cloud.utils.Pair;
-
-@Implementation(description="List routers.", responseObject=DomainRouterResponse.class)
-public class ListRoutersCmd extends BaseListProjectAndAccountResourcesCmd {
- public static final Logger s_logger = Logger.getLogger(ListRoutersCmd.class.getName());
-
- private static final String s_name = "listroutersresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="host")
- @Parameter(name=ApiConstants.HOST_ID, type=CommandType.LONG, description="the host ID of the router")
- private Long hostId;
-
- @IdentityMapper(entityTableName="vm_instance")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the ID of the disk router")
- private Long id;
-
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the router")
- private String routerName;
-
- @IdentityMapper(entityTableName="host_pod_ref")
- @Parameter(name=ApiConstants.POD_ID, type=CommandType.LONG, description="the Pod ID of the router")
- private Long podId;
-
- @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="the state of the router")
- private String state;
-
- @IdentityMapper(entityTableName="data_center")
- @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the Zone ID of the router")
- private Long zoneId;
-
- @IdentityMapper(entityTableName="networks")
- @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.LONG, description="list by network id")
- private Long networkId;
-
- @IdentityMapper(entityTableName="vpc")
- @Parameter(name=ApiConstants.VPC_ID, type=CommandType.LONG, description="List networks by VPC")
- private Long vpcId;
-
- @Parameter(name=ApiConstants.FOR_VPC, type=CommandType.BOOLEAN, description="if true is passed for this parameter, list only VPC routers")
- private Boolean forVpc;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Long getHostId() {
- return hostId;
- }
-
- public Long getId() {
- return id;
- }
-
- public String getRouterName() {
- return routerName;
- }
-
- public Long getPodId() {
- return podId;
- }
-
- public String getState() {
- return state;
- }
-
- public Long getZoneId() {
- return zoneId;
- }
-
- public Long getNetworkId() {
- return networkId;
- }
-
- public Long getVpcId() {
- return vpcId;
- }
-
- public Boolean getForVpc() {
- return forVpc;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- public AsyncJob.Type getInstanceType() {
- return AsyncJob.Type.DomainRouter;
- }
-
- @Override
- public void execute(){
- Pair<List<? extends VirtualRouter>, Integer> result = _mgr.searchForRouters(this);
- ListResponse<DomainRouterResponse> response = new ListResponse<DomainRouterResponse>();
- List<DomainRouterResponse> routerResponses = new ArrayList<DomainRouterResponse>();
- for (VirtualRouter router : result.first()) {
- DomainRouterResponse routerResponse = _responseGenerator.createDomainRouterResponse(router);
- routerResponse.setObjectName("router");
- routerResponses.add(routerResponse);
- }
-
- response.setResponses(routerResponses, 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/ListS3sCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListS3sCmd.java b/api/src/com/cloud/api/commands/ListS3sCmd.java
deleted file mode 100644
index d536cfc..0000000
--- a/api/src/com/cloud/api/commands/ListS3sCmd.java
+++ /dev/null
@@ -1,75 +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.BaseListCmd;
-import com.cloud.api.Implementation;
-import com.cloud.api.ServerApiException;
-import com.cloud.api.response.ListResponse;
-import com.cloud.api.response.S3Response;
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InsufficientCapacityException;
-import com.cloud.exception.NetworkRuleConflictException;
-import com.cloud.exception.ResourceAllocationException;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.storage.S3;
-
-@Implementation(description = "Lists S3s", responseObject = S3Response.class, since = "4.0.0")
-public final class ListS3sCmd extends BaseListCmd {
-
- private static final String COMMAND_NAME = "lists3sresponse";
-
- @Override
- public void execute() throws ResourceUnavailableException, InsufficientCapacityException,
- ServerApiException, ConcurrentOperationException, ResourceAllocationException,
- NetworkRuleConflictException {
-
- final List<? extends S3> result = _resourceService.listS3s(this);
- final ListResponse<S3Response> response = new ListResponse<S3Response>();
- final List<S3Response> s3Responses = new ArrayList<S3Response>();
-
- if (result != null) {
-
- for (S3 s3 : result) {
-
- S3Response s3Response = _responseGenerator.createS3Response(s3);
- s3Response.setResponseName(this.getCommandName());
- s3Response.setObjectName("s3");
- s3Responses.add(s3Response);
-
- }
-
- }
-
- response.setResponses(s3Responses);
- response.setResponseName(this.getCommandName());
-
- this.setResponseObject(response);
-
- }
-
- @Override
- public String getCommandName() {
- return COMMAND_NAME;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListSSHKeyPairsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListSSHKeyPairsCmd.java b/api/src/com/cloud/api/commands/ListSSHKeyPairsCmd.java
deleted file mode 100644
index 8a6cb27..0000000
--- a/api/src/com/cloud/api/commands/ListSSHKeyPairsCmd.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.BaseListProjectAndAccountResourcesCmd;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.response.ListResponse;
-import com.cloud.api.response.SSHKeyPairResponse;
-import com.cloud.user.SSHKeyPair;
-import com.cloud.utils.Pair;
-
-@Implementation(description="List registered keypairs", responseObject=SSHKeyPairResponse.class)
-public class ListSSHKeyPairsCmd extends BaseListProjectAndAccountResourcesCmd {
- public static final Logger s_logger = Logger.getLogger(ListSSHKeyPairsCmd.class.getName());
- private static final String s_name = "listsshkeypairsresponse";
-
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="A key pair name to look for")
- private String name;
-
- @Parameter(name="fingerprint", type=CommandType.STRING, description="A public key fingerprint to look for")
- private String fingerprint;
-
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public String getName() {
- return name;
- }
-
- public String getFingerprint() {
- return fingerprint;
- }
-
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public void execute() {
- Pair<List<? extends SSHKeyPair>, Integer> resultList = _mgr.listSSHKeyPairs(this);
- List<SSHKeyPairResponse> responses = new ArrayList<SSHKeyPairResponse>();
- for (SSHKeyPair result : resultList.first()) {
- SSHKeyPairResponse r = new SSHKeyPairResponse(result.getName(), result.getFingerprint());
- r.setObjectName("sshkeypair");
- responses.add(r);
- }
-
- ListResponse<SSHKeyPairResponse> response = new ListResponse<SSHKeyPairResponse>();
- response.setResponses(responses, resultList.second());
- 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/ListSecurityGroupsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListSecurityGroupsCmd.java b/api/src/com/cloud/api/commands/ListSecurityGroupsCmd.java
deleted file mode 100644
index 6da023a..0000000
--- a/api/src/com/cloud/api/commands/ListSecurityGroupsCmd.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.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.SecurityGroupResponse;
-import com.cloud.async.AsyncJob;
-import com.cloud.network.security.SecurityGroupRules;
-
-
-@Implementation(description="Lists security groups", responseObject=SecurityGroupResponse.class)
-public class ListSecurityGroupsCmd extends BaseListTaggedResourcesCmd {
- public static final Logger s_logger = Logger.getLogger(ListSecurityGroupsCmd.class.getName());
-
- private static final String s_name = "listsecuritygroupsresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @Parameter(name=ApiConstants.SECURITY_GROUP_NAME, type=CommandType.STRING, description="lists security groups by name")
- private String securityGroupName;
-
- @IdentityMapper(entityTableName="vm_instance")
- @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.LONG, description="lists security groups by virtual machine id")
- private Long virtualMachineId;
-
- @IdentityMapper(entityTableName="security_group")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list the security group by the id provided")
- private Long id;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
- public String getSecurityGroupName() {
- return securityGroupName;
- }
-
- public Long getVirtualMachineId() {
- return virtualMachineId;
- }
-
- public Long getId(){
- return id;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public void execute(){
- List<? extends SecurityGroupRules> securityGroups = _securityGroupService.searchForSecurityGroupRules(this);
-
- ListResponse<SecurityGroupResponse> response = _responseGenerator.createSecurityGroupResponses(securityGroups);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-
- @Override
- public AsyncJob.Type getInstanceType() {
- return AsyncJob.Type.SecurityGroup;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListServiceOfferingsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListServiceOfferingsCmd.java b/api/src/com/cloud/api/commands/ListServiceOfferingsCmd.java
deleted file mode 100644
index 39cc7c8..0000000
--- a/api/src/com/cloud/api/commands/ListServiceOfferingsCmd.java
+++ /dev/null
@@ -1,117 +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.ServiceOfferingResponse;
-import com.cloud.offering.ServiceOffering;
-
-@Implementation(description="Lists all available service offerings.", responseObject=ServiceOfferingResponse.class)
-public class ListServiceOfferingsCmd extends BaseListCmd {
- public static final Logger s_logger = Logger.getLogger(ListServiceOfferingsCmd.class.getName());
-
- private static final String s_name = "listserviceofferingsresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="disk_offering")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="ID of the service offering")
- private Long id;
-
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="name of the service offering")
- private String serviceOfferingName;
-
- @IdentityMapper(entityTableName="vm_instance")
- @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.LONG, description="the ID of the virtual machine. Pass this in if you want to see the available service offering that a virtual machine can be changed to.")
- private Long virtualMachineId;
-
- @IdentityMapper(entityTableName="domain")
- @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="the ID of the domain associated with the service offering")
- private Long domainId;
-
- @Parameter(name=ApiConstants.IS_SYSTEM_OFFERING, type=CommandType.BOOLEAN, description="is this a system vm offering")
- private Boolean isSystem;
-
- @Parameter(name=ApiConstants.SYSTEM_VM_TYPE, type=CommandType.STRING, description="the system VM type. Possible types are \"consoleproxy\", \"secondarystoragevm\" or \"domainrouter\".")
- private String systemVmType;
-
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Long getId() {
- return id;
- }
-
- public String getServiceOfferingName() {
- return serviceOfferingName;
- }
-
- public Long getVirtualMachineId() {
- return virtualMachineId;
- }
-
- public Long getDomainId(){
- return domainId;
- }
-
- public Boolean getIsSystem() {
- return isSystem == null ? false : isSystem;
- }
-
- public String getSystemVmType(){
- return systemVmType;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public void execute(){
- List<? extends ServiceOffering> offerings = _mgr.searchForServiceOfferings(this);
- ListResponse<ServiceOfferingResponse> response = new ListResponse<ServiceOfferingResponse>();
- List<ServiceOfferingResponse> offeringResponses = new ArrayList<ServiceOfferingResponse>();
- for (ServiceOffering offering : offerings) {
- ServiceOfferingResponse offeringResponse = _responseGenerator.createServiceOfferingResponse(offering);
- offeringResponse.setObjectName("serviceoffering");
- offeringResponses.add(offeringResponse);
- }
-
- response.setResponses(offeringResponses);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListSnapshotPoliciesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListSnapshotPoliciesCmd.java b/api/src/com/cloud/api/commands/ListSnapshotPoliciesCmd.java
deleted file mode 100644
index c19924b..0000000
--- a/api/src/com/cloud/api/commands/ListSnapshotPoliciesCmd.java
+++ /dev/null
@@ -1,78 +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.SnapshotPolicyResponse;
-import com.cloud.storage.snapshot.SnapshotPolicy;
-
-@Implementation(description="Lists snapshot policies.", responseObject=SnapshotPolicyResponse.class)
-public class ListSnapshotPoliciesCmd extends BaseListCmd {
- public static final Logger s_logger = Logger.getLogger(ListSnapshotPoliciesCmd.class.getName());
-
- private static final String s_name = "listsnapshotpoliciesresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="volumes")
- @Parameter(name=ApiConstants.VOLUME_ID, type=CommandType.LONG, required=true, description="the ID of the disk volume")
- private Long volumeId;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Long getVolumeId() {
- return volumeId;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public void execute(){
- List<? extends SnapshotPolicy> result = _snapshotService.listPoliciesforVolume(this);
- ListResponse<SnapshotPolicyResponse> response = new ListResponse<SnapshotPolicyResponse>();
- List<SnapshotPolicyResponse> policyResponses = new ArrayList<SnapshotPolicyResponse>();
- for (SnapshotPolicy policy : result) {
- SnapshotPolicyResponse policyResponse = _responseGenerator.createSnapshotPolicyResponse(policy);
- policyResponse.setObjectName("snapshotpolicy");
- policyResponses.add(policyResponse);
- }
- response.setResponses(policyResponses);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListSnapshotsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListSnapshotsCmd.java b/api/src/com/cloud/api/commands/ListSnapshotsCmd.java
deleted file mode 100644
index cc2aad8..0000000
--- a/api/src/com/cloud/api/commands/ListSnapshotsCmd.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.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.SnapshotResponse;
-import com.cloud.async.AsyncJob;
-import com.cloud.storage.Snapshot;
-import com.cloud.utils.Pair;
-
-
-@Implementation(description="Lists all available snapshots for the account.", responseObject=SnapshotResponse.class)
-public class ListSnapshotsCmd extends BaseListTaggedResourcesCmd {
- public static final Logger s_logger = Logger.getLogger(ListSnapshotsCmd.class.getName());
-
- private static final String s_name = "listsnapshotsresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="snapshots")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="lists snapshot by snapshot ID")
- private Long id;
-
- @Parameter(name=ApiConstants.INTERVAL_TYPE, type=CommandType.STRING, description="valid values are HOURLY, DAILY, WEEKLY, and MONTHLY.")
- private String intervalType;
-
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="lists snapshot by snapshot name")
- private String snapshotName;
-
- @Parameter(name=ApiConstants.SNAPSHOT_TYPE, type=CommandType.STRING, description="valid values are MANUAL or RECURRING.")
- private String snapshotType;
-
- @IdentityMapper(entityTableName="volumes")
- @Parameter(name=ApiConstants.VOLUME_ID, type=CommandType.LONG, description="the ID of the disk volume")
- private Long volumeId;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Long getId() {
- return id;
- }
-
- public String getIntervalType() {
- return intervalType;
- }
-
- public String getSnapshotName() {
- return snapshotName;
- }
-
- public String getSnapshotType() {
- return snapshotType;
- }
-
- public Long getVolumeId() {
- return volumeId;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- public AsyncJob.Type getInstanceType() {
- return AsyncJob.Type.Snapshot;
- }
-
- @Override
- public void execute(){
- Pair<List<? extends Snapshot>, Integer> result = _snapshotService.listSnapshots(this);
- ListResponse<SnapshotResponse> response = new ListResponse<SnapshotResponse>();
- List<SnapshotResponse> snapshotResponses = new ArrayList<SnapshotResponse>();
- for (Snapshot snapshot : result.first()) {
- SnapshotResponse snapshotResponse = _responseGenerator.createSnapshotResponse(snapshot);
- snapshotResponse.setObjectName("snapshot");
- snapshotResponses.add(snapshotResponse);
- }
- response.setResponses(snapshotResponses, 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/ListStaticRoutesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListStaticRoutesCmd.java b/api/src/com/cloud/api/commands/ListStaticRoutesCmd.java
deleted file mode 100644
index 93b533e..0000000
--- a/api/src/com/cloud/api/commands/ListStaticRoutesCmd.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 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.StaticRouteResponse;
-import com.cloud.network.vpc.StaticRoute;
-import com.cloud.utils.Pair;
-
-@Implementation(description="Lists all static routes", responseObject=StaticRouteResponse.class)
-public class ListStaticRoutesCmd extends BaseListTaggedResourcesCmd {
- private static final String s_name = "liststaticroutesresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
- @IdentityMapper(entityTableName="static_routes")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list static route by id")
- private Long id;
-
- @IdentityMapper(entityTableName="vpc")
- @Parameter(name=ApiConstants.VPC_ID, type=CommandType.LONG, description="list static routes by vpc id")
- private Long vpcId;
-
- @IdentityMapper(entityTableName="vpc_gateways")
- @Parameter(name=ApiConstants.GATEWAY_ID, type=CommandType.LONG, description="list static routes by gateway id")
- private Long gatewayId;
-
- public Long getId() {
- return id;
- }
-
- public Long getVpcId() {
- return vpcId;
- }
-
- public Long getGatewayId() {
- return gatewayId;
- }
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public void execute(){
- Pair<List<? extends StaticRoute>, Integer> result = _vpcService.listStaticRoutes(this);
- ListResponse<StaticRouteResponse> response = new ListResponse<StaticRouteResponse>();
- List<StaticRouteResponse> routeResponses = new ArrayList<StaticRouteResponse>();
-
- for (StaticRoute route : result.first()) {
- StaticRouteResponse ruleData = _responseGenerator.createStaticRouteResponse(route);
- routeResponses.add(ruleData);
- }
- response.setResponses(routeResponses, 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/ListStoragePoolsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListStoragePoolsCmd.java b/api/src/com/cloud/api/commands/ListStoragePoolsCmd.java
deleted file mode 100644
index 7199b0b..0000000
--- a/api/src/com/cloud/api/commands/ListStoragePoolsCmd.java
+++ /dev/null
@@ -1,130 +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.StoragePoolResponse;
-import com.cloud.async.AsyncJob;
-import com.cloud.storage.StoragePool;
-import com.cloud.utils.Pair;
-
-@Implementation(description="Lists storage pools.", responseObject=StoragePoolResponse.class)
-public class ListStoragePoolsCmd extends BaseListCmd {
- public static final Logger s_logger = Logger.getLogger(ListStoragePoolsCmd.class.getName());
-
- private static final String s_name = "liststoragepoolsresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="cluster")
- @Parameter(name=ApiConstants.CLUSTER_ID, type=CommandType.LONG, description="list storage pools belongig to the specific cluster")
- private Long clusterId;
-
- @Parameter(name=ApiConstants.IP_ADDRESS, type=CommandType.STRING, description="the IP address for the storage pool")
- private String ipAddress;
-
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the storage pool")
- private String storagePoolName;
-
- @Parameter(name=ApiConstants.PATH, type=CommandType.STRING, description="the storage pool path")
- private String path;
-
- @IdentityMapper(entityTableName="host_pod_ref")
- @Parameter(name=ApiConstants.POD_ID, type=CommandType.LONG, description="the Pod ID for the storage pool")
- private Long podId;
-
- @IdentityMapper(entityTableName="data_center")
- @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the Zone ID for the storage pool")
- private Long zoneId;
-
- @IdentityMapper(entityTableName="storage_pool")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the ID of the storage pool")
- private Long id;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Long getClusterId() {
- return clusterId;
- }
-
- public String getIpAddress() {
- return ipAddress;
- }
-
- public String getStoragePoolName() {
- return storagePoolName;
- }
-
- public String getPath() {
- return path;
- }
-
- public Long getPodId() {
- return podId;
- }
-
- public Long getZoneId() {
- return zoneId;
- }
-
- public Long getId() {
- return id;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- public AsyncJob.Type getInstanceType() {
- return AsyncJob.Type.StoragePool;
- }
-
- @Override
- public void execute(){
- Pair<List<? extends StoragePool>, Integer> pools = _mgr.searchForStoragePools(this);
- ListResponse<StoragePoolResponse> response = new ListResponse<StoragePoolResponse>();
- List<StoragePoolResponse> poolResponses = new ArrayList<StoragePoolResponse>();
- for (StoragePool pool : pools.first()) {
- StoragePoolResponse poolResponse = _responseGenerator.createStoragePoolResponse(pool);
- poolResponse.setObjectName("storagepool");
- poolResponses.add(poolResponse);
- }
-
- response.setResponses(poolResponses, pools.second());
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-}