mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
merge to master
This commit is contained in:
commit
a0c3d280b4
@ -36,6 +36,11 @@
|
||||
<artifactId>cloud-utils</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-daemon</groupId>
|
||||
<artifactId>commons-daemon</artifactId>
|
||||
<version>${cs.daemon.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<defaultGoal>install</defaultGoal>
|
||||
|
||||
@ -24,7 +24,6 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@ -38,6 +37,9 @@ import java.util.UUID;
|
||||
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.commons.daemon.Daemon;
|
||||
import org.apache.commons.daemon.DaemonContext;
|
||||
import org.apache.commons.daemon.DaemonInitException;
|
||||
import org.apache.commons.httpclient.HttpClient;
|
||||
import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
|
||||
import org.apache.commons.httpclient.methods.GetMethod;
|
||||
@ -47,7 +49,6 @@ import org.apache.log4j.xml.DOMConfigurator;
|
||||
import com.cloud.agent.Agent.ExitStatus;
|
||||
import com.cloud.agent.dao.StorageComponent;
|
||||
import com.cloud.agent.dao.impl.PropertiesStorage;
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.resource.ServerResource;
|
||||
import com.cloud.utils.LogUtils;
|
||||
import com.cloud.utils.NumbersUtil;
|
||||
@ -58,7 +59,7 @@ import com.cloud.utils.backoff.impl.ConstantTimeBackoff;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.utils.script.Script;
|
||||
|
||||
public class AgentShell implements IAgentShell {
|
||||
public class AgentShell implements IAgentShell, Daemon {
|
||||
private static final Logger s_logger = Logger.getLogger(AgentShell.class
|
||||
.getName());
|
||||
private static final MultiThreadedHttpConnectionManager s_httpClientManager = new MultiThreadedHttpConnectionManager();
|
||||
@ -79,7 +80,6 @@ public class AgentShell implements IAgentShell {
|
||||
private int _nextAgentId = 1;
|
||||
private volatile boolean _exit = false;
|
||||
private int _pingRetries;
|
||||
private Thread _consoleProxyMain = null;
|
||||
private final List<Agent> _agents = new ArrayList<Agent>();
|
||||
|
||||
public AgentShell() {
|
||||
@ -377,6 +377,16 @@ public class AgentShell implements IAgentShell {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(DaemonContext dc) throws DaemonInitException {
|
||||
s_logger.debug("Initializing AgentShell from JSVC");
|
||||
try {
|
||||
init(dc.getArguments());
|
||||
} catch (ConfigurationException ex) {
|
||||
throw new DaemonInitException("Initialization failed", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public void init(String[] args) throws ConfigurationException {
|
||||
|
||||
// PropertiesUtil is used both in management server and agent packages,
|
||||
@ -402,10 +412,12 @@ public class AgentShell implements IAgentShell {
|
||||
loadProperties();
|
||||
parseCommand(args);
|
||||
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
List<String> properties = Collections.list((Enumeration<String>)_properties.propertyNames());
|
||||
for (String property:properties){
|
||||
s_logger.debug("Found property: " + property);
|
||||
}
|
||||
}
|
||||
|
||||
s_logger.info("Defaulting to using properties file for storage");
|
||||
_storage = new PropertiesStorage();
|
||||
@ -434,71 +446,6 @@ public class AgentShell implements IAgentShell {
|
||||
launchAgentFromTypeInfo();
|
||||
}
|
||||
|
||||
private boolean needConsoleProxy() {
|
||||
for (Agent agent : _agents) {
|
||||
if (agent.getResource().getType().equals(Host.Type.ConsoleProxy)
|
||||
|| agent.getResource().getType().equals(Host.Type.Routing))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private int getConsoleProxyPort() {
|
||||
int port = NumbersUtil.parseInt(
|
||||
getProperty(null, "consoleproxy.httpListenPort"), 443);
|
||||
return port;
|
||||
}
|
||||
|
||||
private void openPortWithIptables(int port) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
private void launchConsoleProxy() throws ConfigurationException {
|
||||
if (!needConsoleProxy()) {
|
||||
if (s_logger.isInfoEnabled())
|
||||
s_logger.info("Storage only agent, no need to start console proxy on it");
|
||||
return;
|
||||
}
|
||||
|
||||
int port = getConsoleProxyPort();
|
||||
openPortWithIptables(port);
|
||||
|
||||
_consoleProxyMain = new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Class<?> consoleProxyClazz = Class.forName("com.cloud.consoleproxy.ConsoleProxy");
|
||||
|
||||
try {
|
||||
Method method = consoleProxyClazz.getMethod("start",
|
||||
Properties.class);
|
||||
method.invoke(null, _properties);
|
||||
} catch (SecurityException e) {
|
||||
s_logger.error("Unable to launch console proxy due to SecurityException");
|
||||
System.exit(ExitStatus.Error.value());
|
||||
} catch (NoSuchMethodException e) {
|
||||
s_logger.error("Unable to launch console proxy due to NoSuchMethodException");
|
||||
System.exit(ExitStatus.Error.value());
|
||||
} catch (IllegalArgumentException e) {
|
||||
s_logger.error("Unable to launch console proxy due to IllegalArgumentException");
|
||||
System.exit(ExitStatus.Error.value());
|
||||
} catch (IllegalAccessException e) {
|
||||
s_logger.error("Unable to launch console proxy due to IllegalAccessException");
|
||||
System.exit(ExitStatus.Error.value());
|
||||
} catch (InvocationTargetException e) {
|
||||
s_logger.error("Unable to launch console proxy due to InvocationTargetException");
|
||||
System.exit(ExitStatus.Error.value());
|
||||
}
|
||||
} catch (final ClassNotFoundException e) {
|
||||
s_logger.error("Unable to launch console proxy due to ClassNotFoundException");
|
||||
System.exit(ExitStatus.Error.value());
|
||||
}
|
||||
}
|
||||
}, "Console-Proxy-Main");
|
||||
_consoleProxyMain.setDaemon(true);
|
||||
_consoleProxyMain.start();
|
||||
}
|
||||
|
||||
private void launchAgentFromClassInfo(String resourceClassNames)
|
||||
throws ConfigurationException {
|
||||
String[] names = resourceClassNames.split("\\|");
|
||||
@ -591,14 +538,6 @@ public class AgentShell implements IAgentShell {
|
||||
|
||||
launchAgent();
|
||||
|
||||
//
|
||||
// For both KVM & Xen-Server hypervisor, we have switched to
|
||||
// VM-based console proxy solution, disable launching
|
||||
// of console proxy here
|
||||
//
|
||||
// launchConsoleProxy();
|
||||
//
|
||||
|
||||
try {
|
||||
while (!_exit)
|
||||
Thread.sleep(1000);
|
||||
@ -618,9 +557,6 @@ public class AgentShell implements IAgentShell {
|
||||
|
||||
public void stop() {
|
||||
_exit = true;
|
||||
if (_consoleProxyMain != null) {
|
||||
_consoleProxyMain.interrupt();
|
||||
}
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
@ -629,6 +565,7 @@ public class AgentShell implements IAgentShell {
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
s_logger.debug("Initializing AgentShell from main");
|
||||
AgentShell shell = new AgentShell();
|
||||
shell.init(args);
|
||||
shell.start();
|
||||
@ -636,4 +573,5 @@ public class AgentShell implements IAgentShell {
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
53
api/src/com/cloud/agent/api/to/DnsmasqTO.java
Normal file
53
api/src/com/cloud/agent/api/to/DnsmasqTO.java
Normal file
@ -0,0 +1,53 @@
|
||||
// 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.agent.api.to;
|
||||
|
||||
public class DnsmasqTO {
|
||||
String routerIp;
|
||||
String gateway;
|
||||
String netmask;
|
||||
|
||||
public DnsmasqTO(String routerIp, String gateway, String netmask) {
|
||||
this.routerIp = routerIp;
|
||||
this.gateway = gateway;
|
||||
this.netmask =netmask;
|
||||
}
|
||||
|
||||
public void setRouterIp(String routerIp){
|
||||
this.routerIp = routerIp;
|
||||
}
|
||||
|
||||
public void setGateway(String gateway) {
|
||||
this.gateway = gateway;
|
||||
}
|
||||
|
||||
public void setNetmask(String netmask) {
|
||||
this.netmask = netmask ;
|
||||
}
|
||||
|
||||
public String getRouterIp() {
|
||||
return routerIp;
|
||||
}
|
||||
|
||||
public String getGateway() {
|
||||
return gateway;
|
||||
}
|
||||
|
||||
public String getNetmask() {
|
||||
return netmask;
|
||||
}
|
||||
}
|
||||
@ -20,10 +20,10 @@ package com.cloud.agent.api.to;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.cloud.network.vpc.NetworkACLItem;
|
||||
import com.cloud.network.vpc.NetworkACLItem.TrafficType;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import com.cloud.network.rules.FirewallRule;
|
||||
import com.cloud.network.rules.FirewallRule.TrafficType;
|
||||
import com.cloud.utils.net.NetUtils;
|
||||
|
||||
|
||||
@ -37,15 +37,16 @@ public class NetworkACLTO implements InternalIdentity {
|
||||
private List<String> cidrList;
|
||||
private Integer icmpType;
|
||||
private Integer icmpCode;
|
||||
private FirewallRule.TrafficType trafficType;
|
||||
|
||||
private TrafficType trafficType;
|
||||
String action;
|
||||
int number;
|
||||
|
||||
protected NetworkACLTO() {
|
||||
}
|
||||
|
||||
|
||||
public NetworkACLTO(long id,String vlanTag, String protocol, Integer portStart, Integer portEnd, boolean revoked,
|
||||
boolean alreadyAdded, List<String> cidrList, Integer icmpType,Integer icmpCode,TrafficType trafficType) {
|
||||
boolean alreadyAdded, List<String> cidrList, Integer icmpType,Integer icmpCode,TrafficType trafficType, boolean allow, int number) {
|
||||
this.vlanTag = vlanTag;
|
||||
this.protocol = protocol;
|
||||
|
||||
@ -70,12 +71,20 @@ public class NetworkACLTO implements InternalIdentity {
|
||||
this.icmpType = icmpType;
|
||||
this.icmpCode = icmpCode;
|
||||
this.trafficType = trafficType;
|
||||
|
||||
if(!allow){
|
||||
this.action = "DROP";
|
||||
} else {
|
||||
this.action = "ACCEPT";
|
||||
}
|
||||
|
||||
public NetworkACLTO(FirewallRule rule, String vlanTag, FirewallRule.TrafficType trafficType ) {
|
||||
this.number = number;
|
||||
}
|
||||
|
||||
public NetworkACLTO(NetworkACLItem rule, String vlanTag, NetworkACLItem.TrafficType trafficType ) {
|
||||
this(rule.getId(), vlanTag, rule.getProtocol(), rule.getSourcePortStart(), rule.getSourcePortEnd(),
|
||||
rule.getState() == FirewallRule.State.Revoke, rule.getState() == FirewallRule.State.Active,
|
||||
rule.getSourceCidrList() ,rule.getIcmpType(), rule.getIcmpCode(),trafficType);
|
||||
rule.getState() == NetworkACLItem.State.Revoke, rule.getState() == NetworkACLItem.State.Active,
|
||||
rule.getSourceCidrList() ,rule.getIcmpType(), rule.getIcmpCode(),trafficType, rule.getAction() == NetworkACLItem.Action.Allow, rule.getNumber());
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
@ -121,7 +130,15 @@ public class NetworkACLTO implements InternalIdentity {
|
||||
return alreadyAdded;
|
||||
}
|
||||
|
||||
public FirewallRule.TrafficType getTrafficType() {
|
||||
public TrafficType getTrafficType() {
|
||||
return trafficType;
|
||||
}
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public int getNumber(){
|
||||
return number;
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,7 +50,9 @@ public interface AsyncJob extends Identity, InternalIdentity {
|
||||
AutoScaleVmProfile,
|
||||
AutoScaleVmGroup,
|
||||
GlobalLoadBalancerRule,
|
||||
LoadBalancerRule,
|
||||
AffinityGroup,
|
||||
InternalLbVm,
|
||||
DedicatedGuestVlanRange
|
||||
}
|
||||
|
||||
|
||||
@ -16,6 +16,9 @@
|
||||
// under the License.
|
||||
package com.cloud.event;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.cloud.configuration.Configuration;
|
||||
import com.cloud.dc.DataCenter;
|
||||
import com.cloud.dc.Pod;
|
||||
@ -23,8 +26,18 @@ import com.cloud.dc.StorageNetworkIpRange;
|
||||
import com.cloud.dc.Vlan;
|
||||
import com.cloud.domain.Domain;
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.network.*;
|
||||
import com.cloud.network.as.*;
|
||||
import com.cloud.network.GuestVlan;
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.network.PhysicalNetwork;
|
||||
import com.cloud.network.PhysicalNetworkServiceProvider;
|
||||
import com.cloud.network.PhysicalNetworkTrafficType;
|
||||
import com.cloud.network.PublicIpAddress;
|
||||
import com.cloud.network.RemoteAccessVpn;
|
||||
import com.cloud.network.as.AutoScaleCounter;
|
||||
import com.cloud.network.as.AutoScalePolicy;
|
||||
import com.cloud.network.as.AutoScaleVmGroup;
|
||||
import com.cloud.network.as.AutoScaleVmProfile;
|
||||
import com.cloud.network.as.Condition;
|
||||
import com.cloud.network.router.VirtualRouter;
|
||||
import com.cloud.network.rules.LoadBalancer;
|
||||
import com.cloud.network.rules.StaticNat;
|
||||
@ -43,9 +56,6 @@ import com.cloud.user.Account;
|
||||
import com.cloud.user.User;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class EventTypes {
|
||||
|
||||
//map of Event and corresponding entity for which Event is applicable
|
||||
@ -103,6 +113,10 @@ public class EventTypes {
|
||||
public static final String EVENT_NIC_CREATE = "NIC.CREATE";
|
||||
public static final String EVENT_NIC_DELETE = "NIC.DELETE";
|
||||
public static final String EVENT_NIC_UPDATE = "NIC.UPDATE";
|
||||
public static final String EVENT_NIC_DETAIL_ADD = "NIC.DETAIL.ADD";
|
||||
public static final String EVENT_NIC_DETAIL_UPDATE = "NIC.DETAIL.UPDATE";
|
||||
public static final String EVENT_NIC_DETAIL_REMOVE = "NIC.DETAIL.REMOVE";
|
||||
|
||||
|
||||
// Load Balancers
|
||||
public static final String EVENT_ASSIGN_TO_LOAD_BALANCER_RULE = "LB.ASSIGN.TO.RULE";
|
||||
@ -166,6 +180,9 @@ public class EventTypes {
|
||||
public static final String EVENT_VOLUME_UPLOAD = "VOLUME.UPLOAD";
|
||||
public static final String EVENT_VOLUME_MIGRATE = "VOLUME.MIGRATE";
|
||||
public static final String EVENT_VOLUME_RESIZE = "VOLUME.RESIZE";
|
||||
public static final String EVENT_VOLUME_DETAIL_UPDATE = "VOLUME.DETAIL.UPDATE";
|
||||
public static final String EVENT_VOLUME_DETAIL_ADD = "VOLUME.DETAIL.ADD";
|
||||
public static final String EVENT_VOLUME_DETAIL_REMOVE = "VOLUME.DETAIL.REMOVE";
|
||||
|
||||
// Domains
|
||||
public static final String EVENT_DOMAIN_CREATE = "DOMAIN.CREATE";
|
||||
@ -334,6 +351,14 @@ public class EventTypes {
|
||||
public static final String EVENT_VPC_DELETE = "VPC.DELETE";
|
||||
public static final String EVENT_VPC_RESTART = "VPC.RESTART";
|
||||
|
||||
// Network ACL
|
||||
public static final String EVENT_NETWORK_ACL_CREATE = "NETWORK.ACL.CREATE";
|
||||
public static final String EVENT_NETWORK_ACL_DELETE = "NETWORK.ACL.DELETE";
|
||||
public static final String EVENT_NETWORK_ACL_REPLACE = "NETWORK.ACL.REPLACE";
|
||||
public static final String EVENT_NETWORK_ACL_ITEM_CREATE = "NETWORK.ACL.ITEM.CREATE";
|
||||
public static final String EVENT_NETWORK_ACL_ITEM_UPDATE = "NETWORK.ACL.ITEM.UPDATE";
|
||||
public static final String EVENT_NETWORK_ACL_ITEM_DELETE = "NETWORK.ACL.ITEM.DELETE";
|
||||
|
||||
// VPC offerings
|
||||
public static final String EVENT_VPC_OFFERING_CREATE = "VPC.OFFERING.CREATE";
|
||||
public static final String EVENT_VPC_OFFERING_UPDATE = "VPC.OFFERING.UPDATE";
|
||||
@ -351,6 +376,10 @@ public class EventTypes {
|
||||
public static final String EVENT_TAGS_CREATE = "CREATE_TAGS";
|
||||
public static final String EVENT_TAGS_DELETE = "DELETE_TAGS";
|
||||
|
||||
// meta data related events
|
||||
public static final String EVENT_RESOURCE_DETAILS_CREATE = "CREATE_RESOURCE_DETAILS";
|
||||
public static final String EVENT_RESOURCE_DETAILS_DELETE = "DELETE_RESOURCE_DETAILS";
|
||||
|
||||
// vm snapshot events
|
||||
public static final String EVENT_VM_SNAPSHOT_CREATE = "VMSNAPSHOT.CREATE";
|
||||
public static final String EVENT_VM_SNAPSHOT_DELETE = "VMSNAPSHOT.DELETE";
|
||||
@ -390,10 +419,14 @@ public class EventTypes {
|
||||
public static final String EVENT_AFFINITY_GROUP_REMOVE = "AG.REMOVE";
|
||||
public static final String EVENT_VM_AFFINITY_GROUP_UPDATE = "VM.AG.UPDATE";
|
||||
|
||||
public static final String EVENT_INTERNAL_LB_VM_START = "INTERNALLBVM.START";
|
||||
public static final String EVENT_INTERNAL_LB_VM_STOP = "INTERNALLBVM.STOP";
|
||||
|
||||
// Dedicated guest vlan range
|
||||
public static final String EVENT_GUEST_VLAN_RANGE_DEDICATE = "GUESTVLANRANGE.DEDICATE";
|
||||
public static final String EVENT_DEDICATED_GUEST_VLAN_RANGE_RELEASE = "GUESTVLANRANGE.RELEASE";
|
||||
|
||||
|
||||
static {
|
||||
|
||||
// TODO: need a way to force author adding event types to declare the entity details as well, with out braking
|
||||
|
||||
@ -0,0 +1,25 @@
|
||||
// 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.exception;
|
||||
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
public class MissingParameterValueException extends CloudRuntimeException {
|
||||
|
||||
public MissingParameterValueException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
@ -81,4 +81,7 @@ public interface IpAddress extends ControlledEntity, Identity, InternalIdentity
|
||||
Long getVpcId();
|
||||
|
||||
String getVmIp();
|
||||
|
||||
Long getNetworkId();
|
||||
|
||||
}
|
||||
|
||||
@ -16,18 +16,19 @@
|
||||
// under the License.
|
||||
package com.cloud.network;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.acl.ControlledEntity;
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import com.cloud.network.Networks.BroadcastDomainType;
|
||||
import com.cloud.network.Networks.Mode;
|
||||
import com.cloud.network.Networks.TrafficType;
|
||||
import com.cloud.utils.fsm.StateMachine2;
|
||||
import com.cloud.utils.fsm.StateObject;
|
||||
import org.apache.cloudstack.acl.ControlledEntity;
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* owned by an account.
|
||||
@ -50,7 +51,7 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
|
||||
Capability.MultipleIps, Capability.TrafficStatistics, Capability.SupportedTrafficDirection, Capability.SupportedEgressProtocols);
|
||||
public static final Service Lb = new Service("Lb", Capability.SupportedLBAlgorithms, Capability.SupportedLBIsolation,
|
||||
Capability.SupportedProtocols, Capability.TrafficStatistics, Capability.LoadBalancingSupportedIps,
|
||||
Capability.SupportedStickinessMethods, Capability.ElasticLb);
|
||||
Capability.SupportedStickinessMethods, Capability.ElasticLb, Capability.LbSchemes);
|
||||
public static final Service UserData = new Service("UserData");
|
||||
public static final Service SourceNat = new Service("SourceNat", Capability.SupportedSourceNatTypes, Capability.RedundantRouter);
|
||||
public static final Service StaticNat = new Service("StaticNat", Capability.ElasticIp);
|
||||
@ -124,6 +125,7 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
|
||||
public static final Provider None = new Provider("None", false);
|
||||
// NiciraNvp is not an "External" provider, otherwise we get in trouble with NetworkServiceImpl.providersConfiguredForExternalNetworking
|
||||
public static final Provider NiciraNvp = new Provider("NiciraNvp", false);
|
||||
public static final Provider InternalLbVm = new Provider("InternalLbVm", false);
|
||||
public static final Provider CiscoVnmc = new Provider("CiscoVnmc", true);
|
||||
|
||||
private String name;
|
||||
@ -177,6 +179,7 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
|
||||
public static final Capability SupportedTrafficDirection = new Capability("SupportedTrafficDirection");
|
||||
public static final Capability SupportedEgressProtocols = new Capability("SupportedEgressProtocols");
|
||||
public static final Capability HealthCheckPolicy = new Capability("HealthCheckPolicy");
|
||||
public static final Capability LbSchemes = new Capability("LbSchemes");
|
||||
|
||||
private String name;
|
||||
|
||||
@ -319,9 +322,14 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
|
||||
|
||||
boolean getSpecifyIpRanges();
|
||||
|
||||
boolean getDisplayNetwork();
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
Long getVpcId();
|
||||
|
||||
Long getNetworkACLId();
|
||||
|
||||
void setNetworkACLId(Long networkACLId);
|
||||
}
|
||||
|
||||
@ -33,6 +33,7 @@ import com.cloud.network.Networks.TrafficType;
|
||||
import com.cloud.network.element.NetworkElement;
|
||||
import com.cloud.network.element.UserDataServiceProvider;
|
||||
import com.cloud.offering.NetworkOffering;
|
||||
import com.cloud.offering.NetworkOffering.Detail;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.vm.Nic;
|
||||
import com.cloud.vm.NicProfile;
|
||||
@ -264,5 +265,11 @@ public interface NetworkModel {
|
||||
|
||||
Nic getPlaceholderNicForRouter(Network network, Long podId);
|
||||
|
||||
IpAddress getPublicIpAddress(String ipAddress, long zoneId);
|
||||
|
||||
List<String> getUsedIpsInNetwork(Network network);
|
||||
|
||||
Map<Detail, String> getNtwkOffDetails(long offId);
|
||||
|
||||
Networks.IsolationType[] listNetworkIsolationMethods();
|
||||
}
|
||||
@ -52,6 +52,8 @@ public class NetworkProfile implements Network {
|
||||
private boolean restartRequired;
|
||||
private boolean specifyIpRanges;
|
||||
private Long vpcId;
|
||||
private boolean displayNetwork;
|
||||
private Long networkAclId;
|
||||
|
||||
public NetworkProfile(Network network) {
|
||||
this.id = network.getId();
|
||||
@ -81,6 +83,8 @@ public class NetworkProfile implements Network {
|
||||
this.restartRequired = network.isRestartRequired();
|
||||
this.specifyIpRanges = network.getSpecifyIpRanges();
|
||||
this.vpcId = network.getVpcId();
|
||||
this.displayNetwork = network.getDisplayNetwork();
|
||||
this.networkAclId = network.getNetworkACLId();
|
||||
}
|
||||
|
||||
public String getDns1() {
|
||||
@ -231,11 +235,26 @@ public class NetworkProfile implements Network {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getDisplayNetwork() {
|
||||
return displayNetwork;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getVpcId() {
|
||||
return vpcId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getNetworkACLId() {
|
||||
return networkAclId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNetworkACLId(Long networkACLId) {
|
||||
this.networkAclId = networkACLId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTrafficType(TrafficType type) {
|
||||
this.trafficType = type;
|
||||
|
||||
@ -21,9 +21,7 @@ import java.util.List;
|
||||
import org.apache.cloudstack.api.command.admin.network.DedicateGuestVlanRangeCmd;
|
||||
import org.apache.cloudstack.api.command.admin.network.ListDedicatedGuestVlanRangesCmd;
|
||||
import org.apache.cloudstack.api.command.admin.usage.ListTrafficTypeImplementorsCmd;
|
||||
import org.apache.cloudstack.api.command.user.network.RestartNetworkCmd;
|
||||
import org.apache.cloudstack.api.command.user.network.CreateNetworkCmd;
|
||||
import org.apache.cloudstack.api.command.user.network.ListNetworksCmd;
|
||||
import org.apache.cloudstack.api.command.user.network.*;
|
||||
import org.apache.cloudstack.api.command.user.vm.ListNicsCmd;
|
||||
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
@ -73,7 +71,7 @@ public interface NetworkService {
|
||||
IpAddress getIp(long id);
|
||||
|
||||
Network updateGuestNetwork(long networkId, String name, String displayText, Account callerAccount, User callerUser,
|
||||
String domainSuffix, Long networkOfferingId, Boolean changeCidr, String guestVmCidr);
|
||||
String domainSuffix, Long networkOfferingId, Boolean changeCidr, String guestVmCidr, Boolean displayNetwork);
|
||||
|
||||
PhysicalNetwork createPhysicalNetwork(Long zoneId, String vnetRange, String networkSpeed,
|
||||
List<String> isolationMethods, String broadcastDomainRange, Long domainId, List<String> tags, String name);
|
||||
@ -176,4 +174,5 @@ public interface NetworkService {
|
||||
|
||||
/* lists the nic informaton */
|
||||
List<? extends Nic> listNics(ListNicsCmd listNicsCmd);
|
||||
|
||||
}
|
||||
|
||||
@ -64,4 +64,6 @@ public interface VirtualNetworkApplianceService {
|
||||
|
||||
VirtualRouter destroyRouter(long routerId, Account caller, Long callerUserId) throws ResourceUnavailableException, ConcurrentOperationException;
|
||||
|
||||
VirtualRouter findRouter(long routerId);
|
||||
|
||||
}
|
||||
|
||||
@ -23,7 +23,8 @@ public interface VirtualRouterProvider extends InternalIdentity, Identity {
|
||||
public enum VirtualRouterProviderType {
|
||||
VirtualRouter,
|
||||
ElasticLoadBalancerVm,
|
||||
VPCVirtualRouter
|
||||
VPCVirtualRouter,
|
||||
InternalLbVm
|
||||
}
|
||||
|
||||
public VirtualRouterProviderType getType();
|
||||
|
||||
@ -28,4 +28,6 @@ import com.cloud.vm.VirtualMachineProfile;
|
||||
|
||||
public interface DhcpServiceProvider extends NetworkElement {
|
||||
boolean addDhcpEntry(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException;
|
||||
boolean configDhcpSupportForSubnet(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException;
|
||||
boolean removeDhcpSupportForSubnet(Network network);
|
||||
}
|
||||
|
||||
@ -21,6 +21,7 @@ import java.util.List;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.network.rules.FirewallRule;
|
||||
import com.cloud.network.vpc.NetworkACLItem;
|
||||
|
||||
public interface NetworkACLServiceProvider extends NetworkElement{
|
||||
|
||||
@ -30,6 +31,6 @@ public interface NetworkACLServiceProvider extends NetworkElement{
|
||||
* @return
|
||||
* @throws ResourceUnavailableException
|
||||
*/
|
||||
boolean applyNetworkACLs(Network config, List<? extends FirewallRule> rules) throws ResourceUnavailableException;
|
||||
boolean applyNetworkACLs(Network config, List<? extends NetworkACLItem> rules) throws ResourceUnavailableException;
|
||||
|
||||
}
|
||||
|
||||
@ -52,4 +52,6 @@ public interface VpcProvider extends NetworkElement{
|
||||
boolean deletePrivateGateway(PrivateGateway privateGateway) throws ConcurrentOperationException, ResourceUnavailableException;
|
||||
|
||||
boolean applyStaticRoutes(Vpc vpc, List<StaticRouteProfile> routes) throws ResourceUnavailableException;
|
||||
|
||||
boolean applyACLItemsToPrivateGw(PrivateGateway gateway) throws ResourceUnavailableException;
|
||||
}
|
||||
|
||||
@ -25,111 +25,83 @@ import com.cloud.network.as.Condition;
|
||||
import com.cloud.network.as.Counter;
|
||||
import com.cloud.network.rules.FirewallRule;
|
||||
import com.cloud.network.rules.LoadBalancer;
|
||||
import com.cloud.network.rules.LoadBalancerContainer.Scheme;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.net.Ip;
|
||||
|
||||
public class LoadBalancingRule implements FirewallRule, LoadBalancer {
|
||||
public class LoadBalancingRule {
|
||||
private LoadBalancer lb;
|
||||
private Ip sourceIp;
|
||||
private List<LbDestination> destinations;
|
||||
private List<LbStickinessPolicy> stickinessPolicies;
|
||||
private LbAutoScaleVmGroup autoScaleVmGroup;
|
||||
private List<LbHealthCheckPolicy> healthCheckPolicies;
|
||||
|
||||
public LoadBalancingRule(LoadBalancer lb, List<LbDestination> destinations,
|
||||
List<LbStickinessPolicy> stickinessPolicies, List<LbHealthCheckPolicy> healthCheckPolicies) {
|
||||
List<LbStickinessPolicy> stickinessPolicies, List<LbHealthCheckPolicy> healthCheckPolicies, Ip sourceIp) {
|
||||
this.lb = lb;
|
||||
this.destinations = destinations;
|
||||
this.stickinessPolicies = stickinessPolicies;
|
||||
this.healthCheckPolicies = healthCheckPolicies;
|
||||
this.sourceIp = sourceIp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getId() {
|
||||
return lb.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getAccountId() {
|
||||
return lb.getAccountId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getDomainId() {
|
||||
return lb.getDomainId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return lb.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return lb.getDescription();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDefaultPortStart() {
|
||||
return lb.getDefaultPortStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDefaultPortEnd() {
|
||||
return lb.getDefaultPortEnd();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAlgorithm() {
|
||||
return lb.getAlgorithm();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUuid() {
|
||||
return lb.getUuid();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getXid() {
|
||||
return lb.getXid();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getSourceIpAddressId() {
|
||||
return lb.getSourceIpAddressId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getSourcePortStart() {
|
||||
return lb.getSourcePortStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getSourcePortEnd() {
|
||||
return lb.getSourcePortEnd();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProtocol() {
|
||||
return lb.getProtocol();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Purpose getPurpose() {
|
||||
return Purpose.LoadBalancing;
|
||||
public FirewallRule.Purpose getPurpose() {
|
||||
return FirewallRule.Purpose.LoadBalancing;
|
||||
}
|
||||
|
||||
@Override
|
||||
public State getState() {
|
||||
public FirewallRule.State getState() {
|
||||
return lb.getState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getNetworkId() {
|
||||
return lb.getNetworkId();
|
||||
}
|
||||
|
||||
public LoadBalancer getLb() {
|
||||
return lb;
|
||||
}
|
||||
|
||||
public void setDestinations(List<LbDestination> destinations) {
|
||||
this.destinations = destinations;
|
||||
@ -287,36 +259,6 @@ public class LoadBalancingRule implements FirewallRule, LoadBalancer {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getIcmpCode() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getIcmpType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getSourceCidrList() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getRelated() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TrafficType getTrafficType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FirewallRuleType getType() {
|
||||
return FirewallRuleType.User;
|
||||
}
|
||||
|
||||
public LbAutoScaleVmGroup getAutoScaleVmGroup() {
|
||||
return autoScaleVmGroup;
|
||||
}
|
||||
@ -473,4 +415,11 @@ public class LoadBalancingRule implements FirewallRule, LoadBalancer {
|
||||
}
|
||||
}
|
||||
|
||||
public Ip getSourceIp() {
|
||||
return sourceIp;
|
||||
}
|
||||
|
||||
public Scheme getScheme() {
|
||||
return lb.getScheme();
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,10 +17,10 @@
|
||||
package com.cloud.network.lb;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.CreateLBHealthCheckPolicyCmd;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.CreateLBStickinessPolicyCmd;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.CreateLoadBalancerRuleCmd;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.ListLBHealthCheckPoliciesCmd;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.ListLBStickinessPoliciesCmd;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.ListLoadBalancerRuleInstancesCmd;
|
||||
@ -30,12 +30,13 @@ import org.apache.cloudstack.api.command.user.loadbalancer.UpdateLoadBalancerRul
|
||||
import com.cloud.exception.InsufficientAddressCapacityException;
|
||||
import com.cloud.exception.NetworkRuleConflictException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.lb.LoadBalancingRule.LbStickinessPolicy;
|
||||
import com.cloud.network.rules.HealthCheckPolicy;
|
||||
import com.cloud.network.rules.LoadBalancer;
|
||||
import com.cloud.network.rules.LoadBalancerContainer.Scheme;
|
||||
import com.cloud.network.rules.StickinessPolicy;
|
||||
import com.cloud.uservm.UserVm;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.net.Ip;
|
||||
|
||||
|
||||
public interface LoadBalancingRulesService {
|
||||
@ -49,7 +50,9 @@ public interface LoadBalancingRulesService {
|
||||
* @return the newly created LoadBalancerVO if successful, null otherwise
|
||||
* @throws InsufficientAddressCapacityException
|
||||
*/
|
||||
LoadBalancer createLoadBalancerRule(CreateLoadBalancerRuleCmd lb, boolean openFirewall) throws NetworkRuleConflictException, InsufficientAddressCapacityException;
|
||||
LoadBalancer createPublicLoadBalancerRule(String xId, String name, String description,
|
||||
int srcPortStart, int srcPortEnd, int defPortStart, int defPortEnd, Long ipAddrId, String protocol, String algorithm,
|
||||
long networkId, long lbOwnerId, boolean openFirewall) throws NetworkRuleConflictException, InsufficientAddressCapacityException;
|
||||
|
||||
LoadBalancer updateLoadBalancerRule(UpdateLoadBalancerRuleCmd cmd);
|
||||
|
||||
@ -134,8 +137,9 @@ public interface LoadBalancingRulesService {
|
||||
|
||||
List<? extends HealthCheckPolicy> searchForLBHealthCheckPolicies(ListLBHealthCheckPoliciesCmd cmd);
|
||||
|
||||
List<LoadBalancingRule> listByNetworkId(long networkId);
|
||||
|
||||
LoadBalancer findById(long LoadBalancer);
|
||||
public void updateLBHealthChecks() throws ResourceUnavailableException;
|
||||
|
||||
public void updateLBHealthChecks(Scheme scheme) throws ResourceUnavailableException;
|
||||
|
||||
Map<Ip, UserVm> getLbInstances(long lbId);
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@ import com.cloud.vm.VirtualMachine;
|
||||
*/
|
||||
public interface VirtualRouter extends VirtualMachine {
|
||||
public enum Role {
|
||||
VIRTUAL_ROUTER, LB
|
||||
VIRTUAL_ROUTER, LB, INTERNAL_LB_VM
|
||||
}
|
||||
Role getRole();
|
||||
boolean getIsRedundantRouter();
|
||||
|
||||
@ -19,16 +19,10 @@ package com.cloud.network.rules;
|
||||
/**
|
||||
* Definition for a LoadBalancer
|
||||
*/
|
||||
public interface LoadBalancer extends FirewallRule {
|
||||
|
||||
String getName();
|
||||
|
||||
String getDescription();
|
||||
public interface LoadBalancer extends FirewallRule, LoadBalancerContainer {
|
||||
|
||||
int getDefaultPortStart();
|
||||
|
||||
int getDefaultPortEnd();
|
||||
|
||||
String getAlgorithm();
|
||||
|
||||
}
|
||||
|
||||
33
api/src/com/cloud/network/rules/LoadBalancerContainer.java
Normal file
33
api/src/com/cloud/network/rules/LoadBalancerContainer.java
Normal file
@ -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 com.cloud.network.rules;
|
||||
|
||||
public interface LoadBalancerContainer {
|
||||
|
||||
public enum Scheme {
|
||||
Public, Internal;
|
||||
}
|
||||
|
||||
String getName();
|
||||
|
||||
String getDescription();
|
||||
|
||||
String getAlgorithm();
|
||||
|
||||
Scheme getScheme();
|
||||
|
||||
}
|
||||
36
api/src/com/cloud/network/vpc/NetworkACL.java
Normal file
36
api/src/com/cloud/network/vpc/NetworkACL.java
Normal file
@ -0,0 +1,36 @@
|
||||
// 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.network.vpc;
|
||||
|
||||
import org.apache.cloudstack.acl.ControlledEntity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
public interface NetworkACL extends InternalIdentity{
|
||||
public static final long DEFAULT_DENY = 1;
|
||||
public static final long DEFAULT_ALLOW = 2;
|
||||
|
||||
String getDescription();
|
||||
|
||||
String getUuid();
|
||||
|
||||
Long getVpcId();
|
||||
|
||||
long getId();
|
||||
|
||||
String getName();
|
||||
}
|
||||
80
api/src/com/cloud/network/vpc/NetworkACLItem.java
Normal file
80
api/src/com/cloud/network/vpc/NetworkACLItem.java
Normal file
@ -0,0 +1,80 @@
|
||||
// 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.network.vpc;
|
||||
|
||||
import org.apache.cloudstack.acl.ControlledEntity;
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface NetworkACLItem extends InternalIdentity {
|
||||
|
||||
String getUuid();
|
||||
|
||||
Action getAction();
|
||||
|
||||
int getNumber();
|
||||
|
||||
enum State {
|
||||
Staged, // Rule been created but has never got through network rule conflict detection. Rules in this state can not be sent to network elements.
|
||||
Add, // Add means the rule has been created and has gone through network rule conflict detection.
|
||||
Active, // Rule has been sent to the network elements and reported to be active.
|
||||
Revoke // Revoke means this rule has been revoked. If this rule has been sent to the network elements, the rule will be deleted from database.
|
||||
}
|
||||
|
||||
enum TrafficType {
|
||||
Ingress,
|
||||
Egress
|
||||
}
|
||||
|
||||
enum Action {
|
||||
Allow,
|
||||
Deny
|
||||
}
|
||||
|
||||
/**
|
||||
* @return first port of the source port range.
|
||||
*/
|
||||
Integer getSourcePortStart();
|
||||
|
||||
/**
|
||||
* @return last port of the source prot range. If this is null, that means only one port is mapped.
|
||||
*/
|
||||
Integer getSourcePortEnd();
|
||||
|
||||
/**
|
||||
* @return protocol to open these ports for.
|
||||
*/
|
||||
String getProtocol();
|
||||
|
||||
State getState();
|
||||
|
||||
long getAclId();
|
||||
|
||||
Integer getIcmpCode();
|
||||
|
||||
Integer getIcmpType();
|
||||
|
||||
List<String> getSourceCidrList();
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
TrafficType getTrafficType();
|
||||
|
||||
}
|
||||
135
api/src/com/cloud/network/vpc/NetworkACLService.java
Normal file
135
api/src/com/cloud/network/vpc/NetworkACLService.java
Normal file
@ -0,0 +1,135 @@
|
||||
// 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.network.vpc;
|
||||
|
||||
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.utils.Pair;
|
||||
import org.apache.cloudstack.api.command.user.network.CreateNetworkACLCmd;
|
||||
import org.apache.cloudstack.api.command.user.network.ListNetworkACLsCmd;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface NetworkACLService {
|
||||
/**
|
||||
* Creates Network ACL for the specified VPC
|
||||
* @param name
|
||||
* @param description
|
||||
* @param vpcId
|
||||
* @return
|
||||
*/
|
||||
NetworkACL createNetworkACL(String name, String description, long vpcId);
|
||||
|
||||
/**
|
||||
* Get Network ACL with specified Id
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
NetworkACL getNetworkACL(long id);
|
||||
|
||||
/**
|
||||
* List NetworkACLs by Id/Name/Network or Vpc it belongs to
|
||||
* @param id
|
||||
* @param name
|
||||
* @param networkId
|
||||
* @param vpcId
|
||||
* @return
|
||||
*/
|
||||
Pair<List<? extends NetworkACL>,Integer> listNetworkACLs(Long id, String name, Long networkId, Long vpcId);
|
||||
|
||||
/**
|
||||
* Delete specified network ACL. Deletion fails if the list is not empty
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
boolean deleteNetworkACL(long id);
|
||||
|
||||
/**
|
||||
* Associates ACL with specified Network
|
||||
* @param aclId
|
||||
* @param networkId
|
||||
* @return
|
||||
* @throws ResourceUnavailableException
|
||||
*/
|
||||
boolean replaceNetworkACL(long aclId, long networkId) throws ResourceUnavailableException;
|
||||
|
||||
/**
|
||||
* Applied ACL to associated networks
|
||||
* @param aclId
|
||||
* @return
|
||||
* @throws ResourceUnavailableException
|
||||
*/
|
||||
boolean applyNetworkACL(long aclId) throws ResourceUnavailableException;
|
||||
|
||||
/**
|
||||
* Creates a Network ACL Item within an ACL and applies the ACL to associated networks
|
||||
* @param createNetworkACLCmd
|
||||
* @return
|
||||
*/
|
||||
NetworkACLItem createNetworkACLItem(CreateNetworkACLCmd aclItemCmd);
|
||||
|
||||
/**
|
||||
* Return ACL item with specified Id
|
||||
* @param ruleId
|
||||
* @return
|
||||
*/
|
||||
NetworkACLItem getNetworkACLItem(long ruleId);
|
||||
|
||||
/**
|
||||
* Lists Network ACL Items by Id, Network, ACLId, Traffic Type, protocol
|
||||
* @param listNetworkACLsCmd
|
||||
* @return
|
||||
*/
|
||||
Pair<List<? extends NetworkACLItem>, Integer> listNetworkACLItems(ListNetworkACLsCmd cmd);
|
||||
|
||||
/**
|
||||
* Revoked ACL Item with specified Id
|
||||
* @param ruleId
|
||||
* @param apply
|
||||
* @return
|
||||
*/
|
||||
boolean revokeNetworkACLItem(long ruleId);
|
||||
|
||||
/**
|
||||
* Updates existing aclItem applies to associated networks
|
||||
* @param id
|
||||
* @param protocol
|
||||
* @param sourceCidrList
|
||||
* @param trafficType
|
||||
* @param action
|
||||
* @param number
|
||||
* @param sourcePortStart
|
||||
* @param sourcePortEnd
|
||||
* @param icmpCode
|
||||
* @param icmpType
|
||||
* @return
|
||||
* @throws ResourceUnavailableException
|
||||
*/
|
||||
NetworkACLItem updateNetworkACLItem(Long id, String protocol, List<String> sourceCidrList, NetworkACLItem.TrafficType trafficType,
|
||||
String action, Integer number, Integer sourcePortStart, Integer sourcePortEnd,
|
||||
Integer icmpCode, Integer icmpType) throws ResourceUnavailableException;
|
||||
|
||||
/**
|
||||
* Associates ACL with specified Network
|
||||
* @param aclId
|
||||
* @param privateGatewayId
|
||||
* @return
|
||||
* @throws ResourceUnavailableException
|
||||
*/
|
||||
boolean replaceNetworkACLonPrivateGw(long aclId, long privateGatewayId) throws ResourceUnavailableException;
|
||||
|
||||
}
|
||||
@ -81,4 +81,9 @@ public interface VpcGateway extends Identity, ControlledEntity, InternalIdentity
|
||||
* @return
|
||||
*/
|
||||
boolean getSourceNat();
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
long getNetworkACLId();
|
||||
}
|
||||
|
||||
@ -26,6 +26,7 @@ public interface VpcOffering extends InternalIdentity, Identity {
|
||||
}
|
||||
|
||||
public static final String defaultVPCOfferingName = "Default VPC offering";
|
||||
public static final String defaultVPCNSOfferingName = "Default VPC offering with Netscaler";
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@ -172,13 +172,14 @@ public interface VpcService {
|
||||
* @param netmask
|
||||
* @param gatewayOwnerId
|
||||
* @param isSourceNat
|
||||
* @param aclId
|
||||
* @return
|
||||
* @throws InsufficientCapacityException
|
||||
* @throws ConcurrentOperationException
|
||||
* @throws ResourceAllocationException
|
||||
*/
|
||||
public PrivateGateway createVpcPrivateGateway(long vpcId, Long physicalNetworkId, String vlan, String ipAddress,
|
||||
String gateway, String netmask, long gatewayOwnerId, Boolean isSourceNat) throws ResourceAllocationException,
|
||||
String gateway, String netmask, long gatewayOwnerId, Boolean isSoruceNat, Long aclId) throws ResourceAllocationException,
|
||||
ConcurrentOperationException, InsufficientCapacityException;
|
||||
|
||||
/**
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
// under the License.
|
||||
package com.cloud.offering;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.cloudstack.acl.InfrastructureEntity;
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
@ -39,6 +41,11 @@ public interface NetworkOffering extends InfrastructureEntity, InternalIdentity,
|
||||
Enabled
|
||||
}
|
||||
|
||||
public enum Detail {
|
||||
InternalLbProvider,
|
||||
PublicLbProvider
|
||||
}
|
||||
|
||||
public final static String SystemPublicNetwork = "System-Public-Network";
|
||||
public final static String SystemControlNetwork = "System-Control-Network";
|
||||
public final static String SystemManagementNetwork = "System-Management-Network";
|
||||
@ -117,4 +124,8 @@ public interface NetworkOffering extends InfrastructureEntity, InternalIdentity,
|
||||
|
||||
boolean getIsPersistent();
|
||||
|
||||
boolean getInternalLb();
|
||||
|
||||
boolean getPublicLb();
|
||||
|
||||
}
|
||||
|
||||
@ -30,6 +30,7 @@ public interface ServiceOffering extends InfrastructureEntity, InternalIdentity,
|
||||
public static final String ssvmDefaultOffUniqueName = "Cloud.com-SecondaryStorage";
|
||||
public static final String routerDefaultOffUniqueName = "Cloud.Com-SoftwareRouter";
|
||||
public static final String elbVmDefaultOffUniqueName = "Cloud.Com-ElasticLBVm";
|
||||
public static final String internalLbVmDefaultOffUniqueName = "Cloud.Com-InternalLBVm";
|
||||
|
||||
public enum StorageType {
|
||||
local,
|
||||
|
||||
47
api/src/com/cloud/server/ResourceMetaDataService.java
Normal file
47
api/src/com/cloud/server/ResourceMetaDataService.java
Normal file
@ -0,0 +1,47 @@
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.package com.cloud.server;
|
||||
|
||||
package com.cloud.server;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.cloud.server.ResourceTag.TaggedResourceType;
|
||||
|
||||
public interface ResourceMetaDataService {
|
||||
|
||||
TaggedResourceType getResourceType (String resourceTypeStr);
|
||||
|
||||
/**
|
||||
* @param resourceId TODO
|
||||
* @param resourceType
|
||||
* @param details
|
||||
* @return
|
||||
*/
|
||||
boolean addResourceMetaData(String resourceId, TaggedResourceType resourceType, Map<String, String> details);
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param resourceId
|
||||
* @param resourceType
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
public boolean deleteResourceMetaData(String resourceId, TaggedResourceType resourceType, String key);
|
||||
|
||||
|
||||
}
|
||||
@ -29,6 +29,7 @@ public interface ResourceTag extends ControlledEntity, Identity, InternalIdentit
|
||||
Volume,
|
||||
Snapshot,
|
||||
Network,
|
||||
Nic,
|
||||
LoadBalancer,
|
||||
PortForwardingRule,
|
||||
FirewallRule,
|
||||
|
||||
@ -51,4 +51,7 @@ public interface TaggedResourceService {
|
||||
boolean deleteTags(List<String> resourceIds, TaggedResourceType resourceType, Map<String, String> tags);
|
||||
|
||||
List<? extends ResourceTag> listByResourceTypeAndId(TaggedResourceType type, long resourceId);
|
||||
}
|
||||
|
||||
public Long getResourceId(String resourceId, TaggedResourceType resourceType);
|
||||
|
||||
}
|
||||
|
||||
@ -18,12 +18,7 @@
|
||||
*/
|
||||
package com.cloud.storage;
|
||||
|
||||
import org.apache.cloudstack.api.command.user.volume.AttachVolumeCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.CreateVolumeCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.DetachVolumeCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.MigrateVolumeCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.ResizeVolumeCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.UploadVolumeCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.*;
|
||||
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.PermissionDeniedException;
|
||||
@ -85,4 +80,5 @@ public interface VolumeApiService {
|
||||
|
||||
Snapshot allocSnapshot(Long volumeId, Long policyId)
|
||||
throws ResourceAllocationException;
|
||||
Volume updateVolume(UpdateVolumeCmd updateVolumeCmd);
|
||||
}
|
||||
|
||||
45
api/src/com/cloud/vm/NicIpAlias.java
Normal file
45
api/src/com/cloud/vm/NicIpAlias.java
Normal file
@ -0,0 +1,45 @@
|
||||
// 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.vm;
|
||||
|
||||
import org.apache.cloudstack.acl.ControlledEntity;
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
/** Each entry represents the alis ip of a perticular nic.
|
||||
*
|
||||
*/
|
||||
public interface NicIpAlias extends ControlledEntity, Identity, InternalIdentity{
|
||||
/**
|
||||
* @return id in the CloudStack database
|
||||
*/
|
||||
enum state {
|
||||
active,
|
||||
revoked,
|
||||
}
|
||||
long getId();
|
||||
long getNicId();
|
||||
String getIp4Address();
|
||||
String getIp6Address();
|
||||
long getNetworkId();
|
||||
long getVmId();
|
||||
Long getAliasCount();
|
||||
String getNetmask();
|
||||
String getGateway();
|
||||
|
||||
|
||||
}
|
||||
@ -177,7 +177,10 @@ public interface UserVmService {
|
||||
* TODO
|
||||
* @param defaultIp
|
||||
* TODO
|
||||
* @param displayVm
|
||||
* - Boolean flag whether to the display the vm to the end user or not
|
||||
* @param affinityGroupIdList
|
||||
*
|
||||
* @param accountName
|
||||
* - an optional account for the virtual machine. Must be used
|
||||
* with domainId
|
||||
@ -199,7 +202,7 @@ public interface UserVmService {
|
||||
UserVm createBasicSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> securityGroupIdList, Account owner, String hostName,
|
||||
String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor,
|
||||
HTTPMethod httpmethod, String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps,
|
||||
IpAddresses defaultIp, String keyboard, List<Long> affinityGroupIdList)
|
||||
IpAddresses defaultIp, Boolean displayVm, String keyboard, List<Long> affinityGroupIdList)
|
||||
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
|
||||
|
||||
/**
|
||||
@ -250,7 +253,10 @@ public interface UserVmService {
|
||||
* TODO
|
||||
* @param defaultIps
|
||||
* TODO
|
||||
* @param displayVm
|
||||
* - Boolean flag whether to the display the vm to the end user or not
|
||||
* @param affinityGroupIdList
|
||||
*
|
||||
* @param accountName
|
||||
* - an optional account for the virtual machine. Must be used
|
||||
* with domainId
|
||||
@ -271,7 +277,7 @@ public interface UserVmService {
|
||||
*/
|
||||
UserVm createAdvancedSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> networkIdList, List<Long> securityGroupIdList,
|
||||
Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, HTTPMethod httpmethod, String userData, String sshKeyPair,
|
||||
Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, String keyboard, List<Long> affinityGroupIdList)
|
||||
Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, Boolean displayVm, String keyboard, List<Long> affinityGroupIdList)
|
||||
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
|
||||
|
||||
/**
|
||||
@ -319,7 +325,10 @@ public interface UserVmService {
|
||||
* TODO
|
||||
* @param defaultIps
|
||||
* TODO
|
||||
* @param displayVm
|
||||
* - Boolean flag whether to the display the vm to the end user or not
|
||||
* @param affinityGroupIdList
|
||||
*
|
||||
* @param accountName
|
||||
* - an optional account for the virtual machine. Must be used
|
||||
* with domainId
|
||||
@ -341,7 +350,8 @@ public interface UserVmService {
|
||||
UserVm createAdvancedVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> networkIdList, Account owner, String hostName,
|
||||
String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor,
|
||||
HTTPMethod httpmethod, String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps,
|
||||
IpAddresses defaultIps, String keyboard, List<Long> affinityGroupIdList)
|
||||
IpAddresses defaultIps, Boolean displayVm, String keyboard, List<Long> affinityGroupIdList)
|
||||
|
||||
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
|
||||
|
||||
/**
|
||||
|
||||
@ -186,6 +186,7 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I
|
||||
SecondaryStorageVm,
|
||||
ElasticIpVm,
|
||||
ElasticLoadBalancerVm,
|
||||
InternalLoadBalancerVm,
|
||||
|
||||
/*
|
||||
* UserBareMetal is only used for selecting VirtualMachineGuru, there is no
|
||||
@ -196,7 +197,7 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I
|
||||
public static boolean isSystemVM(VirtualMachine.Type vmtype) {
|
||||
if (DomainRouter.equals(vmtype)
|
||||
|| ConsoleProxy.equals(vmtype)
|
||||
|| SecondaryStorageVm.equals(vmtype)) {
|
||||
|| SecondaryStorageVm.equals(vmtype) || InternalLoadBalancerVm.equals(vmtype)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@ -56,7 +56,12 @@ public class ApiConstants {
|
||||
public static final String DISK_OFFERING_ID = "diskofferingid";
|
||||
public static final String DISK_SIZE = "disksize";
|
||||
public static final String DISPLAY_NAME = "displayname";
|
||||
public static final String DISPLAY_NETWORK = "displaynetwork";
|
||||
public static final String DISPLAY_NIC = "displaynic";
|
||||
public static final String DISPLAY_TEXT = "displaytext";
|
||||
public static final String DISPLAY_VM = "displayvm";
|
||||
public static final String DISPLAY_OFFERING = "displayoffering";
|
||||
public static final String DISPLAY_VOLUME = "displayvolume";
|
||||
public static final String DNS1 = "dns1";
|
||||
public static final String DNS2 = "dns2";
|
||||
public static final String IP6_DNS1 = "ip6dns1";
|
||||
@ -480,10 +485,18 @@ public class ApiConstants {
|
||||
public static final String HEALTHCHECK_HEALTHY_THRESHOLD = "healthythreshold";
|
||||
public static final String HEALTHCHECK_UNHEALTHY_THRESHOLD = "unhealthythreshold";
|
||||
public static final String HEALTHCHECK_PINGPATH = "pingpath";
|
||||
public static final String SOURCE_PORT = "sourceport";
|
||||
public static final String INSTANCE_PORT = "instanceport";
|
||||
public static final String SOURCE_IP = "sourceipaddress";
|
||||
public static final String SOURCE_IP_NETWORK_ID = "sourceipaddressnetworkid";
|
||||
public static final String SCHEME = "scheme";
|
||||
public static final String PROVIDER_TYPE = "providertype";
|
||||
public static final String AFFINITY_GROUP_IDS = "affinitygroupids";
|
||||
public static final String AFFINITY_GROUP_NAMES = "affinitygroupnames";
|
||||
public static final String ASA_INSIDE_PORT_PROFILE = "insideportprofile";
|
||||
public static final String AFFINITY_GROUP_ID = "affinitygroupid";
|
||||
public static final String ACL_ID = "aclid";
|
||||
public static final String NUMBER = "number";
|
||||
|
||||
public enum HostDetails {
|
||||
all, capacity, events, stats, min;
|
||||
|
||||
@ -28,6 +28,10 @@ import java.util.regex.Pattern;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.cloudstack.affinity.AffinityGroupService;
|
||||
import com.cloud.server.ResourceMetaDataService;
|
||||
import org.apache.cloudstack.network.element.InternalLoadBalancerElementService;
|
||||
import org.apache.cloudstack.network.lb.ApplicationLoadBalancerService;
|
||||
import org.apache.cloudstack.network.lb.InternalLoadBalancerVMService;
|
||||
import org.apache.cloudstack.query.QueryService;
|
||||
import org.apache.cloudstack.usage.UsageService;
|
||||
import org.apache.log4j.Logger;
|
||||
@ -49,7 +53,7 @@ import com.cloud.network.StorageNetworkService;
|
||||
import com.cloud.network.VpcVirtualNetworkApplianceService;
|
||||
import com.cloud.network.as.AutoScaleService;
|
||||
import com.cloud.network.firewall.FirewallService;
|
||||
import com.cloud.network.firewall.NetworkACLService;
|
||||
import com.cloud.network.vpc.NetworkACLService;
|
||||
import com.cloud.network.lb.LoadBalancingRulesService;
|
||||
import com.cloud.network.rules.RulesService;
|
||||
import com.cloud.network.security.SecurityGroupService;
|
||||
@ -129,6 +133,7 @@ public abstract class BaseCmd {
|
||||
@Inject public IdentityService _identityService;
|
||||
@Inject public StorageNetworkService _storageNetworkService;
|
||||
@Inject public TaggedResourceService _taggedResourceService;
|
||||
@Inject public ResourceMetaDataService _resourceMetaDataService;
|
||||
@Inject public VpcService _vpcService;
|
||||
@Inject public NetworkACLService _networkACLService;
|
||||
@Inject public Site2SiteVpnService _s2sVpnService;
|
||||
@ -139,7 +144,11 @@ public abstract class BaseCmd {
|
||||
@Inject public VMSnapshotService _vmSnapshotService;
|
||||
@Inject public DataStoreProviderApiService dataStoreProviderApiService;
|
||||
@Inject public VpcProvisioningService _vpcProvSvc;
|
||||
@Inject public ApplicationLoadBalancerService _newLbSvc;
|
||||
@Inject public ApplicationLoadBalancerService _appLbService;
|
||||
@Inject public AffinityGroupService _affinityGroupService;
|
||||
@Inject public InternalLoadBalancerElementService _internalLbElementSvc;
|
||||
@Inject public InternalLoadBalancerVMService _internalLbSvc;
|
||||
@Inject public NetworkModel _ntwkModel;
|
||||
|
||||
public abstract void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException;
|
||||
|
||||
@ -19,90 +19,22 @@ package org.apache.cloudstack.api;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.cloud.vm.NicSecondaryIp;
|
||||
import org.apache.cloudstack.affinity.AffinityGroup;
|
||||
import org.apache.cloudstack.affinity.AffinityGroupResponse;
|
||||
import com.cloud.network.vpc.NetworkACL;
|
||||
import com.cloud.network.vpc.NetworkACLItem;
|
||||
import com.cloud.network.vpc.PrivateGateway;
|
||||
import com.cloud.network.vpc.StaticRoute;
|
||||
import com.cloud.network.vpc.Vpc;
|
||||
import com.cloud.network.vpc.VpcOffering;
|
||||
import org.apache.cloudstack.api.ApiConstants.HostDetails;
|
||||
import org.apache.cloudstack.api.ApiConstants.VMDetails;
|
||||
import org.apache.cloudstack.api.command.user.job.QueryAsyncJobResultCmd;
|
||||
import org.apache.cloudstack.api.response.AccountResponse;
|
||||
import org.apache.cloudstack.api.response.AsyncJobResponse;
|
||||
import org.apache.cloudstack.api.response.AutoScalePolicyResponse;
|
||||
import org.apache.cloudstack.api.response.AutoScaleVmGroupResponse;
|
||||
import org.apache.cloudstack.api.response.AutoScaleVmProfileResponse;
|
||||
import org.apache.cloudstack.api.response.CapacityResponse;
|
||||
import org.apache.cloudstack.api.response.ClusterResponse;
|
||||
import org.apache.cloudstack.api.response.ConditionResponse;
|
||||
import org.apache.cloudstack.api.response.ConfigurationResponse;
|
||||
import org.apache.cloudstack.api.response.CounterResponse;
|
||||
import org.apache.cloudstack.api.response.CreateCmdResponse;
|
||||
import org.apache.cloudstack.api.response.DiskOfferingResponse;
|
||||
import org.apache.cloudstack.api.response.DomainResponse;
|
||||
import org.apache.cloudstack.api.response.DomainRouterResponse;
|
||||
import org.apache.cloudstack.api.response.EventResponse;
|
||||
import org.apache.cloudstack.api.response.ExtractResponse;
|
||||
import org.apache.cloudstack.api.response.FirewallResponse;
|
||||
import org.apache.cloudstack.api.response.FirewallRuleResponse;
|
||||
import org.apache.cloudstack.api.response.GuestOSResponse;
|
||||
import org.apache.cloudstack.api.response.HostResponse;
|
||||
import org.apache.cloudstack.api.response.HypervisorCapabilitiesResponse;
|
||||
import org.apache.cloudstack.api.response.IPAddressResponse;
|
||||
import org.apache.cloudstack.api.response.InstanceGroupResponse;
|
||||
import org.apache.cloudstack.api.response.IpForwardingRuleResponse;
|
||||
import org.apache.cloudstack.api.response.IsolationMethodResponse;
|
||||
import org.apache.cloudstack.api.response.LBHealthCheckResponse;
|
||||
import org.apache.cloudstack.api.response.LBStickinessResponse;
|
||||
import org.apache.cloudstack.api.response.LDAPConfigResponse;
|
||||
import org.apache.cloudstack.api.response.LoadBalancerResponse;
|
||||
import org.apache.cloudstack.api.response.NetworkACLResponse;
|
||||
import org.apache.cloudstack.api.response.NetworkOfferingResponse;
|
||||
import org.apache.cloudstack.api.response.NetworkResponse;
|
||||
import org.apache.cloudstack.api.response.NicResponse;
|
||||
import org.apache.cloudstack.api.response.NicSecondaryIpResponse;
|
||||
import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
|
||||
import org.apache.cloudstack.api.response.PodResponse;
|
||||
import org.apache.cloudstack.api.response.PrivateGatewayResponse;
|
||||
import org.apache.cloudstack.api.response.ProjectAccountResponse;
|
||||
import org.apache.cloudstack.api.response.ProjectInvitationResponse;
|
||||
import org.apache.cloudstack.api.response.ProjectResponse;
|
||||
import org.apache.cloudstack.api.response.ProviderResponse;
|
||||
import org.apache.cloudstack.api.response.RegionResponse;
|
||||
import org.apache.cloudstack.api.response.RemoteAccessVpnResponse;
|
||||
import org.apache.cloudstack.api.response.ResourceCountResponse;
|
||||
import org.apache.cloudstack.api.response.ResourceLimitResponse;
|
||||
import org.apache.cloudstack.api.response.ResourceTagResponse;
|
||||
import org.apache.cloudstack.api.response.S3Response;
|
||||
import org.apache.cloudstack.api.response.SecurityGroupResponse;
|
||||
import org.apache.cloudstack.api.response.ServiceOfferingResponse;
|
||||
import org.apache.cloudstack.api.response.ServiceResponse;
|
||||
import org.apache.cloudstack.api.response.Site2SiteCustomerGatewayResponse;
|
||||
import org.apache.cloudstack.api.response.Site2SiteVpnConnectionResponse;
|
||||
import org.apache.cloudstack.api.response.Site2SiteVpnGatewayResponse;
|
||||
import org.apache.cloudstack.api.response.SnapshotPolicyResponse;
|
||||
import org.apache.cloudstack.api.response.SnapshotResponse;
|
||||
import org.apache.cloudstack.api.response.SnapshotScheduleResponse;
|
||||
import org.apache.cloudstack.api.response.StaticRouteResponse;
|
||||
import org.apache.cloudstack.api.response.StorageNetworkIpRangeResponse;
|
||||
import org.apache.cloudstack.api.response.StoragePoolResponse;
|
||||
import org.apache.cloudstack.api.response.SwiftResponse;
|
||||
import org.apache.cloudstack.api.response.SystemVmInstanceResponse;
|
||||
import org.apache.cloudstack.api.response.SystemVmResponse;
|
||||
import org.apache.cloudstack.api.response.TemplatePermissionsResponse;
|
||||
import org.apache.cloudstack.api.response.TemplateResponse;
|
||||
import org.apache.cloudstack.api.response.TrafficMonitorResponse;
|
||||
import org.apache.cloudstack.api.response.TrafficTypeResponse;
|
||||
import org.apache.cloudstack.api.response.UsageRecordResponse;
|
||||
import org.apache.cloudstack.api.response.UserResponse;
|
||||
import org.apache.cloudstack.api.response.UserVmResponse;
|
||||
import org.apache.cloudstack.api.response.VMSnapshotResponse;
|
||||
import org.apache.cloudstack.api.response.VirtualRouterProviderResponse;
|
||||
import org.apache.cloudstack.api.response.VlanIpRangeResponse;
|
||||
import org.apache.cloudstack.api.response.VolumeResponse;
|
||||
import org.apache.cloudstack.api.response.VpcOfferingResponse;
|
||||
import org.apache.cloudstack.api.response.VpcResponse;
|
||||
import org.apache.cloudstack.api.response.VpnUsersResponse;
|
||||
import org.apache.cloudstack.api.response.ZoneResponse;
|
||||
import org.apache.cloudstack.api.response.*;
|
||||
import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRule;
|
||||
import org.apache.cloudstack.region.Region;
|
||||
import org.apache.cloudstack.usage.Usage;
|
||||
|
||||
@ -119,10 +51,25 @@ import com.cloud.domain.Domain;
|
||||
import com.cloud.event.Event;
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.hypervisor.HypervisorCapabilities;
|
||||
import com.cloud.network.*;
|
||||
import com.cloud.network.GuestVlan;
|
||||
import com.cloud.network.IpAddress;
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.network.Network.Service;
|
||||
import com.cloud.network.Networks.IsolationType;
|
||||
import com.cloud.network.as.*;
|
||||
import com.cloud.network.PhysicalNetwork;
|
||||
import com.cloud.network.PhysicalNetworkServiceProvider;
|
||||
import com.cloud.network.PhysicalNetworkTrafficType;
|
||||
import com.cloud.network.RemoteAccessVpn;
|
||||
import com.cloud.network.Site2SiteCustomerGateway;
|
||||
import com.cloud.network.Site2SiteVpnConnection;
|
||||
import com.cloud.network.Site2SiteVpnGateway;
|
||||
import com.cloud.network.VirtualRouterProvider;
|
||||
import com.cloud.network.VpnUser;
|
||||
import com.cloud.network.as.AutoScalePolicy;
|
||||
import com.cloud.network.as.AutoScaleVmGroup;
|
||||
import com.cloud.network.as.AutoScaleVmProfile;
|
||||
import com.cloud.network.as.Condition;
|
||||
import com.cloud.network.as.Counter;
|
||||
import com.cloud.network.router.VirtualRouter;
|
||||
import com.cloud.network.rules.FirewallRule;
|
||||
import com.cloud.network.rules.HealthCheckPolicy;
|
||||
@ -132,10 +79,6 @@ import com.cloud.network.rules.StaticNatRule;
|
||||
import com.cloud.network.rules.StickinessPolicy;
|
||||
import com.cloud.network.security.SecurityGroup;
|
||||
import com.cloud.network.security.SecurityRule;
|
||||
import com.cloud.network.vpc.PrivateGateway;
|
||||
import com.cloud.network.vpc.StaticRoute;
|
||||
import com.cloud.network.vpc.Vpc;
|
||||
import com.cloud.network.vpc.VpcOffering;
|
||||
import com.cloud.offering.DiskOffering;
|
||||
import com.cloud.offering.NetworkOffering;
|
||||
import com.cloud.offering.ServiceOffering;
|
||||
@ -145,7 +88,13 @@ import com.cloud.projects.ProjectAccount;
|
||||
import com.cloud.projects.ProjectInvitation;
|
||||
import com.cloud.region.ha.GlobalLoadBalancerRule;
|
||||
import com.cloud.server.ResourceTag;
|
||||
import com.cloud.storage.*;
|
||||
import com.cloud.storage.GuestOS;
|
||||
import com.cloud.storage.ImageStore;
|
||||
import com.cloud.storage.S3;
|
||||
import com.cloud.storage.Snapshot;
|
||||
import com.cloud.storage.StoragePool;
|
||||
import com.cloud.storage.Swift;
|
||||
import com.cloud.storage.Volume;
|
||||
import com.cloud.storage.snapshot.SnapshotPolicy;
|
||||
import com.cloud.storage.snapshot.SnapshotSchedule;
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
@ -153,11 +102,12 @@ import com.cloud.user.Account;
|
||||
import com.cloud.user.User;
|
||||
import com.cloud.user.UserAccount;
|
||||
import com.cloud.uservm.UserVm;
|
||||
import com.cloud.utils.net.Ip;
|
||||
import com.cloud.vm.InstanceGroup;
|
||||
import com.cloud.vm.Nic;
|
||||
import com.cloud.vm.snapshot.VMSnapshot;
|
||||
import com.cloud.vm.NicSecondaryIp;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
import org.apache.cloudstack.api.response.*;
|
||||
import com.cloud.vm.snapshot.VMSnapshot;
|
||||
|
||||
public interface ResponseGenerator {
|
||||
UserResponse createUserResponse(UserAccount user);
|
||||
@ -357,11 +307,17 @@ public interface ResponseGenerator {
|
||||
*/
|
||||
VpcResponse createVpcResponse(Vpc vpc);
|
||||
|
||||
/**
|
||||
* @param networkACLItem
|
||||
* @return
|
||||
*/
|
||||
NetworkACLItemResponse createNetworkACLItemResponse(NetworkACLItem networkACLItem);
|
||||
|
||||
/**
|
||||
* @param networkACL
|
||||
* @return
|
||||
*/
|
||||
NetworkACLResponse createNetworkACLResponse(FirewallRule networkACL);
|
||||
NetworkACLResponse createNetworkACLResponse(NetworkACL networkACL);
|
||||
|
||||
/**
|
||||
* @param result
|
||||
@ -401,9 +357,13 @@ public interface ResponseGenerator {
|
||||
NicSecondaryIpResponse createSecondaryIPToNicResponse(NicSecondaryIp result);
|
||||
public NicResponse createNicResponse(Nic result);
|
||||
|
||||
ApplicationLoadBalancerResponse createLoadBalancerContainerReponse(ApplicationLoadBalancerRule lb, Map<Ip, UserVm> lbInstances);
|
||||
|
||||
AffinityGroupResponse createAffinityGroupResponse(AffinityGroup group);
|
||||
|
||||
Long getAffinityGroupId(String name, long entityOwnerId);
|
||||
|
||||
InternalLoadBalancerElementResponse createInternalLbElementResponse(VirtualRouterProvider result);
|
||||
|
||||
IsolationMethodResponse createIsolationMethodResponse(IsolationType method);
|
||||
}
|
||||
|
||||
@ -0,0 +1,114 @@
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package org.apache.cloudstack.api.command.admin.internallb;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
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.InternalLoadBalancerElementResponse;
|
||||
import org.apache.cloudstack.network.element.InternalLoadBalancerElementService;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.VirtualRouterProvider;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.UserContext;
|
||||
|
||||
@APICommand(name = "configureInternalLoadBalancerElement", responseObject=InternalLoadBalancerElementResponse.class,
|
||||
description="Configures an Internal Load Balancer element.", since="4.2.0")
|
||||
public class ConfigureInternalLoadBalancerElementCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(ConfigureInternalLoadBalancerElementCmd.class.getName());
|
||||
private static final String s_name = "configureinternalloadbalancerelementresponse";
|
||||
|
||||
@Inject
|
||||
private List<InternalLoadBalancerElementService> _service;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = InternalLoadBalancerElementResponse.class,
|
||||
required=true, description="the ID of the internal lb provider")
|
||||
private Long id;
|
||||
|
||||
@Parameter(name=ApiConstants.ENABLED, type=CommandType.BOOLEAN, required=true, description="Enables/Disables the Internal Load Balancer element")
|
||||
private Boolean enabled;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public Boolean getEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
return Account.ACCOUNT_ID_SYSTEM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventType() {
|
||||
return EventTypes.EVENT_NETWORK_ELEMENT_CONFIGURE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventDescription() {
|
||||
return "configuring internal load balancer element: " + id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException{
|
||||
s_logger.debug("hello alena");
|
||||
UserContext.current().setEventDetails("Internal load balancer element: " + id);
|
||||
s_logger.debug("hello alena");
|
||||
VirtualRouterProvider result = _service.get(0).configureInternalLoadBalancerElement(getId(), getEnabled());
|
||||
s_logger.debug("hello alena");
|
||||
if (result != null){
|
||||
InternalLoadBalancerElementResponse routerResponse = _responseGenerator.createInternalLbElementResponse(result);
|
||||
routerResponse.setResponseName(getCommandName());
|
||||
this.setResponseObject(routerResponse);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to configure the internal load balancer element");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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.admin.internallb;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
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.InternalLoadBalancerElementResponse;
|
||||
import org.apache.cloudstack.api.response.ProviderResponse;
|
||||
import org.apache.cloudstack.network.element.InternalLoadBalancerElementService;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.network.VirtualRouterProvider;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.UserContext;
|
||||
|
||||
@APICommand(name = "createInternalLoadBalancerElement", responseObject=InternalLoadBalancerElementResponse.class, description="Create an Internal Load Balancer element.",since="4.2.0")
|
||||
public class CreateInternalLoadBalancerElementCmd extends BaseAsyncCreateCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(CreateInternalLoadBalancerElementCmd.class.getName());
|
||||
private static final String s_name = "createinternalloadbalancerelementresponse";
|
||||
|
||||
@Inject
|
||||
private List<InternalLoadBalancerElementService> _service;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name=ApiConstants.NETWORK_SERVICE_PROVIDER_ID, type=CommandType.UUID, entityType = ProviderResponse.class, required=true, description="the network service provider ID of the internal load balancer element")
|
||||
private Long nspId;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public void setNspId(Long nspId) {
|
||||
this.nspId = nspId;
|
||||
}
|
||||
|
||||
public Long getNspId() {
|
||||
return nspId;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
return Account.ACCOUNT_ID_SYSTEM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
UserContext.current().setEventDetails("Virtual router element Id: "+getEntityId());
|
||||
VirtualRouterProvider result = _service.get(0).getInternalLoadBalancerElement(getEntityId());
|
||||
if (result != null) {
|
||||
InternalLoadBalancerElementResponse response = _responseGenerator.createInternalLbElementResponse(result);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
}else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add Virtual Router entity to physical network");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create() throws ResourceAllocationException {
|
||||
VirtualRouterProvider result = _service.get(0).addInternalLoadBalancerElement(getNspId());
|
||||
if (result != null) {
|
||||
setEntityId(result.getId());
|
||||
setEntityUuid(result.getUuid());
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add Internal Load Balancer entity to physical network");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventType() {
|
||||
return EventTypes.EVENT_SERVICE_PROVIDER_CREATE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventDescription() {
|
||||
return "Adding physical network element Internal Load Balancer: " + getEntityId();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,151 @@
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.command.admin.internallb;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.response.DomainRouterResponse;
|
||||
import org.apache.cloudstack.api.response.HostResponse;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.cloudstack.api.response.NetworkResponse;
|
||||
import org.apache.cloudstack.api.response.PodResponse;
|
||||
import org.apache.cloudstack.api.response.UserVmResponse;
|
||||
import org.apache.cloudstack.api.response.VpcResponse;
|
||||
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 = "listInternalLoadBalancerVMs", description="List internal LB VMs.", responseObject=DomainRouterResponse.class)
|
||||
public class ListInternalLBVMsCmd extends BaseListProjectAndAccountResourcesCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(ListInternalLBVMsCmd.class.getName());
|
||||
|
||||
private static final String s_name = "listinternallbvmssresponse";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name=ApiConstants.HOST_ID, type=CommandType.UUID, entityType=HostResponse.class,
|
||||
description="the host ID of the Internal LB VM")
|
||||
private Long hostId;
|
||||
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=UserVmResponse.class,
|
||||
description="the ID of the Internal LB VM")
|
||||
private Long id;
|
||||
|
||||
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the Internal LB VM")
|
||||
private String routerName;
|
||||
|
||||
@Parameter(name=ApiConstants.POD_ID, type=CommandType.UUID, entityType=PodResponse.class,
|
||||
description="the Pod ID of the Internal LB VM")
|
||||
private Long podId;
|
||||
|
||||
@Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="the state of the Internal LB VM")
|
||||
private String state;
|
||||
|
||||
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType=ZoneResponse.class,
|
||||
description="the Zone ID of the Internal LB VM")
|
||||
private Long zoneId;
|
||||
|
||||
@Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.UUID, entityType=NetworkResponse.class,
|
||||
description="list by network id")
|
||||
private Long networkId;
|
||||
|
||||
@Parameter(name=ApiConstants.VPC_ID, type=CommandType.UUID, entityType=VpcResponse.class,
|
||||
description="List Internal LB VMs by VPC")
|
||||
private Long vpcId;
|
||||
|
||||
@Parameter(name=ApiConstants.FOR_VPC, type=CommandType.BOOLEAN, description="if true is passed for this parameter, list only VPC Internal LB VMs")
|
||||
private Boolean forVpc;
|
||||
|
||||
@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 ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public Long getHostId() {
|
||||
return hostId;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getRouterName() {
|
||||
return routerName;
|
||||
}
|
||||
|
||||
public Long getPodId() {
|
||||
return podId;
|
||||
}
|
||||
|
||||
public String getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public Long getZoneId() {
|
||||
return zoneId;
|
||||
}
|
||||
|
||||
public Long getNetworkId() {
|
||||
return networkId;
|
||||
}
|
||||
|
||||
public Long getVpcId() {
|
||||
return vpcId;
|
||||
}
|
||||
|
||||
public Boolean getForVpc() {
|
||||
return forVpc;
|
||||
}
|
||||
|
||||
public String getRole() {
|
||||
return Role.INTERNAL_LB_VM.toString();
|
||||
}
|
||||
|
||||
public String getZoneType() {
|
||||
return zoneType;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.DomainRouter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
ListResponse<DomainRouterResponse> response = _queryService.searchForInternalLbVms(this);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,99 @@
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.command.admin.internallb;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
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.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.InternalLoadBalancerElementResponse;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.cloudstack.api.response.ProviderResponse;
|
||||
import org.apache.cloudstack.network.element.InternalLoadBalancerElementService;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.VirtualRouterProvider;
|
||||
|
||||
@APICommand(name = "listInternalLoadBalancerElements", description="Lists all available Internal Load Balancer elements.",
|
||||
responseObject=InternalLoadBalancerElementResponse.class, since="4.2.0")
|
||||
public class ListInternalLoadBalancerElementsCmd extends BaseListCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(ListInternalLoadBalancerElementsCmd.class.getName());
|
||||
private static final String _name = "listinternalloadbalancerelementsresponse";
|
||||
|
||||
@Inject
|
||||
private InternalLoadBalancerElementService _service;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = InternalLoadBalancerElementResponse.class,
|
||||
description="list internal load balancer elements by id")
|
||||
private Long id;
|
||||
|
||||
@Parameter(name=ApiConstants.NSP_ID, type=CommandType.UUID, entityType = ProviderResponse.class,
|
||||
description="list internal load balancer elements by network service provider id")
|
||||
private Long nspId;
|
||||
|
||||
@Parameter(name=ApiConstants.ENABLED, type=CommandType.BOOLEAN, description="list internal load balancer elements by enabled state")
|
||||
private Boolean enabled;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public Long getNspId() {
|
||||
return nspId;
|
||||
}
|
||||
|
||||
public Boolean getEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return _name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
|
||||
List<? extends VirtualRouterProvider> providers = _service.searchForInternalLoadBalancerElements(getId(), getNspId(), getEnabled());
|
||||
ListResponse<InternalLoadBalancerElementResponse> response = new ListResponse<InternalLoadBalancerElementResponse>();
|
||||
List<InternalLoadBalancerElementResponse> providerResponses = new ArrayList<InternalLoadBalancerElementResponse>();
|
||||
for (VirtualRouterProvider provider : providers) {
|
||||
InternalLoadBalancerElementResponse providerResponse = _responseGenerator.createInternalLbElementResponse(provider);
|
||||
providerResponses.add(providerResponse);
|
||||
}
|
||||
response.setResponses(providerResponses);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,120 @@
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.command.admin.internallb;
|
||||
|
||||
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.DomainRouterResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
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.UserContext;
|
||||
|
||||
@APICommand(name = "startInternalLoadBalancerVM", responseObject=DomainRouterResponse.class, description="Starts an existing internal lb vm.")
|
||||
public class StartInternalLBVMCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(StartInternalLBVMCmd.class.getName());
|
||||
private static final String s_name = "startinternallbvmresponse";
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=DomainRouterResponse.class,
|
||||
required=true, description="the ID of the internal lb vm")
|
||||
private Long id;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
public static String getResultObjectName() {
|
||||
return "router";
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
VirtualRouter router = _entityMgr.findById(VirtualRouter.class, getId());
|
||||
if (router != null && router.getRole() == Role.INTERNAL_LB_VM) {
|
||||
return router.getAccountId();
|
||||
} else {
|
||||
throw new InvalidParameterValueException("Unable to find internal lb vm by id");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventType() {
|
||||
return EventTypes.EVENT_INTERNAL_LB_VM_START;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventDescription() {
|
||||
return "starting internal lb vm: " + getId();
|
||||
}
|
||||
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.InternalLbVm;
|
||||
}
|
||||
|
||||
public Long getInstanceId() {
|
||||
return getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException{
|
||||
UserContext.current().setEventDetails("Internal Lb Vm Id: "+getId());
|
||||
VirtualRouter result = null;
|
||||
VirtualRouter router = _routerService.findRouter(getId());
|
||||
if (router == null || router.getRole() != Role.INTERNAL_LB_VM) {
|
||||
throw new InvalidParameterValueException("Can't find internal lb vm by id");
|
||||
} else {
|
||||
result = _internalLbSvc.startInternalLbVm(getId(), UserContext.current().getCaller(), UserContext.current().getCallerUserId());
|
||||
}
|
||||
|
||||
if (result != null){
|
||||
DomainRouterResponse routerResponse = _responseGenerator.createDomainRouterResponse(result);
|
||||
routerResponse.setResponseName(getCommandName());
|
||||
this.setResponseObject(routerResponse);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to start internal lb vm");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,123 @@
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.command.admin.internallb;
|
||||
|
||||
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.DomainRouterResponse;
|
||||
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.UserContext;
|
||||
|
||||
@APICommand(name = "stopInternalLoadBalancerVM", description = "Stops an Internal LB vm.", responseObject = DomainRouterResponse.class)
|
||||
public class StopInternalLBVMCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(StopInternalLBVMCmd.class.getName());
|
||||
private static final String s_name = "stopinternallbvmresponse";
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
// ////////////// API parameters /////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = DomainRouterResponse.class,
|
||||
required = true, description = "the ID of the internal lb vm")
|
||||
private Long id;
|
||||
|
||||
@Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, description = "Force stop the VM. The caller knows the VM is stopped.")
|
||||
private Boolean forced;
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
// ///////////////// Accessors ///////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
// ///////////// API Implementation///////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
VirtualRouter vm = _entityMgr.findById(VirtualRouter.class, getId());
|
||||
if (vm != null && vm.getRole() == Role.INTERNAL_LB_VM) {
|
||||
return vm.getAccountId();
|
||||
} else {
|
||||
throw new InvalidParameterValueException("Unable to find internal lb vm by id");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventType() {
|
||||
return EventTypes.EVENT_INTERNAL_LB_VM_STOP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventDescription() {
|
||||
return "stopping internal lb vm: " + getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.InternalLbVm;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getInstanceId() {
|
||||
return getId();
|
||||
}
|
||||
|
||||
public boolean isForced() {
|
||||
return (forced != null) ? forced : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() throws ConcurrentOperationException, ResourceUnavailableException {
|
||||
UserContext.current().setEventDetails("Internal lb vm Id: "+getId());
|
||||
VirtualRouter result = null;
|
||||
VirtualRouter vm = _routerService.findRouter(getId());
|
||||
if (vm == null || vm.getRole() != Role.INTERNAL_LB_VM) {
|
||||
throw new InvalidParameterValueException("Can't find internal lb vm by id");
|
||||
} else {
|
||||
result = _internalLbSvc.stopInternalLbVm(getId(), isForced(), UserContext.current().getCaller(), UserContext.current().getCallerUserId());
|
||||
}
|
||||
|
||||
if (result != null) {
|
||||
DomainRouterResponse response = _responseGenerator.createDomainRouterResponse(result);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to stop internal lb vm");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -31,7 +31,6 @@ import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.NetworkOfferingResponse;
|
||||
import org.apache.cloudstack.api.response.ServiceOfferingResponse;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
@ -96,6 +95,10 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
|
||||
@Parameter(name=ApiConstants.IS_PERSISTENT, type=CommandType.BOOLEAN, description="true if network offering supports persistent networks; defaulted to false if not specified")
|
||||
private Boolean isPersistent;
|
||||
|
||||
@Parameter(name=ApiConstants.DETAILS, type=CommandType.MAP, since="4.2.0", description="Template details in key/value pairs." +
|
||||
" Supported keys are internallbprovider/publiclbprovider with service provider as a value")
|
||||
protected Map details;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
@ -216,6 +219,16 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
|
||||
return capabilityMap;
|
||||
}
|
||||
|
||||
public Map<String, String> getDetails() {
|
||||
if (details == null || details.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Collection paramsCollection = details.values();
|
||||
Map<String, String> params = (Map<String, String>) (paramsCollection.toArray())[0];
|
||||
return params;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ -62,7 +62,10 @@ public class CreateDiskOfferingCmd extends BaseCmd {
|
||||
@Parameter(name=ApiConstants.STORAGE_TYPE, type=CommandType.STRING, description="the storage type of the disk offering. Values are local and shared.")
|
||||
private String storageType = ServiceOffering.StorageType.shared.toString();
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
@Parameter(name=ApiConstants.DISPLAY_OFFERING, type=CommandType.BOOLEAN, description="an optional field, whether to display the offering to the end user or not.")
|
||||
private Boolean displayOffering;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ -94,6 +97,10 @@ public class CreateDiskOfferingCmd extends BaseCmd {
|
||||
return storageType;
|
||||
}
|
||||
|
||||
public Boolean getDisplayOffering() {
|
||||
return displayOffering;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ -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;
|
||||
@ -53,6 +54,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());
|
||||
|
||||
@ -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 {
|
||||
@ -122,6 +123,10 @@ public class ListRoutersCmd extends BaseListProjectAndAccountResourcesCmd {
|
||||
return forVpc;
|
||||
}
|
||||
|
||||
public String getRole() {
|
||||
return Role.VIRTUAL_ROUTER.toString();
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ -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());
|
||||
|
||||
@ -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());
|
||||
|
||||
@ -23,6 +23,7 @@ import org.apache.cloudstack.api.BaseAsyncCmd;
|
||||
import org.apache.cloudstack.api.BaseAsyncCreateCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.NetworkACLResponse;
|
||||
import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
|
||||
import org.apache.cloudstack.api.response.PrivateGatewayResponse;
|
||||
import org.apache.cloudstack.api.response.VpcResponse;
|
||||
@ -74,6 +75,11 @@ public class CreatePrivateGatewayCmd extends BaseAsyncCreateCmd {
|
||||
" 'false': sourcenat is not supported")
|
||||
private Boolean isSourceNat;
|
||||
|
||||
@Parameter(name=ApiConstants.ACL_ID, type=CommandType.UUID, entityType = NetworkACLResponse.class,
|
||||
required=false, description="the ID of the network ACL")
|
||||
private Long aclId;
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
@ -106,9 +112,14 @@ public class CreatePrivateGatewayCmd extends BaseAsyncCreateCmd {
|
||||
if (isSourceNat == null) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return isSourceNat;
|
||||
}
|
||||
|
||||
public Long getAclId() {
|
||||
return aclId;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
@ -123,7 +134,7 @@ public class CreatePrivateGatewayCmd extends BaseAsyncCreateCmd {
|
||||
PrivateGateway result = null;
|
||||
try {
|
||||
result = _vpcService.createVpcPrivateGateway(getVpcId(), getPhysicalNetworkId(),
|
||||
getVlan(), getStartIp(), getGateway(), getNetmask(), getEntityOwnerId(), getIsSourceNat());
|
||||
getVlan(), getStartIp(), getGateway(), getNetmask(), getEntityOwnerId(), getIsSourceNat(), getAclId());
|
||||
} catch (InsufficientCapacityException ex){
|
||||
s_logger.info(ex);
|
||||
s_logger.trace(ex);
|
||||
|
||||
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@ -19,6 +19,8 @@ package org.apache.cloudstack.api.command.user.network;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.cloud.network.vpc.NetworkACL;
|
||||
import com.cloud.network.vpc.NetworkACLItem;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
@ -26,6 +28,7 @@ import org.apache.cloudstack.api.BaseAsyncCmd;
|
||||
import org.apache.cloudstack.api.BaseAsyncCreateCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.NetworkACLItemResponse;
|
||||
import org.apache.cloudstack.api.response.NetworkACLResponse;
|
||||
import org.apache.cloudstack.api.response.NetworkResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
@ -36,15 +39,14 @@ import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.exception.NetworkRuleConflictException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.network.rules.FirewallRule;
|
||||
import com.cloud.network.vpc.Vpc;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.UserContext;
|
||||
import com.cloud.utils.net.NetUtils;
|
||||
|
||||
@APICommand(name = "createNetworkACL", description = "Creates a ACL rule the given network (the network has to belong to VPC)",
|
||||
responseObject = NetworkACLResponse.class)
|
||||
public class CreateNetworkACLCmd extends BaseAsyncCreateCmd implements FirewallRule {
|
||||
@APICommand(name = "createNetworkACL", description = "Creates a ACL rule in the given network (the network has to belong to VPC)",
|
||||
responseObject = NetworkACLItemResponse.class)
|
||||
public class CreateNetworkACLCmd extends BaseAsyncCreateCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(CreateNetworkACLCmd.class.getName());
|
||||
|
||||
private static final String s_name = "createnetworkaclresponse";
|
||||
@ -54,7 +56,7 @@ public class CreateNetworkACLCmd extends BaseAsyncCreateCmd implements FirewallR
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name = ApiConstants.PROTOCOL, type = CommandType.STRING, required = true, description =
|
||||
"the protocol for the ACL rule. Valid values are TCP/UDP/ICMP.")
|
||||
"the protocol for the ACL rule. Valid values are TCP/UDP/ICMP/ALL or valid protocol number")
|
||||
private String protocol;
|
||||
|
||||
@Parameter(name = ApiConstants.START_PORT, type = CommandType.INTEGER, description = "the starting port of ACL")
|
||||
@ -74,23 +76,27 @@ public class CreateNetworkACLCmd extends BaseAsyncCreateCmd implements FirewallR
|
||||
private Integer icmpCode;
|
||||
|
||||
@Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.UUID, entityType = NetworkResponse.class,
|
||||
required=true,
|
||||
description="The network of the vm the ACL will be created for")
|
||||
private Long networkId;
|
||||
|
||||
@Parameter(name=ApiConstants.ACL_ID, type=CommandType.UUID, entityType = NetworkACLResponse.class,
|
||||
description="The network of the vm the ACL will be created for")
|
||||
private Long aclId;
|
||||
|
||||
@Parameter(name=ApiConstants.TRAFFIC_TYPE, type=CommandType.STRING, description="the traffic type for the ACL," +
|
||||
"can be Ingress or Egress, defaulted to Ingress if not specified")
|
||||
private String trafficType;
|
||||
|
||||
@Parameter(name=ApiConstants.NUMBER, type=CommandType.INTEGER, description="The network of the vm the ACL will be created for")
|
||||
private Integer number;
|
||||
|
||||
@Parameter(name=ApiConstants.ACTION, type=CommandType.STRING, description="scl entry action, allow or deny")
|
||||
private String action;
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
// ///////////////// Accessors ///////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
public Long getIpAddressId() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProtocol() {
|
||||
return protocol.trim();
|
||||
}
|
||||
@ -105,26 +111,11 @@ public class CreateNetworkACLCmd extends BaseAsyncCreateCmd implements FirewallR
|
||||
}
|
||||
}
|
||||
|
||||
public long getVpcId() {
|
||||
Network network = _networkService.getNetwork(getNetworkId());
|
||||
if (network == null) {
|
||||
throw new InvalidParameterValueException("Invalid networkId is given");
|
||||
}
|
||||
|
||||
Long vpcId = network.getVpcId();
|
||||
if (vpcId == null) {
|
||||
throw new InvalidParameterValueException("Can create network ACL only for the network belonging to the VPC");
|
||||
}
|
||||
|
||||
return vpcId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FirewallRule.TrafficType getTrafficType() {
|
||||
public NetworkACLItem.TrafficType getTrafficType() {
|
||||
if (trafficType == null) {
|
||||
return FirewallRule.TrafficType.Ingress;
|
||||
return NetworkACLItem.TrafficType.Ingress;
|
||||
}
|
||||
for (FirewallRule.TrafficType type : FirewallRule.TrafficType.values()) {
|
||||
for (NetworkACLItem.TrafficType type : NetworkACLItem.TrafficType.values()) {
|
||||
if (type.toString().equalsIgnoreCase(trafficType)) {
|
||||
return type;
|
||||
}
|
||||
@ -141,192 +132,103 @@ public class CreateNetworkACLCmd extends BaseAsyncCreateCmd implements FirewallR
|
||||
return s_name;
|
||||
}
|
||||
|
||||
public void setSourceCidrList(List<String> cidrs){
|
||||
cidrlist = cidrs;
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() throws ResourceUnavailableException {
|
||||
UserContext callerContext = UserContext.current();
|
||||
boolean success = false;
|
||||
FirewallRule rule = _networkACLService.getNetworkACL(getEntityId());
|
||||
try {
|
||||
UserContext.current().setEventDetails("Rule Id: " + getEntityId());
|
||||
success = _networkACLService.applyNetworkACLs(rule.getNetworkId(), callerContext.getCaller());
|
||||
|
||||
// State is different after the rule is applied, so get new object here
|
||||
NetworkACLResponse aclResponse = new NetworkACLResponse();
|
||||
if (rule != null) {
|
||||
aclResponse = _responseGenerator.createNetworkACLResponse(rule);
|
||||
setResponseObject(aclResponse);
|
||||
}
|
||||
aclResponse.setResponseName(getCommandName());
|
||||
} finally {
|
||||
if (!success || rule == null) {
|
||||
_networkACLService.revokeNetworkACL(getEntityId(), true);
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create network ACL");
|
||||
}
|
||||
}
|
||||
public Integer getNumber() {
|
||||
return number;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getId() {
|
||||
throw new UnsupportedOperationException("database id can only provided by VO objects");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getXid() {
|
||||
// FIXME: We should allow for end user to specify Xid.
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getUuid() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getSourceIpAddressId() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getSourcePortStart() {
|
||||
if (publicStartPort != null) {
|
||||
return publicStartPort.intValue();
|
||||
}
|
||||
return null;
|
||||
return publicStartPort;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getSourcePortEnd() {
|
||||
if (publicEndPort == null) {
|
||||
if (publicStartPort != null) {
|
||||
return publicStartPort.intValue();
|
||||
return publicStartPort;
|
||||
}
|
||||
} else {
|
||||
return publicEndPort.intValue();
|
||||
return publicEndPort;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Purpose getPurpose() {
|
||||
return Purpose.Firewall;
|
||||
}
|
||||
|
||||
@Override
|
||||
public State getState() {
|
||||
throw new UnsupportedOperationException("Should never call me to find the state");
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getNetworkId() {
|
||||
public Long getNetworkId() {
|
||||
return networkId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Vpc vpc = _vpcService.getVpc(getVpcId());
|
||||
if (vpc == null) {
|
||||
throw new InvalidParameterValueException("Invalid vpcId is given");
|
||||
}
|
||||
|
||||
Account account = _accountService.getAccount(vpc.getAccountId());
|
||||
return account.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getDomainId() {
|
||||
Vpc vpc = _vpcService.getVpc(getVpcId());
|
||||
return vpc.getDomainId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create() {
|
||||
if (getSourceCidrList() != null) {
|
||||
for (String cidr: getSourceCidrList()){
|
||||
if (!NetUtils.isValidCIDR(cidr)){
|
||||
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Source cidrs formatting error " + cidr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
FirewallRule result = _networkACLService.createNetworkACL(this);
|
||||
setEntityId(result.getId());
|
||||
setEntityUuid(result.getUuid());
|
||||
} catch (NetworkRuleConflictException ex) {
|
||||
s_logger.info("Network rule conflict: " + ex.getMessage());
|
||||
s_logger.trace("Network Rule Conflict: ", ex);
|
||||
throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage());
|
||||
}
|
||||
Account caller = UserContext.current().getCaller();
|
||||
return caller.getAccountId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventType() {
|
||||
return EventTypes.EVENT_FIREWALL_OPEN;
|
||||
return EventTypes.EVENT_NETWORK_ACL_ITEM_CREATE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventDescription() {
|
||||
Network network = _networkService.getNetwork(networkId);
|
||||
return ("Createing Network ACL for Netowrk: " + network + " for protocol:" + this.getProtocol());
|
||||
return "Creating Network ACL Item";
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getAccountId() {
|
||||
Vpc vpc = _vpcService.getVpc(getVpcId());
|
||||
return vpc.getAccountId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSyncObjType() {
|
||||
return BaseAsyncCmd.networkSyncObject;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getSyncObjId() {
|
||||
return getNetworkId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getIcmpCode() {
|
||||
if (icmpCode != null) {
|
||||
return icmpCode;
|
||||
} else if (protocol.equalsIgnoreCase(NetUtils.ICMP_PROTO)) {
|
||||
} else if (getProtocol().equalsIgnoreCase(NetUtils.ICMP_PROTO)) {
|
||||
return -1;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getIcmpType() {
|
||||
if (icmpType != null) {
|
||||
return icmpType;
|
||||
} else if (protocol.equalsIgnoreCase(NetUtils.ICMP_PROTO)) {
|
||||
} else if (getProtocol().equalsIgnoreCase(NetUtils.ICMP_PROTO)) {
|
||||
return -1;
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getRelated() {
|
||||
return null;
|
||||
public Long getACLId() {
|
||||
return aclId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FirewallRuleType getType() {
|
||||
return FirewallRuleType.User;
|
||||
public void create() {
|
||||
NetworkACLItem result = _networkACLService.createNetworkACLItem(this);
|
||||
setEntityId(result.getId());
|
||||
setEntityUuid(result.getUuid());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.FirewallRule;
|
||||
public void execute() throws ResourceUnavailableException {
|
||||
boolean success = false;
|
||||
NetworkACLItem rule = _networkACLService.getNetworkACLItem(getEntityId());
|
||||
try {
|
||||
UserContext.current().setEventDetails("Rule Id: " + getEntityId());
|
||||
success = _networkACLService.applyNetworkACL(rule.getAclId());
|
||||
|
||||
// State is different after the rule is applied, so get new object here
|
||||
rule = _networkACLService.getNetworkACLItem(getEntityId());
|
||||
NetworkACLItemResponse aclResponse = new NetworkACLItemResponse();
|
||||
if (rule != null) {
|
||||
aclResponse = _responseGenerator.createNetworkACLItemResponse(rule);
|
||||
setResponseObject(aclResponse);
|
||||
}
|
||||
aclResponse.setResponseName(getCommandName());
|
||||
} finally {
|
||||
if (!success || rule == null) {
|
||||
_networkACLService.revokeNetworkACLItem(getEntityId());
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create network ACL Item");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,120 @@
|
||||
// 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.network;
|
||||
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.vpc.NetworkACL;
|
||||
import com.cloud.network.vpc.Vpc;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.UserContext;
|
||||
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.NetworkACLResponse;
|
||||
import org.apache.cloudstack.api.response.VpcResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
@APICommand(name = "createNetworkACLList", description = "Creates a Network ACL for the given VPC",
|
||||
responseObject = NetworkACLResponse.class)
|
||||
public class CreateNetworkACLListCmd extends BaseAsyncCreateCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(CreateNetworkACLListCmd.class.getName());
|
||||
|
||||
private static final String s_name = "createnetworkacllistresponse";
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
// ////////////// API parameters /////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "Name of the network ACL List")
|
||||
private String name;
|
||||
|
||||
@Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, description = "Description of the network ACL List")
|
||||
private String description;
|
||||
|
||||
@Parameter(name = ApiConstants.VPC_ID, type = CommandType.UUID, required = true, entityType = VpcResponse.class, description = "Id of the VPC associated with this network ACL List")
|
||||
private Long vpcId;
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
// ///////////////// Accessors ///////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public Long getVpcId() {
|
||||
return vpcId;
|
||||
}
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
// ///////////// API Implementation///////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create() {
|
||||
NetworkACL result = _networkACLService.createNetworkACL(getName(), getDescription(), getVpcId());
|
||||
setEntityId(result.getId());
|
||||
setEntityUuid(result.getUuid());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() throws ResourceUnavailableException {
|
||||
NetworkACL acl = _networkACLService.getNetworkACL(getEntityId());
|
||||
if(acl != null){
|
||||
NetworkACLResponse aclResponse = _responseGenerator.createNetworkACLResponse(acl);
|
||||
setResponseObject(aclResponse);
|
||||
aclResponse.setResponseName(getCommandName());
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create network ACL");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Vpc vpc = _vpcService.getVpc(getVpcId());
|
||||
if (vpc == null) {
|
||||
throw new InvalidParameterValueException("Invalid vpcId is given");
|
||||
}
|
||||
|
||||
Account account = _accountService.getAccount(vpc.getAccountId());
|
||||
return account.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventType() {
|
||||
return EventTypes.EVENT_NETWORK_ACL_CREATE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventDescription() {
|
||||
return "Creating Network ACL with id: "+getEntityUuid();
|
||||
}
|
||||
}
|
||||
@ -22,13 +22,7 @@ import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.BaseCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.DomainResponse;
|
||||
import org.apache.cloudstack.api.response.NetworkOfferingResponse;
|
||||
import org.apache.cloudstack.api.response.NetworkResponse;
|
||||
import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
|
||||
import org.apache.cloudstack.api.response.ProjectResponse;
|
||||
import org.apache.cloudstack.api.response.VpcResponse;
|
||||
import org.apache.cloudstack.api.response.ZoneResponse;
|
||||
import org.apache.cloudstack.api.response.*;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
@ -126,6 +120,12 @@ public class CreateNetworkCmd extends BaseCmd {
|
||||
@Parameter(name=ApiConstants.IP6_CIDR, type=CommandType.STRING, description="the CIDR of IPv6 network, must be at least /64")
|
||||
private String ip6Cidr;
|
||||
|
||||
@Parameter(name=ApiConstants.DISPLAY_NETWORK, type=CommandType.BOOLEAN, description="an optional field, whether to the display the network to the end user or not.")
|
||||
private Boolean displayNetwork;
|
||||
|
||||
@Parameter(name=ApiConstants.ACL_ID, type=CommandType.UUID, entityType = NetworkACLResponse.class,
|
||||
description="Network ACL Id associated for the network")
|
||||
private Long aclId;
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
@ -189,6 +189,10 @@ public class CreateNetworkCmd extends BaseCmd {
|
||||
return vpcId;
|
||||
}
|
||||
|
||||
public Boolean getDisplayNetwork() {
|
||||
return displayNetwork;
|
||||
}
|
||||
|
||||
public Long getZoneId() {
|
||||
Long physicalNetworkId = getPhysicalNetworkId();
|
||||
|
||||
@ -247,6 +251,10 @@ public class CreateNetworkCmd extends BaseCmd {
|
||||
return ip6Cidr.toLowerCase();
|
||||
}
|
||||
|
||||
public Long getAclId() {
|
||||
return aclId;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.command.user.network;
|
||||
|
||||
import com.cloud.network.vpc.NetworkACLItem;
|
||||
import com.cloud.user.Account;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
@ -24,6 +26,7 @@ import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.AccountResponse;
|
||||
import org.apache.cloudstack.api.response.FirewallRuleResponse;
|
||||
import org.apache.cloudstack.api.response.NetworkACLItemResponse;
|
||||
import org.apache.cloudstack.api.response.SuccessResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
@ -43,14 +46,10 @@ public class DeleteNetworkACLCmd extends BaseAsyncCmd {
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = FirewallRuleResponse.class,
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = NetworkACLItemResponse.class,
|
||||
required=true, description="the ID of the network ACL")
|
||||
private Long id;
|
||||
|
||||
// unexposed parameter needed for events logging
|
||||
@Parameter(name=ApiConstants.ACCOUNT_ID, type=CommandType.UUID, entityType = AccountResponse.class,
|
||||
expose=false)
|
||||
private Long ownerId;
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
@ -69,7 +68,7 @@ public class DeleteNetworkACLCmd extends BaseAsyncCmd {
|
||||
|
||||
@Override
|
||||
public String getEventType() {
|
||||
return EventTypes.EVENT_FIREWALL_CLOSE;
|
||||
return EventTypes.EVENT_NETWORK_ACL_ITEM_DELETE;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -79,44 +78,22 @@ public class DeleteNetworkACLCmd extends BaseAsyncCmd {
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
if (ownerId == null) {
|
||||
FirewallRule rule = _networkACLService.getNetworkACL(id);
|
||||
if (rule == null) {
|
||||
throw new InvalidParameterValueException("Unable to find network ACL by id=" + id);
|
||||
} else {
|
||||
ownerId = rule.getAccountId();
|
||||
}
|
||||
}
|
||||
return ownerId;
|
||||
Account caller = UserContext.current().getCaller();
|
||||
return caller.getAccountId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() throws ResourceUnavailableException {
|
||||
UserContext.current().setEventDetails("Network ACL Id: " + id);
|
||||
boolean result = _networkACLService.revokeNetworkACL(id, true);
|
||||
UserContext.current().setEventDetails("Network ACL Item Id: " + id);
|
||||
boolean result = _networkACLService.revokeNetworkACLItem(id);
|
||||
|
||||
if (result) {
|
||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete network ACL");
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete network ACL Item");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getSyncObjType() {
|
||||
return BaseAsyncCmd.networkSyncObject;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getSyncObjId() {
|
||||
return _firewallService.getFirewallRule(id).getNetworkId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.FirewallRule;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,93 @@
|
||||
// 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.network;
|
||||
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.rules.FirewallRule;
|
||||
import com.cloud.network.vpc.NetworkACL;
|
||||
import com.cloud.network.vpc.Vpc;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.UserContext;
|
||||
import org.apache.cloudstack.api.*;
|
||||
import org.apache.cloudstack.api.response.AccountResponse;
|
||||
import org.apache.cloudstack.api.response.FirewallRuleResponse;
|
||||
import org.apache.cloudstack.api.response.NetworkACLResponse;
|
||||
import org.apache.cloudstack.api.response.SuccessResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
@APICommand(name = "deleteNetworkACLList", description="Deletes a Network ACL", responseObject=SuccessResponse.class)
|
||||
public class DeleteNetworkACLListCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(DeleteNetworkACLListCmd.class.getName());
|
||||
private static final String s_name = "deletenetworkacllistresponse";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = NetworkACLResponse.class,
|
||||
required=true, description="the ID of the network ACL")
|
||||
private Long id;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventType() {
|
||||
return EventTypes.EVENT_NETWORK_ACL_DELETE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventDescription() {
|
||||
return ("Deleting Network ACL id=" + id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Account caller = UserContext.current().getCaller();
|
||||
return caller.getAccountId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() throws ResourceUnavailableException {
|
||||
UserContext.current().setEventDetails("Network ACL Id: " + id);
|
||||
boolean result = _networkACLService.deleteNetworkACL(id);
|
||||
|
||||
if (result) {
|
||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete network ACL");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,102 @@
|
||||
// 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.network;
|
||||
|
||||
import com.cloud.network.vpc.NetworkACL;
|
||||
import com.cloud.utils.Pair;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseListCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.cloudstack.api.response.NetworkACLResponse;
|
||||
import org.apache.cloudstack.api.response.NetworkResponse;
|
||||
import org.apache.cloudstack.api.response.VpcResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@APICommand(name = "listNetworkACLLists", description="Lists all network ACLs", responseObject=NetworkACLResponse.class)
|
||||
public class ListNetworkACLListsCmd extends BaseListCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(ListNetworkACLListsCmd.class.getName());
|
||||
|
||||
private static final String s_name = "listnetworkacllistsresponse";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = NetworkACLResponse.class,
|
||||
description="Lists network ACL with the specified ID.")
|
||||
private Long id;
|
||||
|
||||
@Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.UUID, entityType = NetworkResponse.class,
|
||||
description="list network ACLs by network Id")
|
||||
private Long networkId;
|
||||
|
||||
@Parameter(name=ApiConstants.VPC_ID, type=CommandType.UUID, entityType = VpcResponse.class,
|
||||
description="list network ACLs by Vpc Id")
|
||||
private Long vpcId;
|
||||
|
||||
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="list network ACLs by specified name")
|
||||
private String name;
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public Long getNetworkId() {
|
||||
return networkId;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public Long getVpcId() {
|
||||
return vpcId;
|
||||
}
|
||||
|
||||
public String getName(){
|
||||
return name;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
Pair<List<? extends NetworkACL>,Integer> result = _networkACLService.listNetworkACLs(getId(), getName(), getNetworkId(), getVpcId());
|
||||
ListResponse<NetworkACLResponse> response = new ListResponse<NetworkACLResponse>();
|
||||
List<NetworkACLResponse> aclResponses = new ArrayList<NetworkACLResponse>();
|
||||
|
||||
for (NetworkACL acl : result.first()) {
|
||||
NetworkACLResponse aclResponse = _responseGenerator.createNetworkACLResponse(acl);
|
||||
aclResponses.add(aclResponse);
|
||||
}
|
||||
response.setResponses(aclResponses, result.second());
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
}
|
||||
}
|
||||
@ -19,20 +19,18 @@ package org.apache.cloudstack.api.command.user.network;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.cloud.network.vpc.NetworkACLItem;
|
||||
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.FirewallRuleResponse;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.cloudstack.api.response.NetworkACLResponse;
|
||||
import org.apache.cloudstack.api.response.NetworkResponse;
|
||||
import org.apache.cloudstack.api.response.*;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.network.rules.FirewallRule;
|
||||
import com.cloud.utils.Pair;
|
||||
|
||||
@APICommand(name = "listNetworkACLs", description="Lists all network ACLs", responseObject=NetworkACLResponse.class)
|
||||
@APICommand(name = "listNetworkACLs", description="Lists all network ACL items", responseObject=NetworkACLItemResponse.class)
|
||||
public class ListNetworkACLsCmd extends BaseListTaggedResourcesCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(ListNetworkACLsCmd.class.getName());
|
||||
|
||||
@ -42,16 +40,26 @@ public class ListNetworkACLsCmd extends BaseListTaggedResourcesCmd {
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = FirewallRuleResponse.class,
|
||||
description="Lists network ACL with the specified ID.")
|
||||
description="Lists network ACL Item with the specified ID")
|
||||
private Long id;
|
||||
|
||||
@Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.UUID, entityType = NetworkResponse.class,
|
||||
description="list network ACLs by network Id")
|
||||
description="list network ACL Items by network Id")
|
||||
private Long networkId;
|
||||
|
||||
@Parameter(name=ApiConstants.TRAFFIC_TYPE, type=CommandType.STRING, description="list network ACLs by traffic type - Ingress or Egress")
|
||||
@Parameter(name=ApiConstants.TRAFFIC_TYPE, type=CommandType.STRING, description="list network ACL Items by traffic type - Ingress or Egress")
|
||||
private String trafficType;
|
||||
|
||||
@Parameter(name=ApiConstants.ACL_ID, type=CommandType.UUID, entityType = NetworkACLResponse.class,
|
||||
description="list network ACL Items by ACL Id")
|
||||
private Long aclId;
|
||||
|
||||
@Parameter(name=ApiConstants.PROTOCOL, type=CommandType.STRING, description="list network ACL Items by Protocol")
|
||||
private String protocol;
|
||||
|
||||
@Parameter(name=ApiConstants.ACTION, type=CommandType.STRING, description="list network ACL Items by Action")
|
||||
private String action;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
@ -68,6 +76,18 @@ public class ListNetworkACLsCmd extends BaseListTaggedResourcesCmd {
|
||||
return trafficType;
|
||||
}
|
||||
|
||||
public Long getAclId(){
|
||||
return aclId;
|
||||
}
|
||||
|
||||
public String getProtocol() {
|
||||
return protocol;
|
||||
}
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
@ -79,12 +99,12 @@ public class ListNetworkACLsCmd extends BaseListTaggedResourcesCmd {
|
||||
|
||||
@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>();
|
||||
Pair<List<? extends NetworkACLItem>,Integer> result = _networkACLService.listNetworkACLItems(this);
|
||||
ListResponse<NetworkACLItemResponse> response = new ListResponse<NetworkACLItemResponse>();
|
||||
List<NetworkACLItemResponse> aclResponses = new ArrayList<NetworkACLItemResponse>();
|
||||
|
||||
for (FirewallRule acl : result.first()) {
|
||||
NetworkACLResponse ruleData = _responseGenerator.createNetworkACLResponse(acl);
|
||||
for (NetworkACLItem acl : result.first()) {
|
||||
NetworkACLItemResponse ruleData = _responseGenerator.createNetworkACLItemResponse(acl);
|
||||
aclResponses.add(ruleData);
|
||||
}
|
||||
response.setResponses(aclResponses, result.second());
|
||||
|
||||
@ -0,0 +1,120 @@
|
||||
// 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.network;
|
||||
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.vpc.NetworkACL;
|
||||
import com.cloud.network.vpc.Vpc;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.UserContext;
|
||||
import org.apache.cloudstack.api.*;
|
||||
import org.apache.cloudstack.api.response.NetworkACLResponse;
|
||||
import org.apache.cloudstack.api.response.NetworkResponse;
|
||||
import org.apache.cloudstack.api.response.PrivateGatewayResponse;
|
||||
import org.apache.cloudstack.api.response.SuccessResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
@APICommand(name = "replaceNetworkACLList", description="Replaces ACL associated with a Network or private gateway", responseObject=SuccessResponse.class)
|
||||
public class ReplaceNetworkACLListCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(ReplaceNetworkACLListCmd.class.getName());
|
||||
private static final String s_name = "replacenetworkacllistresponse";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name=ApiConstants.ACL_ID, type=CommandType.UUID, entityType = NetworkACLResponse.class,
|
||||
required=true, description="the ID of the network ACL")
|
||||
private long aclId;
|
||||
|
||||
@Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.UUID, entityType = NetworkResponse.class,
|
||||
description="the ID of the network")
|
||||
private Long networkId;
|
||||
|
||||
@Parameter(name=ApiConstants.GATEWAY_ID, type=CommandType.UUID, entityType = PrivateGatewayResponse.class,
|
||||
description="the ID of the private gateway")
|
||||
private Long privateGatewayId;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public long getAclId() {
|
||||
return aclId;
|
||||
}
|
||||
|
||||
public Long getNetworkId(){
|
||||
return networkId;
|
||||
}
|
||||
|
||||
public Long getPrivateGatewayId() {
|
||||
return privateGatewayId;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventType() {
|
||||
return EventTypes.EVENT_NETWORK_ACL_REPLACE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventDescription() {
|
||||
return ("Associating Network ACL id=" + aclId+ " with Network id="+ networkId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Account caller = UserContext.current().getCaller();
|
||||
return caller.getAccountId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() throws ResourceUnavailableException {
|
||||
if (getNetworkId() == null && getPrivateGatewayId() == null) {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Network id and private gateway can't be null at the same time");
|
||||
}
|
||||
|
||||
if (getNetworkId() != null && getPrivateGatewayId() != null) {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Network id and private gateway can't be passed at the same time");
|
||||
}
|
||||
|
||||
UserContext.current().setEventDetails("Network ACL Id: " + aclId);
|
||||
boolean result = false;
|
||||
if (getPrivateGatewayId() != null) {
|
||||
result = _networkACLService.replaceNetworkACLonPrivateGw(aclId, privateGatewayId);
|
||||
} else {
|
||||
result = _networkACLService.replaceNetworkACL(aclId, networkId);
|
||||
}
|
||||
|
||||
if (result) {
|
||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to replace network ACL");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,173 @@
|
||||
// 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.network;
|
||||
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.vpc.NetworkACLItem;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.UserContext;
|
||||
import com.cloud.utils.net.NetUtils;
|
||||
import org.apache.cloudstack.api.*;
|
||||
import org.apache.cloudstack.api.response.NetworkACLItemResponse;
|
||||
import org.apache.cloudstack.api.response.NetworkACLResponse;
|
||||
import org.apache.cloudstack.api.response.NetworkResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@APICommand(name = "updateNetworkACLItem", description = "Updates ACL Item with specified Id",
|
||||
responseObject = NetworkACLItemResponse.class)
|
||||
public class UpdateNetworkACLItemCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(UpdateNetworkACLItemCmd.class.getName());
|
||||
|
||||
private static final String s_name = "createnetworkaclresponse";
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
// ////////////// API parameters /////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = NetworkACLItemResponse.class,
|
||||
required=true, description="the ID of the network ACL Item")
|
||||
private Long id;
|
||||
|
||||
@Parameter(name = ApiConstants.PROTOCOL, type = CommandType.STRING, description =
|
||||
"the protocol for the ACL rule. Valid values are TCP/UDP/ICMP/ALL or valid protocol number")
|
||||
private String protocol;
|
||||
|
||||
@Parameter(name = ApiConstants.START_PORT, type = CommandType.INTEGER, description = "the starting port of ACL")
|
||||
private Integer publicStartPort;
|
||||
|
||||
@Parameter(name = ApiConstants.END_PORT, type = CommandType.INTEGER, description = "the ending port of ACL")
|
||||
private Integer publicEndPort;
|
||||
|
||||
@Parameter(name = ApiConstants.CIDR_LIST, type = CommandType.LIST, collectionType = CommandType.STRING,
|
||||
description = "the cidr list to allow traffic from/to")
|
||||
private List<String> cidrlist;
|
||||
|
||||
@Parameter(name = ApiConstants.ICMP_TYPE, type = CommandType.INTEGER, description = "type of the icmp message being sent")
|
||||
private Integer icmpType;
|
||||
|
||||
@Parameter(name = ApiConstants.ICMP_CODE, type = CommandType.INTEGER, description = "error code for this icmp message")
|
||||
private Integer icmpCode;
|
||||
|
||||
@Parameter(name=ApiConstants.TRAFFIC_TYPE, type=CommandType.STRING, description="the traffic type for the ACL," +
|
||||
"can be Ingress or Egress, defaulted to Ingress if not specified")
|
||||
private String trafficType;
|
||||
|
||||
@Parameter(name=ApiConstants.NUMBER, type=CommandType.INTEGER, description="The network of the vm the ACL will be created for")
|
||||
private Integer number;
|
||||
|
||||
@Parameter(name=ApiConstants.ACTION, type=CommandType.STRING, description="scl entry action, allow or deny")
|
||||
private String action;
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
// ///////////////// Accessors ///////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getProtocol() {
|
||||
if(protocol != null){
|
||||
return protocol.trim();
|
||||
} else
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<String> getSourceCidrList() {
|
||||
return cidrlist;
|
||||
}
|
||||
|
||||
public NetworkACLItem.TrafficType getTrafficType() {
|
||||
if (trafficType != null) {
|
||||
for (NetworkACLItem.TrafficType type : NetworkACLItem.TrafficType.values()) {
|
||||
if (type.toString().equalsIgnoreCase(trafficType)) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
// ///////////// API Implementation///////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public Integer getNumber() {
|
||||
return number;
|
||||
}
|
||||
|
||||
public Integer getSourcePortStart() {
|
||||
return publicStartPort;
|
||||
}
|
||||
|
||||
public Integer getSourcePortEnd() {
|
||||
return publicEndPort;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Account caller = UserContext.current().getCaller();
|
||||
return caller.getAccountId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventType() {
|
||||
return EventTypes.EVENT_NETWORK_ACL_ITEM_UPDATE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventDescription() {
|
||||
return "Updating Network ACL Item";
|
||||
}
|
||||
|
||||
public Integer getIcmpCode() {
|
||||
return icmpCode;
|
||||
}
|
||||
|
||||
public Integer getIcmpType() {
|
||||
return icmpType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() throws ResourceUnavailableException {
|
||||
UserContext.current().setEventDetails("Rule Id: " + getId());
|
||||
NetworkACLItem aclItem = _networkACLService.updateNetworkACLItem(getId(), getProtocol(), getSourceCidrList(), getTrafficType(),
|
||||
getAction(), getNumber(), getSourcePortStart(), getSourcePortEnd(), getIcmpCode(), getIcmpType());
|
||||
if (aclItem == null) {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update network ACL Item");
|
||||
}
|
||||
NetworkACLItemResponse aclResponse = _responseGenerator.createNetworkACLItemResponse(aclItem);
|
||||
setResponseObject(aclResponse);
|
||||
aclResponse.setResponseName(getCommandName());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -67,6 +67,9 @@ public class UpdateNetworkCmd extends BaseAsyncCmd {
|
||||
@Parameter(name=ApiConstants.GUEST_VM_CIDR, type=CommandType.STRING, description="CIDR for Guest VMs,Cloudstack allocates IPs to Guest VMs only from this CIDR")
|
||||
private String guestVmCidr;
|
||||
|
||||
@Parameter(name=ApiConstants.DISPLAY_NETWORK, type=CommandType.BOOLEAN, description="an optional field, whether to the display the network to the end user or not.")
|
||||
private Boolean displayNetwork;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
@ -101,6 +104,10 @@ public class UpdateNetworkCmd extends BaseAsyncCmd {
|
||||
private String getGuestVmCidr() {
|
||||
return guestVmCidr;
|
||||
}
|
||||
|
||||
public Boolean getDisplayNetwork() {
|
||||
return displayNetwork;
|
||||
}
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
@ -130,7 +137,7 @@ public class UpdateNetworkCmd extends BaseAsyncCmd {
|
||||
}
|
||||
|
||||
Network result = _networkService.updateGuestNetwork(getId(), getNetworkName(), getDisplayText(), callerAccount,
|
||||
callerUser, getNetworkDomain(), getNetworkOfferingId(), getChangeCidr(), getGuestVmCidr());
|
||||
callerUser, getNetworkDomain(), getNetworkOfferingId(), getChangeCidr(), getGuestVmCidr(), getDisplayNetwork());
|
||||
|
||||
|
||||
if (result != null) {
|
||||
|
||||
@ -183,6 +183,8 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
|
||||
+ "Mutually exclusive with affinitygroupids parameter")
|
||||
private List<String> affinityGroupNameList;
|
||||
|
||||
@Parameter(name=ApiConstants.DISPLAY_VM, type=CommandType.BOOLEAN, since="4.2", description="an optional field, whether to the display the vm to the end user or not.")
|
||||
private Boolean displayVm;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
@ -219,6 +221,10 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
|
||||
return HypervisorType.getType(hypervisor);
|
||||
}
|
||||
|
||||
public Boolean getDisplayVm() {
|
||||
return displayVm;
|
||||
}
|
||||
|
||||
public List<Long> getSecurityGroupIdList() {
|
||||
if (securityGroupNameList != null && securityGroupIdList != null) {
|
||||
throw new InvalidParameterValueException("securitygroupids parameter is mutually exclusive with securitygroupnames parameter");
|
||||
@ -481,18 +487,20 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
|
||||
throw new InvalidParameterValueException("Can't specify network Ids in Basic zone");
|
||||
} else {
|
||||
vm = _userVmService.createBasicSecurityGroupVirtualMachine(zone, serviceOffering, template, getSecurityGroupIdList(), owner, name,
|
||||
displayName, diskOfferingId, size, group, getHypervisor(), this.getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, keyboard, getAffinityGroupIdList());
|
||||
displayName, diskOfferingId, size, group, getHypervisor(), this.getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, displayVm, keyboard, getAffinityGroupIdList());
|
||||
}
|
||||
} else {
|
||||
if (zone.isSecurityGroupEnabled()) {
|
||||
vm = _userVmService.createAdvancedSecurityGroupVirtualMachine(zone, serviceOffering, template, getNetworkIds(), getSecurityGroupIdList(),
|
||||
owner, name, displayName, diskOfferingId, size, group, getHypervisor(), this.getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, keyboard, getAffinityGroupIdList());
|
||||
owner, name, displayName, diskOfferingId, size, group, getHypervisor(), this.getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, displayVm, keyboard, getAffinityGroupIdList());
|
||||
|
||||
} else {
|
||||
if (getSecurityGroupIdList() != null && !getSecurityGroupIdList().isEmpty()) {
|
||||
throw new InvalidParameterValueException("Can't create vm with security groups; security group feature is not enabled per zone");
|
||||
}
|
||||
vm = _userVmService.createAdvancedVirtualMachine(zone, serviceOffering, template, getNetworkIds(), owner, name, displayName,
|
||||
diskOfferingId, size, group, getHypervisor(), this.getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, keyboard, getAffinityGroupIdList());
|
||||
diskOfferingId, size, group, getHypervisor(), this.getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, displayVm, keyboard, getAffinityGroupIdList());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -64,6 +64,8 @@ public class UpdateVMCmd extends BaseCmd{
|
||||
@Parameter(name=ApiConstants.USER_DATA, type=CommandType.STRING, description="an optional binary data that can be sent to the virtual machine upon a successful deployment. This binary data must be base64 encoded before adding it to the request. Using HTTP GET (via querystring), you can send up to 2KB of data after base64 encoding. Using HTTP POST(via POST body), you can send up to 32K of data after base64 encoding.", length=32768)
|
||||
private String userData;
|
||||
|
||||
@Parameter(name=ApiConstants.DISPLAY_VM, type=CommandType.BOOLEAN, description="an optional field, whether to the display the vm to the end user or not.")
|
||||
private Boolean displayVm;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
@ -89,6 +91,10 @@ public class UpdateVMCmd extends BaseCmd{
|
||||
return userData;
|
||||
}
|
||||
|
||||
public Boolean getDisplayVm() {
|
||||
return displayVm;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
@ -107,6 +113,7 @@ public class UpdateVMCmd extends BaseCmd{
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public long getEntityOwnerId() {
|
||||
UserVm userVm = _entityMgr.findById(UserVm.class, getId());
|
||||
if (userVm != null) {
|
||||
|
||||
@ -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.volume;
|
||||
|
||||
import com.cloud.server.ResourceTag;
|
||||
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.SuccessResponse;
|
||||
import org.apache.cloudstack.api.response.UserVmResponse;
|
||||
import org.apache.cloudstack.api.response.VolumeResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.storage.Volume;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.UserContext;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@APICommand(name = "addResourceDetail", description="Adds detail for the Resource.", responseObject=SuccessResponse.class)
|
||||
public class AddResourceDetailCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(AddResourceDetailCmd.class.getName());
|
||||
private static final String s_name = "addResourceDetailresponse";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, required=true, description = "Map of (key/value pairs)")
|
||||
private Map details;
|
||||
|
||||
@Parameter(name=ApiConstants.RESOURCE_TYPE, type=CommandType.STRING, required=true, description="type of the resource")
|
||||
private String resourceType;
|
||||
|
||||
@Parameter(name=ApiConstants.RESOURCE_ID, type=CommandType.STRING, required=true,
|
||||
collectionType=CommandType.STRING, description="resource id to create the details for")
|
||||
private String resourceId;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public Map getDetails() {
|
||||
Map<String, String> detailsMap = null;
|
||||
if (!details.isEmpty()) {
|
||||
detailsMap = new HashMap<String, String>();
|
||||
Collection<?> servicesCollection = details.values();
|
||||
Iterator<?> iter = servicesCollection.iterator();
|
||||
while (iter.hasNext()) {
|
||||
HashMap<String, String> services = (HashMap<String, String>) iter.next();
|
||||
String key = services.get("key");
|
||||
String value = services.get("value");
|
||||
detailsMap.put(key, value);
|
||||
}
|
||||
}
|
||||
return detailsMap;
|
||||
}
|
||||
|
||||
public ResourceTag.TaggedResourceType getResourceType() {
|
||||
return _taggedResourceService.getResourceType(resourceType);
|
||||
}
|
||||
|
||||
public String getResourceId() {
|
||||
return resourceId;
|
||||
}
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
//FIXME - validate the owner here
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventType() {
|
||||
return EventTypes.EVENT_RESOURCE_DETAILS_CREATE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventDescription() {
|
||||
return "adding details to the resource ";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
_resourceMetaDataService.addResourceMetaData(getResourceId(), getResourceType(), getDetails());
|
||||
this.setResponseObject(new SuccessResponse(getCommandName()));
|
||||
}
|
||||
}
|
||||
@ -76,8 +76,10 @@ public class CreateVolumeCmd extends BaseAsyncCreateCmd {
|
||||
description="the ID of the availability zone")
|
||||
private Long zoneId;
|
||||
|
||||
@Parameter(name=ApiConstants.DISPLAY_VOLUME, type=CommandType.BOOLEAN, description="an optional field, whether to display the volume to the end user or not.")
|
||||
private Boolean displayVolume;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ -114,6 +116,10 @@ public class CreateVolumeCmd extends BaseAsyncCreateCmd {
|
||||
return projectId;
|
||||
}
|
||||
|
||||
public Boolean getDisplayVolume() {
|
||||
return displayVolume;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ -0,0 +1,75 @@
|
||||
// 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.volume;
|
||||
|
||||
import com.cloud.server.ResourceTag;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.cloudstack.api.response.ResourceDetailResponse;
|
||||
import org.apache.cloudstack.api.response.ResourceTagResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@APICommand(name = "listResourceDetails", description = "List resource detail(s)", responseObject = ResourceTagResponse.class, since = "4.2")
|
||||
public class ListResourceDetailsCmd extends BaseListProjectAndAccountResourcesCmd{
|
||||
private static final String s_name = "listresourcedetailsresponse";
|
||||
|
||||
@Parameter(name=ApiConstants.RESOURCE_TYPE, type=CommandType.STRING, description="list by resource type")
|
||||
private String resourceType;
|
||||
|
||||
@Parameter(name=ApiConstants.RESOURCE_ID, type=CommandType.STRING, description="list by resource id")
|
||||
private String resourceId;
|
||||
|
||||
@Parameter(name=ApiConstants.KEY, type=CommandType.STRING, description="list by key")
|
||||
private String key;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
|
||||
ListResponse<ResourceDetailResponse> response = new ListResponse<ResourceDetailResponse>();
|
||||
List<ResourceDetailResponse> resourceDetailResponse = _queryService.listResource(this);
|
||||
response.setResponses(resourceDetailResponse);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
}
|
||||
|
||||
public ResourceTag.TaggedResourceType getResourceType() {
|
||||
return _taggedResourceService.getResourceType(resourceType);
|
||||
}
|
||||
|
||||
public String getResourceId() {
|
||||
return resourceId;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,110 @@
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for Removeitional 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.volume;
|
||||
|
||||
import com.cloud.server.ResourceTag;
|
||||
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.SuccessResponse;
|
||||
import org.apache.cloudstack.api.response.UserVmResponse;
|
||||
import org.apache.cloudstack.api.response.VolumeResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.storage.Volume;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.UserContext;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@APICommand(name = "removeResourceDetail", description="Removes detail for the Resource.", responseObject=SuccessResponse.class)
|
||||
public class RemoveResourceDetailCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(RemoveResourceDetailCmd.class.getName());
|
||||
private static final String s_name = "RemoveResourceDetailresponse";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name = ApiConstants.KEY, type = CommandType.STRING, description = "Delete details matching key/value pairs")
|
||||
private String key;
|
||||
|
||||
@Parameter(name=ApiConstants.RESOURCE_TYPE, type=CommandType.STRING, required=true, description="Delete detail by resource type")
|
||||
private String resourceType;
|
||||
|
||||
@Parameter(name=ApiConstants.RESOURCE_ID, type=CommandType.STRING, required=true,
|
||||
collectionType=CommandType.STRING, description="Delete details for resource id")
|
||||
private String resourceId;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
|
||||
public ResourceTag.TaggedResourceType getResourceType(){
|
||||
return _taggedResourceService.getResourceType(resourceType);
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public String getResourceId() {
|
||||
return resourceId;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.Volume;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
//FIXME - validate the owner here
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventType() {
|
||||
return EventTypes.EVENT_RESOURCE_DETAILS_DELETE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventDescription() {
|
||||
return "Removing detail to the volume ";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
_resourceMetaDataService.deleteResourceMetaData(getResourceId(), getResourceType(), getKey());
|
||||
this.setResponseObject(new SuccessResponse(getCommandName()));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,112 @@
|
||||
// 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.volume;
|
||||
|
||||
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.VolumeResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.storage.Volume;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.UserContext;
|
||||
|
||||
@APICommand(name = "updateVolume", description="Updates the volume.", responseObject=VolumeResponse.class)
|
||||
public class UpdateVolumeCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(UpdateVolumeCmd.class.getName());
|
||||
private static final String s_name = "addVolumeresponse";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=VolumeResponse.class,
|
||||
required=true, description="the ID of the disk volume")
|
||||
private Long id;
|
||||
|
||||
@Parameter(name=ApiConstants.PATH, type=CommandType.STRING,
|
||||
required=true, description="the path of the volume")
|
||||
private String path;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.Volume;
|
||||
}
|
||||
|
||||
public Long getInstanceId() {
|
||||
return getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Volume volume = _responseGenerator.findVolumeById(getId());
|
||||
if (volume == null) {
|
||||
return Account.ACCOUNT_ID_SYSTEM; // bad id given, parent this command to SYSTEM so ERROR events are tracked
|
||||
}
|
||||
return volume.getAccountId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventType() {
|
||||
return EventTypes.EVENT_VOLUME_ATTACH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventDescription() {
|
||||
return "adding detail to the volume: " + getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
UserContext.current().setEventDetails("Volume Id: "+getId());
|
||||
Volume result = _volumeService.updateVolume(this);
|
||||
if (result != null) {
|
||||
VolumeResponse response = _responseGenerator.createVolumeResponse(result);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update volume");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
@ -58,8 +58,20 @@ public class DiskOfferingResponse extends BaseResponse {
|
||||
@SerializedName("storagetype") @Param(description="the storage type for this disk offering")
|
||||
private String storageType;
|
||||
|
||||
@SerializedName("displayoffering") @Param(description="whether to display the offering to the end user or not.")
|
||||
private Boolean displayOffering;
|
||||
|
||||
public Boolean getDisplayOffering() {
|
||||
return displayOffering;
|
||||
}
|
||||
|
||||
public void setDisplayOffering(Boolean displayOffering) {
|
||||
this.displayOffering = displayOffering;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
|
||||
@ -153,9 +153,12 @@ 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")
|
||||
private Set<NicResponse> nics;
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,122 @@
|
||||
// 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.List;
|
||||
|
||||
import com.cloud.network.vpc.NetworkACLItem;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseResponse;
|
||||
|
||||
import com.cloud.serializer.Param;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import org.apache.cloudstack.api.EntityReference;
|
||||
|
||||
@EntityReference(value = NetworkACLItem.class)
|
||||
public class NetworkACLItemResponse extends BaseResponse {
|
||||
@SerializedName(ApiConstants.ID) @Param(description="the ID of the ACL Item")
|
||||
private String id;
|
||||
|
||||
@SerializedName(ApiConstants.PROTOCOL) @Param(description="the protocol of the ACL")
|
||||
private String protocol;
|
||||
|
||||
@SerializedName(ApiConstants.START_PORT) @Param(description="the starting port of ACL's port range")
|
||||
private String startPort;
|
||||
|
||||
@SerializedName(ApiConstants.END_PORT) @Param(description = "the ending port of ACL's port range")
|
||||
private String endPort;
|
||||
|
||||
@SerializedName(ApiConstants.TRAFFIC_TYPE) @Param(description="the traffic type for the ACL")
|
||||
private String trafficType;
|
||||
|
||||
@SerializedName(ApiConstants.STATE) @Param(description="the state of the rule")
|
||||
private String state;
|
||||
|
||||
@SerializedName(ApiConstants.CIDR_LIST) @Param(description="the cidr list to forward traffic from")
|
||||
private String cidrList;
|
||||
|
||||
@SerializedName(ApiConstants.ICMP_TYPE) @Param(description= "type of the icmp message being sent")
|
||||
private Integer icmpType;
|
||||
|
||||
@SerializedName(ApiConstants.ICMP_CODE) @Param(description = "error code for this icmp message")
|
||||
private Integer icmpCode;
|
||||
|
||||
@SerializedName(ApiConstants.TAGS) @Param(description="the list of resource tags associated with the network ACLs",
|
||||
responseObject = ResourceTagResponse.class)
|
||||
private List<ResourceTagResponse> tags;
|
||||
|
||||
@SerializedName(ApiConstants.ACL_ID) @Param(description="the ID of the ACL this item belongs to")
|
||||
private String aclId;
|
||||
|
||||
@SerializedName(ApiConstants.NUMBER) @Param(description= "Number of the ACL Item")
|
||||
private Integer number;
|
||||
|
||||
@SerializedName(ApiConstants.ACTION) @Param(description="Action of ACL Item. Allow/Deny")
|
||||
private String action;
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setProtocol(String protocol) {
|
||||
this.protocol = protocol;
|
||||
}
|
||||
|
||||
public void setStartPort(String startPort) {
|
||||
this.startPort = startPort;
|
||||
}
|
||||
|
||||
public void setEndPort(String endPort) {
|
||||
this.endPort = endPort;
|
||||
}
|
||||
|
||||
public void setState(String state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public void setCidrList(String cidrList) {
|
||||
this.cidrList = cidrList;
|
||||
}
|
||||
|
||||
public void setIcmpType(Integer icmpType) {
|
||||
this.icmpType = icmpType;
|
||||
}
|
||||
|
||||
public void setIcmpCode(Integer icmpCode) {
|
||||
this.icmpCode = icmpCode;
|
||||
}
|
||||
|
||||
public void setTrafficType(String trafficType) {
|
||||
this.trafficType = trafficType;
|
||||
}
|
||||
|
||||
public void setTags(List<ResourceTagResponse> tags) {
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
public void setAclId(String aclId) {
|
||||
this.aclId = aclId;
|
||||
}
|
||||
|
||||
public void setNumber(Integer number) {
|
||||
this.number = number;
|
||||
}
|
||||
|
||||
public void setAction(String action) {
|
||||
this.action = action;
|
||||
}
|
||||
}
|
||||
@ -16,84 +16,42 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.response;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseResponse;
|
||||
|
||||
import com.cloud.network.vpc.NetworkACL;
|
||||
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;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
import java.util.List;
|
||||
|
||||
@EntityReference(value = NetworkACL.class)
|
||||
public class NetworkACLResponse extends BaseResponse {
|
||||
@SerializedName(ApiConstants.ID) @Param(description="the ID of the ACL")
|
||||
private String id;
|
||||
|
||||
@SerializedName(ApiConstants.PROTOCOL) @Param(description="the protocol of the ACL")
|
||||
private String protocol;
|
||||
@SerializedName(ApiConstants.NAME) @Param(description="the Name of the ACL")
|
||||
private String name;
|
||||
|
||||
@SerializedName(ApiConstants.START_PORT) @Param(description="the starting port of ACL's port range")
|
||||
private String startPort;
|
||||
@SerializedName(ApiConstants.DESCRIPTION) @Param(description="Description of the ACL")
|
||||
private String description;
|
||||
|
||||
@SerializedName(ApiConstants.END_PORT) @Param(description = "the ending port of ACL's port range")
|
||||
private String endPort;
|
||||
|
||||
@SerializedName(ApiConstants.TRAFFIC_TYPE) @Param(description="the traffic type for the ACL")
|
||||
private String trafficType;
|
||||
|
||||
@SerializedName(ApiConstants.STATE) @Param(description="the state of the rule")
|
||||
private String state;
|
||||
|
||||
@SerializedName(ApiConstants.CIDR_LIST) @Param(description="the cidr list to forward traffic from")
|
||||
private String cidrList;
|
||||
|
||||
@SerializedName(ApiConstants.ICMP_TYPE) @Param(description= "type of the icmp message being sent")
|
||||
private Integer icmpType;
|
||||
|
||||
@SerializedName(ApiConstants.ICMP_CODE) @Param(description = "error code for this icmp message")
|
||||
private Integer icmpCode;
|
||||
|
||||
@SerializedName(ApiConstants.TAGS) @Param(description="the list of resource tags associated with the network ACLs",
|
||||
responseObject = ResourceTagResponse.class)
|
||||
private List<ResourceTagResponse> tags;
|
||||
@SerializedName(ApiConstants.VPC_ID) @Param(description="Id of the VPC this ACL is associated with")
|
||||
private String vpcId;
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setProtocol(String protocol) {
|
||||
this.protocol = protocol;
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setStartPort(String startPort) {
|
||||
this.startPort = startPort;
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public void setEndPort(String endPort) {
|
||||
this.endPort = endPort;
|
||||
}
|
||||
|
||||
public void setState(String state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public void setCidrList(String cidrList) {
|
||||
this.cidrList = cidrList;
|
||||
}
|
||||
|
||||
public void setIcmpType(Integer icmpType) {
|
||||
this.icmpType = icmpType;
|
||||
}
|
||||
|
||||
public void setIcmpCode(Integer icmpCode) {
|
||||
this.icmpCode = icmpCode;
|
||||
}
|
||||
|
||||
public void setTrafficType(String trafficType) {
|
||||
this.trafficType = trafficType;
|
||||
}
|
||||
|
||||
public void setTags(List<ResourceTagResponse> tags) {
|
||||
this.tags = tags;
|
||||
public void setVpcId(String vpcId) {
|
||||
this.vpcId = vpcId;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
@ -84,6 +85,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;
|
||||
}
|
||||
@ -157,4 +162,8 @@ public class NetworkOfferingResponse extends BaseResponse {
|
||||
this.isPersistent = isPersistent;
|
||||
}
|
||||
|
||||
public void setDetails(Map details) {
|
||||
this.details = details;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -163,6 +163,17 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes
|
||||
@SerializedName(ApiConstants.IP6_CIDR) @Param(description="the cidr of IPv6 network")
|
||||
private String ip6Cidr;
|
||||
|
||||
@SerializedName(ApiConstants.DISPLAY_NETWORK) @Param(description="an optional field, whether to the display the network to the end user or not.")
|
||||
private Boolean displayNetwork;
|
||||
|
||||
public Boolean getDisplayNetwork() {
|
||||
return displayNetwork;
|
||||
}
|
||||
|
||||
public void setDisplayNetwork(Boolean displayNetwork) {
|
||||
this.displayNetwork = displayNetwork;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@ -0,0 +1,81 @@
|
||||
// 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.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseResponse;
|
||||
import org.apache.cloudstack.api.EntityReference;
|
||||
|
||||
import com.cloud.serializer.Param;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class NicDetailResponse extends BaseResponse{
|
||||
@SerializedName(ApiConstants.ID)
|
||||
@Param(description = "ID of the nic")
|
||||
private String id;
|
||||
|
||||
@SerializedName(ApiConstants.NAME)
|
||||
@Param(description = "name of the nic detail")
|
||||
private String name;
|
||||
|
||||
|
||||
@SerializedName(ApiConstants.VALUE)
|
||||
@Param(description = "value of the nic detail")
|
||||
private String value;
|
||||
|
||||
@SerializedName(ApiConstants.DISPLAY_NIC) @Param(description="an optional field whether to the display the nic to the end user or not.")
|
||||
private Boolean displayNic;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Boolean getDisplayNic() {
|
||||
return displayNic;
|
||||
}
|
||||
|
||||
public void setDisplayNic(Boolean displayNic) {
|
||||
this.displayNic = displayNic;
|
||||
}
|
||||
}
|
||||
@ -80,6 +80,10 @@ public class PrivateGatewayResponse extends BaseResponse implements ControlledEn
|
||||
private Boolean sourceNat;
|
||||
|
||||
|
||||
@SerializedName(ApiConstants.ACL_ID) @Param(description = "ACL Id set for private gateway")
|
||||
private String aclId;
|
||||
|
||||
|
||||
@Override
|
||||
public String getObjectId() {
|
||||
return this.id;
|
||||
@ -154,6 +158,11 @@ public class PrivateGatewayResponse extends BaseResponse implements ControlledEn
|
||||
this.sourceNat = sourceNat;
|
||||
}
|
||||
|
||||
public void setAclId(String aclId) {
|
||||
this.aclId = aclId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,81 @@
|
||||
// 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.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseResponse;
|
||||
import org.apache.cloudstack.api.EntityReference;
|
||||
|
||||
import com.cloud.serializer.Param;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class ResourceDetailResponse extends BaseResponse{
|
||||
@SerializedName(ApiConstants.RESOURCE_ID)
|
||||
@Param(description = "ID of the resource")
|
||||
private String resourceId;
|
||||
|
||||
@SerializedName(ApiConstants.RESOURCE_TYPE)
|
||||
@Param(description = "ID of the resource")
|
||||
private String resourceType;
|
||||
|
||||
@SerializedName(ApiConstants.KEY)
|
||||
@Param(description = "key of the resource detail")
|
||||
private String name;
|
||||
|
||||
|
||||
@SerializedName(ApiConstants.VALUE)
|
||||
@Param(description = "value of the resource detail")
|
||||
private String value;
|
||||
|
||||
public String getResourceId() {
|
||||
return resourceId;
|
||||
}
|
||||
|
||||
public void setResourceId(String resourceId) {
|
||||
this.resourceId = resourceId;
|
||||
}
|
||||
|
||||
public String getResourceType() {
|
||||
return resourceType;
|
||||
}
|
||||
|
||||
public void setResourceType(String resourceType) {
|
||||
this.resourceType = resourceType;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
@ -177,6 +177,9 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp
|
||||
@Param(description = "list of affinity groups associated with the virtual machine", responseObject = AffinityGroupResponse.class)
|
||||
private Set<AffinityGroupResponse> affinityGroupList;
|
||||
|
||||
@SerializedName(ApiConstants.DISPLAY_VM) @Param(description="an optional field whether to the display the vm to the end user or not.")
|
||||
private Boolean displayVm;
|
||||
|
||||
public UserVmResponse(){
|
||||
securityGroupList = new LinkedHashSet<SecurityGroupResponse>();
|
||||
nics = new LinkedHashSet<NicResponse>();
|
||||
@ -196,7 +199,13 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public Boolean getDisplayVm() {
|
||||
return displayVm;
|
||||
}
|
||||
|
||||
public void setDisplayVm(Boolean displayVm) {
|
||||
this.displayVm = displayVm;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getObjectId() {
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -0,0 +1,82 @@
|
||||
// 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.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseResponse;
|
||||
import org.apache.cloudstack.api.EntityReference;
|
||||
|
||||
import com.cloud.serializer.Param;
|
||||
import com.cloud.storage.Volume;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class VolumeDetailResponse extends BaseResponse{
|
||||
@SerializedName(ApiConstants.ID)
|
||||
@Param(description = "ID of the volume")
|
||||
private String id;
|
||||
|
||||
@SerializedName(ApiConstants.NAME)
|
||||
@Param(description = "name of the volume detail")
|
||||
private String name;
|
||||
|
||||
|
||||
@SerializedName(ApiConstants.VALUE)
|
||||
@Param(description = "value of the volume detail")
|
||||
private String value;
|
||||
|
||||
@SerializedName(ApiConstants.DISPLAY_VOLUME) @Param(description="an optional field whether to the display the volume to the end user or not.")
|
||||
private Boolean displayVm;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Boolean getDisplayVm() {
|
||||
return displayVm;
|
||||
}
|
||||
|
||||
public void setDisplayVm(Boolean displayVm) {
|
||||
this.displayVm = displayVm;
|
||||
}
|
||||
}
|
||||
@ -165,6 +165,9 @@ public class VolumeResponse extends BaseResponse implements ControlledViewEntity
|
||||
@SerializedName(ApiConstants.TAGS) @Param(description="the list of resource tags associated with volume", responseObject = ResourceTagResponse.class)
|
||||
private Set<ResourceTagResponse> tags;
|
||||
|
||||
@SerializedName(ApiConstants.DISPLAY_VOLUME) @Param(description="an optional field whether to the display the volume to the end user or not.")
|
||||
private Boolean displayVm;
|
||||
|
||||
public VolumeResponse(){
|
||||
tags = new LinkedHashSet<ResourceTagResponse>();
|
||||
}
|
||||
@ -324,4 +327,13 @@ public class VolumeResponse extends BaseResponse implements ControlledViewEntity
|
||||
public void addTag(ResourceTagResponse tag){
|
||||
this.tags.add(tag);
|
||||
}
|
||||
|
||||
public Boolean getDisplayVm() {
|
||||
return displayVm;
|
||||
}
|
||||
|
||||
public void setDisplayVm(Boolean displayVm) {
|
||||
this.displayVm = displayVm;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
// 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.lb;
|
||||
|
||||
import com.cloud.network.rules.LoadBalancerContainer;
|
||||
import com.cloud.utils.net.Ip;
|
||||
|
||||
public interface ApplicationLoadBalancerContainer extends LoadBalancerContainer{
|
||||
|
||||
public Long getSourceIpNetworkId();
|
||||
|
||||
public Ip getSourceIp();
|
||||
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
// 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.lb;
|
||||
|
||||
import com.cloud.network.rules.LoadBalancer;
|
||||
|
||||
public interface ApplicationLoadBalancerRule extends ApplicationLoadBalancerContainer, LoadBalancer{
|
||||
int getInstancePort();
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
// 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.lb;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.ListApplicationLoadBalancersCmd;
|
||||
|
||||
import com.cloud.exception.InsufficientAddressCapacityException;
|
||||
import com.cloud.exception.InsufficientVirtualNetworkCapcityException;
|
||||
import com.cloud.exception.NetworkRuleConflictException;
|
||||
import com.cloud.network.rules.LoadBalancerContainer.Scheme;
|
||||
import com.cloud.utils.Pair;
|
||||
|
||||
public interface ApplicationLoadBalancerService {
|
||||
|
||||
ApplicationLoadBalancerRule createApplicationLoadBalancer(String name, String description, Scheme scheme, long sourceIpNetworkId, String sourceIp,
|
||||
int sourcePort, int instancePort, String algorithm, long networkId, long lbOwnerId) throws InsufficientAddressCapacityException,
|
||||
NetworkRuleConflictException, InsufficientVirtualNetworkCapcityException;
|
||||
|
||||
boolean deleteApplicationLoadBalancer(long id);
|
||||
|
||||
Pair<List<? extends ApplicationLoadBalancerRule>, Integer> listApplicationLoadBalancers(ListApplicationLoadBalancersCmd cmd);
|
||||
|
||||
ApplicationLoadBalancerRule getApplicationLoadBalancer(long ruleId);
|
||||
|
||||
}
|
||||
@ -14,38 +14,21 @@
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.network.firewall;
|
||||
package org.apache.cloudstack.network.lb;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.api.command.user.network.ListNetworkACLsCmd;
|
||||
|
||||
import com.cloud.exception.NetworkRuleConflictException;
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.rules.FirewallRule;
|
||||
import com.cloud.exception.StorageUnavailableException;
|
||||
import com.cloud.network.router.VirtualRouter;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.utils.Pair;
|
||||
|
||||
public interface NetworkACLService {
|
||||
FirewallRule getNetworkACL(long ruleId);
|
||||
boolean applyNetworkACLs(long networkId, Account caller) throws ResourceUnavailableException;
|
||||
public interface InternalLoadBalancerVMService {
|
||||
|
||||
/**
|
||||
* @param createNetworkACLCmd
|
||||
* @return
|
||||
*/
|
||||
FirewallRule createNetworkACL(FirewallRule acl) throws NetworkRuleConflictException;
|
||||
/**
|
||||
* @param ruleId
|
||||
* @param apply
|
||||
* @return
|
||||
*/
|
||||
boolean revokeNetworkACL(long ruleId, boolean apply);
|
||||
/**
|
||||
* @param listNetworkACLsCmd
|
||||
* @return
|
||||
*/
|
||||
Pair<List<? extends FirewallRule>, Integer> listNetworkACLs(ListNetworkACLsCmd cmd);
|
||||
VirtualRouter startInternalLbVm(long internalLbVmId, Account caller, long callerUserId)
|
||||
throws StorageUnavailableException, InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException;
|
||||
|
||||
VirtualRouter stopInternalLbVm(long vmId, boolean forced, Account caller, long callerUserId)
|
||||
throws ConcurrentOperationException, ResourceUnavailableException;
|
||||
|
||||
}
|
||||
@ -18,6 +18,7 @@ package org.apache.cloudstack.query;
|
||||
|
||||
import org.apache.cloudstack.affinity.AffinityGroupResponse;
|
||||
import org.apache.cloudstack.api.command.admin.host.ListHostsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.internallb.ListInternalLBVMsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.router.ListRoutersCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.ListImageStoresCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.ListStoragePoolsCmd;
|
||||
@ -36,6 +37,7 @@ import org.apache.cloudstack.api.command.user.tag.ListTagsCmd;
|
||||
import org.apache.cloudstack.api.command.user.template.ListTemplatesCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.ListVMsCmd;
|
||||
import org.apache.cloudstack.api.command.user.vmgroup.ListVMGroupsCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.ListResourceDetailsCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.ListVolumesCmd;
|
||||
import org.apache.cloudstack.api.command.user.zone.ListZonesByCmd;
|
||||
import org.apache.cloudstack.api.response.AccountResponse;
|
||||
@ -59,9 +61,12 @@ import org.apache.cloudstack.api.response.UserResponse;
|
||||
import org.apache.cloudstack.api.response.UserVmResponse;
|
||||
import org.apache.cloudstack.api.response.VolumeResponse;
|
||||
import org.apache.cloudstack.api.response.ZoneResponse;
|
||||
import org.apache.cloudstack.api.response.*;
|
||||
|
||||
import com.cloud.exception.PermissionDeniedException;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Service used for list api query.
|
||||
*
|
||||
@ -111,4 +116,9 @@ public interface QueryService {
|
||||
public ListResponse<TemplateResponse> listIsos(ListIsosCmd cmd);
|
||||
public ListResponse<AffinityGroupResponse> listAffinityGroups(Long affinityGroupId, String affinityGroupName,
|
||||
String affinityGroupType, Long vmId, Long startIndex, Long pageSize);
|
||||
|
||||
public List<ResourceDetailResponse> listResource(ListResourceDetailsCmd cmd);
|
||||
|
||||
ListResponse<DomainRouterResponse> searchForInternalLbVms(ListInternalLBVMsCmd cmd);
|
||||
|
||||
}
|
||||
|
||||
@ -85,6 +85,11 @@
|
||||
<artifactId>cloud-plugin-network-midonet</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-plugin-network-internallb</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-plugin-hypervisor-xen</artifactId>
|
||||
|
||||
@ -251,6 +251,8 @@
|
||||
<bean id="mockVMDaoImpl" class="com.cloud.simulator.dao.MockVMDaoImpl" />
|
||||
<bean id="mockVolumeDaoImpl" class="com.cloud.simulator.dao.MockVolumeDaoImpl" />
|
||||
<bean id="networkAccountDaoImpl" class="com.cloud.network.dao.NetworkAccountDaoImpl" />
|
||||
<bean id="networkACLDaoImpl" class="com.cloud.network.vpc.dao.NetworkACLDaoImpl" />
|
||||
<bean id="networkACLItemDaoImpl" class="com.cloud.network.vpc.dao.NetworkACLItemDaoImpl" />
|
||||
<bean id="networkDaoImpl" class="com.cloud.network.dao.NetworkDaoImpl" />
|
||||
<bean id="networkDomainDaoImpl" class="com.cloud.network.dao.NetworkDomainDaoImpl" />
|
||||
<bean id="networkExternalFirewallDaoImpl" class="com.cloud.network.dao.NetworkExternalFirewallDaoImpl" />
|
||||
@ -261,7 +263,9 @@
|
||||
<bean id="networkRuleConfigDaoImpl" class="com.cloud.network.dao.NetworkRuleConfigDaoImpl" />
|
||||
<bean id="networkServiceMapDaoImpl" class="com.cloud.network.dao.NetworkServiceMapDaoImpl" />
|
||||
<bean id="nicDaoImpl" class="com.cloud.vm.dao.NicDaoImpl" />
|
||||
<bean id="nicDetailDaoImpl" class="com.cloud.vm.dao.NicDetailDaoImpl" />
|
||||
<bean id="nicSecondaryIpDaoImpl" class="com.cloud.vm.dao.NicSecondaryIpDaoImpl" />
|
||||
<bean id="nicIpAliasDaoImpl" class="com.cloud.vm.dao.NicIpAliasDaoImpl" />
|
||||
<bean id="objectInDataStoreDaoImpl" class="org.apache.cloudstack.storage.db.ObjectInDataStoreDaoImpl" />
|
||||
<bean id="ovsTunnelInterfaceDaoImpl" class="com.cloud.network.ovs.dao.OvsTunnelInterfaceDaoImpl" />
|
||||
<bean id="ovsTunnelNetworkDaoImpl" class="com.cloud.network.ovs.dao.OvsTunnelNetworkDaoImpl" />
|
||||
@ -359,6 +363,7 @@
|
||||
<bean id="vmRulesetLogDaoImpl" class="com.cloud.network.security.dao.VmRulesetLogDaoImpl" />
|
||||
<bean id="volumeDao2Impl" class="org.apache.cloudstack.storage.volume.db.VolumeDao2Impl" />
|
||||
<bean id="volumeDaoImpl" class="com.cloud.storage.dao.VolumeDaoImpl" />
|
||||
<bean id="volumeDetailsDaoImpl" class="com.cloud.storage.dao.VolumeDetailsDaoImpl" />
|
||||
<bean id="volumeHostDaoImpl" class="com.cloud.storage.dao.VolumeHostDaoImpl" />
|
||||
<bean id="volumeJoinDaoImpl" class="com.cloud.api.query.dao.VolumeJoinDaoImpl" />
|
||||
<bean id="volumeReservationDaoImpl" class="org.apache.cloudstack.engine.cloud.entity.api.db.dao.VolumeReservationDaoImpl" />
|
||||
@ -368,6 +373,9 @@
|
||||
<bean id="vpcOfferingServiceMapDaoImpl" class="com.cloud.network.vpc.dao.VpcOfferingServiceMapDaoImpl" />
|
||||
<bean id="vpcServiceMapDaoImpl" class="com.cloud.network.vpc.dao.VpcServiceMapDaoImpl" />
|
||||
<bean id="vpnUserDaoImpl" class="com.cloud.network.dao.VpnUserDaoImpl" />
|
||||
<bean id="applicationLbRuleDaoImpl" class="org.apache.cloudstack.lb.dao.ApplicationLoadBalancerRuleDaoImpl" />
|
||||
<bean id="networkOfferingDetailsDaoImpl" class="com.cloud.offerings.dao.NetworkOfferingDetailsDaoImpl" />
|
||||
|
||||
|
||||
<!--
|
||||
Checkers
|
||||
@ -411,10 +419,12 @@
|
||||
<bean id="VpcVirtualRouter" class="com.cloud.network.element.VpcVirtualRouterElement">
|
||||
<property name="name" value="VpcVirtualRouter"/>
|
||||
</bean>
|
||||
|
||||
<bean id="elasticLoadBalancerElement" class="com.cloud.network.element.ElasticLoadBalancerElement">
|
||||
<property name="name" value="ElasticLoadBalancerElement"/>
|
||||
</bean>
|
||||
<bean id="InternalLbVm" class="org.apache.cloudstack.network.element.InternalLoadBalancerElement">
|
||||
<property name="name" value="InternalLbVm"/>
|
||||
</bean>
|
||||
|
||||
<!--
|
||||
General allocators
|
||||
@ -688,6 +698,7 @@
|
||||
<bean id="keystoreManagerImpl" class="com.cloud.keystore.KeystoreManagerImpl" />
|
||||
<bean id="loadBalancingRulesManagerImpl" class="com.cloud.network.lb.LoadBalancingRulesManagerImpl" />
|
||||
<bean id="networkACLManagerImpl" class="com.cloud.network.vpc.NetworkACLManagerImpl" />
|
||||
<bean id="networkACLServiceImpl" class="com.cloud.network.vpc.NetworkACLServiceImpl" />
|
||||
<bean id="networkServiceImpl" class="com.cloud.network.NetworkServiceImpl" />
|
||||
<bean id="networkUsageManagerImpl" class="com.cloud.network.NetworkUsageManagerImpl" />
|
||||
<bean id="oCFS2ManagerImpl" class="com.cloud.storage.OCFS2ManagerImpl" />
|
||||
@ -707,6 +718,7 @@
|
||||
<bean id="swiftManagerImpl" class="com.cloud.storage.swift.SwiftManagerImpl" />
|
||||
<bean id="syncQueueManagerImpl" class="com.cloud.async.SyncQueueManagerImpl" />
|
||||
<bean id="taggedResourceManagerImpl" class="com.cloud.tags.TaggedResourceManagerImpl" />
|
||||
<bean id="resourceMetaDataManagerImpl" class="com.cloud.metadata.ResourceMetaDataManagerImpl" />
|
||||
<bean id="templateManagerImpl" class="com.cloud.template.TemplateManagerImpl" />
|
||||
<bean id="uploadMonitorImpl" class="com.cloud.storage.upload.UploadMonitorImpl" />
|
||||
<bean id="usageServiceImpl" class="com.cloud.usage.UsageServiceImpl" />
|
||||
@ -798,6 +810,8 @@
|
||||
<bean id="cloudStackImageStoreProviderImpl" class="org.apache.cloudstack.storage.datastore.provider.CloudStackImageStoreProviderImpl" />
|
||||
<bean id="s3ImageStoreProviderImpl" class="org.apache.cloudstack.storage.datastore.provider.S3ImageStoreProviderImpl" />
|
||||
<bean id="swiftImageStoreProviderImpl" class="org.apache.cloudstack.storage.datastore.provider.SwiftImageStoreProviderImpl" />
|
||||
<bean id="ApplicationLoadBalancerService" class="org.apache.cloudstack.network.lb.ApplicationLoadBalancerManagerImpl" />
|
||||
<bean id="InternalLoadBalancerVMManager" class="org.apache.cloudstack.network.lb.InternalLoadBalancerVMManagerImpl" />
|
||||
|
||||
|
||||
<!--=======================================================================================================-->
|
||||
|
||||
@ -67,7 +67,7 @@ getVMPassword=15
|
||||
restoreVirtualMachine=15
|
||||
changeServiceForVirtualMachine=15
|
||||
scaleVirtualMachine=15
|
||||
assignVirtualMachine=1
|
||||
assignVirtualMachine=7
|
||||
migrateVirtualMachine=1
|
||||
migrateVirtualMachineWithVolume=1
|
||||
recoverVirtualMachine=7
|
||||
@ -278,6 +278,11 @@ listVolumes=15
|
||||
extractVolume=15
|
||||
migrateVolume=15
|
||||
resizeVolume=15
|
||||
updateVolume=1
|
||||
addVolumeDetail=1
|
||||
updateVolumeDetail=1
|
||||
removeVolumeDetail=1
|
||||
listVolumeDetails=1
|
||||
|
||||
#### registration command: FIXME -- this really should be something in management server that
|
||||
#### generates a new key for the user and they just have to
|
||||
@ -348,6 +353,10 @@ updateNetwork=15
|
||||
addNicToVirtualMachine=15
|
||||
removeNicFromVirtualMachine=15
|
||||
updateDefaultNicForVirtualMachine=15
|
||||
addNicDetail=1
|
||||
updateNicDetail=1
|
||||
removeNicDetail=1
|
||||
listNicDetails=1
|
||||
|
||||
####
|
||||
addIpToNic=15
|
||||
@ -439,8 +448,14 @@ deletePrivateGateway=1
|
||||
|
||||
#### Network ACL commands
|
||||
createNetworkACL=15
|
||||
updateNetworkACLItem=15
|
||||
deleteNetworkACL=15
|
||||
listNetworkACLs=15
|
||||
createNetworkACLList=15
|
||||
deleteNetworkACLList=15
|
||||
replaceNetworkACLList=15
|
||||
listNetworkACLLists=15
|
||||
|
||||
|
||||
#### Static route commands
|
||||
createStaticRoute=15
|
||||
@ -452,6 +467,11 @@ createTags=15
|
||||
deleteTags=15
|
||||
listTags=15
|
||||
|
||||
#### Meta Data commands
|
||||
addResourceDetail=1
|
||||
removeResourceDetail=1
|
||||
listResourceDetails=1
|
||||
|
||||
### Site-to-site VPN commands
|
||||
createVpnCustomerGateway=15
|
||||
createVpnGateway=15
|
||||
@ -583,6 +603,17 @@ revertToVMSnapshot=15
|
||||
#### Baremetal commands
|
||||
addBaremetalHost=1
|
||||
|
||||
#### New Load Balancer commands
|
||||
createLoadBalancer=15
|
||||
listLoadBalancers=15
|
||||
deleteLoadBalancer=15
|
||||
|
||||
#Internal Load Balancer Element commands
|
||||
configureInternalLoadBalancerElement=7
|
||||
createInternalLoadBalancerElement=7
|
||||
listInternalLoadBalancerElements=7
|
||||
|
||||
|
||||
#### Affinity group commands
|
||||
createAffinityGroup=15
|
||||
deleteAffinityGroup=15
|
||||
@ -600,5 +631,10 @@ addCiscoAsa1000vResource=1
|
||||
deleteCiscoAsa1000vResource=1
|
||||
listCiscoAsa1000vResources=1
|
||||
|
||||
#### Internal LB VM commands
|
||||
stopInternalLoadBalancerVM=1
|
||||
startInternalLoadBalancerVM=1
|
||||
listInternalLoadBalancerVMs=1
|
||||
|
||||
### Network Isolation methods listing
|
||||
listNetworkIsolationMethods=1
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user