You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ni...@apache.org on 2013/05/13 14:26:12 UTC
[42/57] [abbrv] [partial] merge master
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/admin/router/CreateVirtualRouterElementCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/CreateVirtualRouterElementCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/CreateVirtualRouterElementCmd.java
index 39fac13..b3fca5a 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/router/CreateVirtualRouterElementCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/router/CreateVirtualRouterElementCmd.java
@@ -31,6 +31,7 @@ import org.apache.cloudstack.api.response.VirtualRouterProviderResponse;
import org.apache.log4j.Logger;
import com.cloud.event.EventTypes;
+import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.network.VirtualRouterProvider;
import com.cloud.network.VirtualRouterProvider.VirtualRouterProviderType;
@@ -52,6 +53,9 @@ public class CreateVirtualRouterElementCmd extends BaseAsyncCreateCmd {
@Parameter(name=ApiConstants.NETWORK_SERVICE_PROVIDER_ID, type=CommandType.UUID, entityType = ProviderResponse.class, required=true, description="the network service provider ID of the virtual router element")
private Long nspId;
+
+ @Parameter(name=ApiConstants.PROVIDER_TYPE, type=CommandType.UUID, entityType = ProviderResponse.class, description="The provider type. Supported types are VirtualRouter (default) and VPCVirtualRouter")
+ private String providerType;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
@@ -61,16 +65,27 @@ public class CreateVirtualRouterElementCmd extends BaseAsyncCreateCmd {
this.nspId = nspId;
}
-
-
public Long getNspId() {
return nspId;
}
+
+ public VirtualRouterProviderType getProviderType() {
+ if (providerType != null) {
+ if (providerType.equalsIgnoreCase(VirtualRouterProviderType.VirtualRouter.toString())) {
+ return VirtualRouterProviderType.VirtualRouter;
+ } else if (providerType.equalsIgnoreCase(VirtualRouterProviderType.VPCVirtualRouter.toString())) {
+ return VirtualRouterProviderType.VPCVirtualRouter;
+ } else throw new InvalidParameterValueException("Invalid providerType specified");
+ }
+ return VirtualRouterProviderType.VirtualRouter;
+ }
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
+
+
@Override
public String getCommandName() {
return s_name;
@@ -96,7 +111,7 @@ public class CreateVirtualRouterElementCmd extends BaseAsyncCreateCmd {
@Override
public void create() throws ResourceAllocationException {
- VirtualRouterProvider result = _service.get(0).addElement(getNspId(), VirtualRouterProviderType.VirtualRouter);
+ VirtualRouterProvider result = _service.get(0).addElement(getNspId(), getProviderType());
if (result != null) {
setEntityId(result.getId());
setEntityUuid(result.getUuid());
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java
index d2b26c0..78c3554 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java
@@ -31,6 +31,7 @@ import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.log4j.Logger;
import com.cloud.async.AsyncJob;
+import com.cloud.network.router.VirtualRouter.Role;
@APICommand(name = "listRouters", description="List routers.", responseObject=DomainRouterResponse.class)
public class ListRoutersCmd extends BaseListProjectAndAccountResourcesCmd {
@@ -64,6 +65,9 @@ public class ListRoutersCmd extends BaseListProjectAndAccountResourcesCmd {
description="the Zone ID of the router")
private Long zoneId;
+ @Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to")
+ private String zoneType;
+
@Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.UUID, entityType=NetworkResponse.class,
description="list by network id")
private Long networkId;
@@ -74,7 +78,7 @@ public class ListRoutersCmd extends BaseListProjectAndAccountResourcesCmd {
@Parameter(name=ApiConstants.FOR_VPC, type=CommandType.BOOLEAN, description="if true is passed for this parameter, list only VPC routers")
private Boolean forVpc;
-
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -103,6 +107,10 @@ public class ListRoutersCmd extends BaseListProjectAndAccountResourcesCmd {
return zoneId;
}
+ public String getZoneType() {
+ return zoneType;
+ }
+
public Long getNetworkId() {
return networkId;
}
@@ -114,6 +122,10 @@ public class ListRoutersCmd extends BaseListProjectAndAccountResourcesCmd {
public Boolean getForVpc() {
return forVpc;
}
+
+ public String getRole() {
+ return Role.VIRTUAL_ROUTER.toString();
+ }
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/admin/router/StartRouterCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/StartRouterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/StartRouterCmd.java
index 1d3930b..ad0461e 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/router/StartRouterCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/router/StartRouterCmd.java
@@ -29,8 +29,10 @@ import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.router.VirtualRouter;
+import com.cloud.network.router.VirtualRouter.Role;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
@@ -100,7 +102,13 @@ public class StartRouterCmd extends BaseAsyncCmd {
@Override
public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException{
UserContext.current().setEventDetails("Router Id: "+getId());
- VirtualRouter result = _routerService.startRouter(id);
+ VirtualRouter result = null;
+ VirtualRouter router = _routerService.findRouter(getId());
+ if (router == null || router.getRole() != Role.VIRTUAL_ROUTER) {
+ throw new InvalidParameterValueException("Can't find router by id");
+ } else {
+ result = _routerService.startRouter(getId());
+ }
if (result != null){
DomainRouterResponse routerResponse = _responseGenerator.createDomainRouterResponse(result);
routerResponse.setResponseName(getCommandName());
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/admin/router/StopRouterCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/StopRouterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/StopRouterCmd.java
index 60dd938..94473cf 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/router/StopRouterCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/router/StopRouterCmd.java
@@ -28,8 +28,10 @@ import org.apache.log4j.Logger;
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.router.VirtualRouter;
+import com.cloud.network.router.VirtualRouter.Role;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
@@ -103,7 +105,14 @@ public class StopRouterCmd extends BaseAsyncCmd {
@Override
public void execute() throws ConcurrentOperationException, ResourceUnavailableException {
UserContext.current().setEventDetails("Router Id: "+getId());
- VirtualRouter result = _routerService.stopRouter(getId(), isForced());
+ VirtualRouter result = null;
+ VirtualRouter router = _routerService.findRouter(getId());
+ if (router == null || router.getRole() != Role.VIRTUAL_ROUTER) {
+ throw new InvalidParameterValueException("Can't find router by id");
+ } else {
+ result = _routerService.stopRouter(getId(), isForced());
+ }
+
if (result != null) {
DomainRouterResponse response = _responseGenerator.createDomainRouterResponse(result);
response.setResponseName(getCommandName());
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java
index f230a20..b5a0f3f 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java
@@ -74,6 +74,9 @@ public class ListSystemVMsCmd extends BaseListCmd {
description="the storage ID where vm's volumes belong to", since="3.0.1")
private Long storageId;
+ @Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to")
+ private String zoneType;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -110,6 +113,10 @@ public class ListSystemVMsCmd extends BaseListCmd {
return storageId;
}
+ public String getZoneType() {
+ return zoneType;
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayCmd.java
index 9fd736f..2055695 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayCmd.java
@@ -69,6 +69,11 @@ public class CreatePrivateGatewayCmd extends BaseAsyncCreateCmd {
required=true, description="the VPC network belongs to")
private Long vpcId;
+ @Parameter(name=ApiConstants.SOURCE_NAT_SUPPORTED, type=CommandType.BOOLEAN, required=false,
+ description="source NAT supported value. Default value false. If 'true' source NAT is enabled on the private gateway" +
+ " 'false': sourcenat is not supported")
+ private Boolean isSourceNat;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -97,6 +102,13 @@ public class CreatePrivateGatewayCmd extends BaseAsyncCreateCmd {
return vpcId;
}
+ public Boolean getIsSourceNat () {
+ if (isSourceNat == null) {
+ return false;
+ }
+ return true;
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -111,7 +123,7 @@ public class CreatePrivateGatewayCmd extends BaseAsyncCreateCmd {
PrivateGateway result = null;
try {
result = _vpcService.createVpcPrivateGateway(getVpcId(), getPhysicalNetworkId(),
- getVlan(), getStartIp(), getGateway(), getNetmask(), getEntityOwnerId());
+ getVlan(), getStartIp(), getGateway(), getNetmask(), getEntityOwnerId(), getIsSourceNat());
} catch (InsufficientCapacityException ex){
s_logger.info(ex);
s_logger.trace(ex);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java b/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java
index 3219601..f872c12 100644
--- a/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java
@@ -78,6 +78,9 @@ public class ListIsosCmd extends BaseListTaggedResourcesCmd {
description="the ID of the zone")
private Long zoneId;
+ @Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to")
+ private String zoneType;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -115,6 +118,10 @@ public class ListIsosCmd extends BaseListTaggedResourcesCmd {
return zoneId;
}
+ public String getZoneType() {
+ return zoneType;
+ }
+
public boolean listInReadyState() {
Account account = UserContext.current().getCaller();
// It is account specific if account is admin type and domainId and accountName are not null
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateApplicationLoadBalancerCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateApplicationLoadBalancerCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateApplicationLoadBalancerCmd.java
new file mode 100644
index 0000000..17ae959
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateApplicationLoadBalancerCmd.java
@@ -0,0 +1,218 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.user.loadbalancer;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCreateCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.ApplicationLoadBalancerResponse;
+import org.apache.cloudstack.api.response.NetworkResponse;
+import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRule;
+import org.apache.log4j.Logger;
+
+import com.cloud.async.AsyncJob;
+import com.cloud.event.EventTypes;
+import com.cloud.exception.InsufficientAddressCapacityException;
+import com.cloud.exception.InsufficientVirtualNetworkCapcityException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.NetworkRuleConflictException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.Network;
+import com.cloud.network.rules.LoadBalancerContainer.Scheme;
+import com.cloud.user.UserContext;
+import com.cloud.utils.net.NetUtils;
+
+@APICommand(name = "createLoadBalancer", description="Creates a Load Balancer", responseObject=ApplicationLoadBalancerResponse.class, since="4.2.0")
+public class CreateApplicationLoadBalancerCmd extends BaseAsyncCreateCmd {
+ public static final Logger s_logger = Logger.getLogger(CreateApplicationLoadBalancerCmd.class.getName());
+
+ private static final String s_name = "createloadbalancerresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+ @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="name of the Load Balancer")
+ private String loadBalancerName;
+
+ @Parameter(name=ApiConstants.DESCRIPTION, type=CommandType.STRING, description="the description of the Load Balancer", length=4096)
+ private String description;
+
+ @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.UUID, required=true, entityType = NetworkResponse.class,
+ description="The guest network the Load Balancer will be created for")
+ private Long networkId;
+
+ @Parameter(name=ApiConstants.SOURCE_PORT, type=CommandType.INTEGER, required=true, description="the source port the network traffic will be load balanced from")
+ private Integer sourcePort;
+
+ @Parameter(name=ApiConstants.ALGORITHM, type=CommandType.STRING, required=true, description="load balancer algorithm (source, roundrobin, leastconn)")
+ private String algorithm;
+
+ @Parameter(name=ApiConstants.INSTANCE_PORT, type=CommandType.INTEGER, required=true, description="the TCP port of the virtual machine where the network traffic will be load balanced to")
+ private Integer instancePort;
+
+ @Parameter(name=ApiConstants.SOURCE_IP, type=CommandType.STRING, description="the source ip address the network traffic will be load balanced from")
+ private String sourceIp;
+
+ @Parameter(name=ApiConstants.SOURCE_IP_NETWORK_ID, type=CommandType.UUID, entityType = NetworkResponse.class, required=true,
+ description="the network id of the source ip address")
+ private Long sourceIpNetworkId;
+
+ @Parameter(name=ApiConstants.SCHEME, type=CommandType.STRING, required=true, description="the load balancer scheme. Supported value in this release is Internal")
+ private String scheme;
+
+
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public String getAlgorithm() {
+ return algorithm;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public String getLoadBalancerName() {
+ return loadBalancerName;
+ }
+
+ public Integer getPrivatePort() {
+ return instancePort;
+ }
+
+ public long getNetworkId() {
+ return networkId;
+ }
+
+ public String getName() {
+ return loadBalancerName;
+ }
+
+ public Integer getSourcePort() {
+ return sourcePort.intValue();
+ }
+
+ public String getProtocol() {
+ return NetUtils.TCP_PROTO;
+ }
+
+ public long getAccountId() {
+ //get account info from the network object
+ Network ntwk = _networkService.getNetwork(networkId);
+ if (ntwk == null) {
+ throw new InvalidParameterValueException("Invalid network id specified");
+ }
+
+ return ntwk.getAccountId();
+
+ }
+
+ public int getInstancePort() {
+ return instancePort.intValue();
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_LOAD_BALANCER_CREATE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "creating load balancer: " + getName() + " account: " + getAccountId();
+
+ }
+
+ @Override
+ public AsyncJob.Type getInstanceType() {
+ return AsyncJob.Type.LoadBalancerRule;
+ }
+
+ public String getSourceIp() {
+ return sourceIp;
+ }
+
+ public long getSourceIpNetworkId() {
+ return sourceIpNetworkId;
+ }
+
+ public Scheme getScheme() {
+ if (scheme.equalsIgnoreCase(Scheme.Internal.toString())) {
+ return Scheme.Internal;
+ } else {
+ throw new InvalidParameterValueException("Invalid value for scheme. Supported value is Internal");
+ }
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return getAccountId();
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public void execute() throws ResourceAllocationException, ResourceUnavailableException {
+ ApplicationLoadBalancerRule rule = null;
+ try {
+ UserContext.current().setEventDetails("Load Balancer Id: " + getEntityId());
+ // State might be different after the rule is applied, so get new object here
+ rule = _entityMgr.findById(ApplicationLoadBalancerRule.class, getEntityId());
+ ApplicationLoadBalancerResponse lbResponse = _responseGenerator.createLoadBalancerContainerReponse(rule, _lbService.getLbInstances(getEntityId()));
+ setResponseObject(lbResponse);
+ lbResponse.setResponseName(getCommandName());
+ } catch (Exception ex) {
+ s_logger.warn("Failed to create Load Balancer due to exception ", ex);
+ } finally {
+ if (rule == null) {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create Load Balancer");
+ }
+ }
+ }
+
+ @Override
+ public void create() {
+ try {
+
+ ApplicationLoadBalancerRule result = _appLbService.createApplicationLoadBalancer(getName(), getDescription(), getScheme(),
+ getSourceIpNetworkId(), getSourceIp(), getSourcePort(), getInstancePort(), getAlgorithm(), getNetworkId(), getEntityOwnerId());
+ this.setEntityId(result.getId());
+ this.setEntityUuid(result.getUuid());
+ }catch (NetworkRuleConflictException e) {
+ s_logger.warn("Exception: ", e);
+ throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, e.getMessage());
+ } catch (InsufficientAddressCapacityException e) {
+ s_logger.warn("Exception: ", e);
+ throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, e.getMessage());
+ } catch (InsufficientVirtualNetworkCapcityException e) {
+ s_logger.warn("Exception: ", e);
+ throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, e.getMessage());
+ }
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLoadBalancerRuleCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLoadBalancerRuleCmd.java
index 5f1d97b..f6cc1f1 100644
--- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLoadBalancerRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLoadBalancerRuleCmd.java
@@ -148,7 +148,7 @@ public class CreateLoadBalancerRuleCmd extends BaseAsyncCreateCmd /*implements
}
- public Long getNetworkId() {
+ public long getNetworkId() {
if (networkId != null) {
return networkId;
}
@@ -278,7 +278,9 @@ public class CreateLoadBalancerRuleCmd extends BaseAsyncCreateCmd /*implements
throw new InvalidParameterValueException("Parameter cidrList is deprecated; if you need to open firewall rule for the specific cidr, please refer to createFirewallRule command");
}
try {
- LoadBalancer result = _lbService.createLoadBalancerRule(this, getOpenFirewall());
+ LoadBalancer result = _lbService.createPublicLoadBalancerRule(getXid(), getName(), getDescription(),
+ getSourcePortStart(), getSourcePortEnd(), getDefaultPortStart(), getDefaultPortEnd(), getSourceIpAddressId(), getProtocol(), getAlgorithm(),
+ getNetworkId(), getEntityOwnerId(), getOpenFirewall());
this.setEntityId(result.getId());
this.setEntityUuid(result.getUuid());
} catch (NetworkRuleConflictException e) {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteApplicationLoadBalancerCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteApplicationLoadBalancerCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteApplicationLoadBalancerCmd.java
new file mode 100644
index 0000000..bc6cd09
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteApplicationLoadBalancerCmd.java
@@ -0,0 +1,116 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.user.loadbalancer;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.FirewallRuleResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRule;
+import org.apache.log4j.Logger;
+
+import com.cloud.async.AsyncJob;
+import com.cloud.event.EventTypes;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.user.UserContext;
+
+@APICommand(name = "deleteLoadBalancer", description="Deletes a load balancer", responseObject=SuccessResponse.class, since="4.2.0")
+public class DeleteApplicationLoadBalancerCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger.getLogger(DeleteApplicationLoadBalancerCmd.class.getName());
+ private static final String s_name = "deleteloadbalancerresponse";
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = FirewallRuleResponse.class,
+ required=true, description="the ID of the Load Balancer")
+ private Long id;
+
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getId() {
+ return id;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ ApplicationLoadBalancerRule lb = _entityMgr.findById(ApplicationLoadBalancerRule.class, getId());
+ if (lb != null) {
+ return lb.getAccountId();
+ } else {
+ throw new InvalidParameterValueException("Can't find load balancer by id specified");
+ }
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_LOAD_BALANCER_DELETE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "deleting load balancer: " + getId();
+ }
+
+ @Override
+ public void execute(){
+ UserContext.current().setEventDetails("Load balancer Id: " + getId());
+ boolean result = _appLbService.deleteApplicationLoadBalancer(getId());
+
+ if (result) {
+ SuccessResponse response = new SuccessResponse(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete load balancer");
+ }
+ }
+
+ @Override
+ public String getSyncObjType() {
+ return BaseAsyncCmd.networkSyncObject;
+ }
+
+ @Override
+ public Long getSyncObjId() {
+ ApplicationLoadBalancerRule lb = _appLbService.getApplicationLoadBalancer(id);
+ if(lb == null){
+ throw new InvalidParameterValueException("Unable to find load balancer by id ");
+ }
+ return lb.getNetworkId();
+ }
+
+ @Override
+ public AsyncJob.Type getInstanceType() {
+ return AsyncJob.Type.FirewallRule;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListApplicationLoadBalancersCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListApplicationLoadBalancersCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListApplicationLoadBalancersCmd.java
new file mode 100644
index 0000000..8e5df31
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListApplicationLoadBalancersCmd.java
@@ -0,0 +1,131 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.user.loadbalancer;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.ApplicationLoadBalancerResponse;
+import org.apache.cloudstack.api.response.FirewallRuleResponse;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.NetworkResponse;
+import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRule;
+import org.apache.log4j.Logger;
+
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.network.rules.LoadBalancerContainer.Scheme;
+import com.cloud.utils.Pair;
+
+@APICommand(name = "listLoadBalancers", description = "Lists Load Balancers", responseObject = ApplicationLoadBalancerResponse.class, since="4.2.0")
+public class ListApplicationLoadBalancersCmd extends BaseListTaggedResourcesCmd {
+ public static final Logger s_logger = Logger.getLogger(ListApplicationLoadBalancersCmd.class.getName());
+
+ private static final String s_name = "listloadbalancerssresponse";
+
+ // ///////////////////////////////////////////////////
+ // ////////////// API parameters /////////////////////
+ // ///////////////////////////////////////////////////
+
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = FirewallRuleResponse.class,
+ description = "the ID of the Load Balancer")
+ private Long id;
+
+ @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the Load Balancer")
+ private String loadBalancerName;
+
+ @Parameter(name = ApiConstants.SOURCE_IP, type = CommandType.STRING, description = "the source ip address of the Load Balancer")
+ private String sourceIp;
+
+ @Parameter(name=ApiConstants.SOURCE_IP_NETWORK_ID, type=CommandType.UUID, entityType = NetworkResponse.class,
+ description="the network id of the source ip address")
+ private Long sourceIpNetworkId;
+
+ @Parameter(name = ApiConstants.SCHEME, type = CommandType.STRING, description = "the scheme of the Load Balancer. Supported value is Internal in the current release")
+ private String scheme;
+
+ @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.UUID, entityType = NetworkResponse.class,
+ description="the network id of the Load Balancer")
+ private Long networkId;
+
+
+ // ///////////////////////////////////////////////////
+ // ///////////////// Accessors ///////////////////////
+ // ///////////////////////////////////////////////////
+
+ public Long getId() {
+ return id;
+ }
+
+ public String getLoadBalancerRuleName() {
+ return loadBalancerName;
+ }
+
+ public String getLoadBalancerName() {
+ return loadBalancerName;
+ }
+
+ public String getSourceIp() {
+ return sourceIp;
+ }
+
+ public Long getSourceIpNetworkId() {
+ return sourceIpNetworkId;
+ }
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ public Scheme getScheme() {
+ if (scheme != null) {
+ if (scheme.equalsIgnoreCase(Scheme.Internal.toString())) {
+ return Scheme.Internal;
+ } else {
+ throw new InvalidParameterValueException("Invalid value for scheme. Supported value is Internal");
+ }
+ }
+ return null;
+ }
+
+ public Long getNetworkId() {
+ return networkId;
+ }
+ // ///////////////////////////////////////////////////
+ // ///////////// API Implementation///////////////////
+ // ///////////////////////////////////////////////////
+
+ @Override
+ public void execute() {
+ Pair<List<? extends ApplicationLoadBalancerRule>, Integer> loadBalancers = _appLbService.listApplicationLoadBalancers(this);
+ ListResponse<ApplicationLoadBalancerResponse> response = new ListResponse<ApplicationLoadBalancerResponse>();
+ List<ApplicationLoadBalancerResponse> lbResponses = new ArrayList<ApplicationLoadBalancerResponse>();
+ for (ApplicationLoadBalancerRule loadBalancer : loadBalancers.first()) {
+ ApplicationLoadBalancerResponse lbResponse = _responseGenerator.createLoadBalancerContainerReponse(loadBalancer, _lbService.getLbInstances(loadBalancer.getId()));
+ lbResponse.setObjectName("loadbalancer");
+ lbResponses.add(lbResponse);
+ }
+ response.setResponses(lbResponses, loadBalancers.second());
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/user/nat/EnableStaticNatCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/nat/EnableStaticNatCmd.java b/api/src/org/apache/cloudstack/api/command/user/nat/EnableStaticNatCmd.java
index a0ec68e..902dbae 100644
--- a/api/src/org/apache/cloudstack/api/command/user/nat/EnableStaticNatCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/nat/EnableStaticNatCmd.java
@@ -120,7 +120,7 @@ public class EnableStaticNatCmd extends BaseCmd{
@Override
public void execute() throws ResourceUnavailableException{
try {
- boolean result = _rulesService.enableStaticNat(ipAddressId, virtualMachineId, getNetworkId(), false, getVmSecondaryIp());
+ boolean result = _rulesService.enableStaticNat(ipAddressId, virtualMachineId, getNetworkId(), getVmSecondaryIp());
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java
index afce092..d25e2c0 100644
--- a/api/src/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java
@@ -48,6 +48,9 @@ public class ListNetworksCmd extends BaseListTaggedResourcesCmd {
description="the Zone ID of the network")
private Long zoneId;
+ @Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to")
+ private String zoneType;
+
@Parameter(name=ApiConstants.TYPE, type=CommandType.STRING, description="the type of the network. Supported values are: Isolated and Shared")
private String guestIpType;
@@ -96,6 +99,10 @@ public class ListNetworksCmd extends BaseListTaggedResourcesCmd {
return zoneId;
}
+ public String getZoneType() {
+ return zoneType;
+ }
+
public String getGuestIpType() {
return guestIpType;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java b/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java
index 95d7659..0b33f56 100644
--- a/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java
@@ -163,6 +163,7 @@ public class CreateSnapshotCmd extends BaseAsyncCreateCmd {
@Override
public void execute() {
+ s_logger.info("VOLSS: createSnapshotCmd starts:" + System.currentTimeMillis());
UserContext.current().setEventDetails("Volume Id: "+getVolumeId());
Snapshot snapshot = _snapshotService.createSnapshot(getVolumeId(), getPolicyId(), getEntityId(), _accountService.getAccount(getEntityOwnerId()));
if (snapshot != null) {
@@ -172,6 +173,7 @@ public class CreateSnapshotCmd extends BaseAsyncCreateCmd {
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create snapshot due to an internal error creating snapshot for volume " + volumeId);
}
+ s_logger.info("VOLSS: backupSnapshotCmd finishes:" + System.currentTimeMillis());
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java b/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java
index 17f20ae..d7e6bc8 100644
--- a/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java
@@ -58,6 +58,9 @@ public class ListSnapshotsCmd extends BaseListTaggedResourcesCmd {
@Parameter(name=ApiConstants.VOLUME_ID, type=CommandType.UUID, entityType = VolumeResponse.class,
description="the ID of the disk volume")
private Long volumeId;
+
+ @Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to")
+ private String zoneType;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
@@ -83,6 +86,10 @@ public class ListSnapshotsCmd extends BaseListTaggedResourcesCmd {
return volumeId;
}
+ public String getZoneType() {
+ return zoneType;
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
index aeb76f5..f0fc241 100644
--- a/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
@@ -68,6 +68,10 @@ public class ListTemplatesCmd extends BaseListTaggedResourcesCmd {
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = ZoneResponse.class,
description="list templates by zoneId")
private Long zoneId;
+
+ @Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to")
+ private String zoneType;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -92,6 +96,10 @@ public class ListTemplatesCmd extends BaseListTaggedResourcesCmd {
return zoneId;
}
+ public String getZoneType() {
+ return zoneType;
+ }
+
public boolean listInReadyState() {
Account account = UserContext.current().getCaller();
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/user/vm/AddIpToVmNicCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/AddIpToVmNicCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/AddIpToVmNicCmd.java
index df6b399..ae5482b 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/AddIpToVmNicCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/AddIpToVmNicCmd.java
@@ -16,6 +16,7 @@
// under the License.
package org.apache.cloudstack.api.command.user.vm;
+import com.cloud.vm.NicSecondaryIp;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
@@ -146,6 +147,7 @@ public class AddIpToVmNicCmd extends BaseAsyncCmd {
UserContext.current().setEventDetails("Nic Id: " + getNicId() );
String ip;
+ NicSecondaryIp result;
String secondaryIp = null;
if ((ip = getIpaddress()) != null) {
if (!NetUtils.isValidIp(ip)) {
@@ -154,12 +156,13 @@ public class AddIpToVmNicCmd extends BaseAsyncCmd {
}
try {
- secondaryIp = _networkService.allocateSecondaryGuestIP(_accountService.getAccount(getEntityOwnerId()), getZoneId(), getNicId(), getNetworkId(), getIpaddress());
+ result = _networkService.allocateSecondaryGuestIP(_accountService.getAccount(getEntityOwnerId()), getZoneId(), getNicId(), getNetworkId(), getIpaddress());
} catch (InsufficientAddressCapacityException e) {
throw new InvalidParameterValueException("Allocating guest ip for nic failed");
}
- if (secondaryIp != null) {
+ if (result != null) {
+ secondaryIp = result.getIp4Address();
if (getNetworkType() == NetworkType.Basic) {
// add security group rules for the secondary ip addresses
boolean success = false;
@@ -171,7 +174,7 @@ public class AddIpToVmNicCmd extends BaseAsyncCmd {
s_logger.info("Associated ip address to NIC : " + secondaryIp);
NicSecondaryIpResponse response = new NicSecondaryIpResponse();
- response = _responseGenerator.createSecondaryIPToNicResponse(secondaryIp, getNicId(), getNetworkId());
+ response = _responseGenerator.createSecondaryIPToNicResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java
index 4fc65c3..4f2ac75 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java
@@ -22,11 +22,12 @@ import com.cloud.user.UserContext;
import com.cloud.uservm.UserVm;
import org.apache.cloudstack.api.*;
import org.apache.cloudstack.api.response.ServiceOfferingResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
import org.apache.log4j.Logger;
-@APICommand(name = "scaleVirtualMachine", description="Scales the virtual machine to a new service offering.", responseObject=UserVmResponse.class)
+@APICommand(name = "scaleVirtualMachine", description="Scales the virtual machine to a new service offering.", responseObject=SuccessResponse.class)
public class ScaleVMCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(ScaleVMCmd.class.getName());
private static final String s_name = "scalevirtualmachineresponse";
@@ -83,7 +84,7 @@ public class ScaleVMCmd extends BaseCmd {
@Override
public void execute(){
//UserContext.current().setEventDetails("Vm Id: "+getId());
- UserVm result = null;
+ boolean result;
try {
result = _userVmService.upgradeVirtualMachine(this);
} catch (ResourceUnavailableException ex) {
@@ -99,9 +100,8 @@ public class ScaleVMCmd extends BaseCmd {
s_logger.warn("Exception: ", ex);
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
}
- if (result != null){
- UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", result).get(0);
- response.setResponseName(getCommandName());
+ if (result){
+ SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to scale vm");
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/RevertToSnapshotCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/RevertToSnapshotCmd.java b/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/RevertToSnapshotCmd.java
deleted file mode 100644
index ea7bf60..0000000
--- a/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/RevertToSnapshotCmd.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 org.apache.cloudstack.api.command.user.vmsnapshot;
-
-import java.util.logging.Logger;
-
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.ApiErrorCode;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import org.apache.cloudstack.api.response.UserVmResponse;
-import org.apache.cloudstack.api.response.VMSnapshotResponse;
-
-import com.cloud.event.EventTypes;
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InsufficientCapacityException;
-import com.cloud.exception.ResourceAllocationException;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.user.Account;
-import com.cloud.user.UserContext;
-import com.cloud.uservm.UserVm;
-import com.cloud.vm.snapshot.VMSnapshot;
-
-@APICommand(name = "revertToSnapshot",description = "Revert VM from a vmsnapshot.", responseObject = UserVmResponse.class, since="4.2.0")
-public class RevertToSnapshotCmd extends BaseAsyncCmd {
- public static final Logger s_logger = Logger
- .getLogger(RevertToSnapshotCmd.class.getName());
- private static final String s_name = "reverttosnapshotresponse";
-
- @Parameter(name = ApiConstants.VM_SNAPSHOT_ID, type = CommandType.UUID, required = true,entityType=VMSnapshotResponse.class,description = "The ID of the vm snapshot")
- private Long vmSnapShotId;
-
- public Long getVmSnapShotId() {
- return vmSnapShotId;
- }
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public long getEntityOwnerId() {
- VMSnapshot vmSnapshot = _entityMgr.findById(VMSnapshot.class, getVmSnapShotId());
- if (vmSnapshot != null) {
- return vmSnapshot.getAccountId();
- }
- return Account.ACCOUNT_ID_SYSTEM;
- }
-
- @Override
- public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ResourceAllocationException, ConcurrentOperationException {
- UserContext.current().setEventDetails(
- "vmsnapshot id: " + getVmSnapShotId());
- UserVm result = _vmSnapshotService.revertToSnapshot(getVmSnapShotId());
- if (result != null) {
- UserVmResponse response = _responseGenerator.createUserVmResponse(
- "virtualmachine", result).get(0);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- } else {
- throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,"Failed to revert VM snapshot");
- }
- }
-
- @Override
- public String getEventDescription() {
- return "Revert from VM snapshot: " + getVmSnapShotId();
- }
-
- @Override
- public String getEventType() {
- return EventTypes.EVENT_VM_SNAPSHOT_REVERT;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/RevertToVMSnapshotCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/RevertToVMSnapshotCmd.java b/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/RevertToVMSnapshotCmd.java
new file mode 100644
index 0000000..f6d8b2c
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/RevertToVMSnapshotCmd.java
@@ -0,0 +1,92 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.user.vmsnapshot;
+
+import java.util.logging.Logger;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.api.response.VMSnapshotResponse;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+import com.cloud.uservm.UserVm;
+import com.cloud.vm.snapshot.VMSnapshot;
+
+@APICommand(name = "revertToVMSnapshot",description = "Revert VM from a vmsnapshot.", responseObject = UserVmResponse.class, since="4.2.0")
+public class RevertToVMSnapshotCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger
+ .getLogger(RevertToVMSnapshotCmd.class.getName());
+ private static final String s_name = "reverttovmsnapshotresponse";
+
+ @Parameter(name = ApiConstants.VM_SNAPSHOT_ID, type = CommandType.UUID, required = true,entityType=VMSnapshotResponse.class,description = "The ID of the vm snapshot")
+ private Long vmSnapShotId;
+
+ public Long getVmSnapShotId() {
+ return vmSnapShotId;
+ }
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ VMSnapshot vmSnapshot = _entityMgr.findById(VMSnapshot.class, getVmSnapShotId());
+ if (vmSnapshot != null) {
+ return vmSnapshot.getAccountId();
+ }
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ResourceAllocationException, ConcurrentOperationException {
+ UserContext.current().setEventDetails(
+ "vmsnapshot id: " + getVmSnapShotId());
+ UserVm result = _vmSnapshotService.revertToSnapshot(getVmSnapShotId());
+ if (result != null) {
+ UserVmResponse response = _responseGenerator.createUserVmResponse(
+ "virtualmachine", result).get(0);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,"Failed to revert VM snapshot");
+ }
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "Revert from VM snapshot: " + getVmSnapShotId();
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_VM_SNAPSHOT_REVERT;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/user/zone/ListZonesByCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/zone/ListZonesByCmd.java b/api/src/org/apache/cloudstack/api/command/user/zone/ListZonesByCmd.java
index bbfb598..ed31037 100644
--- a/api/src/org/apache/cloudstack/api/command/user/zone/ListZonesByCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/zone/ListZonesByCmd.java
@@ -23,6 +23,7 @@ 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.BaseCmd.CommandType;
import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.ServiceOfferingResponse;
@@ -56,6 +57,9 @@ public class ListZonesByCmd extends BaseListCmd {
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the zone")
private String name;
+ @Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to")
+ private String zoneType;
+
@Parameter(name=ApiConstants.SHOW_CAPACITIES, type=CommandType.BOOLEAN, description="flag to display the capacity of the zones")
private Boolean showCapacities;
@@ -79,6 +83,10 @@ public class ListZonesByCmd extends BaseListCmd {
return name;
}
+ public String getZoneType() {
+ return zoneType;
+ }
+
public Boolean getShowCapacities() {
return showCapacities;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/response/ApplicationLoadBalancerInstanceResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/ApplicationLoadBalancerInstanceResponse.java b/api/src/org/apache/cloudstack/api/response/ApplicationLoadBalancerInstanceResponse.java
new file mode 100644
index 0000000..2d6614d
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/response/ApplicationLoadBalancerInstanceResponse.java
@@ -0,0 +1,63 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.response;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseResponse;
+
+import com.cloud.serializer.Param;
+import com.google.gson.annotations.SerializedName;
+
+/**
+ *
+ * Load Balancer instance is the User Vm instance participating in the Load Balancer
+ *
+ */
+
+@SuppressWarnings("unused")
+public class ApplicationLoadBalancerInstanceResponse extends BaseResponse{
+
+ @SerializedName(ApiConstants.ID) @Param(description = "the instance ID")
+ private String id;
+
+ @SerializedName(ApiConstants.NAME) @Param(description = "the name of the instance")
+ private String name;
+
+ @SerializedName(ApiConstants.STATE) @Param(description="the state of the instance")
+ private String state;
+
+ @SerializedName(ApiConstants.IP_ADDRESS)
+ @Param(description="the ip address of the instance")
+ private String ipAddress;
+
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setState(String state) {
+ this.state = state;
+ }
+
+ public void setIpAddress(String ipAddress) {
+ this.ipAddress = ipAddress;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/response/ApplicationLoadBalancerResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/ApplicationLoadBalancerResponse.java b/api/src/org/apache/cloudstack/api/response/ApplicationLoadBalancerResponse.java
new file mode 100644
index 0000000..de9bce6
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/response/ApplicationLoadBalancerResponse.java
@@ -0,0 +1,142 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.cloudstack.api.response;
+
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseResponse;
+
+import com.cloud.serializer.Param;
+import com.google.gson.annotations.SerializedName;
+
+@SuppressWarnings("unused")
+public class ApplicationLoadBalancerResponse extends BaseResponse implements ControlledEntityResponse{
+ @SerializedName(ApiConstants.ID) @Param(description = "the Load Balancer ID")
+ private String id;
+
+ @SerializedName(ApiConstants.NAME) @Param(description = "the name of the Load Balancer")
+ private String name;
+
+ @SerializedName(ApiConstants.DESCRIPTION) @Param(description = "the description of the Load Balancer")
+ private String description;
+
+ @SerializedName(ApiConstants.ALGORITHM) @Param(description = "the load balancer algorithm (source, roundrobin, leastconn)")
+ private String algorithm;
+
+ @SerializedName(ApiConstants.NETWORK_ID) @Param(description="Load Balancer network id")
+ private String networkId;
+
+ @SerializedName(ApiConstants.SOURCE_IP) @Param(description="Load Balancer source ip")
+ private String sourceIp;
+
+ @SerializedName(ApiConstants.SOURCE_IP_NETWORK_ID) @Param(description="Load Balancer source ip network id")
+ private String sourceIpNetworkId;
+
+ @SerializedName(ApiConstants.ACCOUNT)
+ @Param(description = "the account of the Load Balancer")
+ private String accountName;
+
+ @SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id of the Load Balancer")
+ private String projectId;
+
+ @SerializedName(ApiConstants.PROJECT) @Param(description="the project name of the Load Balancer")
+ private String projectName;
+
+ @SerializedName(ApiConstants.DOMAIN_ID)
+ @Param(description = "the domain ID of the Load Balancer")
+ private String domainId;
+
+ @SerializedName(ApiConstants.DOMAIN)
+ @Param(description = "the domain of the Load Balancer")
+ private String domainName;
+
+ @SerializedName("loadbalancerrule") @Param(description="the list of rules associated with the Load Balancer", responseObject = ApplicationLoadBalancerRuleResponse.class)
+ private List<ApplicationLoadBalancerRuleResponse> lbRules;
+
+ @SerializedName("loadbalancerinstance") @Param(description="the list of instances associated with the Load Balancer", responseObject = ApplicationLoadBalancerInstanceResponse.class)
+ private List<ApplicationLoadBalancerInstanceResponse> lbInstances;
+
+ @SerializedName(ApiConstants.TAGS) @Param(description="the list of resource tags associated with the Load Balancer", responseObject = ResourceTagResponse.class)
+ private List<ResourceTagResponse> tags;
+
+ public void setAccountName(String accountName) {
+ this.accountName = accountName;
+ }
+
+ @Override
+ public void setDomainId(String domainId) {
+ this.domainId = domainId;
+ }
+
+ public void setDomainName(String domainName) {
+ this.domainName = domainName;
+ }
+
+ @Override
+ public void setProjectId(String projectId) {
+ this.projectId = projectId;
+ }
+
+ @Override
+ public void setProjectName(String projectName) {
+ this.projectName = projectName;
+ }
+
+ public void setTags(List<ResourceTagResponse> tags) {
+ this.tags = tags;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public void setAlgorithm(String algorithm) {
+ this.algorithm = algorithm;
+ }
+
+ public void setNetworkId(String networkId) {
+ this.networkId = networkId;
+ }
+
+ public void setSourceIp(String sourceIp) {
+ this.sourceIp = sourceIp;
+ }
+
+ public void setSourceIpNetworkId(String sourceIpNetworkId) {
+ this.sourceIpNetworkId = sourceIpNetworkId;
+ }
+
+ public void setLbRules(List<ApplicationLoadBalancerRuleResponse> lbRules) {
+ this.lbRules = lbRules;
+ }
+
+ public void setLbInstances(List<ApplicationLoadBalancerInstanceResponse> lbInstances) {
+ this.lbInstances = lbInstances;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/response/ApplicationLoadBalancerRuleResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/ApplicationLoadBalancerRuleResponse.java b/api/src/org/apache/cloudstack/api/response/ApplicationLoadBalancerRuleResponse.java
new file mode 100644
index 0000000..ffc64d5
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/response/ApplicationLoadBalancerRuleResponse.java
@@ -0,0 +1,51 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.cloudstack.api.response;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseResponse;
+
+import com.cloud.serializer.Param;
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Subobject of the load balancer container response
+ */
+@SuppressWarnings("unused")
+public class ApplicationLoadBalancerRuleResponse extends BaseResponse{
+ @SerializedName(ApiConstants.SOURCE_PORT) @Param(description = "source port of the load balancer rule")
+ private Integer sourcePort;
+
+ @SerializedName(ApiConstants.INSTANCE_PORT) @Param(description = "instance port of the load balancer rule")
+ private Integer instancePort;
+
+ @SerializedName(ApiConstants.STATE) @Param(description = "the state of the load balancer rule")
+ private String state;
+
+ public void setSourcePort(Integer sourcePort) {
+ this.sourcePort = sourcePort;
+ }
+
+ public void setInstancePort(Integer instancePort) {
+ this.instancePort = instancePort;
+ }
+
+ public void setState(String state) {
+ this.state = state;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/response/ConfigurationResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/ConfigurationResponse.java b/api/src/org/apache/cloudstack/api/response/ConfigurationResponse.java
index 176c47a..fa0d4b4 100644
--- a/api/src/org/apache/cloudstack/api/response/ConfigurationResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/ConfigurationResponse.java
@@ -35,6 +35,9 @@ public class ConfigurationResponse extends BaseResponse {
@SerializedName(ApiConstants.SCOPE) @Param(description="scope(zone/cluster/pool/account) of the parameter that needs to be updated")
private String scope;
+ @SerializedName(ApiConstants.ID) @Param(description="the value of the configuration")
+ private Long id;
+
@SerializedName(ApiConstants.DESCRIPTION) @Param(description="the description of the configuration")
private String description;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/response/DomainRouterResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/DomainRouterResponse.java b/api/src/org/apache/cloudstack/api/response/DomainRouterResponse.java
index 79c8596..852d988 100644
--- a/api/src/org/apache/cloudstack/api/response/DomainRouterResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/DomainRouterResponse.java
@@ -153,8 +153,11 @@ public class DomainRouterResponse extends BaseResponse implements ControlledView
@SerializedName("scriptsversion") @Param(description="the version of scripts")
private String scriptsVersion;
- @SerializedName(ApiConstants.VPC_ID) @Param(description="VPC the network belongs to")
+ @SerializedName(ApiConstants.VPC_ID) @Param(description="VPC the router belongs to")
private String vpcId;
+
+ @SerializedName(ApiConstants.ROLE) @Param(description="role of the domain router")
+ private String role;
@SerializedName("nic") @Param(description="the list of nics associated with the router",
responseObject = NicResponse.class, since="4.0")
@@ -164,15 +167,11 @@ public class DomainRouterResponse extends BaseResponse implements ControlledView
nics = new LinkedHashSet<NicResponse>();
}
-
-
@Override
public String getObjectId() {
return this.getId();
}
-
-
public String getId() {
return id;
}
@@ -372,4 +371,8 @@ public class DomainRouterResponse extends BaseResponse implements ControlledView
public void setIp6Dns2(String ip6Dns2) {
this.ip6Dns2 = ip6Dns2;
}
+
+ public void setRole(String role) {
+ this.role = role;
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/response/GuestVlanRangeResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/GuestVlanRangeResponse.java b/api/src/org/apache/cloudstack/api/response/GuestVlanRangeResponse.java
new file mode 100644
index 0000000..bf19688
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/response/GuestVlanRangeResponse.java
@@ -0,0 +1,94 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.response;
+
+import com.cloud.serializer.Param;
+import com.google.gson.annotations.SerializedName;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseResponse;
+import org.apache.cloudstack.api.EntityReference;
+
+import com.cloud.network.GuestVlan;
+
+@EntityReference(value=GuestVlan.class)
+@SuppressWarnings("unused")
+public class GuestVlanRangeResponse extends BaseResponse implements ControlledEntityResponse {
+ @SerializedName(ApiConstants.ID) @Param(description="the ID of the guest VLAN range")
+ private String id;
+
+ @SerializedName(ApiConstants.ACCOUNT) @Param(description="the account of the guest VLAN range")
+ private String accountName;
+
+ @SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain ID of the guest VLAN range")
+ private String domainId;
+
+ @SerializedName(ApiConstants.DOMAIN) @Param(description="the domain name of the guest VLAN range")
+ private String domainName;
+
+ @SerializedName(ApiConstants.GUEST_VLAN_RANGE) @Param(description="the guest VLAN range")
+ private String guestVlanRange;
+
+ @SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id of the guest vlan range")
+ private String projectId;
+
+ @SerializedName(ApiConstants.PROJECT) @Param(description="the project name of the guest vlan range")
+ private String projectName;
+
+ @SerializedName(ApiConstants.PHYSICAL_NETWORK_ID) @Param(description="the physical network of the guest vlan range")
+ private Long physicalNetworkId;
+
+ @SerializedName(ApiConstants.ZONE_ID) @Param(description="the zone of the guest vlan range")
+ private Long zoneId;
+
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public void setAccountName(String accountName) {
+ this.accountName = accountName;
+ }
+
+ public void setDomainId(String domainId) {
+ this.domainId = domainId;
+ }
+
+ public void setDomainName(String domainName) {
+ this.domainName = domainName;
+ }
+
+ public void setGuestVlanRange(String guestVlanRange) {
+ this.guestVlanRange = guestVlanRange;
+ }
+
+ public void setProjectId(String projectId) {
+ this.projectId = projectId;
+ }
+
+ public void setProjectName(String projectName) {
+ this.projectName = projectName;
+ }
+
+ public void setPhysicalNetworkId(Long physicalNetworkId) {
+ this.physicalNetworkId = physicalNetworkId;
+ }
+
+ public void setZoneId(Long zoneId) {
+ this.zoneId = zoneId;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/response/InternalLoadBalancerElementResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/InternalLoadBalancerElementResponse.java b/api/src/org/apache/cloudstack/api/response/InternalLoadBalancerElementResponse.java
new file mode 100644
index 0000000..b7e8634
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/response/InternalLoadBalancerElementResponse.java
@@ -0,0 +1,51 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.response;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseResponse;
+import org.apache.cloudstack.api.EntityReference;
+
+import com.cloud.network.VirtualRouterProvider;
+import com.cloud.serializer.Param;
+import com.google.gson.annotations.SerializedName;
+
+@EntityReference(value=VirtualRouterProvider.class)
+@SuppressWarnings("unused")
+public class InternalLoadBalancerElementResponse extends BaseResponse {
+ @SerializedName(ApiConstants.ID) @Param(description="the id of the internal load balancer element")
+ private String id;
+
+ @SerializedName(ApiConstants.NSP_ID) @Param(description="the physical network service provider id of the element")
+ private String nspId;
+
+ @SerializedName(ApiConstants.ENABLED) @Param(description="Enabled/Disabled the element")
+ private Boolean enabled;
+
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public void setNspId(String nspId) {
+ this.nspId = nspId;
+ }
+
+ public void setEnabled(Boolean enabled) {
+ this.enabled = enabled;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/response/IsolationMethodResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/IsolationMethodResponse.java b/api/src/org/apache/cloudstack/api/response/IsolationMethodResponse.java
new file mode 100644
index 0000000..3aaa7a4
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/response/IsolationMethodResponse.java
@@ -0,0 +1,33 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.response;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseResponse;
+
+import com.cloud.serializer.Param;
+import com.google.gson.annotations.SerializedName;
+
+@SuppressWarnings("unused")
+public class IsolationMethodResponse extends BaseResponse{
+ @SerializedName(ApiConstants.NAME) @Param(description="Network isolation method name")
+ private String name;
+
+ public void setIsolationMethodName(String isolationMethodName) {
+ this.name = isolationMethodName;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/response/NetworkOfferingResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/NetworkOfferingResponse.java b/api/src/org/apache/cloudstack/api/response/NetworkOfferingResponse.java
index b1dcd42..7a7e371 100644
--- a/api/src/org/apache/cloudstack/api/response/NetworkOfferingResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/NetworkOfferingResponse.java
@@ -18,6 +18,7 @@ package org.apache.cloudstack.api.response;
import java.util.Date;
import java.util.List;
+import java.util.Map;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseResponse;
@@ -83,6 +84,10 @@ public class NetworkOfferingResponse extends BaseResponse {
@SerializedName(ApiConstants.IS_PERSISTENT) @Param(description="true if network offering supports persistent networks, false otherwise")
private Boolean isPersistent;
+
+ @SerializedName(ApiConstants.DETAILS) @Param(description="additional key/value details tied with network offering", since="4.2.0")
+ private Map details;
+
public void setId(String id) {
this.id = id;
@@ -156,5 +161,9 @@ public class NetworkOfferingResponse extends BaseResponse {
public void setIsPersistent(Boolean isPersistent) {
this.isPersistent = isPersistent;
}
+
+ public void setDetails(Map details) {
+ this.details = details;
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/response/PrivateGatewayResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/PrivateGatewayResponse.java b/api/src/org/apache/cloudstack/api/response/PrivateGatewayResponse.java
index 4123477..ca76062 100644
--- a/api/src/org/apache/cloudstack/api/response/PrivateGatewayResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/PrivateGatewayResponse.java
@@ -76,6 +76,10 @@ public class PrivateGatewayResponse extends BaseResponse implements ControlledEn
private String state;
+ @SerializedName(ApiConstants.SOURCE_NAT_SUPPORTED) @Param(description = "Souce Nat enable status")
+ private Boolean sourceNat;
+
+
@Override
public String getObjectId() {
return this.id;
@@ -145,5 +149,11 @@ public class PrivateGatewayResponse extends BaseResponse implements ControlledEn
public void setState(String state) {
this.state = state;
}
+
+ public void setSourceNat(Boolean sourceNat) {
+ this.sourceNat = sourceNat;
+ }
+
+
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/response/VirtualRouterProviderResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/VirtualRouterProviderResponse.java b/api/src/org/apache/cloudstack/api/response/VirtualRouterProviderResponse.java
index 92d9a1d..de355bd 100644
--- a/api/src/org/apache/cloudstack/api/response/VirtualRouterProviderResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/VirtualRouterProviderResponse.java
@@ -25,6 +25,7 @@ import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
@EntityReference(value=VirtualRouterProvider.class)
+@SuppressWarnings("unused")
public class VirtualRouterProviderResponse extends BaseResponse implements ControlledEntityResponse {
@SerializedName(ApiConstants.ID) @Param(description="the id of the router")
private String id;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/network/element/InternalLoadBalancerElementService.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/network/element/InternalLoadBalancerElementService.java b/api/src/org/apache/cloudstack/network/element/InternalLoadBalancerElementService.java
new file mode 100644
index 0000000..33a0c64
--- /dev/null
+++ b/api/src/org/apache/cloudstack/network/element/InternalLoadBalancerElementService.java
@@ -0,0 +1,56 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.network.element;
+
+import java.util.List;
+
+
+import com.cloud.network.VirtualRouterProvider;
+import com.cloud.utils.component.PluggableService;
+
+public interface InternalLoadBalancerElementService extends PluggableService{
+ /**
+ * Configures existing Internal Load Balancer Element (enables or disables it)
+ * @param id
+ * @param enable
+ * @return
+ */
+ VirtualRouterProvider configureInternalLoadBalancerElement(long id, boolean enable);
+
+ /**
+ * Adds Internal Load Balancer element to the Network Service Provider
+ * @param ntwkSvcProviderId
+ * @return
+ */
+ VirtualRouterProvider addInternalLoadBalancerElement(long ntwkSvcProviderId);
+
+ /**
+ * Retrieves existing Internal Load Balancer element
+ * @param id
+ * @return
+ */
+ VirtualRouterProvider getInternalLoadBalancerElement(long id);
+
+ /**
+ * Searches for existing Internal Load Balancer elements based on parameters passed to the call
+ * @param id
+ * @param ntwkSvsProviderId
+ * @param enabled
+ * @return
+ */
+ List<? extends VirtualRouterProvider> searchForInternalLoadBalancerElements(Long id, Long ntwkSvsProviderId, Boolean enabled);
+}