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
[36/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/ListEventsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListEventsCmd.java b/api/src/com/cloud/api/commands/ListEventsCmd.java
deleted file mode 100755
index 512d377..0000000
--- a/api/src/com/cloud/api/commands/ListEventsCmd.java
+++ /dev/null
@@ -1,120 +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.Date;
-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.EventResponse;
-import com.cloud.api.response.ListResponse;
-import com.cloud.event.Event;
-
-@Implementation(description="A command to list events.", responseObject=EventResponse.class)
-public class ListEventsCmd extends BaseListProjectAndAccountResourcesCmd {
- public static final Logger s_logger = Logger.getLogger(ListEventsCmd.class.getName());
-
- private static final String s_name = "listeventsresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="event")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the ID of the event")
- private Long id;
-
- @Parameter(name=ApiConstants.DURATION, type=CommandType.INTEGER, description="the duration of the event")
- private Integer duration;
-
- @Parameter(name=ApiConstants.END_DATE, type=CommandType.DATE, description="the end date range of the list you want to retrieve (use format \"yyyy-MM-dd\" or the new format \"yyyy-MM-dd HH:mm:ss\")")
- private Date endDate;
-
- @Parameter(name=ApiConstants.ENTRY_TIME, type=CommandType.INTEGER, description="the time the event was entered")
- private Integer entryTime;
-
- @Parameter(name=ApiConstants.LEVEL, type=CommandType.STRING, description="the event level (INFO, WARN, ERROR)")
- private String level;
-
- @Parameter(name=ApiConstants.START_DATE, type=CommandType.DATE, description="the start date range of the list you want to retrieve (use format \"yyyy-MM-dd\" or the new format \"yyyy-MM-dd HH:mm:ss\")")
- private Date startDate;
-
- @Parameter(name=ApiConstants.TYPE, type=CommandType.STRING, description="the event type (see event types)")
- private String type;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Long getId() {
- return id;
- }
-
- public Integer getDuration() {
- return duration;
- }
-
- public Date getEndDate() {
- return endDate;
- }
-
- public Integer getEntryTime() {
- return entryTime;
- }
-
- public String getLevel() {
- return level;
- }
-
- public Date getStartDate() {
- return startDate;
- }
-
- public String getType() {
- return type;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public void execute(){
- List<? extends Event> result = _mgr.searchForEvents(this);
- ListResponse<EventResponse> response = new ListResponse<EventResponse>();
- List<EventResponse> eventResponses = new ArrayList<EventResponse>();
- for (Event event : result) {
- eventResponses.add(_responseGenerator.createEventResponse(event));
- }
-
- response.setResponses(eventResponses);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListFirewallRulesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListFirewallRulesCmd.java b/api/src/com/cloud/api/commands/ListFirewallRulesCmd.java
deleted file mode 100644
index c136266..0000000
--- a/api/src/com/cloud/api/commands/ListFirewallRulesCmd.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.BaseListTaggedResourcesCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.response.FirewallResponse;
-import com.cloud.api.response.ListResponse;
-import com.cloud.network.rules.FirewallRule;
-import com.cloud.utils.Pair;
-
-@Implementation(description="Lists all firewall rules for an IP address.", responseObject=FirewallResponse.class)
-public class ListFirewallRulesCmd extends BaseListTaggedResourcesCmd {
- public static final Logger s_logger = Logger.getLogger(ListFirewallRulesCmd.class.getName());
- private static final String s_name = "listfirewallrulesresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
- @IdentityMapper(entityTableName="firewall_rules")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="Lists rule with the specified ID.")
- private Long id;
-
- @IdentityMapper(entityTableName="user_ip_address")
- @Parameter(name=ApiConstants.IP_ADDRESS_ID, type=CommandType.LONG, description="the id of IP address of the firwall services")
- private Long ipAddressId;
-
- /////////////////////////////////////////////////////
- /////////////////// 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 FirewallRule>, Integer> result = _firewallService.listFirewallRules(this);
- ListResponse<FirewallResponse> response = new ListResponse<FirewallResponse>();
- List<FirewallResponse> fwResponses = new ArrayList<FirewallResponse>();
-
- for (FirewallRule fwRule : result.first()) {
- FirewallResponse ruleData = _responseGenerator.createFirewallResponse(fwRule);
- ruleData.setObjectName("firewallrule");
- 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/ListGuestOsCategoriesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListGuestOsCategoriesCmd.java b/api/src/com/cloud/api/commands/ListGuestOsCategoriesCmd.java
deleted file mode 100644
index 79ce709..0000000
--- a/api/src/com/cloud/api/commands/ListGuestOsCategoriesCmd.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.BaseListCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.response.GuestOSCategoryResponse;
-import com.cloud.api.response.ListResponse;
-import com.cloud.storage.GuestOsCategory;
-import com.cloud.utils.Pair;
-
-@Implementation(description="Lists all supported OS categories for this cloud.", responseObject=GuestOSCategoryResponse.class)
-public class ListGuestOsCategoriesCmd extends BaseListCmd {
- public static final Logger s_logger = Logger.getLogger(ListIsosCmd.class.getName());
-
- private static final String s_name = "listoscategoriesresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="guest_os_category")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list Os category by id")
- private Long id;
-
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="list os category by name", since="3.0.1")
- private String name;
-
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Long getId() {
- return id;
- }
-
- public String getName() {
- return name;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public void execute(){
- Pair<List<? extends GuestOsCategory>, Integer> result = _mgr.listGuestOSCategoriesByCriteria(this);
- ListResponse<GuestOSCategoryResponse> response = new ListResponse<GuestOSCategoryResponse>();
- List<GuestOSCategoryResponse> osCatResponses = new ArrayList<GuestOSCategoryResponse>();
- for (GuestOsCategory osCategory : result.first()) {
- GuestOSCategoryResponse categoryResponse = new GuestOSCategoryResponse();
- categoryResponse.setId(osCategory.getId());
- categoryResponse.setName(osCategory.getName());
-
- categoryResponse.setObjectName("oscategory");
- osCatResponses.add(categoryResponse);
- }
-
- response.setResponses(osCatResponses, 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/ListGuestOsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListGuestOsCmd.java b/api/src/com/cloud/api/commands/ListGuestOsCmd.java
deleted file mode 100644
index 61ec453..0000000
--- a/api/src/com/cloud/api/commands/ListGuestOsCmd.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.BaseListCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.response.GuestOSResponse;
-import com.cloud.api.response.ListResponse;
-import com.cloud.storage.GuestOS;
-import com.cloud.utils.Pair;
-
-@Implementation(description="Lists all supported OS types for this cloud.", responseObject=GuestOSResponse.class)
-public class ListGuestOsCmd extends BaseListCmd {
- public static final Logger s_logger = Logger.getLogger(ListIsosCmd.class.getName());
-
- private static final String s_name = "listostypesresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="guest_os")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list by Os type Id")
- private Long id;
-
- @IdentityMapper(entityTableName="guest_os_category")
- @Parameter(name=ApiConstants.OS_CATEGORY_ID, type=CommandType.LONG, description="list by Os Category id")
- private Long osCategoryId;
-
- @Parameter(name=ApiConstants.DESCRIPTION, type=CommandType.STRING, description="list os by description", since="3.0.1")
- private String description;
-
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Long getId() {
- return id;
- }
-
- public Long getOsCategoryId() {
- return osCategoryId;
- }
-
- public String getDescription() {
- return description;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public void execute(){
- Pair<List<? extends GuestOS>, Integer> result = _mgr.listGuestOSByCriteria(this);
- ListResponse<GuestOSResponse> response = new ListResponse<GuestOSResponse>();
- List<GuestOSResponse> osResponses = new ArrayList<GuestOSResponse>();
- for (GuestOS guestOS : result.first()) {
- GuestOSResponse guestOSResponse = new GuestOSResponse();
- guestOSResponse.setDescription(guestOS.getDisplayName());
- guestOSResponse.setId(guestOS.getId());
- guestOSResponse.setOsCategoryId(guestOS.getCategoryId());
-
- guestOSResponse.setObjectName("ostype");
- osResponses.add(guestOSResponse);
- }
-
- response.setResponses(osResponses, 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/ListHostsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListHostsCmd.java b/api/src/com/cloud/api/commands/ListHostsCmd.java
deleted file mode 100755
index 87f1330..0000000
--- a/api/src/com/cloud/api/commands/ListHostsCmd.java
+++ /dev/null
@@ -1,192 +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.HostDetails;
-import com.cloud.api.BaseListCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.response.HostResponse;
-import com.cloud.api.response.ListResponse;
-import com.cloud.async.AsyncJob;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.host.Host;
-import com.cloud.utils.Pair;
-
-@Implementation(description="Lists hosts.", responseObject=HostResponse.class)
-public class ListHostsCmd extends BaseListCmd {
- public static final Logger s_logger = Logger.getLogger(ListHostsCmd.class.getName());
-
- private static final String s_name = "listhostsresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="cluster")
- @Parameter(name=ApiConstants.CLUSTER_ID, type=CommandType.LONG, description="lists hosts existing in particular cluster")
- private Long clusterId;
-
- @IdentityMapper(entityTableName="host")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the id of the host")
- private Long id;
-
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the host")
- private String hostName;
-
- @IdentityMapper(entityTableName="host_pod_ref")
- @Parameter(name=ApiConstants.POD_ID, type=CommandType.LONG, description="the Pod ID for the host")
- private Long podId;
-
- @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="the state of the host")
- private String state;
-
- @Parameter(name=ApiConstants.TYPE, type=CommandType.STRING, description="the host type")
- private String type;
-
- @IdentityMapper(entityTableName="data_center")
- @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the Zone ID for the host")
- private Long zoneId;
-
- @IdentityMapper(entityTableName="vm_instance")
- @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.LONG, required=false, description="lists hosts in the same cluster as this VM and flag hosts with enough CPU/RAm to host this VM")
- private Long virtualMachineId;
-
- @Parameter(name=ApiConstants.RESOURCE_STATE, type=CommandType.STRING, description="list hosts by resource state. Resource state represents current state determined by admin of host, valule can be one of [Enabled, Disabled, Unmanaged, PrepareForMaintenance, ErrorInMaintenance, Maintenance, Error]")
- private String resourceState;
-
- @Parameter(name=ApiConstants.DETAILS, type=CommandType.LIST, collectionType=CommandType.STRING, description="comma separated list of host details requested, value can be a list of [ min, all, capacity, events, stats]" )
- private List<String> viewDetails;
-
- @Parameter(name=ApiConstants.HA_HOST, type=CommandType.BOOLEAN, description="if true, list only hosts dedicated to HA")
- private Boolean haHost;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Long getClusterId() {
- return clusterId;
- }
-
- public Long getId() {
- return id;
- }
-
- public String getHostName() {
- return hostName;
- }
-
- public Long getPodId() {
- return podId;
- }
-
- public String getState() {
- return state;
- }
-
- public String getType() {
- return type;
- }
-
- public Boolean getHaHost() {
- return haHost;
- }
-
- public Long getZoneId() {
- return zoneId;
- }
-
- public Long getVirtualMachineId() {
- return virtualMachineId;
- }
-
- public EnumSet<HostDetails> getDetails() throws InvalidParameterValueException {
- EnumSet<HostDetails> dv;
- if (viewDetails==null || viewDetails.size() <=0){
- dv = EnumSet.of(HostDetails.all);
- }
- else {
- try {
- ArrayList<HostDetails> dc = new ArrayList<HostDetails>();
- for (String detail: viewDetails){
- dc.add(HostDetails.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(HostDetails.class));
- }
- }
- return dv;
- }
-
- public String getResourceState() {
- return resourceState;
- }
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- public AsyncJob.Type getInstanceType() {
- return AsyncJob.Type.Host;
- }
-
- @Override
- public void execute(){
- List<? extends Host> result = new ArrayList<Host>();
- List<? extends Host> hostsWithCapacity = new ArrayList<Host>();
-
- if(getVirtualMachineId() != null){
- Pair<List<? extends Host>, List<? extends Host>> hostsForMigration = _mgr.listHostsForMigrationOfVM(getVirtualMachineId(), this.getStartIndex(), this.getPageSizeVal());
- result = hostsForMigration.first();
- hostsWithCapacity = hostsForMigration.second();
- }else{
- result = _mgr.searchForServers(this);
- }
-
- ListResponse<HostResponse> response = new ListResponse<HostResponse>();
- List<HostResponse> hostResponses = new ArrayList<HostResponse>();
- for (Host host : result) {
- HostResponse hostResponse = _responseGenerator.createHostResponse(host, getDetails());
- Boolean suitableForMigration = false;
- if(hostsWithCapacity.contains(host)){
- suitableForMigration = true;
- }
- hostResponse.setSuitableForMigration(suitableForMigration);
- hostResponse.setObjectName("host");
- hostResponses.add(hostResponse);
- }
-
- response.setResponses(hostResponses);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListHypervisorCapabilitiesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListHypervisorCapabilitiesCmd.java b/api/src/com/cloud/api/commands/ListHypervisorCapabilitiesCmd.java
deleted file mode 100644
index 9afd3eb..0000000
--- a/api/src/com/cloud/api/commands/ListHypervisorCapabilitiesCmd.java
+++ /dev/null
@@ -1,94 +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.HypervisorCapabilitiesResponse;
-import com.cloud.api.response.ListResponse;
-import com.cloud.hypervisor.Hypervisor.HypervisorType;
-import com.cloud.hypervisor.HypervisorCapabilities;
-import com.cloud.utils.Pair;
-
-@Implementation(description="Lists all hypervisor capabilities.", responseObject=HypervisorCapabilitiesResponse.class, since="3.0.0")
-public class ListHypervisorCapabilitiesCmd extends BaseListCmd {
- public static final Logger s_logger = Logger.getLogger(ListHypervisorCapabilitiesCmd.class.getName());
-
- private static final String s_name = "listhypervisorcapabilitiesresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="hypervisor_capabilities")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="ID of the hypervisor capability")
- private Long id;
-
- @Parameter(name=ApiConstants.HYPERVISOR, type=CommandType.STRING, description="the hypervisor for which to restrict the search")
- private String hypervisor;
-
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Long getId() {
- return id;
- }
-
- public HypervisorType getHypervisor() {
- if(hypervisor != null){
- return HypervisorType.getType(hypervisor);
- }else{
- return null;
- }
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public void execute(){
- Pair<List<? extends HypervisorCapabilities>, Integer> hpvCapabilities = _mgr.listHypervisorCapabilities(getId(),
- getHypervisor(), getKeyword(), this.getStartIndex(), this.getPageSizeVal());
- ListResponse<HypervisorCapabilitiesResponse> response = new ListResponse<HypervisorCapabilitiesResponse>();
- List<HypervisorCapabilitiesResponse> hpvCapabilitiesResponses = new ArrayList<HypervisorCapabilitiesResponse>();
- for (HypervisorCapabilities capability : hpvCapabilities.first()) {
- HypervisorCapabilitiesResponse hpvCapabilityResponse = _responseGenerator.createHypervisorCapabilitiesResponse(capability);
- hpvCapabilityResponse.setObjectName("hypervisorCapabilities");
- hpvCapabilitiesResponses.add(hpvCapabilityResponse);
- }
-
- response.setResponses(hpvCapabilitiesResponses, hpvCapabilities.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/ListHypervisorsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListHypervisorsCmd.java b/api/src/com/cloud/api/commands/ListHypervisorsCmd.java
deleted file mode 100644
index e058df6..0000000
--- a/api/src/com/cloud/api/commands/ListHypervisorsCmd.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.BaseCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.response.HypervisorResponse;
-import com.cloud.api.response.ListResponse;
-import com.cloud.user.Account;
-
-@Implementation(description = "List hypervisors", responseObject = HypervisorResponse.class)
-public class ListHypervisorsCmd extends BaseCmd {
- public static final Logger s_logger = Logger.getLogger(UpgradeRouterCmd.class.getName());
- private static final String s_name = "listhypervisorsresponse";
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- // ///////////////////////////////////////////////////
- // ////////////// API parameters /////////////////////
- // ///////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="data_center")
- @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.LONG, description = "the zone id for listing hypervisors.")
- private Long zoneId;
-
- // ///////////////////////////////////////////////////
- // ///////////////// Accessors ///////////////////////
- // ///////////////////////////////////////////////////
-
- public Long getZoneId() {
- return this.zoneId;
- }
-
- // ///////////////////////////////////////////////////
- // ///////////// API Implementation///////////////////
- // ///////////////////////////////////////////////////
- @Override
- public long getEntityOwnerId() {
- return Account.ACCOUNT_ID_SYSTEM;
- }
-
- @Override
- public void execute() {
- List<String> result = _mgr.getHypervisors(getZoneId());
- ListResponse<HypervisorResponse> response = new ListResponse<HypervisorResponse>();
- ArrayList<HypervisorResponse> responses = new ArrayList<HypervisorResponse>();
- if (result != null) {
- for (String hypervisor : result) {
- HypervisorResponse hypervisorResponse = new HypervisorResponse();
- hypervisorResponse.setName(hypervisor);
- hypervisorResponse.setObjectName("hypervisor");
- responses.add(hypervisorResponse);
- }
- }
- response.setResponses(responses);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListIpForwardingRulesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListIpForwardingRulesCmd.java b/api/src/com/cloud/api/commands/ListIpForwardingRulesCmd.java
deleted file mode 100644
index fedbac0..0000000
--- a/api/src/com/cloud/api/commands/ListIpForwardingRulesCmd.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.BaseListProjectAndAccountResourcesCmd;
-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.IpForwardingRuleResponse;
-import com.cloud.api.response.ListResponse;
-import com.cloud.network.rules.FirewallRule;
-import com.cloud.network.rules.StaticNatRule;
-import com.cloud.utils.Pair;
-
-@Implementation(description="List the ip forwarding rules", responseObject=FirewallRuleResponse.class)
-public class ListIpForwardingRulesCmd extends BaseListProjectAndAccountResourcesCmd {
- public static final Logger s_logger = Logger.getLogger(ListIpForwardingRulesCmd.class.getName());
-
- private static final String s_name = "listipforwardingrulesresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="user_ip_address")
- @Parameter(name=ApiConstants.IP_ADDRESS_ID, type=CommandType.LONG, description="list the rule belonging to this public ip address")
- private Long publicIpAddressId;
-
- @IdentityMapper(entityTableName="firewall_rules")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="Lists rule with the specified ID.")
- private Long id;
-
- @IdentityMapper(entityTableName="vm_instance")
- @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.LONG, description="Lists all rules applied to the specified Vm.")
- private Long vmId;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- public Long getPublicIpAddressId() {
- return publicIpAddressId;
- }
-
- public Long getId() {
- return id;
- }
-
- public Long getVmId() {
- return vmId;
- }
-
- @Override
- public void execute(){
- Pair<List<? extends FirewallRule>, Integer> result = _rulesService.searchStaticNatRules(publicIpAddressId, id, vmId,
- this.getStartIndex(), this.getPageSizeVal(), this.getAccountName(), this.getDomainId(), this.getProjectId(), this.isRecursive(), this.listAll());
- ListResponse<IpForwardingRuleResponse> response = new ListResponse<IpForwardingRuleResponse>();
- List<IpForwardingRuleResponse> ipForwardingResponses = new ArrayList<IpForwardingRuleResponse>();
- for (FirewallRule rule : result.first()) {
- StaticNatRule staticNatRule = _rulesService.buildStaticNatRule(rule, false);
- IpForwardingRuleResponse resp = _responseGenerator.createIpForwardingRuleResponse(staticNatRule);
- if (resp != null) {
- ipForwardingResponses.add(resp);
- }
- }
- response.setResponses(ipForwardingResponses, 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/ListIsoPermissionsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListIsoPermissionsCmd.java b/api/src/com/cloud/api/commands/ListIsoPermissionsCmd.java
deleted file mode 100644
index 0af5855..0000000
--- a/api/src/com/cloud/api/commands/ListIsoPermissionsCmd.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 ListIsoPermissionsCmd extends ListTemplateOrIsoPermissionsCmd {
- protected String getResponseName() {
- return "listisopermissionsresponse";
- }
-
- @Override
- public String getMediaType() {
- return "iso";
- }
-
- @Override
- protected Logger getLogger() {
- return Logger.getLogger(ListIsoPermissionsCmd.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/ListIsosCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListIsosCmd.java b/api/src/com/cloud/api/commands/ListIsosCmd.java
deleted file mode 100755
index 752c834..0000000
--- a/api/src/com/cloud/api/commands/ListIsosCmd.java
+++ /dev/null
@@ -1,161 +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="Lists all available ISO files.", responseObject=TemplateResponse.class)
-public class ListIsosCmd extends BaseListTaggedResourcesCmd {
- public static final Logger s_logger = Logger.getLogger(ListIsosCmd.class.getName());
-
- private static final String s_name = "listisosresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @Parameter(name=ApiConstants.BOOTABLE, type=CommandType.BOOLEAN, description="true if the ISO is bootable, false otherwise")
- private Boolean bootable;
-
- @Parameter(name=ApiConstants.HYPERVISOR, type=CommandType.STRING, description="the hypervisor for which to restrict the search")
- private String hypervisor;
-
- @IdentityMapper(entityTableName="vm_template")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list all isos by id")
- private Long id;
-
- @Parameter(name=ApiConstants.IS_PUBLIC, type=CommandType.BOOLEAN, description="true if the ISO is publicly available to all users, false otherwise.")
- private Boolean publicIso;
-
- @Parameter(name=ApiConstants.IS_READY, type=CommandType.BOOLEAN, description="true if this ISO is ready to be deployed")
- private Boolean ready;
-
- @Parameter(name=ApiConstants.ISO_FILTER, type=CommandType.STRING, description="possible values are \"featured\", \"self\", \"self-executable\",\"executable\", and \"community\". " +
- "* featured-ISOs that are featured and are publicself-ISOs that have been registered/created by the owner. " +
- "* selfexecutable-ISOs that have been registered/created by the owner that can be used to deploy a new VM. " +
- "* executable-all ISOs that can be used to deploy a new VM " +
- "* community-ISOs that are public.")
- private String isoFilter = TemplateFilter.selfexecutable.toString();
-
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="list all isos by name")
- private String isoName;
-
- @IdentityMapper(entityTableName="data_center")
- @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the ID of the zone")
- private Long zoneId;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
-
- public Boolean isBootable() {
- return bootable;
- }
-
- public String getHypervisor() {
- return hypervisor;
- }
-
- public Long getId() {
- return id;
- }
-
- public Boolean isPublic() {
- return publicIso;
- }
-
- public Boolean isReady() {
- return ready;
- }
-
- public String getIsoFilter() {
- return isoFilter;
- }
-
- public String getIsoName() {
- return isoName;
- }
-
- 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(getIsoFilter());
- boolean onlyReady = (templateFilter == TemplateFilter.featured) || (templateFilter == TemplateFilter.selfexecutable) || (templateFilter == TemplateFilter.sharedexecutable)
- || (templateFilter == TemplateFilter.executable && isAccountSpecific) || (templateFilter == TemplateFilter.community);
-
- if (!onlyReady) {
- if (isReady() != null && isReady().booleanValue() != onlyReady) {
- onlyReady = isReady().booleanValue();
- }
- }
-
- return onlyReady;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- public AsyncJob.Type getInstanceType() {
- return AsyncJob.Type.Iso;
- }
-
- @Override
- public void execute(){
- Set<Pair<Long, Long>> isoZonePairSet = _mgr.listIsos(this);
- ListResponse<TemplateResponse> response = new ListResponse<TemplateResponse>();
- List<TemplateResponse> templateResponses = new ArrayList<TemplateResponse>();
-
- for (Pair<Long, Long> iso : isoZonePairSet) {
- List<TemplateResponse> responses = new ArrayList<TemplateResponse>();
- responses = _responseGenerator.createIsoResponses(iso.first(), iso.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/ListLBStickinessPoliciesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListLBStickinessPoliciesCmd.java b/api/src/com/cloud/api/commands/ListLBStickinessPoliciesCmd.java
deleted file mode 100644
index 6be47c1..0000000
--- a/api/src/com/cloud/api/commands/ListLBStickinessPoliciesCmd.java
+++ /dev/null
@@ -1,90 +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.LBStickinessResponse;
-import com.cloud.api.response.ListResponse;
-import com.cloud.network.rules.LoadBalancer;
-import com.cloud.network.rules.StickinessPolicy;
-import com.cloud.user.Account;
-import com.cloud.user.UserContext;
-
-@Implementation(description = "Lists LBStickiness policies.", responseObject = LBStickinessResponse.class, since="3.0.0")
-public class ListLBStickinessPoliciesCmd extends BaseListCmd {
- public static final Logger s_logger = Logger
- .getLogger(ListLBStickinessPoliciesCmd.class.getName());
-
- private static final String s_name = "listlbstickinesspoliciesresponse";
-
- // ///////////////////////////////////////////////////
- // ////////////// API parameters /////////////////////
- // ///////////////////////////////////////////////////
- @IdentityMapper(entityTableName="firewall_rules")
- @Parameter(name = ApiConstants.LBID, type = CommandType.LONG, required = true, description = "the ID of the load balancer rule")
- private Long lbRuleId;
-
-
-
- // ///////////////////////////////////////////////////
- // ///////////////// Accessors ///////////////////////
- // ///////////////////////////////////////////////////
- public Long getLbRuleId() {
- return lbRuleId;
- }
-
-
-
- // ///////////////////////////////////////////////////
- // ///////////// API Implementation///////////////////
- // ///////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public void execute() {
- List<LBStickinessResponse> spResponses = new ArrayList<LBStickinessResponse>();
- LoadBalancer lb = _lbService.findById(getLbRuleId());
- ListResponse<LBStickinessResponse> response = new ListResponse<LBStickinessResponse>();
-
- if (lb != null) {
- //check permissions
- Account caller = UserContext.current().getCaller();
- _accountService.checkAccess(caller, null, true, lb);
- List<? extends StickinessPolicy> stickinessPolicies = _lbService.searchForLBStickinessPolicies(this);
- LBStickinessResponse spResponse = _responseGenerator.createLBStickinessPolicyResponse(stickinessPolicies, lb);
- spResponses.add(spResponse);
- response.setResponses(spResponses);
- }
-
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListLoadBalancerRuleInstancesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListLoadBalancerRuleInstancesCmd.java b/api/src/com/cloud/api/commands/ListLoadBalancerRuleInstancesCmd.java
deleted file mode 100644
index d721914..0000000
--- a/api/src/com/cloud/api/commands/ListLoadBalancerRuleInstancesCmd.java
+++ /dev/null
@@ -1,83 +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.UserVmResponse;
-import com.cloud.uservm.UserVm;
-
-@Implementation(description="List all virtual machine instances that are assigned to a load balancer rule.", responseObject=UserVmResponse.class)
-public class ListLoadBalancerRuleInstancesCmd extends BaseListCmd {
- public static final Logger s_logger = Logger.getLogger (ListLoadBalancerRuleInstancesCmd.class.getName());
-
- private static final String s_name = "listloadbalancerruleinstancesresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @Parameter(name=ApiConstants.APPLIED, type=CommandType.BOOLEAN, description="true if listing all virtual machines currently applied to the load balancer rule; default is true")
- private Boolean applied;
-
- @IdentityMapper(entityTableName="firewall_rules")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the load balancer rule")
- private Long id;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Boolean isApplied() {
- return applied;
- }
-
- public Long getId() {
- return id;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public void execute(){
- List<? extends UserVm> result = _lbService.listLoadBalancerInstances(this);
- ListResponse<UserVmResponse> response = new ListResponse<UserVmResponse>();
- List<UserVmResponse> vmResponses = new ArrayList<UserVmResponse>();
- if (result != null) {
- vmResponses = _responseGenerator.createUserVmResponse("loadbalancerruleinstance", result.toArray(new UserVm[result.size()]));
- }
- response.setResponses(vmResponses);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListLoadBalancerRulesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListLoadBalancerRulesCmd.java b/api/src/com/cloud/api/commands/ListLoadBalancerRulesCmd.java
deleted file mode 100644
index 8413f60..0000000
--- a/api/src/com/cloud/api/commands/ListLoadBalancerRulesCmd.java
+++ /dev/null
@@ -1,113 +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.LoadBalancerResponse;
-import com.cloud.network.rules.LoadBalancer;
-import com.cloud.utils.Pair;
-
-@Implementation(description = "Lists load balancer rules.", responseObject = LoadBalancerResponse.class)
-public class ListLoadBalancerRulesCmd extends BaseListTaggedResourcesCmd {
- public static final Logger s_logger = Logger.getLogger(ListLoadBalancerRulesCmd.class.getName());
-
- private static final String s_name = "listloadbalancerrulesresponse";
-
- // ///////////////////////////////////////////////////
- // ////////////// API parameters /////////////////////
- // ///////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="firewall_rules")
- @Parameter(name = ApiConstants.ID, type = CommandType.LONG, description = "the ID of the load balancer rule")
- private Long id;
-
- @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the load balancer rule")
- private String loadBalancerRuleName;
-
- @IdentityMapper(entityTableName="user_ip_address")
- @Parameter(name = ApiConstants.PUBLIC_IP_ID, type = CommandType.LONG, description = "the public IP address id of the load balancer rule ")
- private Long publicIpId;
-
- @IdentityMapper(entityTableName="vm_instance")
- @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.LONG, description = "the ID of the virtual machine of the load balancer rule")
- private Long virtualMachineId;
-
- @IdentityMapper(entityTableName="data_center")
- @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.LONG, description = "the availability zone ID")
- private Long zoneId;
-
- // ///////////////////////////////////////////////////
- // ///////////////// Accessors ///////////////////////
- // ///////////////////////////////////////////////////
-
- public Long getId() {
- return id;
- }
-
- public String getLoadBalancerRuleName() {
- return loadBalancerRuleName;
- }
-
- public Long getPublicIpId() {
- return publicIpId;
- }
-
- public Long getVirtualMachineId() {
- return virtualMachineId;
- }
-
- public Long getZoneId() {
- return zoneId;
- }
-
- // ///////////////////////////////////////////////////
- // ///////////// API Implementation///////////////////
- // ///////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public void execute() {
- Pair<List<? extends LoadBalancer>, Integer> loadBalancers = _lbService.searchForLoadBalancers(this);
- ListResponse<LoadBalancerResponse> response = new ListResponse<LoadBalancerResponse>();
- List<LoadBalancerResponse> lbResponses = new ArrayList<LoadBalancerResponse>();
- if (loadBalancers != null) {
- for (LoadBalancer loadBalancer : loadBalancers.first()) {
- LoadBalancerResponse lbResponse = _responseGenerator.createLoadBalancerResponse(loadBalancer);
- lbResponse.setObjectName("loadbalancerrule");
- lbResponses.add(lbResponse);
- }
- }
- response.setResponses(lbResponses, loadBalancers.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/ListNetworkACLsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListNetworkACLsCmd.java b/api/src/com/cloud/api/commands/ListNetworkACLsCmd.java
deleted file mode 100644
index bdb3c3b..0000000
--- a/api/src/com/cloud/api/commands/ListNetworkACLsCmd.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.BaseCmd.CommandType;
-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.NetworkACLResponse;
-import com.cloud.network.rules.FirewallRule;
-import com.cloud.utils.Pair;
-
-@Implementation(description="Lists all network ACLs", responseObject=NetworkACLResponse.class)
-public class ListNetworkACLsCmd extends BaseListTaggedResourcesCmd {
- public static final Logger s_logger = Logger.getLogger(ListNetworkACLsCmd.class.getName());
-
- private static final String s_name = "listnetworkaclsresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
- @IdentityMapper(entityTableName="firewall_rules")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="Lists network ACL with the specified ID.")
- private Long id;
-
- @IdentityMapper(entityTableName="networks")
- @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.LONG, description="list network ACLs by network Id")
- private Long networkId;
-
- @Parameter(name=ApiConstants.TRAFFIC_TYPE, type=CommandType.STRING, description="list network ACLs by traffic type - Ingress or Egress")
- private String trafficType;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Long getNetworkId() {
- return networkId;
- }
-
- public Long getId() {
- return id;
- }
-
- public String getTrafficType() {
- return trafficType;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public void execute(){
- Pair<List<? extends FirewallRule>,Integer> result = _networkACLService.listNetworkACLs(this);
- ListResponse<NetworkACLResponse> response = new ListResponse<NetworkACLResponse>();
- List<NetworkACLResponse> aclResponses = new ArrayList<NetworkACLResponse>();
-
- for (FirewallRule acl : result.first()) {
- NetworkACLResponse ruleData = _responseGenerator.createNetworkACLResponse(acl);
- aclResponses.add(ruleData);
- }
- response.setResponses(aclResponses, 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/ListNetworkOfferingsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListNetworkOfferingsCmd.java b/api/src/com/cloud/api/commands/ListNetworkOfferingsCmd.java
deleted file mode 100644
index 70dd1be..0000000
--- a/api/src/com/cloud/api/commands/ListNetworkOfferingsCmd.java
+++ /dev/null
@@ -1,191 +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.NetworkOfferingResponse;
-import com.cloud.offering.NetworkOffering;
-
-
-@Implementation(description="Lists all available network offerings.", responseObject=NetworkOfferingResponse.class)
-public class ListNetworkOfferingsCmd extends BaseListCmd {
- public static final Logger s_logger = Logger.getLogger(ListNetworkOfferingsCmd.class.getName());
- private static final String _name = "listnetworkofferingsresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
- @IdentityMapper(entityTableName="network_offerings")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list network offerings by id")
- private Long id;
-
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="list network offerings by name")
- private String networkOfferingName;
-
- @Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, description="list network offerings by display text")
- private String displayText;
-
- @Parameter(name=ApiConstants.TRAFFIC_TYPE, type=CommandType.STRING, description="list by traffic type")
- private String trafficType;
-
- @Parameter(name=ApiConstants.IS_DEFAULT, type=CommandType.BOOLEAN, description="true if need to list only default network offerings. Default value is false")
- private Boolean isDefault;
-
- @Parameter(name=ApiConstants.SPECIFY_VLAN, type=CommandType.BOOLEAN, description="the tags for the network offering.")
- private Boolean specifyVlan;
-
- @Parameter(name=ApiConstants.AVAILABILITY, type=CommandType.STRING, description="the availability of network offering. Default value is Required")
- private String availability;
-
- @IdentityMapper(entityTableName="data_center")
- @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="list netowrk offerings available for network creation in specific zone")
- private Long zoneId;
-
- @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="list network offerings by state")
- private String state;
-
- @IdentityMapper(entityTableName="networks")
- @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.LONG, description="the ID of the network. Pass this in if you want to see the available network offering that a network can be changed to.")
- private Long networkId;
-
- @Parameter(name=ApiConstants.GUEST_IP_TYPE, type=CommandType.STRING, description="list network offerings by guest type: Shared or Isolated")
- private String guestIpType;
-
- @Parameter(name=ApiConstants.SUPPORTED_SERVICES, type=CommandType.LIST, collectionType=CommandType.STRING, description="list network offerings supporting certain services")
- private List<String> supportedServices;
-
- @Parameter(name=ApiConstants.SOURCE_NAT_SUPPORTED, type=CommandType.BOOLEAN, description="true if need to list only netwok offerings where source nat is supported, false otherwise")
- private Boolean sourceNatSupported;
-
- @Parameter(name=ApiConstants.SPECIFY_IP_RANGES, type=CommandType.BOOLEAN, description="true if need to list only network offerings which support specifying ip ranges")
- private Boolean specifyIpRanges;
-
- @Parameter(name=ApiConstants.TAGS, type=CommandType.STRING, description="list network offerings by tags", length=4096)
- private String tags;
-
- @Parameter(name=ApiConstants.IS_TAGGED, type=CommandType.BOOLEAN, description="true if offering has tags specified")
- private Boolean isTagged;
-
- @Parameter(name=ApiConstants.FOR_VPC, type=CommandType.BOOLEAN, description="the network offering can be used" +
- " only for network creation inside the VPC")
- private Boolean forVpc;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public String getNetworkOfferingName() {
- return networkOfferingName;
- }
-
- public String getDisplayText() {
- return displayText;
- }
-
- public String getTrafficType() {
- return trafficType;
- }
-
- public Long getId() {
- return id;
- }
-
- public Boolean getIsDefault() {
- return isDefault;
- }
-
- public Boolean getSpecifyVlan() {
- return specifyVlan;
- }
-
- public String getAvailability() {
- return availability;
- }
-
- public Long getZoneId() {
- return zoneId;
- }
-
- public String getState() {
- return state;
- }
-
- public Long getNetworkId() {
- return networkId;
- }
-
- public String getGuestIpType() {
- return guestIpType;
- }
-
- public List<String> getSupportedServices() {
- return supportedServices;
- }
-
- public Boolean getSourceNatSupported() {
- return sourceNatSupported;
- }
-
- public Boolean getSpecifyIpRanges() {
- return specifyIpRanges;
- }
-
- public String getTags() {
- return tags;
- }
-
- public Boolean isTagged() {
- return isTagged;
- }
-
- public Boolean getForVpc() {
- return forVpc;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
- @Override
- public String getCommandName() {
- return _name;
- }
-
- @Override
- public void execute(){
- List<? extends NetworkOffering> offerings = _configService.searchForNetworkOfferings(this);
- ListResponse<NetworkOfferingResponse> response = new ListResponse<NetworkOfferingResponse>();
- List<NetworkOfferingResponse> offeringResponses = new ArrayList<NetworkOfferingResponse>();
- for (NetworkOffering offering : offerings) {
- NetworkOfferingResponse offeringResponse = _responseGenerator.createNetworkOfferingResponse(offering);
- 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/ListNetworkServiceProvidersCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListNetworkServiceProvidersCmd.java b/api/src/com/cloud/api/commands/ListNetworkServiceProvidersCmd.java
deleted file mode 100644
index 97bfd77..0000000
--- a/api/src/com/cloud/api/commands/ListNetworkServiceProvidersCmd.java
+++ /dev/null
@@ -1,105 +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.network.PhysicalNetworkServiceProvider;
-import com.cloud.user.Account;
-import com.cloud.utils.Pair;
-
-
-@Implementation(description="Lists network serviceproviders for a given physical network.", responseObject=ProviderResponse.class, since="3.0.0")
-public class ListNetworkServiceProvidersCmd extends BaseListCmd {
- public static final Logger s_logger = Logger.getLogger(ListNetworkServiceProvidersCmd.class.getName());
- private static final String _name = "listnetworkserviceprovidersresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="physical_network")
- @Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.LONG, description="the Physical Network ID")
- private Long physicalNetworkId;
-
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="list providers by name")
- private String name;
-
- @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="list providers by state")
- private String state;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public void setPhysicalNetworkId(Long physicalNetworkId) {
- this.physicalNetworkId = physicalNetworkId;
- }
-
- public Long getPhysicalNetworkId() {
- return physicalNetworkId;
- }
-
- public String getName() {
- return name;
- }
-
- public String getState() {
- return state;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
- @Override
- public String getCommandName() {
- return _name;
- }
-
- @Override
- public long getEntityOwnerId() {
- return Account.ACCOUNT_ID_SYSTEM;
- }
-
- @Override
- public void execute(){
- Pair<List<? extends PhysicalNetworkServiceProvider>, Integer> serviceProviders = _networkService.listNetworkServiceProviders(getPhysicalNetworkId(),
- getName(), getState(), this.getStartIndex(), this.getPageSizeVal());
- ListResponse<ProviderResponse> response = new ListResponse<ProviderResponse>();
- List<ProviderResponse> serviceProvidersResponses = new ArrayList<ProviderResponse>();
- for (PhysicalNetworkServiceProvider serviceProvider : serviceProviders.first()) {
- ProviderResponse serviceProviderResponse = _responseGenerator.createNetworkServiceProviderResponse(serviceProvider);
- serviceProvidersResponses.add(serviceProviderResponse);
- }
-
- response.setResponses(serviceProvidersResponses, serviceProviders.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/ListNetworksCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListNetworksCmd.java b/api/src/com/cloud/api/commands/ListNetworksCmd.java
deleted file mode 100644
index 61aff01..0000000
--- a/api/src/com/cloud/api/commands/ListNetworksCmd.java
+++ /dev/null
@@ -1,164 +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.NetworkResponse;
-import com.cloud.network.Network;
-
-
-@Implementation(description="Lists all available networks.", responseObject=NetworkResponse.class)
-public class ListNetworksCmd extends BaseListTaggedResourcesCmd {
- public static final Logger s_logger = Logger.getLogger(ListNetworksCmd.class.getName());
- private static final String _name = "listnetworksresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
- @IdentityMapper(entityTableName="networks")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list networks by id")
- private Long id;
-
- @IdentityMapper(entityTableName="data_center")
- @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the Zone ID of the network")
- private Long zoneId;
-
- @Parameter(name=ApiConstants.TYPE, type=CommandType.STRING, description="the type of the network. Supported values are: Isolated and Shared")
- private String guestIpType;
-
- @Parameter(name=ApiConstants.IS_SYSTEM, type=CommandType.BOOLEAN, description="true if network is system, false otherwise")
- private Boolean isSystem;
-
- @Parameter(name=ApiConstants.ACL_TYPE, type=CommandType.STRING, description="list networks by ACL (access control list) type. Supported values are Account and Domain")
- private String aclType;
-
- @Parameter(name=ApiConstants.TRAFFIC_TYPE, type=CommandType.STRING, description="type of the traffic")
- private String trafficType;
-
- @IdentityMapper(entityTableName="physical_network")
- @Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.LONG, description="list networks by physical network id")
- private Long physicalNetworkId;
-
- @Parameter(name=ApiConstants.SUPPORTED_SERVICES, type=CommandType.LIST, collectionType=CommandType.STRING, description="list networks supporting certain services")
- private List<String> supportedServices;
-
- @Parameter(name=ApiConstants.RESTART_REQUIRED, type=CommandType.BOOLEAN, description="list networks by restartRequired")
-
- private Boolean restartRequired;
-
- @Parameter(name=ApiConstants.SPECIFY_IP_RANGES, type=CommandType.BOOLEAN, description="true if need to list only networks which support specifying ip ranges")
- private Boolean specifyIpRanges;
-
- @IdentityMapper(entityTableName="vpc")
- @Parameter(name=ApiConstants.VPC_ID, type=CommandType.LONG, description="List networks by VPC")
- private Long vpcId;
-
- @Parameter(name=ApiConstants.CAN_USE_FOR_DEPLOY, type=CommandType.BOOLEAN, description="list networks available for vm deployment")
- private Boolean canUseForDeploy;
-
- @Parameter(name=ApiConstants.FOR_VPC, type=CommandType.BOOLEAN, description="the network belongs to vpc")
- private Boolean forVpc;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Long getId() {
- return id;
- }
-
- public Long getZoneId() {
- return zoneId;
- }
-
- public String getGuestIpType() {
- return guestIpType;
- }
-
- public Boolean getIsSystem() {
- return isSystem;
- }
-
- public String getAclType() {
- return aclType;
- }
-
- public String getTrafficType() {
- return trafficType;
- }
-
- public Long getPhysicalNetworkId() {
- return physicalNetworkId;
- }
-
- public List<String> getSupportedServices() {
- return supportedServices;
- }
-
- public Boolean getRestartRequired() {
- return restartRequired;
- }
-
- public Boolean getSpecifyIpRanges() {
- return specifyIpRanges;
- }
-
- public Long getVpcId() {
- return vpcId;
- }
-
- public Boolean canUseForDeploy() {
- return canUseForDeploy;
- }
-
- public Boolean getForVpc() {
- return forVpc;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
- @Override
- public String getCommandName() {
- return _name;
- }
-
- @Override
- public void execute(){
- List<? extends Network> networks = _networkService.searchForNetworks(this);
- ListResponse<NetworkResponse> response = new ListResponse<NetworkResponse>();
- List<NetworkResponse> networkResponses = new ArrayList<NetworkResponse>();
- for (Network network : networks) {
- NetworkResponse networkResponse = _responseGenerator.createNetworkResponse(network);
- networkResponses.add(networkResponse);
- }
-
- response.setResponses(networkResponses);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/ListPhysicalNetworksCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListPhysicalNetworksCmd.java b/api/src/com/cloud/api/commands/ListPhysicalNetworksCmd.java
deleted file mode 100644
index ed2968f..0000000
--- a/api/src/com/cloud/api/commands/ListPhysicalNetworksCmd.java
+++ /dev/null
@@ -1,106 +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.BaseCmd;
-import com.cloud.api.BaseListCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.ServerApiException;
-import com.cloud.api.response.ListResponse;
-import com.cloud.api.response.PhysicalNetworkResponse;
-import com.cloud.network.PhysicalNetwork;
-import com.cloud.user.Account;
-import com.cloud.utils.Pair;
-
-@Implementation(description="Lists physical networks", responseObject=PhysicalNetworkResponse.class, since="3.0.0")
-public class ListPhysicalNetworksCmd extends BaseListCmd {
- public static final Logger s_logger = Logger.getLogger(ListPhysicalNetworksCmd.class.getName());
-
- private static final String s_name = "listphysicalnetworksresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="physical_network")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list physical network by id")
- private Long id;
-
- @IdentityMapper(entityTableName="data_center")
- @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the Zone ID for the physical network")
- private Long zoneId;
-
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="search by name")
- private String networkName;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Long getId() {
- return id;
- }
-
- public Long getZoneId() {
- return zoneId;
- }
-
- public String getNetworkName() {
- return networkName;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public long getEntityOwnerId() {
- return Account.ACCOUNT_ID_SYSTEM;
- }
-
- @Override
- public void execute(){
- Pair<List<? extends PhysicalNetwork>, Integer> result = _networkService.searchPhysicalNetworks(getId(),getZoneId(),
- this.getKeyword(), this.getStartIndex(), this.getPageSizeVal(), getNetworkName());
- if (result != null) {
- ListResponse<PhysicalNetworkResponse> response = new ListResponse<PhysicalNetworkResponse>();
- List<PhysicalNetworkResponse> networkResponses = new ArrayList<PhysicalNetworkResponse>();
- for (PhysicalNetwork network : result.first()) {
- PhysicalNetworkResponse networkResponse = _responseGenerator.createPhysicalNetworkResponse(network);
- networkResponses.add(networkResponse);
- }
- response.setResponses(networkResponses, result.second());
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to search for physical networks");
- }
- }
-}