mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Merge branch 'master' into marvin
Conflicts: test/integration/component/test_base_image_updation.py test/integration/component/test_cpu_domain_limits.py test/integration/component/test_cpu_limits.py test/integration/component/test_cpu_project_limits.py test/integration/component/test_ip_reservation.py test/integration/component/test_memory_limits.py test/integration/component/test_mm_domain_limits.py test/integration/component/test_mm_project_limits.py test/integration/component/test_persistent_networks.py test/integration/component/test_portable_ip.py test/integration/component/test_routers.py test/integration/smoke/test_deploy_vm.py test/integration/smoke/test_deploy_vm_with_userdata.py test/integration/smoke/test_internal_lb.py test/integration/smoke/test_vm_life_cycle.py test/integration/smoke/test_volumes.py tools/marvin/marvin/codes.py tools/marvin/marvin/configGenerator.py tools/marvin/marvin/lib/base.py tools/marvin/marvin/lib/common.py tools/marvin/marvin/lib/utils.py
This commit is contained in:
commit
0e223d6787
1
.gitignore
vendored
1
.gitignore
vendored
@ -64,6 +64,7 @@ awsapi/modules/*
|
||||
.settings.xml
|
||||
.settings/
|
||||
db.properties.override
|
||||
replace.properties.override
|
||||
awsapi/overlays/
|
||||
tools/marvin/marvin/cloudstackAPI/*
|
||||
*.egg-info/
|
||||
|
||||
34
LICENSE
34
LICENSE
@ -1,4 +1,4 @@
|
||||
Copyright (c) 2013 The Apache Software Foundation
|
||||
Copyright (c) 2014 The Apache Software Foundation
|
||||
|
||||
|
||||
Apache License
|
||||
@ -207,38 +207,6 @@ Within the console-proxy/js directory
|
||||
from John Resig
|
||||
jquery.js
|
||||
|
||||
Within the deps directory
|
||||
licensed under the BSD (2-clause) for XenServerJava http://www.opensource.org/licenses/BSD-2-Clause (as follows)
|
||||
|
||||
Copyright (c) Citrix Systems, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
1) Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2) Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
from Citrix Systems, Inc http://www.citrix.com/
|
||||
XenServerJava from http://community.citrix.com/cdn/xs/sdks/
|
||||
|
||||
Within the patches/systemvm/debian/config/etc directory
|
||||
placed in the public domain
|
||||
|
||||
3
NOTICE
3
NOTICE
@ -1,4 +1,5 @@
|
||||
|
||||
Apache CloudStack
|
||||
Copyright 2014 The Apache Software Foundation
|
||||
|
||||
This product includes software developed at
|
||||
The Apache Software Foundation (http://www.apache.org/).
|
||||
|
||||
@ -70,6 +70,17 @@ domr.scripts.dir=scripts/network/domr/kvm
|
||||
# In MegaBytes per second
|
||||
#vm.migrate.speed=0
|
||||
|
||||
# set target downtime at end of livemigration, the 'hiccup' for final copy. Higher numbers
|
||||
# make livemigration easier, lower numbers may cause migration to never complete. Less than 1
|
||||
# means hypervisor default (20ms).
|
||||
#vm.migrate.downtime=0
|
||||
|
||||
# Busy VMs may never finish migrating, depending on environment. When its available, we will
|
||||
# want to add support for autoconvergence migration flag which should fix this. Set an upper
|
||||
# limit in milliseconds for how long live migration should wait, at which point VM is paused and
|
||||
# migration will finish quickly. Less than 1 means disabled.
|
||||
#vm.migrate.pauseafter=0
|
||||
|
||||
# set the type of bridge used on the hypervisor, this defines what commands the resource
|
||||
# will use to setup networking. Currently supported NATIVE, OPENVSWITCH
|
||||
#network.bridge.type=native
|
||||
|
||||
@ -24,12 +24,10 @@
|
||||
|
||||
. /etc/rc.d/init.d/functions
|
||||
|
||||
whatami=cloud-agent
|
||||
|
||||
# set environment variables
|
||||
|
||||
SHORTNAME="$whatami"
|
||||
PIDFILE=@PIDDIR@/"$whatami".pid
|
||||
SHORTNAME=`basename $0`
|
||||
PIDFILE=@PIDDIR@/"$SHORTNAME".pid
|
||||
LOCKFILE=@LOCKDIR@/"$SHORTNAME"
|
||||
LOGFILE=@AGENTLOG@
|
||||
PROGNAME="Cloud Agent"
|
||||
@ -114,7 +112,7 @@ case "$1" in
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $whatami {start|stop|restart|condrestart|status|help}"
|
||||
echo $"Usage: $SHORTNAME {start|stop|restart|condrestart|status|help}"
|
||||
RETVAL=3
|
||||
esac
|
||||
|
||||
|
||||
@ -24,12 +24,10 @@
|
||||
|
||||
. /etc/rc.d/init.d/functions
|
||||
|
||||
whatami=cloud-agent
|
||||
|
||||
# set environment variables
|
||||
|
||||
SHORTNAME="$whatami"
|
||||
PIDFILE=@PIDDIR@/"$whatami".pid
|
||||
SHORTNAME=`basename $0`
|
||||
PIDFILE=@PIDDIR@/"$SHORTNAME".pid
|
||||
LOCKFILE=@LOCKDIR@/"$SHORTNAME"
|
||||
LOGFILE=@AGENTLOG@
|
||||
PROGNAME="Cloud Agent"
|
||||
@ -114,7 +112,7 @@ case "$1" in
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $whatami {start|stop|restart|condrestart|status|help}"
|
||||
echo $"Usage: $SHORTNAME {start|stop|restart|condrestart|status|help}"
|
||||
RETVAL=3
|
||||
esac
|
||||
|
||||
|
||||
@ -31,12 +31,10 @@
|
||||
. /lib/lsb/init-functions
|
||||
. /etc/rc.status
|
||||
|
||||
whatami=cloud-agent
|
||||
|
||||
# set environment variables
|
||||
|
||||
SHORTNAME="$whatami"
|
||||
PIDFILE=@PIDDIR@/"$whatami".pid
|
||||
SHORTNAME=`basename $0`
|
||||
PIDFILE=@PIDDIR@/"$SHORTNAME".pid
|
||||
LOCKFILE=@LOCKDIR@/"$SHORTNAME"
|
||||
LOGFILE=@AGENTLOG@
|
||||
PROGNAME="Cloud Agent"
|
||||
@ -166,7 +164,7 @@ case "$1" in
|
||||
start
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $whatami {start|stop|restart|status|help}"
|
||||
echo $"Usage: $SHORTNAME {start|stop|restart|status|help}"
|
||||
RETVAL=3
|
||||
esac
|
||||
|
||||
|
||||
@ -24,12 +24,10 @@
|
||||
|
||||
. /etc/rc.d/init.d/functions
|
||||
|
||||
whatami=cloud-agent
|
||||
|
||||
# set environment variables
|
||||
|
||||
SHORTNAME="$whatami"
|
||||
PIDFILE=@PIDDIR@/"$whatami".pid
|
||||
SHORTNAME=`basename $0`
|
||||
PIDFILE=@PIDDIR@/"$SHORTNAME".pid
|
||||
LOCKFILE=@LOCKDIR@/"$SHORTNAME"
|
||||
LOGFILE=@AGENTLOG@
|
||||
PROGNAME="Cloud Agent"
|
||||
@ -114,7 +112,7 @@ case "$1" in
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $whatami {start|stop|restart|condrestart|status|help}"
|
||||
echo $"Usage: $SHORTNAME {start|stop|restart|condrestart|status|help}"
|
||||
RETVAL=3
|
||||
esac
|
||||
|
||||
|
||||
@ -31,12 +31,10 @@
|
||||
. /lib/lsb/init-functions
|
||||
. /etc/rc.status
|
||||
|
||||
whatami=cloud-agent
|
||||
|
||||
# set environment variables
|
||||
|
||||
SHORTNAME="$whatami"
|
||||
PIDFILE=@PIDDIR@/"$whatami".pid
|
||||
SHORTNAME=`basename $0`
|
||||
PIDFILE=@PIDDIR@/"$SHORTNAME".pid
|
||||
LOCKFILE=@LOCKDIR@/"$SHORTNAME"
|
||||
LOGFILE=@AGENTLOG@
|
||||
PROGNAME="Cloud Agent"
|
||||
@ -166,7 +164,7 @@ case "$1" in
|
||||
start
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $whatami {start|stop|restart|status|help}"
|
||||
echo $"Usage: $SHORTNAME {start|stop|restart|status|help}"
|
||||
RETVAL=3
|
||||
esac
|
||||
|
||||
|
||||
25
agent/findbugsExcludeFilter.xml
Normal file
25
agent/findbugsExcludeFilter.xml
Normal file
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
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.
|
||||
|
||||
-->
|
||||
<FindBugsFilter>
|
||||
|
||||
|
||||
</FindBugsFilter>
|
||||
@ -23,7 +23,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloudstack</artifactId>
|
||||
<version>4.4.0-SNAPSHOT</version>
|
||||
<version>4.5.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
25
api/findbugsExcludeFilter.xml
Normal file
25
api/findbugsExcludeFilter.xml
Normal file
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
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.
|
||||
|
||||
-->
|
||||
<FindBugsFilter>
|
||||
|
||||
|
||||
</FindBugsFilter>
|
||||
@ -23,7 +23,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloudstack</artifactId>
|
||||
<version>4.4.0-SNAPSHOT</version>
|
||||
<version>4.5.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@ -32,16 +32,12 @@ public class HostVmStateReportEntry {
|
||||
// host name or host uuid
|
||||
String host;
|
||||
|
||||
// XS needs Xen Tools version info
|
||||
String hostToolsVersion;
|
||||
|
||||
public HostVmStateReportEntry() {
|
||||
}
|
||||
|
||||
public HostVmStateReportEntry(PowerState state, String host, String hostToolsVersion) {
|
||||
public HostVmStateReportEntry(PowerState state, String host) {
|
||||
this.state = state;
|
||||
this.host = host;
|
||||
this.hostToolsVersion = hostToolsVersion;
|
||||
}
|
||||
|
||||
public PowerState getState() {
|
||||
@ -51,8 +47,4 @@ public class HostVmStateReportEntry {
|
||||
public String getHost() {
|
||||
return host;
|
||||
}
|
||||
|
||||
public String getHostToolsVersion() {
|
||||
return hostToolsVersion;
|
||||
}
|
||||
}
|
||||
|
||||
56
api/src/com/cloud/agent/api/to/GPUDeviceTO.java
Normal file
56
api/src/com/cloud/agent/api/to/GPUDeviceTO.java
Normal file
@ -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 com.cloud.agent.api.to;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class GPUDeviceTO {
|
||||
|
||||
private String gpuGroup;
|
||||
private String vgpuType;
|
||||
private HashMap<String, HashMap<String, Long>> groupDetails = new HashMap<String, HashMap<String, Long>>();
|
||||
|
||||
public GPUDeviceTO( String gpuGroup, String vgpuType, HashMap<String, HashMap<String, Long>> groupDetails) {
|
||||
this.gpuGroup = gpuGroup;
|
||||
this.vgpuType = vgpuType;
|
||||
this.groupDetails = groupDetails;
|
||||
}
|
||||
|
||||
public String getGpuGroup() {
|
||||
return gpuGroup;
|
||||
}
|
||||
|
||||
public String getVgpuType() {
|
||||
return vgpuType;
|
||||
}
|
||||
|
||||
public void setGpuGroup(String gpuGroup) {
|
||||
this.gpuGroup = gpuGroup;
|
||||
}
|
||||
|
||||
public void setVgpuType(String vgpuType) {
|
||||
this.vgpuType = vgpuType;
|
||||
}
|
||||
|
||||
public HashMap<String, HashMap<String, Long>> getGroupDetails() {
|
||||
return groupDetails;
|
||||
}
|
||||
|
||||
public void setGroupDetails(HashMap<String, HashMap<String, Long>> groupDetails) {
|
||||
this.groupDetails = groupDetails;
|
||||
}
|
||||
}
|
||||
@ -80,4 +80,12 @@ public class NicTO extends NetworkTO {
|
||||
public List<String> getNicSecIps() {
|
||||
return nicSecIps;
|
||||
}
|
||||
|
||||
public String getNetworkUuid() {
|
||||
return super.getUuid();
|
||||
}
|
||||
|
||||
public void setNetworkUuid(String uuid) {
|
||||
super.setUuid(uuid);
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,6 +60,7 @@ public class VirtualMachineTO {
|
||||
|
||||
DiskTO[] disks;
|
||||
NicTO[] nics;
|
||||
GPUDeviceTO gpuDevice;
|
||||
|
||||
public VirtualMachineTO(long id, String instanceName, VirtualMachine.Type type, int cpus, Integer speed, long minRam, long maxRam, BootloaderType bootloader,
|
||||
String os, boolean enableHA, boolean limitCpuUse, String vncPassword) {
|
||||
@ -266,4 +267,12 @@ public class VirtualMachineTO {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public GPUDeviceTO getGpuDevice() {
|
||||
return gpuDevice;
|
||||
}
|
||||
|
||||
public void setGpuDevice(GPUDeviceTO gpuDevice) {
|
||||
this.gpuDevice = gpuDevice;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -60,7 +60,4 @@ public interface Domain extends OwnedBy, Identity, InternalIdentity {
|
||||
|
||||
String getNetworkDomain();
|
||||
|
||||
@Override
|
||||
public String getUuid();
|
||||
|
||||
}
|
||||
|
||||
@ -50,6 +50,8 @@ import com.cloud.offering.DiskOffering;
|
||||
import com.cloud.offering.NetworkOffering;
|
||||
import com.cloud.offering.ServiceOffering;
|
||||
import com.cloud.projects.Project;
|
||||
import com.cloud.storage.GuestOS;
|
||||
import com.cloud.storage.GuestOSHypervisor;
|
||||
import com.cloud.storage.Snapshot;
|
||||
import com.cloud.storage.Volume;
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
@ -102,6 +104,7 @@ public class EventTypes {
|
||||
// Network Events
|
||||
public static final String EVENT_NET_IP_ASSIGN = "NET.IPASSIGN";
|
||||
public static final String EVENT_NET_IP_RELEASE = "NET.IPRELEASE";
|
||||
public static final String EVENT_NET_IP_UPDATE = "NET.IPUPDATE";
|
||||
public static final String EVENT_PORTABLE_IP_ASSIGN = "PORTABLE.IPASSIGN";
|
||||
public static final String EVENT_PORTABLE_IP_RELEASE = "PORTABLE.IPRELEASE";
|
||||
public static final String EVENT_NET_RULE_ADD = "NET.RULEADD";
|
||||
@ -112,6 +115,7 @@ public class EventTypes {
|
||||
public static final String EVENT_NETWORK_UPDATE = "NETWORK.UPDATE";
|
||||
public static final String EVENT_FIREWALL_OPEN = "FIREWALL.OPEN";
|
||||
public static final String EVENT_FIREWALL_CLOSE = "FIREWALL.CLOSE";
|
||||
public static final String EVENT_FIREWALL_UPDATE = "FIREWALL.UPDATE";
|
||||
|
||||
//NIC Events
|
||||
public static final String EVENT_NIC_CREATE = "NIC.CREATE";
|
||||
@ -285,16 +289,19 @@ public class EventTypes {
|
||||
// VPN
|
||||
public static final String EVENT_REMOTE_ACCESS_VPN_CREATE = "VPN.REMOTE.ACCESS.CREATE";
|
||||
public static final String EVENT_REMOTE_ACCESS_VPN_DESTROY = "VPN.REMOTE.ACCESS.DESTROY";
|
||||
public static final String EVENT_REMOTE_ACCESS_VPN_UPDATE = "VPN.REMOTE.ACCESS.UPDATE";
|
||||
public static final String EVENT_VPN_USER_ADD = "VPN.USER.ADD";
|
||||
public static final String EVENT_VPN_USER_REMOVE = "VPN.USER.REMOVE";
|
||||
public static final String EVENT_S2S_VPN_GATEWAY_CREATE = "VPN.S2S.VPN.GATEWAY.CREATE";
|
||||
public static final String EVENT_S2S_VPN_GATEWAY_DELETE = "VPN.S2S.VPN.GATEWAY.DELETE";
|
||||
public static final String EVENT_S2S_VPN_GATEWAY_UPDATE = "VPN.S2S.VPN.GATEWAY.UPDATE";
|
||||
public static final String EVENT_S2S_VPN_CUSTOMER_GATEWAY_CREATE = "VPN.S2S.CUSTOMER.GATEWAY.CREATE";
|
||||
public static final String EVENT_S2S_VPN_CUSTOMER_GATEWAY_DELETE = "VPN.S2S.CUSTOMER.GATEWAY.DELETE";
|
||||
public static final String EVENT_S2S_VPN_CUSTOMER_GATEWAY_UPDATE = "VPN.S2S.CUSTOMER.GATEWAY.UPDATE";
|
||||
public static final String EVENT_S2S_VPN_CONNECTION_CREATE = "VPN.S2S.CONNECTION.CREATE";
|
||||
public static final String EVENT_S2S_VPN_CONNECTION_DELETE = "VPN.S2S.CONNECTION.DELETE";
|
||||
public static final String EVENT_S2S_VPN_CONNECTION_RESET = "VPN.S2S.CONNECTION.RESET";
|
||||
public static final String EVENT_S2S_VPN_CONNECTION_UPDATE = "VPN.S2S.CONNECTION.UPDATE";
|
||||
|
||||
// Network
|
||||
public static final String EVENT_NETWORK_RESTART = "NETWORK.RESTART";
|
||||
@ -364,6 +371,7 @@ public class EventTypes {
|
||||
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_UPDATE = "NETWORK.ACL.UPDATE";
|
||||
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";
|
||||
@ -449,6 +457,19 @@ public class EventTypes {
|
||||
|
||||
public static final String EVENT_UCS_ASSOCIATED_PROFILE = "UCS.ASSOCIATEPROFILE";
|
||||
|
||||
// IAM events
|
||||
public static final String EVENT_IAM_POLICY_CREATE = "IAMPOLICY.CREATE";
|
||||
public static final String EVENT_IAM_POLICY_DELETE = "IAMPOLICY.DELETE";
|
||||
public static final String EVENT_IAM_POLICY_GRANT = "IAMPOLICY.GRANT";
|
||||
public static final String EVENT_IAM_POLICY_REVOKE = "IAMPOLICY.REVOKE";
|
||||
|
||||
public static final String EVENT_IAM_GROUP_UPDATE = "IAMGROUP.UPDATE";
|
||||
public static final String EVENT_IAM_GROUP_CREATE = "IAMGROUP.CREATE";
|
||||
public static final String EVENT_IAM_GROUP_DELETE = "IAMGROUP.DELETE";
|
||||
public static final String EVENT_IAM_GROUP_GRANT = "IAMGROUP.GRANT";
|
||||
public static final String EVENT_IAM_GROUP_REVOKE = "IAMGROUP.REVOKE";
|
||||
public static final String EVENT_IAM_ACCOUNT_POLICY_UPDATE = "IAMACCOUNTPOLICY.UPDATE";
|
||||
|
||||
// Object store migration
|
||||
public static final String EVENT_MIGRATE_PREPARE_SECONDARY_STORAGE = "MIGRATE.PREPARE.SS";
|
||||
|
||||
@ -460,10 +481,19 @@ public class EventTypes {
|
||||
public static final String EVENT_EXTERNAL_OPENDAYLIGHT_DELETE_CONTROLLER = "PHYSICAL.ODLCONTROLLER.DELETE";
|
||||
public static final String EVENT_EXTERNAL_OPENDAYLIGHT_CONFIGURE_CONTROLLER = "PHYSICAL.ODLCONTROLLER.CONFIGURE";
|
||||
|
||||
//Guest OS related events
|
||||
public static final String EVENT_GUEST_OS_ADD = "GUEST.OS.ADD";
|
||||
public static final String EVENT_GUEST_OS_REMOVE = "GUEST.OS.REMOVE";
|
||||
public static final String EVENT_GUEST_OS_UPDATE = "GUEST.OS.UPDATE";
|
||||
public static final String EVENT_GUEST_OS_MAPPING_ADD = "GUEST.OS.MAPPING.ADD";
|
||||
public static final String EVENT_GUEST_OS_MAPPING_REMOVE = "GUEST.OS.MAPPING.REMOVE";
|
||||
public static final String EVENT_GUEST_OS_MAPPING_UPDATE = "GUEST.OS.MAPPING.UPDATE";
|
||||
|
||||
static {
|
||||
|
||||
// TODO: need a way to force author adding event types to declare the entity details as well, with out braking
|
||||
// current ActionEvent annotation semantics
|
||||
// TODO #2 - The map should be from event type to class.
|
||||
|
||||
entityEventDetails = new HashMap<String, String>();
|
||||
|
||||
@ -474,10 +504,13 @@ public class EventTypes {
|
||||
entityEventDetails.put(EVENT_VM_REBOOT, VirtualMachine.class.getName());
|
||||
entityEventDetails.put(EVENT_VM_UPDATE, VirtualMachine.class.getName());
|
||||
entityEventDetails.put(EVENT_VM_UPGRADE, VirtualMachine.class.getName());
|
||||
entityEventDetails.put(EVENT_VM_DYNAMIC_SCALE, VirtualMachine.class.getName());
|
||||
entityEventDetails.put(EVENT_VM_RESETPASSWORD, VirtualMachine.class.getName());
|
||||
entityEventDetails.put(EVENT_VM_RESETSSHKEY, VirtualMachine.class.getName());
|
||||
entityEventDetails.put(EVENT_VM_MIGRATE, VirtualMachine.class.getName());
|
||||
entityEventDetails.put(EVENT_VM_MOVE, VirtualMachine.class.getName());
|
||||
entityEventDetails.put(EVENT_VM_RESTORE, VirtualMachine.class.getName());
|
||||
entityEventDetails.put(EVENT_VM_EXPUNGE, VirtualMachine.class.getName());
|
||||
|
||||
entityEventDetails.put(EVENT_ROUTER_CREATE, VirtualRouter.class.getName());
|
||||
entityEventDetails.put(EVENT_ROUTER_DESTROY, VirtualRouter.class.getName());
|
||||
@ -525,9 +558,11 @@ public class EventTypes {
|
||||
entityEventDetails.put(EVENT_LB_CERT_REMOVE, LoadBalancer.class.getName());
|
||||
|
||||
// Account events
|
||||
entityEventDetails.put(EVENT_ACCOUNT_ENABLE, Account.class.getName());
|
||||
entityEventDetails.put(EVENT_ACCOUNT_DISABLE, Account.class.getName());
|
||||
entityEventDetails.put(EVENT_ACCOUNT_CREATE, Account.class.getName());
|
||||
entityEventDetails.put(EVENT_ACCOUNT_DELETE, Account.class.getName());
|
||||
entityEventDetails.put(EVENT_ACCOUNT_UPDATE, Account.class.getName());
|
||||
entityEventDetails.put(EVENT_ACCOUNT_MARK_DEFAULT_ZONE, Account.class.getName());
|
||||
|
||||
// UserVO Events
|
||||
@ -770,6 +805,14 @@ public class EventTypes {
|
||||
entityEventDetails.put(EVENT_EXTERNAL_OPENDAYLIGHT_ADD_CONTROLLER, "OpenDaylightController");
|
||||
entityEventDetails.put(EVENT_EXTERNAL_OPENDAYLIGHT_DELETE_CONTROLLER, "OpenDaylightController");
|
||||
entityEventDetails.put(EVENT_EXTERNAL_OPENDAYLIGHT_CONFIGURE_CONTROLLER, "OpenDaylightController");
|
||||
|
||||
//Guest OS
|
||||
entityEventDetails.put(EVENT_GUEST_OS_ADD, GuestOS.class.getName());
|
||||
entityEventDetails.put(EVENT_GUEST_OS_REMOVE, GuestOS.class.getName());
|
||||
entityEventDetails.put(EVENT_GUEST_OS_UPDATE, GuestOS.class.getName());
|
||||
entityEventDetails.put(EVENT_GUEST_OS_MAPPING_ADD, GuestOSHypervisor.class.getName());
|
||||
entityEventDetails.put(EVENT_GUEST_OS_MAPPING_REMOVE, GuestOSHypervisor.class.getName());
|
||||
entityEventDetails.put(EVENT_GUEST_OS_MAPPING_UPDATE, GuestOSHypervisor.class.getName());
|
||||
}
|
||||
|
||||
public static String getEntityForEvent(String eventName) {
|
||||
|
||||
49
api/src/com/cloud/gpu/GPU.java
Normal file
49
api/src/com/cloud/gpu/GPU.java
Normal file
@ -0,0 +1,49 @@
|
||||
// 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.gpu;
|
||||
|
||||
|
||||
public class GPU {
|
||||
|
||||
public enum Keys {
|
||||
pciDevice,
|
||||
vgpuType
|
||||
}
|
||||
public enum Type {
|
||||
GPU_Passthrough,
|
||||
VGPU
|
||||
}
|
||||
|
||||
public enum vGPUType {
|
||||
GRID_K100("GRID K100"),
|
||||
GRID_K140Q("GRID K140Q"),
|
||||
GRID_K200("GRID K200"),
|
||||
GRID_K240Q("GRID K240Q"),
|
||||
GRID_K260("GRID K260Q"),
|
||||
passthrough("passthrough");
|
||||
|
||||
private String type;
|
||||
|
||||
vGPUType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -85,4 +85,6 @@ public interface IpAddress extends ControlledEntity, Identity, InternalIdentity
|
||||
|
||||
Long getNetworkId();
|
||||
|
||||
boolean isDisplay();
|
||||
|
||||
}
|
||||
|
||||
@ -39,7 +39,7 @@ public interface MonitoringService extends ControlledEntity, Identity, InternalI
|
||||
|
||||
String getServiceName();
|
||||
|
||||
String getPidFile();
|
||||
String getServicePidFile();
|
||||
|
||||
String getServicePath();
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
|
||||
public static final Service PortForwarding = new Service("PortForwarding");
|
||||
public static final Service SecurityGroup = new Service("SecurityGroup");
|
||||
public static final Service NetworkACL = new Service("NetworkACL", Capability.SupportedProtocols);
|
||||
public static final Service Connectivity = new Service("Connectivity");
|
||||
public static final Service Connectivity = new Service("Connectivity", Capability.DistributedRouter, Capability.RegionLevelVpc, Capability.StretchedL2Subnet);
|
||||
|
||||
private final String name;
|
||||
private final Capability[] caps;
|
||||
@ -113,6 +113,7 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
|
||||
|
||||
public static final Provider VirtualRouter = new Provider("VirtualRouter", false);
|
||||
public static final Provider JuniperContrailRouter = new Provider("JuniperContrailRouter", false);
|
||||
public static final Provider JuniperContrailVpcRouter = new Provider("JuniperContrailVpcRouter", false);
|
||||
public static final Provider JuniperSRX = new Provider("JuniperSRX", true);
|
||||
public static final Provider PaloAlto = new Provider("PaloAlto", true);
|
||||
public static final Provider F5BigIp = new Provider("F5BigIp", true);
|
||||
@ -185,6 +186,9 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
|
||||
public static final Capability SslTermination = new Capability("SslTermination");
|
||||
public static final Capability LbSchemes = new Capability("LbSchemes");
|
||||
public static final Capability DhcpAccrossMultipleSubnets = new Capability("DhcpAccrossMultipleSubnets");
|
||||
public static final Capability DistributedRouter = new Capability("DistributedRouter");
|
||||
public static final Capability StretchedL2Subnet = new Capability("StretchedL2Subnet");
|
||||
public static final Capability RegionLevelVpc = new Capability("RegionLevelVpc");
|
||||
|
||||
private final String name;
|
||||
|
||||
@ -335,4 +339,6 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
|
||||
Long getNetworkACLId();
|
||||
|
||||
void setNetworkACLId(Long networkACLId);
|
||||
|
||||
boolean isStrechedL2Network();
|
||||
}
|
||||
|
||||
@ -22,6 +22,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
|
||||
|
||||
import com.cloud.dc.Vlan;
|
||||
import com.cloud.exception.InsufficientAddressCapacityException;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
@ -199,10 +201,10 @@ public interface NetworkModel {
|
||||
List<? extends PhysicalNetwork> getPhysicalNtwksSupportingTrafficType(long zoneId, TrafficType trafficType);
|
||||
|
||||
/**
|
||||
* @param guestNic
|
||||
* @param ntwkId
|
||||
* @return
|
||||
*/
|
||||
boolean isPrivateGateway(Nic guestNic);
|
||||
boolean isPrivateGateway(long ntwkId);
|
||||
|
||||
Map<Service, Map<Capability, String>> getNetworkCapabilities(long networkId);
|
||||
|
||||
@ -273,4 +275,6 @@ public interface NetworkModel {
|
||||
boolean isNetworkReadyForGc(long networkId);
|
||||
|
||||
boolean getNetworkEgressDefaultPolicy(Long networkId);
|
||||
|
||||
void checkNetworkPermissions(Account owner, Network network, AccessType accessType);
|
||||
}
|
||||
@ -55,6 +55,7 @@ public class NetworkProfile implements Network {
|
||||
private final boolean displayNetwork;
|
||||
private Long networkAclId;
|
||||
private final String guruName;
|
||||
private boolean strechedL2Subnet;
|
||||
|
||||
public NetworkProfile(Network network) {
|
||||
id = network.getId();
|
||||
@ -87,6 +88,7 @@ public class NetworkProfile implements Network {
|
||||
displayNetwork = network.getDisplayNetwork();
|
||||
networkAclId = network.getNetworkACLId();
|
||||
guruName = network.getGuruName();
|
||||
strechedL2Subnet = network.isStrechedL2Network();
|
||||
}
|
||||
|
||||
public String getDns1() {
|
||||
@ -275,4 +277,15 @@ public class NetworkProfile implements Network {
|
||||
public String getIp6Cidr() {
|
||||
return ip6Cidr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getEntityType() {
|
||||
return Network.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStrechedL2Network() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ public interface NetworkService {
|
||||
|
||||
List<? extends Network> getIsolatedNetworksOwnedByAccountInZone(long zoneId, Account owner);
|
||||
|
||||
IpAddress allocateIP(Account ipOwner, long zoneId, Long networkId) throws ResourceAllocationException, InsufficientAddressCapacityException,
|
||||
IpAddress allocateIP(Account ipOwner, long zoneId, Long networkId, Boolean displayIp) throws ResourceAllocationException, InsufficientAddressCapacityException,
|
||||
ConcurrentOperationException;
|
||||
|
||||
boolean releaseIpAddress(long ipAddressId) throws InsufficientAddressCapacityException;
|
||||
@ -77,7 +77,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, Boolean displayNetwork);
|
||||
Boolean changeCidr, String guestVmCidr, Boolean displayNetwork, String newUUID);
|
||||
|
||||
PhysicalNetwork createPhysicalNetwork(Long zoneId, String vnetRange, String networkSpeed, List<String> isolationMethods, String broadcastDomainRange, Long domainId,
|
||||
List<String> tags, String name);
|
||||
@ -176,4 +176,6 @@ public interface NetworkService {
|
||||
List<? extends Nic> listNics(ListNicsCmd listNicsCmd);
|
||||
|
||||
Map<Network.Capability, String> getNetworkOfferingServiceCapabilities(NetworkOffering offering, Service service);
|
||||
|
||||
IpAddress updateIP(Long id, String customId, Boolean displayIp);
|
||||
}
|
||||
|
||||
@ -38,4 +38,6 @@ public interface RemoteAccessVpn extends ControlledEntity, InternalIdentity, Ide
|
||||
Long getVpcId();
|
||||
|
||||
State getState();
|
||||
|
||||
boolean isDisplay();
|
||||
}
|
||||
|
||||
@ -42,4 +42,6 @@ public interface Site2SiteVpnConnection extends ControlledEntity, InternalIdenti
|
||||
public Date getRemoved();
|
||||
|
||||
public boolean isPassive();
|
||||
|
||||
boolean isDisplay();
|
||||
}
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
|
||||
// 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
|
||||
@ -15,17 +16,19 @@
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.network;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.cloudstack.acl.ControlledEntity;
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
|
||||
public interface Site2SiteVpnGateway extends ControlledEntity, Identity, InternalIdentity {
|
||||
public long getAddrId();
|
||||
|
||||
public long getVpcId();
|
||||
|
||||
public Date getRemoved();
|
||||
|
||||
boolean isDisplay();
|
||||
}
|
||||
|
||||
@ -16,10 +16,13 @@
|
||||
// under the License.
|
||||
package com.cloud.network;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.router.VirtualRouter;
|
||||
import com.cloud.vm.VirtualMachineProfile;
|
||||
|
||||
public interface VpcVirtualNetworkApplianceService extends VirtualNetworkApplianceService {
|
||||
|
||||
@ -27,13 +30,14 @@ public interface VpcVirtualNetworkApplianceService extends VirtualNetworkApplian
|
||||
* @param router
|
||||
* @param network
|
||||
* @param isRedundant
|
||||
* @param params TODO
|
||||
* @return
|
||||
* @throws ConcurrentOperationException
|
||||
* @throws ResourceUnavailableException
|
||||
* @throws InsufficientCapacityException
|
||||
*/
|
||||
boolean addVpcRouterToGuestNetwork(VirtualRouter router, Network network, boolean isRedundant) throws ConcurrentOperationException, ResourceUnavailableException,
|
||||
InsufficientCapacityException;
|
||||
boolean addVpcRouterToGuestNetwork(VirtualRouter router, Network network, boolean isRedundant, Map<VirtualMachineProfile.Param, Object> params)
|
||||
throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
|
||||
|
||||
/**
|
||||
* @param router
|
||||
|
||||
@ -53,4 +53,6 @@ public interface AutoScaleVmGroup extends ControlledEntity, InternalIdentity {
|
||||
|
||||
String getUuid();
|
||||
|
||||
boolean isDisplay();
|
||||
|
||||
}
|
||||
|
||||
@ -48,4 +48,6 @@ public interface AutoScaleVmProfile extends ControlledEntity, InternalIdentity {
|
||||
|
||||
public long getAutoScaleUserId();
|
||||
|
||||
boolean isDisplay();
|
||||
|
||||
}
|
||||
|
||||
@ -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 com.cloud.network.element;
|
||||
|
||||
import com.cloud.deploy.DeployDestination;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.Network;
|
||||
|
||||
public interface AggregatedCommandExecutor {
|
||||
public boolean prepareAggregatedExecution(Network network, DeployDestination dest) throws ResourceUnavailableException;
|
||||
public boolean completeAggregatedExecution(Network network, DeployDestination dest) throws ResourceUnavailableException;
|
||||
public boolean cleanupAggregatedExecution(Network network, DeployDestination dest) throws ResourceUnavailableException;
|
||||
}
|
||||
@ -50,4 +50,6 @@ public interface FirewallService {
|
||||
|
||||
boolean revokeRelatedFirewallRule(long ruleId, boolean apply);
|
||||
|
||||
FirewallRule updateFirewallRule(long ruleId, String customId, Boolean forDisplay);
|
||||
|
||||
}
|
||||
|
||||
@ -41,16 +41,17 @@ import com.cloud.utils.net.Ip;
|
||||
public interface LoadBalancingRulesService {
|
||||
/**
|
||||
* Create a load balancer rule from the given ipAddress/port to the given private port
|
||||
*
|
||||
* @param openFirewall
|
||||
* TODO
|
||||
* @param forDisplay TODO
|
||||
* @param cmd
|
||||
* the command specifying the ip address, public port, protocol, private port, and algorithm
|
||||
*
|
||||
* @return the newly created LoadBalancerVO if successful, null otherwise
|
||||
* @throws 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, String lbProtocol) throws NetworkRuleConflictException,
|
||||
Long ipAddrId, String protocol, String algorithm, long networkId, long lbOwnerId, boolean openFirewall, String lbProtocol, Boolean forDisplay) throws NetworkRuleConflictException,
|
||||
InsufficientAddressCapacityException;
|
||||
|
||||
LoadBalancer updateLoadBalancerRule(UpdateLoadBalancerRuleCmd cmd);
|
||||
@ -91,13 +92,13 @@ public interface LoadBalancingRulesService {
|
||||
boolean deleteLBHealthCheckPolicy(long healthCheckPolicyId, boolean apply);
|
||||
|
||||
/**
|
||||
* Assign a virtual machine, or list of virtual machines, to a load balancer.
|
||||
* Assign a virtual machine or list of virtual machines, or Map of <vmId vmIp> to a load balancer.
|
||||
*/
|
||||
boolean assignToLoadBalancer(long lbRuleId, List<Long> vmIds);
|
||||
boolean assignToLoadBalancer(long lbRuleId, List<Long> vmIds, Map<Long, List<String>> vmIdIpMap);
|
||||
|
||||
boolean assignSSLCertToLoadBalancerRule(Long lbRuleId, String certName, String publicCert, String privateKey);
|
||||
|
||||
boolean removeFromLoadBalancer(long lbRuleId, List<Long> vmIds);
|
||||
boolean removeFromLoadBalancer(long lbRuleId, List<Long> vmIds, Map<Long, List<String>> vmIdIpMap);
|
||||
|
||||
boolean applyLoadBalancerConfig(long lbRuleId) throws ResourceUnavailableException;
|
||||
|
||||
@ -150,4 +151,8 @@ public interface LoadBalancingRulesService {
|
||||
public void updateLBHealthChecks(Scheme scheme) throws ResourceUnavailableException;
|
||||
|
||||
Map<Ip, UserVm> getLbInstances(long lbId);
|
||||
|
||||
boolean isLbRuleMappedToVmGuestIp(String vmSecondaryIp);
|
||||
|
||||
List<String> listLbVmIpAddress(long id, long vmId);
|
||||
}
|
||||
|
||||
@ -87,4 +87,6 @@ public interface FirewallRule extends ControlledEntity, Identity, InternalIdenti
|
||||
*/
|
||||
TrafficType getTrafficType();
|
||||
|
||||
boolean isDisplay();
|
||||
|
||||
}
|
||||
|
||||
@ -41,11 +41,12 @@ public interface RulesService {
|
||||
* vm to be linked to. If specified the destination ip address is ignored.
|
||||
* @param openFirewall
|
||||
* TODO
|
||||
* @param forDisplay TODO
|
||||
* @return PortForwardingRule if created.
|
||||
* @throws NetworkRuleConflictException
|
||||
* if conflicts in the network rules are detected.
|
||||
*/
|
||||
PortForwardingRule createPortForwardingRule(PortForwardingRule rule, Long vmId, Ip vmIp, boolean openFirewall) throws NetworkRuleConflictException;
|
||||
PortForwardingRule createPortForwardingRule(PortForwardingRule rule, Long vmId, Ip vmIp, boolean openFirewall, Boolean forDisplay) throws NetworkRuleConflictException;
|
||||
|
||||
/**
|
||||
* Revokes a port forwarding rule
|
||||
@ -80,4 +81,6 @@ public interface RulesService {
|
||||
|
||||
boolean disableStaticNat(long ipId) throws ResourceUnavailableException, NetworkRuleConflictException, InsufficientAddressCapacityException;
|
||||
|
||||
PortForwardingRule updatePortForwardingRule(long id, String customId, Boolean forDisplay);
|
||||
|
||||
}
|
||||
|
||||
@ -33,4 +33,6 @@ public interface NetworkACL extends InternalIdentity {
|
||||
long getId();
|
||||
|
||||
String getName();
|
||||
|
||||
boolean isDisplay();
|
||||
}
|
||||
|
||||
@ -73,4 +73,6 @@ public interface NetworkACLItem extends InternalIdentity {
|
||||
*/
|
||||
TrafficType getTrafficType();
|
||||
|
||||
boolean isDisplay();
|
||||
|
||||
}
|
||||
|
||||
@ -31,9 +31,10 @@ public interface NetworkACLService {
|
||||
* @param name
|
||||
* @param description
|
||||
* @param vpcId
|
||||
* @param forDisplay TODO
|
||||
* @return
|
||||
*/
|
||||
NetworkACL createNetworkACL(String name, String description, long vpcId);
|
||||
NetworkACL createNetworkACL(String name, String description, long vpcId, Boolean forDisplay);
|
||||
|
||||
/**
|
||||
* Get Network ACL with specified Id
|
||||
@ -114,11 +115,13 @@ public interface NetworkACLService {
|
||||
* @param sourcePortEnd
|
||||
* @param icmpCode
|
||||
* @param icmpType
|
||||
* @param newUUID TODO
|
||||
* @param forDisplay TODO
|
||||
* @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;
|
||||
Integer sourcePortStart, Integer sourcePortEnd, Integer icmpCode, Integer icmpType, String newUUID, Boolean forDisplay) throws ResourceUnavailableException;
|
||||
|
||||
/**
|
||||
* Associates ACL with specified Network
|
||||
@ -129,4 +132,6 @@ public interface NetworkACLService {
|
||||
*/
|
||||
boolean replaceNetworkACLonPrivateGw(long aclId, long privateGatewayId) throws ResourceUnavailableException;
|
||||
|
||||
NetworkACL updateNetworkACL(Long id, String customId, Boolean forDisplay);
|
||||
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
// under the License.
|
||||
package com.cloud.network.vpc;
|
||||
|
||||
|
||||
public class StaticRouteProfile implements StaticRoute {
|
||||
private long id;
|
||||
private String uuid;
|
||||
@ -31,18 +32,18 @@ public class StaticRouteProfile implements StaticRoute {
|
||||
String ipAddress;
|
||||
|
||||
public StaticRouteProfile(StaticRoute staticRoute, VpcGateway gateway) {
|
||||
this.id = staticRoute.getId();
|
||||
this.uuid = staticRoute.getUuid();
|
||||
this.targetCidr = staticRoute.getCidr();
|
||||
this.accountId = staticRoute.getAccountId();
|
||||
this.domainId = staticRoute.getDomainId();
|
||||
this.gatewayId = staticRoute.getVpcGatewayId();
|
||||
this.state = staticRoute.getState();
|
||||
this.vpcId = staticRoute.getVpcId();
|
||||
this.vlanTag = gateway.getBroadcastUri();
|
||||
id = staticRoute.getId();
|
||||
uuid = staticRoute.getUuid();
|
||||
targetCidr = staticRoute.getCidr();
|
||||
accountId = staticRoute.getAccountId();
|
||||
domainId = staticRoute.getDomainId();
|
||||
gatewayId = staticRoute.getVpcGatewayId();
|
||||
state = staticRoute.getState();
|
||||
vpcId = staticRoute.getVpcId();
|
||||
vlanTag = gateway.getBroadcastUri();
|
||||
this.gateway = gateway.getGateway();
|
||||
this.netmask = gateway.getNetmask();
|
||||
this.ipAddress = gateway.getIp4Address();
|
||||
netmask = gateway.getNetmask();
|
||||
ipAddress = gateway.getIp4Address();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -72,7 +73,7 @@ public class StaticRouteProfile implements StaticRoute {
|
||||
|
||||
@Override
|
||||
public Long getVpcId() {
|
||||
return vpcId;
|
||||
return vpcId;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -101,4 +102,8 @@ public class StaticRouteProfile implements StaticRoute {
|
||||
return netmask;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getEntityType() {
|
||||
return StaticRoute.class;
|
||||
}
|
||||
}
|
||||
|
||||
@ -72,4 +72,17 @@ public interface Vpc extends ControlledEntity, Identity, InternalIdentity {
|
||||
*/
|
||||
boolean isRestartRequired();
|
||||
|
||||
boolean isDisplay();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return true if VPC is configured to use distributed router to provides one-hop forwarding and hypervisor based ACL
|
||||
*/
|
||||
boolean usesDistributedRouter();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return true if VPC spans multiple zones in the region
|
||||
*/
|
||||
boolean isRegionLevelVpc();
|
||||
}
|
||||
|
||||
@ -55,4 +55,13 @@ public interface VpcOffering extends InternalIdentity, Identity {
|
||||
*/
|
||||
Long getServiceOfferingId();
|
||||
|
||||
/**
|
||||
* @return true if the offering provides a distributed router capable of one-hop forwarding
|
||||
*/
|
||||
boolean supportsDistributedRouter();
|
||||
|
||||
/**
|
||||
* @return true if VPC created with the offering can span multiple zones in the region
|
||||
*/
|
||||
boolean offersRegionLevelVPC();
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
// under the License.
|
||||
package com.cloud.network.vpc;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -23,8 +24,10 @@ public interface VpcProvisioningService {
|
||||
|
||||
public VpcOffering getVpcOffering(long vpcOfferingId);
|
||||
|
||||
public VpcOffering createVpcOffering(String name, String displayText, List<String> supportedServices, Map<String, List<String>> serviceProviders,
|
||||
Long serviceOfferingId);
|
||||
public VpcOffering createVpcOffering(String name, String displayText, List<String> supportedServices,
|
||||
Map<String, List<String>> serviceProviders,
|
||||
Map serviceCapabilitystList,
|
||||
Long serviceOfferingId);
|
||||
|
||||
List<? extends VpcOffering> listVpcOfferings(Long id, String name, String displayText, List<String> supportedServicesStr, Boolean isDefault, String keyword,
|
||||
String state, Long startIndex, Long pageSizeVal);
|
||||
|
||||
@ -43,10 +43,11 @@ public interface VpcService {
|
||||
* @param displayText
|
||||
* @param cidr
|
||||
* @param networkDomain TODO
|
||||
* @param displayVpc TODO
|
||||
* @return
|
||||
* @throws ResourceAllocationException TODO
|
||||
*/
|
||||
public Vpc createVpc(long zoneId, long vpcOffId, long vpcOwnerId, String vpcName, String displayText, String cidr, String networkDomain)
|
||||
public Vpc createVpc(long zoneId, long vpcOffId, long vpcOwnerId, String vpcName, String displayText, String cidr, String networkDomain, Boolean displayVpc)
|
||||
throws ResourceAllocationException;
|
||||
|
||||
/**
|
||||
@ -66,9 +67,11 @@ public interface VpcService {
|
||||
* @param vpcId
|
||||
* @param vpcName
|
||||
* @param displayText
|
||||
* @param customId TODO
|
||||
* @param displayVpc TODO
|
||||
* @return
|
||||
*/
|
||||
public Vpc updateVpc(long vpcId, String vpcName, String displayText);
|
||||
public Vpc updateVpc(long vpcId, String vpcName, String displayText, String customId, Boolean displayVpc);
|
||||
|
||||
/**
|
||||
* Lists VPC(s) based on the parameters passed to the method call
|
||||
@ -90,12 +93,13 @@ public interface VpcService {
|
||||
* @param restartRequired TODO
|
||||
* @param tags TODO
|
||||
* @param projectId TODO
|
||||
* @param display TODO
|
||||
* @param vpc
|
||||
* @return
|
||||
*/
|
||||
public List<? extends Vpc> listVpcs(Long id, String vpcName, String displayText, List<String> supportedServicesStr, String cidr, Long vpcOffId, String state,
|
||||
String accountName, Long domainId, String keyword, Long startIndex, Long pageSizeVal, Long zoneId, Boolean isRecursive, Boolean listAll, Boolean restartRequired,
|
||||
Map<String, String> tags, Long projectId);
|
||||
Map<String, String> tags, Long projectId, Boolean display);
|
||||
|
||||
/**
|
||||
* Starts VPC which includes starting VPC provider and applying all the neworking rules on the backend
|
||||
|
||||
@ -31,7 +31,7 @@ import com.cloud.utils.Pair;
|
||||
public interface RemoteAccessVpnService {
|
||||
static final String RemoteAccessVpnClientIpRangeCK = "remote.access.vpn.client.iprange";
|
||||
|
||||
RemoteAccessVpn createRemoteAccessVpn(long vpnServerAddressId, String ipRange, boolean openFirewall) throws NetworkRuleConflictException;
|
||||
RemoteAccessVpn createRemoteAccessVpn(long vpnServerAddressId, String ipRange, boolean openFirewall, Boolean forDisplay) throws NetworkRuleConflictException;
|
||||
|
||||
void destroyRemoteAccessVpnForIp(long vpnServerAddressId, Account caller) throws ResourceUnavailableException;
|
||||
|
||||
@ -52,4 +52,9 @@ public interface RemoteAccessVpnService {
|
||||
List<? extends RemoteAccessVpn> listRemoteAccessVpns(long networkId);
|
||||
|
||||
RemoteAccessVpn getRemoteAccessVpn(long vpnAddrId);
|
||||
|
||||
RemoteAccessVpn getRemoteAccessVpnById(long vpnId);
|
||||
|
||||
RemoteAccessVpn updateRemoteAccessVpn(long id, String customId, Boolean forDisplay);
|
||||
|
||||
}
|
||||
|
||||
@ -63,4 +63,8 @@ public interface Site2SiteVpnService {
|
||||
Pair<List<? extends Site2SiteVpnConnection>, Integer> searchForVpnConnections(ListVpnConnectionsCmd listVpnConnectionsCmd);
|
||||
|
||||
Site2SiteCustomerGateway updateCustomerGateway(UpdateVpnCustomerGatewayCmd updateVpnCustomerGatewayCmd);
|
||||
|
||||
Site2SiteVpnConnection updateVpnConnection(long id, String customId, Boolean forDisplay);
|
||||
|
||||
Site2SiteVpnGateway updateVpnGateway(Long id, String customId, Boolean forDisplay);
|
||||
}
|
||||
|
||||
65
api/src/com/cloud/offering/DiskOfferingInfo.java
Normal file
65
api/src/com/cloud/offering/DiskOfferingInfo.java
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* 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.offering;
|
||||
|
||||
public class DiskOfferingInfo {
|
||||
private DiskOffering _diskOffering;
|
||||
private Long _size;
|
||||
private Long _minIops;
|
||||
private Long _maxIops;
|
||||
|
||||
public DiskOfferingInfo() {
|
||||
}
|
||||
|
||||
public DiskOfferingInfo(DiskOffering diskOffering) {
|
||||
_diskOffering = diskOffering;
|
||||
}
|
||||
|
||||
public void setDiskOffering(DiskOffering diskOffering) {
|
||||
_diskOffering = diskOffering;
|
||||
}
|
||||
|
||||
public DiskOffering getDiskOffering() {
|
||||
return _diskOffering;
|
||||
}
|
||||
|
||||
public void setSize(Long size) {
|
||||
_size = size;
|
||||
}
|
||||
|
||||
public Long getSize() {
|
||||
return _size;
|
||||
}
|
||||
|
||||
public void setMinIops(Long minIops) {
|
||||
_minIops = minIops;
|
||||
}
|
||||
|
||||
public Long getMinIops() {
|
||||
return _minIops;
|
||||
}
|
||||
|
||||
public void setMaxIops(Long maxIops) {
|
||||
_maxIops = maxIops;
|
||||
}
|
||||
|
||||
public Long getMaxIops() {
|
||||
return _maxIops;
|
||||
}
|
||||
}
|
||||
@ -129,4 +129,6 @@ public interface NetworkOffering extends InfrastructureEntity, InternalIdentity,
|
||||
Integer getConcurrentConnections();
|
||||
|
||||
boolean isKeepAliveEnabled();
|
||||
|
||||
boolean getSupportsStrechedL2();
|
||||
}
|
||||
|
||||
@ -19,6 +19,8 @@ package com.cloud.serializer;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
import org.apache.cloudstack.acl.RoleType;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Param {
|
||||
String name() default "";
|
||||
@ -33,4 +35,6 @@ public @interface Param {
|
||||
boolean includeInApiDoc() default true;
|
||||
|
||||
String since() default "";
|
||||
|
||||
RoleType[] authorized() default {};
|
||||
}
|
||||
|
||||
@ -23,6 +23,13 @@ import java.util.Map;
|
||||
import org.apache.cloudstack.api.command.admin.cluster.ListClustersCmd;
|
||||
import org.apache.cloudstack.api.command.admin.config.ListCfgsByCmd;
|
||||
import org.apache.cloudstack.api.command.admin.domain.UpdateDomainCmd;
|
||||
import org.apache.cloudstack.api.command.admin.guest.AddGuestOsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.guest.AddGuestOsMappingCmd;
|
||||
import org.apache.cloudstack.api.command.admin.guest.ListGuestOsMappingCmd;
|
||||
import org.apache.cloudstack.api.command.admin.guest.RemoveGuestOsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.guest.RemoveGuestOsMappingCmd;
|
||||
import org.apache.cloudstack.api.command.admin.guest.UpdateGuestOsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.guest.UpdateGuestOsMappingCmd;
|
||||
import org.apache.cloudstack.api.command.admin.host.ListHostsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.host.UpdateHostPasswordCmd;
|
||||
import org.apache.cloudstack.api.command.admin.pod.ListPodsByCmd;
|
||||
@ -67,6 +74,7 @@ import com.cloud.hypervisor.HypervisorCapabilities;
|
||||
import com.cloud.network.IpAddress;
|
||||
import com.cloud.org.Cluster;
|
||||
import com.cloud.storage.GuestOS;
|
||||
import com.cloud.storage.GuestOSHypervisor;
|
||||
import com.cloud.storage.GuestOsCategory;
|
||||
import com.cloud.storage.StoragePool;
|
||||
import com.cloud.user.SSHKeyPair;
|
||||
@ -146,6 +154,69 @@ public interface ManagementService {
|
||||
*/
|
||||
Pair<List<? extends GuestOsCategory>, Integer> listGuestOSCategoriesByCriteria(ListGuestOsCategoriesCmd cmd);
|
||||
|
||||
/**
|
||||
* Obtains a list of all guest OS mappings
|
||||
*
|
||||
* @return list of GuestOSHypervisor
|
||||
*/
|
||||
Pair<List<? extends GuestOSHypervisor>, Integer> listGuestOSMappingByCriteria(ListGuestOsMappingCmd cmd);
|
||||
|
||||
/**
|
||||
* Adds a new guest OS mapping
|
||||
*
|
||||
* @return A VO containing the new mapping, with its hypervisor, hypervisor type, guest OS name, and the name of guest OS specific to hypervisor
|
||||
*/
|
||||
GuestOSHypervisor addGuestOsMapping(AddGuestOsMappingCmd addGuestOsMappingCmd);
|
||||
|
||||
/**
|
||||
* Find newly added guest OS mapping by ID
|
||||
*
|
||||
* @return A VO containing the guest OS mapping specified by ID, with its hypervisor, hypervisor type, guest OS name, and the name of guest OS specific to hypervisor
|
||||
*/
|
||||
GuestOSHypervisor getAddedGuestOsMapping(Long guestOsHypervisorId);
|
||||
|
||||
/**
|
||||
* Adds a new guest OS
|
||||
*
|
||||
* @return A VO containing the new guest OS, with its category ID, name and display name
|
||||
*/
|
||||
GuestOS addGuestOs(AddGuestOsCmd addGuestOsCmd);
|
||||
|
||||
/**
|
||||
* Find newly added guest OS by ID
|
||||
*
|
||||
* @return A VO containing the guest OS specified by ID, with its category ID, name and display name
|
||||
*/
|
||||
GuestOS getAddedGuestOs(Long guestOsId);
|
||||
|
||||
/**
|
||||
* Updates an existing guest OS
|
||||
*
|
||||
* @return A VO containing the updated display name
|
||||
*/
|
||||
GuestOS updateGuestOs(UpdateGuestOsCmd updateGuestOsCmd);
|
||||
|
||||
/**
|
||||
* Updates an existing guest OS mapping
|
||||
*
|
||||
* @return A VO containing the updated OS name for hypervisor
|
||||
*/
|
||||
GuestOSHypervisor updateGuestOsMapping(UpdateGuestOsMappingCmd updateGuestOsMappingCmd);
|
||||
|
||||
/**
|
||||
* Removes an existing guest OS
|
||||
*
|
||||
* @return True is successfully marked for delete, false otherwise
|
||||
*/
|
||||
boolean removeGuestOs(RemoveGuestOsCmd removeGuestOsCmd);
|
||||
|
||||
/**
|
||||
* Removes an existing guest OS mapping
|
||||
*
|
||||
* @return True is successfully marked for delete, false otherwise
|
||||
*/
|
||||
boolean removeGuestOsMapping(RemoveGuestOsMappingCmd removeGuestOsMappingCmd);
|
||||
|
||||
VirtualMachine stopSystemVM(StopSystemVmCmd cmd) throws ResourceUnavailableException, ConcurrentOperationException;
|
||||
|
||||
VirtualMachine startSystemVM(long vmId);
|
||||
@ -269,10 +340,6 @@ public interface ManagementService {
|
||||
*/
|
||||
String generateRandomPassword();
|
||||
|
||||
public Long saveStartedEvent(Long userId, Long accountId, String type, String description, long startEventId);
|
||||
|
||||
public Long saveCompletedEvent(Long userId, Long accountId, String level, String type, String description, long startEventId);
|
||||
|
||||
/**
|
||||
* Search registered key pairs for the logged in user.
|
||||
*
|
||||
@ -365,4 +432,6 @@ public interface ManagementService {
|
||||
ConcurrentOperationException;
|
||||
|
||||
void cleanupVMReservations();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -30,9 +30,10 @@ public interface ResourceMetaDataService {
|
||||
* @param resourceId TODO
|
||||
* @param resourceType
|
||||
* @param details
|
||||
* @param forDisplay TODO
|
||||
* @return
|
||||
*/
|
||||
boolean addResourceMetaData(String resourceId, ResourceObjectType resourceType, Map<String, String> details);
|
||||
boolean addResourceMetaData(String resourceId, ResourceObjectType resourceType, Map<String, String> details, boolean forDisplay);
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@ -51,7 +51,9 @@ public interface ResourceTag extends ControlledEntity, Identity, InternalIdentit
|
||||
CustomerGateway(false, true),
|
||||
VpnConnection(false, true),
|
||||
User(true, true),
|
||||
DiskOffering(false, true);
|
||||
DiskOffering(false, true),
|
||||
AutoScaleVmProfile(false, true),
|
||||
AutoScaleVmGroup(false, true);
|
||||
|
||||
ResourceObjectType(boolean resourceTagsSupport, boolean resourceMetadataSupport) {
|
||||
this.resourceTagsSupport = resourceTagsSupport;
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
// under the License.
|
||||
package com.cloud.storage;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
@ -26,4 +28,8 @@ public interface GuestOS extends InternalIdentity, Identity {
|
||||
String getDisplayName();
|
||||
|
||||
long getCategoryId();
|
||||
|
||||
Date getCreated();
|
||||
|
||||
Date getRemoved();
|
||||
}
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
// under the License.
|
||||
package com.cloud.storage;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
public interface GuestOSHypervisor extends InternalIdentity {
|
||||
@ -25,4 +27,12 @@ public interface GuestOSHypervisor extends InternalIdentity {
|
||||
String getGuestOsName();
|
||||
|
||||
long getGuestOsId();
|
||||
|
||||
String getHypervisorVersion();
|
||||
|
||||
String getUuid();
|
||||
|
||||
Date getRemoved();
|
||||
|
||||
Date getCreated();
|
||||
}
|
||||
|
||||
@ -86,7 +86,7 @@ public class Storage {
|
||||
|
||||
public static enum StoragePoolType {
|
||||
Filesystem(false), // local directory
|
||||
NetworkFilesystem(true), // NFS or CIFS
|
||||
NetworkFilesystem(true), // NFS
|
||||
IscsiLUN(true), // shared LUN, with a clusterfs overlay
|
||||
Iscsi(true), // for e.g., ZFS Comstar
|
||||
ISO(false), // for iso image
|
||||
@ -97,7 +97,9 @@ public class Storage {
|
||||
VMFS(true), // VMware VMFS storage
|
||||
PreSetup(true), // for XenServer, Storage Pool is set up by customers.
|
||||
EXT(false), // XenServer local EXT SR
|
||||
OCFS2(true);
|
||||
OCFS2(true),
|
||||
SMB(true),
|
||||
Gluster(true);
|
||||
|
||||
boolean shared;
|
||||
|
||||
|
||||
@ -21,6 +21,7 @@ import java.util.Date;
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import com.cloud.hypervisor.Hypervisor;
|
||||
import com.cloud.storage.Storage.StoragePoolType;
|
||||
|
||||
public interface StoragePool extends Identity, InternalIdentity {
|
||||
@ -98,10 +99,9 @@ public interface StoragePool extends Identity, InternalIdentity {
|
||||
|
||||
Long getPodId();
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
String getStorageProviderName();
|
||||
|
||||
boolean isInMaintenance();
|
||||
|
||||
Hypervisor.HypervisorType getHypervisor();
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ public interface Volume extends ControlledEntity, Identity, InternalIdentity, Ba
|
||||
s_fsm.addTransition(Destroy, Event.ExpungingRequested, Expunging);
|
||||
s_fsm.addTransition(Expunging, Event.ExpungingRequested, Expunging);
|
||||
s_fsm.addTransition(Expunging, Event.OperationSucceeded, Expunged);
|
||||
s_fsm.addTransition(Expunging, Event.OperationFailed, Expunging);
|
||||
s_fsm.addTransition(Expunging, Event.OperationFailed, Destroy);
|
||||
s_fsm.addTransition(Ready, Event.SnapshotRequested, Snapshotting);
|
||||
s_fsm.addTransition(Snapshotting, Event.OperationSucceeded, Ready);
|
||||
s_fsm.addTransition(Snapshotting, Event.OperationFailed, Ready);
|
||||
@ -190,4 +190,6 @@ public interface Volume extends ControlledEntity, Identity, InternalIdentity, Ba
|
||||
Long getVmSnapshotChainSize();
|
||||
|
||||
Integer getHypervisorSnapshotReserve();
|
||||
|
||||
boolean isDisplayVolume();
|
||||
}
|
||||
|
||||
@ -66,11 +66,11 @@ public interface VolumeApiService {
|
||||
/**
|
||||
* Uploads the volume to secondary storage
|
||||
*
|
||||
* @param UploadVolumeCmd cmd
|
||||
* @param UploadVolumeCmdByAdmin cmd
|
||||
*
|
||||
* @return Volume object
|
||||
*/
|
||||
Volume uploadVolume(UploadVolumeCmd cmd) throws ResourceAllocationException;
|
||||
Volume uploadVolume(UploadVolumeCmd cmd) throws ResourceAllocationException;
|
||||
|
||||
boolean deleteVolume(long volumeId, Account caller) throws ConcurrentOperationException;
|
||||
|
||||
@ -82,7 +82,7 @@ public interface VolumeApiService {
|
||||
|
||||
Snapshot allocSnapshot(Long volumeId, Long policyId) throws ResourceAllocationException;
|
||||
|
||||
Volume updateVolume(long volumeId, String path, String state, Long storageId, Boolean displayVolume, String customId, long owner);
|
||||
Volume updateVolume(long volumeId, String path, String state, Long storageId, Boolean displayVolume, String customId, long owner, String chainInfo);
|
||||
|
||||
/**
|
||||
* Extracts the volume to a particular location.
|
||||
@ -94,4 +94,8 @@ public interface VolumeApiService {
|
||||
*
|
||||
*/
|
||||
String extractVolume(ExtractVolumeCmd cmd);
|
||||
|
||||
boolean isDisplayResourceEnabled(Long id);
|
||||
|
||||
void updateDisplay(Volume volume, Boolean displayVolume);
|
||||
}
|
||||
|
||||
@ -99,5 +99,5 @@ public interface VirtualMachineTemplate extends ControlledEntity, Identity, Inte
|
||||
|
||||
Map getDetails();
|
||||
|
||||
Boolean isDynamicallyScalable();
|
||||
boolean isDynamicallyScalable();
|
||||
}
|
||||
|
||||
@ -23,9 +23,7 @@ import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
public interface Account extends ControlledEntity, InternalIdentity, Identity {
|
||||
public enum Type {
|
||||
Normal, Admin, DomainAdmin, CustomerCare, Project
|
||||
}
|
||||
|
||||
|
||||
public enum State {
|
||||
disabled, enabled, locked
|
||||
|
||||
@ -24,6 +24,7 @@ import org.apache.cloudstack.acl.SecurityChecker.AccessType;
|
||||
import org.apache.cloudstack.api.command.admin.user.RegisterCmd;
|
||||
|
||||
import com.cloud.domain.Domain;
|
||||
import com.cloud.domain.PartOf;
|
||||
import com.cloud.exception.PermissionDeniedException;
|
||||
|
||||
public interface AccountService {
|
||||
@ -87,7 +88,11 @@ public interface AccountService {
|
||||
|
||||
User getUserIncludingRemoved(long userId);
|
||||
|
||||
boolean isRootAdmin(short accountType);
|
||||
boolean isRootAdmin(Long accountId);
|
||||
|
||||
boolean isDomainAdmin(Long accountId);
|
||||
|
||||
boolean isNormalUser(long accountId);
|
||||
|
||||
User getActiveUserByRegistrationToken(String registrationToken);
|
||||
|
||||
@ -101,6 +106,18 @@ public interface AccountService {
|
||||
|
||||
void checkAccess(Account account, Domain domain) throws PermissionDeniedException;
|
||||
|
||||
void checkAccess(Account account, AccessType accessType, ControlledEntity... entities) throws PermissionDeniedException;
|
||||
|
||||
void checkAccess(Account account, AccessType accessType, String apiName, ControlledEntity... entities) throws PermissionDeniedException;
|
||||
|
||||
// TODO: the following two interfaces will be deprecated by the above two counterparts when securityChecker implementation is in place
|
||||
void checkAccess(Account account, AccessType accessType, boolean sameOwner, ControlledEntity... entities) throws PermissionDeniedException;
|
||||
|
||||
void checkAccess(Account account, AccessType accessType, boolean sameOwner, String apiName,
|
||||
ControlledEntity... entities) throws PermissionDeniedException;
|
||||
|
||||
//TO be implemented, to check accessibility for an entity owned by domain
|
||||
void checkAccess(Account account, AccessType accessType, boolean sameOwner, PartOf... entities) throws PermissionDeniedException;
|
||||
|
||||
Long finalyzeAccountId(String accountName, Long domainId, Long projectId, boolean enabledOnly);
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ public interface ResourceLimitService {
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
public long findCorrectResourceLimitForAccount(short accountType, Long limit, ResourceType type);
|
||||
public long findCorrectResourceLimitForAccount(long accountId, Long limit, ResourceType type);
|
||||
|
||||
/**
|
||||
* Finds the resource limit for a specified domain and type. If the domain has an infinite limit, will check
|
||||
|
||||
@ -39,4 +39,5 @@ public interface UserVm extends VirtualMachine, ControlledEntity {
|
||||
|
||||
void setAccountId(long accountId);
|
||||
|
||||
public boolean isDisplayVm();
|
||||
}
|
||||
|
||||
@ -469,4 +469,10 @@ public interface UserVmService {
|
||||
*/
|
||||
String getVmUserData(long vmId);
|
||||
|
||||
/**
|
||||
* determin whether the uservm should be visible to the end user
|
||||
* @return value of the display flag
|
||||
*/
|
||||
public boolean isDisplayResourceEnabled(Long vmId);
|
||||
|
||||
}
|
||||
|
||||
@ -34,7 +34,10 @@ import com.cloud.utils.fsm.StateObject;
|
||||
public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, InternalIdentity, StateObject<VirtualMachine.State> {
|
||||
|
||||
public enum PowerState {
|
||||
PowerUnknown, PowerOn, PowerOff,
|
||||
PowerUnknown,
|
||||
PowerOn,
|
||||
PowerOff,
|
||||
PowerReportMissing
|
||||
}
|
||||
|
||||
public enum State {
|
||||
@ -99,6 +102,7 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I
|
||||
s_fsm.addTransition(State.Running, VirtualMachine.Event.StopRequested, State.Stopping);
|
||||
s_fsm.addTransition(State.Running, VirtualMachine.Event.AgentReportShutdowned, State.Stopped);
|
||||
s_fsm.addTransition(State.Running, VirtualMachine.Event.AgentReportMigrated, State.Running);
|
||||
s_fsm.addTransition(State.Running, VirtualMachine.Event.OperationSucceeded, State.Running);
|
||||
s_fsm.addTransition(State.Migrating, VirtualMachine.Event.MigrationRequested, State.Migrating);
|
||||
s_fsm.addTransition(State.Migrating, VirtualMachine.Event.OperationSucceeded, State.Running);
|
||||
s_fsm.addTransition(State.Migrating, VirtualMachine.Event.OperationFailed, State.Running);
|
||||
@ -116,10 +120,12 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I
|
||||
s_fsm.addTransition(State.Error, VirtualMachine.Event.DestroyRequested, State.Expunging);
|
||||
s_fsm.addTransition(State.Error, VirtualMachine.Event.ExpungeOperation, State.Expunging);
|
||||
|
||||
s_fsm.addTransition(State.Starting, VirtualMachine.Event.FollowAgentPowerOnReport, State.Running);
|
||||
s_fsm.addTransition(State.Stopping, VirtualMachine.Event.FollowAgentPowerOnReport, State.Running);
|
||||
s_fsm.addTransition(State.Stopped, VirtualMachine.Event.FollowAgentPowerOnReport, State.Running);
|
||||
s_fsm.addTransition(State.Running, VirtualMachine.Event.FollowAgentPowerOnReport, State.Running);
|
||||
s_fsm.addTransition(State.Migrating, VirtualMachine.Event.FollowAgentPowerOnReport, State.Running);
|
||||
|
||||
s_fsm.addTransition(State.Starting, VirtualMachine.Event.FollowAgentPowerOffReport, State.Stopped);
|
||||
s_fsm.addTransition(State.Stopping, VirtualMachine.Event.FollowAgentPowerOffReport, State.Stopped);
|
||||
s_fsm.addTransition(State.Running, VirtualMachine.Event.FollowAgentPowerOffReport, State.Stopped);
|
||||
@ -315,4 +321,6 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I
|
||||
|
||||
long getUpdated();
|
||||
|
||||
boolean isDisplay();
|
||||
|
||||
}
|
||||
|
||||
@ -29,4 +29,5 @@ public interface ControlledEntity extends OwnedBy, PartOf {
|
||||
Account, Domain
|
||||
}
|
||||
|
||||
Class<?> getEntityType();
|
||||
}
|
||||
|
||||
@ -16,19 +16,26 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.acl;
|
||||
|
||||
//metadata - consists of default dynamic roles in CS + any custom roles added by user
|
||||
public interface Role {
|
||||
public enum PermissionScope {
|
||||
RESOURCE(0),
|
||||
ACCOUNT(1),
|
||||
DOMAIN(2),
|
||||
REGION(3), ALL(4);
|
||||
|
||||
public static final short ROOT_ADMIN = 0;
|
||||
public static final short DOMAIN_ADMIN = 1;
|
||||
public static final short DOMAIN_USER = 2;
|
||||
public static final short OWNER = 3;
|
||||
public static final short PARENT_DOMAIN_ADMIN = 4;
|
||||
public static final short PARENT_DOMAIN_USER = 5;
|
||||
public static final short CHILD_DOMAIN_ADMIN = 6;
|
||||
public static final short CHILD_DOMAIN_USER = 7;
|
||||
private int _scale;
|
||||
|
||||
public long getId();
|
||||
private PermissionScope(int scale) {
|
||||
_scale = scale;
|
||||
}
|
||||
|
||||
public short getRoleType();
|
||||
public int getScale() {
|
||||
return _scale;
|
||||
}
|
||||
|
||||
public boolean greaterThan(PermissionScope s) {
|
||||
if (_scale > s.getScale())
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
72
api/src/org/apache/cloudstack/acl/QuerySelector.java
Normal file
72
api/src/org/apache/cloudstack/acl/QuerySelector.java
Normal file
@ -0,0 +1,72 @@
|
||||
// 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.acl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.utils.component.Adapter;
|
||||
|
||||
/**
|
||||
* QueryChecker returns granted access at domain, account or resource level.
|
||||
*/
|
||||
public interface QuerySelector extends Adapter {
|
||||
|
||||
/**
|
||||
* List granted domains for the caller, given a specific action.
|
||||
*
|
||||
* @param caller account to check against.
|
||||
* @param action action
|
||||
* @return list of domain Ids granted to the caller account.
|
||||
*/
|
||||
List<Long> getAuthorizedDomains(Account caller, String action);
|
||||
|
||||
/**
|
||||
* List granted accounts for the caller, given a specific action.
|
||||
*
|
||||
* @param caller account to check against.
|
||||
* @param action action.
|
||||
* @return list of domain Ids granted to the caller account.
|
||||
*/
|
||||
List<Long> getAuthorizedAccounts(Account caller, String action);
|
||||
|
||||
|
||||
/**
|
||||
* List granted resources for the caller, given a specific action.
|
||||
*
|
||||
* @param caller account to check against.
|
||||
* @param action action.
|
||||
* @return list of domain Ids granted to the caller account.
|
||||
*/
|
||||
List<Long> getAuthorizedResources(Account caller, String action);
|
||||
|
||||
/**
|
||||
* Check if this account is associated with a policy with scope of ALL
|
||||
* @param caller account to check
|
||||
* @param action action.
|
||||
* @return true if this account is attached with a policy for the given action of ALL scope.
|
||||
*/
|
||||
boolean isGrantedAll(Account caller, String action);
|
||||
|
||||
/**
|
||||
* List of ACL group the given account belongs to
|
||||
* @param accountId account id.
|
||||
* @return ACL group names
|
||||
*/
|
||||
List<String> listAclGroupsByAccount(long accountId);
|
||||
|
||||
}
|
||||
@ -18,7 +18,6 @@ package org.apache.cloudstack.acl;
|
||||
|
||||
// Enum for default roles in CloudStack
|
||||
public enum RoleType {
|
||||
|
||||
Admin(1), ResourceAdmin(2), DomainAdmin(4), User(8), Unknown(0);
|
||||
|
||||
private int mask;
|
||||
@ -31,3 +30,4 @@ public enum RoleType {
|
||||
return mask;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -31,7 +31,10 @@ import com.cloud.utils.component.Adapter;
|
||||
public interface SecurityChecker extends Adapter {
|
||||
|
||||
public enum AccessType {
|
||||
ListEntry, ModifyEntry, ModifyProject, UseNetwork
|
||||
ModifyProject,
|
||||
OperateEntry,
|
||||
UseEntry,
|
||||
ListEntry
|
||||
}
|
||||
|
||||
/**
|
||||
@ -69,11 +72,54 @@ public interface SecurityChecker extends Adapter {
|
||||
* object that the account is trying to access.
|
||||
* @param accessType
|
||||
* TODO
|
||||
* @return true if access allowed. false if this adapter cannot provide permission.
|
||||
* @return true if access allowed. false if this adapter cannot provide
|
||||
* permission.
|
||||
* @throws PermissionDeniedException
|
||||
* if this adapter is suppose to authenticate ownership and the check failed.
|
||||
* if this adapter is suppose to authenticate ownership and the
|
||||
* check failed.
|
||||
*/
|
||||
boolean checkAccess(Account caller, ControlledEntity entity, AccessType accessType) throws PermissionDeniedException;
|
||||
boolean checkAccess(Account caller, ControlledEntity entity, AccessType accessType)
|
||||
throws PermissionDeniedException;
|
||||
|
||||
/**
|
||||
* Checks if the account can access the object.
|
||||
*
|
||||
* @param caller
|
||||
* account to check against.
|
||||
* @param entity
|
||||
* object that the account is trying to access.
|
||||
* @param accessType
|
||||
* TODO
|
||||
* @param action
|
||||
* name of the API
|
||||
* @return true if access allowed. false if this adapter cannot provide
|
||||
* permission.
|
||||
* @throws PermissionDeniedException
|
||||
* if this adapter is suppose to authenticate ownership and the
|
||||
* check failed.
|
||||
*/
|
||||
boolean checkAccess(Account caller, ControlledEntity entity, AccessType accessType, String action) throws PermissionDeniedException;
|
||||
|
||||
/**
|
||||
* Checks if the account can access multiple objects.
|
||||
*
|
||||
* @param caller
|
||||
* account to check against.
|
||||
* @param entities
|
||||
* objects that the account is trying to access.
|
||||
* @param accessType
|
||||
* TODO
|
||||
* @param action
|
||||
* name of the API
|
||||
* @return true if access allowed. false if this adapter cannot provide
|
||||
* permission.
|
||||
* @throws PermissionDeniedException
|
||||
* if this adapter is suppose to authenticate ownership and the
|
||||
* check failed.
|
||||
*/
|
||||
boolean checkAccess(Account caller, AccessType accessType, String action, ControlledEntity... entities)
|
||||
throws PermissionDeniedException;
|
||||
|
||||
|
||||
/**
|
||||
* Checks if the user belongs to an account that can access the object.
|
||||
|
||||
@ -28,7 +28,9 @@ import org.apache.cloudstack.acl.SecurityChecker.AccessType;
|
||||
@Target({FIELD})
|
||||
public @interface ACL {
|
||||
|
||||
AccessType accessType() default AccessType.ListEntry;
|
||||
AccessType accessType() default AccessType.UseEntry;
|
||||
|
||||
String pointerToEntity() default "";
|
||||
|
||||
boolean checkKeyAccess() default false;
|
||||
|
||||
|
||||
@ -23,6 +23,7 @@ import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import org.apache.cloudstack.acl.RoleType;
|
||||
import org.apache.cloudstack.api.ResponseObject.ResponseView;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({TYPE})
|
||||
@ -39,5 +40,13 @@ public @interface APICommand {
|
||||
|
||||
String since() default "";
|
||||
|
||||
ResponseView responseView() default ResponseView.Full;
|
||||
|
||||
boolean requestHasSensitiveInfo() default true;
|
||||
|
||||
boolean responseHasSensitiveInfo() default true;
|
||||
|
||||
RoleType[] authorized() default {};
|
||||
|
||||
Class<?>[] entityType() default {};
|
||||
}
|
||||
|
||||
@ -49,5 +49,9 @@ public enum ApiCommandJobType {
|
||||
LoadBalancerRule,
|
||||
AffinityGroup,
|
||||
InternalLbVm,
|
||||
DedicatedGuestVlanRange
|
||||
}
|
||||
DedicatedGuestVlanRange,
|
||||
IAMPolicy,
|
||||
IAMGroup,
|
||||
GuestOs,
|
||||
GuestOsMapping
|
||||
}
|
||||
|
||||
@ -23,8 +23,10 @@ public class ApiConstants {
|
||||
public static final String ACCOUNT_ID = "accountid";
|
||||
public static final String ALGORITHM = "algorithm";
|
||||
public static final String ALLOCATED_ONLY = "allocatedonly";
|
||||
public static final String API_KEY = "userapikey";
|
||||
public static final String API_KEY = "apikey";
|
||||
public static final String USER_API_KEY = "userapikey";
|
||||
public static final String APPLIED = "applied";
|
||||
public static final String LIST_LB_VMIPS = "lbvmips";
|
||||
public static final String AVAILABLE = "available";
|
||||
public static final String BITS = "bits";
|
||||
public static final String BOOTABLE = "bootable";
|
||||
@ -41,6 +43,7 @@ public class ApiConstants {
|
||||
public static final String PRIVATE_KEY = "privatekey";
|
||||
public static final String DOMAIN_SUFFIX = "domainsuffix";
|
||||
public static final String DNS_SEARCH_ORDER = "dnssearchorder";
|
||||
public static final String CHAIN_INFO = "chaininfo";
|
||||
public static final String CIDR = "cidr";
|
||||
public static final String IP6_CIDR = "ip6cidr";
|
||||
public static final String CIDR_LIST = "cidrlist";
|
||||
@ -48,10 +51,16 @@ public class ApiConstants {
|
||||
public static final String CLUSTER_ID = "clusterid";
|
||||
public static final String CLUSTER_NAME = "clustername";
|
||||
public static final String CLUSTER_TYPE = "clustertype";
|
||||
public static final String COMMAND = "command";
|
||||
public static final String CMD_EVENT_TYPE = "cmdeventtype";
|
||||
public static final String COMPONENT = "component";
|
||||
public static final String CPU_NUMBER = "cpunumber";
|
||||
public static final String CPU_SPEED = "cpuspeed";
|
||||
public static final String CREATED = "created";
|
||||
public static final String CTX_ACCOUNT_ID = "ctxaccountid";
|
||||
public static final String CTX_USER_ID = "ctxuserid";
|
||||
public static final String CTXSTARTEVENTID = "ctxstarteventid";
|
||||
public static final String CTX_START_EVENT_ID = "ctxStartEventId";
|
||||
public static final String CUSTOMIZED = "customized";
|
||||
public static final String CUSTOMIZED_IOPS = "customizediops";
|
||||
public static final String CUSTOM_ID = "customid";
|
||||
@ -78,6 +87,7 @@ public class ApiConstants {
|
||||
public static final String IP6_DNS2 = "ip6dns2";
|
||||
public static final String DOMAIN = "domain";
|
||||
public static final String DOMAIN_ID = "domainid";
|
||||
public static final String DOMAIN__ID = "domainId";
|
||||
public static final String DURATION = "duration";
|
||||
public static final String EMAIL = "email";
|
||||
public static final String END_DATE = "enddate";
|
||||
@ -85,6 +95,7 @@ public class ApiConstants {
|
||||
public static final String END_IPV6 = "endipv6";
|
||||
public static final String END_PORT = "endport";
|
||||
public static final String ENTRY_TIME = "entrytime";
|
||||
public static final String EXPIRES = "expires";
|
||||
public static final String FETCH_LATEST = "fetchlatest";
|
||||
public static final String FIRSTNAME = "firstname";
|
||||
public static final String FORCED = "forced";
|
||||
@ -161,6 +172,8 @@ public class ApiConstants {
|
||||
public static final String OP = "op";
|
||||
public static final String OS_CATEGORY_ID = "oscategoryid";
|
||||
public static final String OS_TYPE_ID = "ostypeid";
|
||||
public static final String OS_DISPLAY_NAME = "osdisplayname";
|
||||
public static final String OS_NAME_FOR_HYPERVISOR = "osnameforhypervisor";
|
||||
public static final String PARAMS = "params";
|
||||
public static final String PARENT_DOMAIN_ID = "parentdomainid";
|
||||
public static final String PASSWORD = "password";
|
||||
@ -208,8 +221,11 @@ public class ApiConstants {
|
||||
public static final String SENT = "sent";
|
||||
public static final String SENT_BYTES = "sentbytes";
|
||||
public static final String SERVICE_OFFERING_ID = "serviceofferingid";
|
||||
public static final String SESSIONKEY = "sessionkey";
|
||||
public static final String SHOW_CAPACITIES = "showcapacities";
|
||||
public static final String SHOW_REMOVED = "showremoved";
|
||||
public static final String SIGNATURE = "signature";
|
||||
public static final String SIGNATURE_VERSION = "signatureversion";
|
||||
public static final String SIZE = "size";
|
||||
public static final String SNAPSHOT_ID = "snapshotid";
|
||||
public static final String SNAPSHOT_POLICY_ID = "snapshotpolicyid";
|
||||
@ -247,6 +263,8 @@ public class ApiConstants {
|
||||
public static final String VALUE = "value";
|
||||
public static final String VIRTUAL_MACHINE_ID = "virtualmachineid";
|
||||
public static final String VIRTUAL_MACHINE_IDS = "virtualmachineids";
|
||||
public static final String VIRTUAL_MACHINE_ID_IP = "vmidipmap";
|
||||
|
||||
public static final String VLAN = "vlan";
|
||||
public static final String VLAN_RANGE = "vlanrange";
|
||||
public static final String REMOVE_VLAN = "removevlan";
|
||||
@ -276,6 +294,7 @@ public class ApiConstants {
|
||||
public static final String NETWORKRATE = "networkrate";
|
||||
public static final String HOST_TAGS = "hosttags";
|
||||
public static final String SSH_KEYPAIR = "keypair";
|
||||
public static final String HTTPMETHOD = "httpmethod";
|
||||
public static final String HOST_CPU_CAPACITY = "hostcpucapacity";
|
||||
public static final String HOST_CPU_NUM = "hostcpunum";
|
||||
public static final String HOST_MEM_CAPACITY = "hostmemcapacity";
|
||||
@ -401,6 +420,7 @@ public class ApiConstants {
|
||||
public static final String INSTANCE_NAME = "instancename";
|
||||
public static final String START_VM = "startvm";
|
||||
public static final String HA_HOST = "hahost";
|
||||
public static final String CUSTOM_DISK_OFF_MIN_SIZE = "customdiskofferingminsize";
|
||||
public static final String CUSTOM_DISK_OFF_MAX_SIZE = "customdiskofferingmaxsize";
|
||||
public static final String DEFAULT_ZONE_ID = "defaultzoneid";
|
||||
public static final String LIVE_MIGRATE = "livemigrate";
|
||||
@ -543,12 +563,42 @@ public class ApiConstants {
|
||||
public static final String ROUTING = "isrouting";
|
||||
public static final String MAX_CONNECTIONS = "maxconnections";
|
||||
public static final String SERVICE_STATE = "servicestate";
|
||||
|
||||
public static final String IAM_ACCOUNT_IDS = "accountids";
|
||||
public static final String IAM_MEMBER_ACCOUNTS = "memberaccounts";
|
||||
public static final String IAM_PARENT_POLICY_ID = "parentpolicyid";
|
||||
public static final String IAM_PARENT_POLICY_NAME = "parentpolicyname";
|
||||
public static final String IAM_POLICY_IDS = "policyids";
|
||||
public static final String IAM_POLICIES = "policies";
|
||||
public static final String IAM_APIS = "apis";
|
||||
public static final String IAM_GROUPS = "groups";
|
||||
public static final String IAM_PERMISSIONS = "permission";
|
||||
public static final String IAM_ACTION = "action";
|
||||
public static final String IAM_SCOPE = "scope";
|
||||
public static final String IAM_SCOPE_ID = "scopeid";
|
||||
public static final String IAM_ALLOW_DENY = "permission";
|
||||
public static final String ENTITY_TYPE = "entitytype";
|
||||
public static final String ENTITY_ID = "entityid";
|
||||
public static final String ACCESS_TYPE = "accesstype";
|
||||
|
||||
public static final String RESOURCE_DETAILS = "resourcedetails";
|
||||
public static final String EXPUNGE = "expunge";
|
||||
public static final String FOR_DISPLAY = "fordisplay";
|
||||
public static final String PASSIVE = "passive";
|
||||
public static final String VERSION = "version";
|
||||
public static final String START = "start";
|
||||
public static final String GPUGROUP = "gpugroup";
|
||||
public static final String GPUGROUPNAME = "gpugroupname";
|
||||
public static final String VGPU = "vgpu";
|
||||
public static final String VGPUTYPE = "vgputype";
|
||||
public static final String REMAININGCAPACITY = "remainingcapacity";
|
||||
public static final String DISTRIBUTED_VPC_ROUTER = "distributedvpcrouter";
|
||||
public static final String READ_ONLY = "readonly";
|
||||
public static final String SUPPORTS_REGION_LEVEL_VPC = "supportsregionLevelvpc";
|
||||
public static final String SUPPORTS_STRECHED_L2_SUBNET = "supportsstrechedl2subnet";
|
||||
public static final String REGION_LEVEL_VPC = "regionlevelvpc";
|
||||
public static final String STRECHED_L2_SUBNET = "strechedl2subnet";
|
||||
public static final String NETWORK_SPANNED_ZONES = "zonesnetworkspans";
|
||||
|
||||
public enum HostDetails {
|
||||
all, capacity, events, stats, min;
|
||||
|
||||
@ -16,9 +16,6 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api;
|
||||
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
|
||||
import com.cloud.user.User;
|
||||
|
||||
/**
|
||||
* queryAsyncJobResult API command.
|
||||
@ -92,35 +89,4 @@ public abstract class BaseAsyncCmd extends BaseCmd {
|
||||
public Object getJob() {
|
||||
return job;
|
||||
}
|
||||
|
||||
protected long saveStartedEvent() {
|
||||
return saveStartedEvent(getEventType(), "Executing job for " + getEventDescription(), getStartEventId());
|
||||
}
|
||||
|
||||
protected long saveStartedEvent(String eventType, String description, Long startEventId) {
|
||||
CallContext ctx = CallContext.current();
|
||||
Long userId = ctx.getCallingUserId();
|
||||
userId = (userId == null) ? User.UID_SYSTEM : userId;
|
||||
Long startEvent = startEventId;
|
||||
if (startEvent == null) {
|
||||
startEvent = 0L;
|
||||
}
|
||||
return _mgr.saveStartedEvent((userId == null) ? User.UID_SYSTEM : userId, getEntityOwnerId(), eventType, description, startEvent);
|
||||
}
|
||||
|
||||
protected long saveCompletedEvent(String level, String description) {
|
||||
return saveCompletedEvent(level, getEventType(), description, getStartEventId());
|
||||
}
|
||||
|
||||
protected long saveCompletedEvent(String level, String eventType, String description, Long startEventId) {
|
||||
CallContext ctx = CallContext.current();
|
||||
Long userId = ctx.getCallingUserId();
|
||||
userId = (userId == null) ? User.UID_SYSTEM : userId;
|
||||
Long startEvent = startEventId;
|
||||
if (startEvent == null) {
|
||||
startEvent = 0L;
|
||||
}
|
||||
return _mgr.saveCompletedEvent((userId == null) ? User.UID_SYSTEM : userId, getEntityOwnerId(), level, eventType, description, startEvent);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -16,13 +16,18 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api;
|
||||
|
||||
import org.apache.cloudstack.acl.RoleType;
|
||||
|
||||
public abstract class BaseAsyncCustomIdCmd extends BaseAsyncCmd {
|
||||
@Parameter(name = ApiConstants.CUSTOM_ID,
|
||||
type = CommandType.STRING,
|
||||
description = "an optional field, in case you want to set a custom id to the resource. Allowed to Root Admins only")
|
||||
description = "an optional field, in case you want to set a custom id to the resource. Allowed to Root Admins only", since = "4.4", authorized = {RoleType.Admin})
|
||||
private String customId;
|
||||
|
||||
public String getCustomId() {
|
||||
return customId;
|
||||
}
|
||||
|
||||
public abstract void checkUuid();
|
||||
|
||||
}
|
||||
|
||||
30
api/src/org/apache/cloudstack/api/BaseAsyncVMCmd.java
Normal file
30
api/src/org/apache/cloudstack/api/BaseAsyncVMCmd.java
Normal file
@ -0,0 +1,30 @@
|
||||
// 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;
|
||||
|
||||
/**
|
||||
* A generic class for implementing methods common to all async vm commands
|
||||
*/
|
||||
public abstract class BaseAsyncVMCmd extends BaseAsyncCmd {
|
||||
|
||||
@Override
|
||||
public boolean isDisplayResourceEnabled(){
|
||||
return _userVmService.isDisplayResourceEnabled(getId());
|
||||
}
|
||||
|
||||
public abstract Long getId();
|
||||
}
|
||||
30
api/src/org/apache/cloudstack/api/BaseAsyncVolumeCmd.java
Normal file
30
api/src/org/apache/cloudstack/api/BaseAsyncVolumeCmd.java
Normal file
@ -0,0 +1,30 @@
|
||||
// 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;
|
||||
|
||||
/**
|
||||
* A generic class for implementing methods common to all async volume commands
|
||||
*/
|
||||
public abstract class BaseAsyncVolumeCmd extends BaseAsyncCmd {
|
||||
|
||||
@Override
|
||||
public boolean isDisplayResourceEnabled(){
|
||||
return _volumeService.isDisplayResourceEnabled(getId());
|
||||
}
|
||||
|
||||
public abstract Long getId();
|
||||
}
|
||||
@ -17,10 +17,13 @@
|
||||
|
||||
package org.apache.cloudstack.api;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@ -28,8 +31,10 @@ import javax.inject.Inject;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.acl.RoleType;
|
||||
import org.apache.cloudstack.affinity.AffinityGroupService;
|
||||
import org.apache.cloudstack.alert.AlertService;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.cloudstack.network.element.InternalLoadBalancerElementService;
|
||||
import org.apache.cloudstack.network.lb.ApplicationLoadBalancerService;
|
||||
import org.apache.cloudstack.network.lb.InternalLoadBalancerVMService;
|
||||
@ -37,12 +42,9 @@ import org.apache.cloudstack.query.QueryService;
|
||||
import org.apache.cloudstack.usage.UsageService;
|
||||
|
||||
import com.cloud.configuration.ConfigurationService;
|
||||
import com.cloud.domain.Domain;
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.exception.NetworkRuleConflictException;
|
||||
import com.cloud.exception.PermissionDeniedException;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.NetworkModel;
|
||||
@ -60,7 +62,6 @@ import com.cloud.network.vpc.VpcProvisioningService;
|
||||
import com.cloud.network.vpc.VpcService;
|
||||
import com.cloud.network.vpn.RemoteAccessVpnService;
|
||||
import com.cloud.network.vpn.Site2SiteVpnService;
|
||||
import com.cloud.projects.Project;
|
||||
import com.cloud.projects.ProjectService;
|
||||
import com.cloud.resource.ResourceService;
|
||||
import com.cloud.server.ManagementService;
|
||||
@ -75,40 +76,36 @@ import com.cloud.user.Account;
|
||||
import com.cloud.user.AccountService;
|
||||
import com.cloud.user.DomainService;
|
||||
import com.cloud.user.ResourceLimitService;
|
||||
import com.cloud.utils.ReflectUtil;
|
||||
import com.cloud.utils.db.EntityManager;
|
||||
import com.cloud.utils.db.UUIDManager;
|
||||
import com.cloud.vm.UserVmService;
|
||||
import com.cloud.vm.snapshot.VMSnapshotService;
|
||||
|
||||
public abstract class BaseCmd {
|
||||
private static final Logger s_logger = Logger.getLogger(BaseCmd.class.getName());
|
||||
|
||||
public static final String USER_ERROR_MESSAGE = "Internal error executing command, please contact your system administrator";
|
||||
public static final int PROGRESS_INSTANCE_CREATED = 1;
|
||||
|
||||
public static final String RESPONSE_TYPE_XML = "xml";
|
||||
public static final String RESPONSE_TYPE_JSON = "json";
|
||||
|
||||
public enum CommandType {
|
||||
public static final DateFormat INPUT_FORMAT = new SimpleDateFormat("yyyy-MM-dd");
|
||||
public static final DateFormat NEW_INPUT_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
public static final String USER_ERROR_MESSAGE = "Internal error executing command, please contact your system administrator";
|
||||
public static Pattern newInputDateFormat = Pattern.compile("[\\d]+-[\\d]+-[\\d]+ [\\d]+:[\\d]+:[\\d]+");
|
||||
private static final DateFormat s_outputFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
|
||||
protected static final Map<Class<?>, List<Field>> fieldsForCmdClass = new HashMap<Class<?>, List<Field>>();
|
||||
public static enum HTTPMethod {
|
||||
GET, POST, PUT, DELETE
|
||||
}
|
||||
public static enum CommandType {
|
||||
BOOLEAN, DATE, FLOAT, INTEGER, SHORT, LIST, LONG, OBJECT, MAP, STRING, TZDATE, UUID
|
||||
}
|
||||
|
||||
public static final DateFormat INPUT_FORMAT = new SimpleDateFormat("yyyy-MM-dd");
|
||||
public static final DateFormat NEW_INPUT_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
public static Pattern newInputDateFormat = Pattern.compile("[\\d]+-[\\d]+-[\\d]+ [\\d]+:[\\d]+:[\\d]+");
|
||||
private static final DateFormat s_outputFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
|
||||
|
||||
private Object _responseObject = null;
|
||||
private Object _responseObject;
|
||||
private Map<String, String> fullUrlParams;
|
||||
|
||||
public enum HTTPMethod {
|
||||
GET, POST, PUT, DELETE
|
||||
}
|
||||
|
||||
private HTTPMethod httpMethod;
|
||||
|
||||
@Parameter(name = "response", type = CommandType.STRING)
|
||||
private String responseType;
|
||||
|
||||
|
||||
@Inject
|
||||
public ConfigurationService _configService;
|
||||
@Inject
|
||||
@ -165,7 +162,6 @@ public abstract class BaseCmd {
|
||||
public NetworkACLService _networkACLService;
|
||||
@Inject
|
||||
public Site2SiteVpnService _s2sVpnService;
|
||||
|
||||
@Inject
|
||||
public QueryService _queryService;
|
||||
@Inject
|
||||
@ -192,6 +188,8 @@ public abstract class BaseCmd {
|
||||
public NetworkModel _ntwkModel;
|
||||
@Inject
|
||||
public AlertService _alertSvc;
|
||||
@Inject
|
||||
public UUIDManager _uuidMgr;
|
||||
|
||||
public abstract void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
|
||||
ResourceAllocationException, NetworkRuleConflictException;
|
||||
@ -203,7 +201,7 @@ public abstract class BaseCmd {
|
||||
return httpMethod;
|
||||
}
|
||||
|
||||
public void setHttpMethod(String method) {
|
||||
public void setHttpMethod(final String method) {
|
||||
if (method != null) {
|
||||
if (method.equalsIgnoreCase("GET"))
|
||||
httpMethod = HTTPMethod.GET;
|
||||
@ -225,12 +223,36 @@ public abstract class BaseCmd {
|
||||
return responseType;
|
||||
}
|
||||
|
||||
public void setResponseType(String responseType) {
|
||||
public void setResponseType(final String responseType) {
|
||||
this.responseType = responseType;
|
||||
}
|
||||
|
||||
/**
|
||||
* For some reason this method does not return the actual command name, but more a name that
|
||||
* is used to create the response. So you can expect for a XCmd a value like xcmdresponse. Anyways
|
||||
* this methods is used in too many places so for now instead of changing it we just create another
|
||||
* method {@link BaseCmd#getActualCommandName()} that returns the value from {@link APICommand#name()}
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public abstract String getCommandName();
|
||||
|
||||
|
||||
/**
|
||||
* Gets the CommandName based on the class annotations: the value from {@link APICommand#name()}
|
||||
*
|
||||
* @return the value from {@link APICommand#name()}
|
||||
*/
|
||||
public String getActualCommandName() {
|
||||
String cmdName = null;
|
||||
if (this.getClass().getAnnotation(APICommand.class) != null) {
|
||||
cmdName = this.getClass().getAnnotation(APICommand.class).name();
|
||||
} else {
|
||||
cmdName = this.getClass().getName();
|
||||
}
|
||||
return cmdName;
|
||||
}
|
||||
|
||||
/**
|
||||
* For commands the API framework needs to know the owner of the object being acted upon. This method is
|
||||
* used to determine that information.
|
||||
@ -243,15 +265,11 @@ public abstract class BaseCmd {
|
||||
return _responseObject;
|
||||
}
|
||||
|
||||
public void setResponseObject(Object responseObject) {
|
||||
public void setResponseObject(final Object responseObject) {
|
||||
_responseObject = responseObject;
|
||||
}
|
||||
|
||||
public ManagementService getMgmtServiceRef() {
|
||||
return _mgr;
|
||||
}
|
||||
|
||||
public static String getDateString(Date date) {
|
||||
public static String getDateString(final Date date) {
|
||||
if (date == null) {
|
||||
return "";
|
||||
}
|
||||
@ -262,101 +280,68 @@ public abstract class BaseCmd {
|
||||
return formattedString;
|
||||
}
|
||||
|
||||
// FIXME: move this to a utils method so that maps can be unpacked and integer/long values can be appropriately cast
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public Map<String, Object> unpackParams(Map<String, String> params) {
|
||||
Map<String, Object> lowercaseParams = new HashMap<String, Object>();
|
||||
for (String key : params.keySet()) {
|
||||
int arrayStartIndex = key.indexOf('[');
|
||||
int arrayStartLastIndex = key.lastIndexOf('[');
|
||||
if (arrayStartIndex != arrayStartLastIndex) {
|
||||
throw new ServerApiException(ApiErrorCode.MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key +
|
||||
"; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
|
||||
protected List<Field> getAllFieldsForClass(final Class<?> clazz) {
|
||||
List<Field> filteredFields = fieldsForCmdClass.get(clazz);
|
||||
|
||||
// If list of fields was not cached yet
|
||||
if (filteredFields == null) {
|
||||
final List<Field> allFields = ReflectUtil.getAllFieldsForClass(this.getClass(), BaseCmd.class);
|
||||
filteredFields = new ArrayList<Field>();
|
||||
|
||||
for (final Field field : allFields) {
|
||||
final Parameter parameterAnnotation = field.getAnnotation(Parameter.class);
|
||||
if ((parameterAnnotation != null) && parameterAnnotation.expose()) {
|
||||
filteredFields.add(field);
|
||||
}
|
||||
}
|
||||
|
||||
// Cache the prepared list for future use
|
||||
fieldsForCmdClass.put(clazz, filteredFields);
|
||||
}
|
||||
return filteredFields;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method doesn't return all the @{link Parameter}, but only the ones exposed
|
||||
* and allowed for current @{link RoleType}. This method will get the fields for a given
|
||||
* Cmd class only once and never again, so in case of a dynamic update the result would
|
||||
* be obsolete (this might be a plugin update. It is agreed upon that we will not do
|
||||
* upgrades dynamically but in case we come back on that decision we need to revisit this)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public List<Field> getParamFields() {
|
||||
final List<Field> allFields = getAllFieldsForClass(this.getClass());
|
||||
final List<Field> validFields = new ArrayList<Field>();
|
||||
final Account caller = CallContext.current().getCallingAccount();
|
||||
|
||||
for (final Field field : allFields) {
|
||||
final Parameter parameterAnnotation = field.getAnnotation(Parameter.class);
|
||||
|
||||
//TODO: Annotate @Validate on API Cmd classes, FIXME how to process Validate
|
||||
final RoleType[] allowedRoles = parameterAnnotation.authorized();
|
||||
boolean roleIsAllowed = true;
|
||||
if (allowedRoles.length > 0) {
|
||||
roleIsAllowed = false;
|
||||
for (final RoleType allowedRole : allowedRoles) {
|
||||
if (allowedRole.getValue() == caller.getType()) {
|
||||
roleIsAllowed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (arrayStartIndex > 0) {
|
||||
int arrayEndIndex = key.indexOf(']');
|
||||
int arrayEndLastIndex = key.lastIndexOf(']');
|
||||
if ((arrayEndIndex < arrayStartIndex) || (arrayEndIndex != arrayEndLastIndex)) {
|
||||
// malformed parameter
|
||||
throw new ServerApiException(ApiErrorCode.MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key +
|
||||
"; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
|
||||
}
|
||||
|
||||
// Now that we have an array object, check for a field name in the case of a complex object
|
||||
int fieldIndex = key.indexOf('.');
|
||||
String fieldName = null;
|
||||
if (fieldIndex < arrayEndIndex) {
|
||||
throw new ServerApiException(ApiErrorCode.MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key +
|
||||
"; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
|
||||
} else {
|
||||
fieldName = key.substring(fieldIndex + 1);
|
||||
}
|
||||
|
||||
// parse the parameter name as the text before the first '[' character
|
||||
String paramName = key.substring(0, arrayStartIndex);
|
||||
paramName = paramName.toLowerCase();
|
||||
|
||||
Map<Integer, Map> mapArray = null;
|
||||
Map<String, Object> mapValue = null;
|
||||
String indexStr = key.substring(arrayStartIndex + 1, arrayEndIndex);
|
||||
int index = 0;
|
||||
boolean parsedIndex = false;
|
||||
try {
|
||||
if (indexStr != null) {
|
||||
index = Integer.parseInt(indexStr);
|
||||
parsedIndex = true;
|
||||
}
|
||||
} catch (NumberFormatException nfe) {
|
||||
s_logger.warn("Invalid parameter " + key + " received, unable to parse object array, returning an error.");
|
||||
}
|
||||
|
||||
if (!parsedIndex) {
|
||||
throw new ServerApiException(ApiErrorCode.MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key +
|
||||
"; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
|
||||
}
|
||||
|
||||
Object value = lowercaseParams.get(paramName);
|
||||
if (value == null) {
|
||||
// for now, assume object array with sub fields
|
||||
mapArray = new HashMap<Integer, Map>();
|
||||
mapValue = new HashMap<String, Object>();
|
||||
mapArray.put(Integer.valueOf(index), mapValue);
|
||||
} else if (value instanceof Map) {
|
||||
mapArray = (HashMap)value;
|
||||
mapValue = mapArray.get(Integer.valueOf(index));
|
||||
if (mapValue == null) {
|
||||
mapValue = new HashMap<String, Object>();
|
||||
mapArray.put(Integer.valueOf(index), mapValue);
|
||||
}
|
||||
}
|
||||
|
||||
// we are ready to store the value for a particular field into the map for this object
|
||||
mapValue.put(fieldName, params.get(key));
|
||||
|
||||
lowercaseParams.put(paramName, mapArray);
|
||||
if (roleIsAllowed) {
|
||||
validFields.add(field);
|
||||
} else {
|
||||
lowercaseParams.put(key.toLowerCase(), params.get(key));
|
||||
s_logger.debug("Ignoring paremeter " + parameterAnnotation.name() + " as the caller is not authorized to pass it in");
|
||||
}
|
||||
}
|
||||
return lowercaseParams;
|
||||
|
||||
return validFields;
|
||||
}
|
||||
|
||||
protected long getInstanceIdFromJobSuccessResult(String result) {
|
||||
s_logger.debug("getInstanceIdFromJobSuccessResult not overridden in subclass " + this.getClass().getName());
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static boolean isAdmin(short accountType) {
|
||||
return ((accountType == Account.ACCOUNT_TYPE_ADMIN) || (accountType == Account.ACCOUNT_TYPE_RESOURCE_DOMAIN_ADMIN) ||
|
||||
(accountType == Account.ACCOUNT_TYPE_DOMAIN_ADMIN) || (accountType == Account.ACCOUNT_TYPE_READ_ONLY_ADMIN));
|
||||
}
|
||||
|
||||
public static boolean isRootAdmin(short accountType) {
|
||||
return ((accountType == Account.ACCOUNT_TYPE_ADMIN));
|
||||
}
|
||||
|
||||
public void setFullUrlParams(Map<String, String> map) {
|
||||
public void setFullUrlParams(final Map<String, String> map) {
|
||||
fullUrlParams = map;
|
||||
}
|
||||
|
||||
@ -364,49 +349,18 @@ public abstract class BaseCmd {
|
||||
return fullUrlParams;
|
||||
}
|
||||
|
||||
public Long finalyzeAccountId(String accountName, Long domainId, Long projectId, boolean enabledOnly) {
|
||||
if (accountName != null) {
|
||||
if (domainId == null) {
|
||||
throw new InvalidParameterValueException("Account must be specified with domainId parameter");
|
||||
}
|
||||
/**
|
||||
* To be overwritten by any class who needs specific validation
|
||||
*/
|
||||
public void validateSpecificParameters(final Map<String, String> params){
|
||||
// To be overwritten by any class who needs specific validation
|
||||
}
|
||||
|
||||
Domain domain = _domainService.getDomain(domainId);
|
||||
if (domain == null) {
|
||||
throw new InvalidParameterValueException("Unable to find domain by id");
|
||||
}
|
||||
|
||||
Account account = _accountService.getActiveAccountByName(accountName, domainId);
|
||||
if (account != null && account.getType() != Account.ACCOUNT_TYPE_PROJECT) {
|
||||
if (!enabledOnly || account.getState() == Account.State.enabled) {
|
||||
return account.getId();
|
||||
} else {
|
||||
throw new PermissionDeniedException("Can't add resources to the account id=" + account.getId() + " in state=" + account.getState() +
|
||||
" as it's no longer active");
|
||||
}
|
||||
} else {
|
||||
// idList is not used anywhere, so removed it now
|
||||
//List<IdentityProxy> idList = new ArrayList<IdentityProxy>();
|
||||
//idList.add(new IdentityProxy("domain", domainId, "domainId"));
|
||||
throw new InvalidParameterValueException("Unable to find account by name " + accountName + " in domain with specified id");
|
||||
}
|
||||
}
|
||||
|
||||
if (projectId != null) {
|
||||
Project project = _projectService.getProject(projectId);
|
||||
if (project != null) {
|
||||
if (!enabledOnly || project.getState() == Project.State.Active) {
|
||||
return project.getProjectAccountId();
|
||||
} else {
|
||||
PermissionDeniedException ex =
|
||||
new PermissionDeniedException("Can't add resources to the project with specified projectId in state=" + project.getState() +
|
||||
" as it's no longer active");
|
||||
ex.addProxyObject(project.getUuid(), "projectId");
|
||||
throw ex;
|
||||
}
|
||||
} else {
|
||||
throw new InvalidParameterValueException("Unable to find project by id");
|
||||
}
|
||||
}
|
||||
return null;
|
||||
/**
|
||||
* display flag is used to control the display of the resource only to the end user. It doesnt affect Root Admin.
|
||||
* @return display flag
|
||||
*/
|
||||
public boolean isDisplayResourceEnabled(){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,14 +16,19 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api;
|
||||
|
||||
import org.apache.cloudstack.acl.RoleType;
|
||||
|
||||
public abstract class BaseCustomIdCmd extends BaseCmd {
|
||||
|
||||
@Parameter(name = ApiConstants.CUSTOM_ID,
|
||||
type = CommandType.STRING,
|
||||
description = "an optional field, in case you want to set a custom id to the resource. Allowed to Root Admins only")
|
||||
description = "an optional field, in case you want to set a custom id to the resource. Allowed to Root Admins only", since = "4.4", authorized = {RoleType.Admin})
|
||||
private String customId;
|
||||
|
||||
public String getCustomId() {
|
||||
return customId;
|
||||
}
|
||||
|
||||
public abstract void checkUuid();
|
||||
|
||||
}
|
||||
|
||||
@ -16,6 +16,10 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api;
|
||||
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
|
||||
import com.cloud.user.Account;
|
||||
|
||||
public abstract class BaseListAccountResourcesCmd extends BaseListDomainResourcesCmd {
|
||||
|
||||
@Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "list resources by account. Must be used with the domainId parameter.")
|
||||
@ -24,4 +28,12 @@ public abstract class BaseListAccountResourcesCmd extends BaseListDomainResource
|
||||
public String getAccountName() {
|
||||
return accountName;
|
||||
}
|
||||
|
||||
public Boolean getDisplay() {
|
||||
Account caller = CallContext.current().getCallingAccount();
|
||||
if (caller.getType() == Account.ACCOUNT_TYPE_NORMAL) {
|
||||
return true;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,12 +16,15 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.utils.exception.CSExceptionErrorCode;
|
||||
|
||||
public abstract class BaseListCmd extends BaseCmd {
|
||||
|
||||
private static Long s_maxPageSize = null;
|
||||
public static Long s_pageSizeUnlimited = -1L;
|
||||
public static final Long s_pageSizeUnlimited = -1L;
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
// ///////// BaseList API parameters /////////////////
|
||||
@ -83,7 +86,7 @@ public abstract class BaseListCmd extends BaseCmd {
|
||||
|
||||
public Long getPageSizeVal() {
|
||||
Long defaultPageSize = s_maxPageSize;
|
||||
Integer pageSizeInt = getPageSize();
|
||||
final Integer pageSizeInt = getPageSize();
|
||||
if (pageSizeInt != null) {
|
||||
defaultPageSize = pageSizeInt.longValue();
|
||||
}
|
||||
@ -96,12 +99,12 @@ public abstract class BaseListCmd extends BaseCmd {
|
||||
|
||||
public Long getStartIndex() {
|
||||
Long startIndex = Long.valueOf(0);
|
||||
Long pageSizeVal = getPageSizeVal();
|
||||
final Long pageSizeVal = getPageSizeVal();
|
||||
|
||||
if (pageSizeVal == null) {
|
||||
startIndex = null;
|
||||
} else if (page != null) {
|
||||
int pageNum = page.intValue();
|
||||
final int pageNum = page.intValue();
|
||||
if (pageNum > 0) {
|
||||
startIndex = Long.valueOf(pageSizeVal * (pageNum - 1));
|
||||
}
|
||||
@ -112,4 +115,25 @@ public abstract class BaseListCmd extends BaseCmd {
|
||||
public ApiCommandJobType getInstanceType() {
|
||||
return ApiCommandJobType.None;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateSpecificParameters(final Map<String, String> params){
|
||||
super.validateSpecificParameters(params);
|
||||
|
||||
final Object pageSizeObj = params.get(ApiConstants.PAGE_SIZE);
|
||||
Long pageSize = null;
|
||||
if (pageSizeObj != null) {
|
||||
pageSize = Long.valueOf((String)pageSizeObj);
|
||||
}
|
||||
|
||||
if (params.get(ApiConstants.PAGE) == null &&
|
||||
pageSize != null &&
|
||||
!pageSize.equals(BaseListCmd.s_pageSizeUnlimited)) {
|
||||
final ServerApiException ex = new ServerApiException(ApiErrorCode.PARAM_ERROR, "\"page\" parameter is required when \"pagesize\" is specified");
|
||||
ex.setCSErrorCode(CSExceptionErrorCode.getCSErrCode(ex.getClass().getName()));
|
||||
throw ex;
|
||||
} else if (pageSize == null && (params.get(ApiConstants.PAGE) != null)) {
|
||||
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "\"pagesize\" parameter is required when \"page\" is specified");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,16 +20,17 @@ import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.ResponseObject.ResponseView;
|
||||
import org.apache.cloudstack.api.response.TemplatePermissionsResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
import com.cloud.user.Account;
|
||||
|
||||
public class BaseListTemplateOrIsoPermissionsCmd extends BaseCmd {
|
||||
public abstract class BaseListTemplateOrIsoPermissionsCmd extends BaseCmd {
|
||||
public Logger logger = getLogger();
|
||||
protected static final String s_name = "listtemplatepermissionsresponse";
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
@ -59,7 +60,7 @@ public class BaseListTemplateOrIsoPermissionsCmd extends BaseCmd {
|
||||
}
|
||||
|
||||
protected Logger getLogger() {
|
||||
return Logger.getLogger(BaseUpdateTemplateOrIsoPermissionsCmd.class);
|
||||
return Logger.getLogger(BaseListTemplateOrIsoPermissionsCmd.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -75,15 +76,14 @@ public class BaseListTemplateOrIsoPermissionsCmd extends BaseCmd {
|
||||
return "templateOrIso";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
|
||||
protected void executeWithView(ResponseView view) {
|
||||
List<String> accountNames = _templateService.listTemplatePermissions(this);
|
||||
|
||||
Account account = CallContext.current().getCallingAccount();
|
||||
boolean isAdmin = (isAdmin(account.getType()));
|
||||
|
||||
TemplatePermissionsResponse response = _responseGenerator.createTemplatePermissionsResponse(accountNames, id, isAdmin);
|
||||
TemplatePermissionsResponse response = _responseGenerator.createTemplatePermissionsResponse(view, accountNames, id);
|
||||
response.setResponseName(getCommandName());
|
||||
setResponseObject(response);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -48,7 +48,5 @@ public @interface Parameter {
|
||||
|
||||
String since() default "";
|
||||
|
||||
String retrieveMethod() default "getById";
|
||||
|
||||
RoleType[] authorized() default {};
|
||||
}
|
||||
|
||||
@ -25,6 +25,7 @@ import org.apache.cloudstack.affinity.AffinityGroup;
|
||||
import org.apache.cloudstack.affinity.AffinityGroupResponse;
|
||||
import org.apache.cloudstack.api.ApiConstants.HostDetails;
|
||||
import org.apache.cloudstack.api.ApiConstants.VMDetails;
|
||||
import org.apache.cloudstack.api.ResponseObject.ResponseView;
|
||||
import org.apache.cloudstack.api.command.user.job.QueryAsyncJobResultCmd;
|
||||
import org.apache.cloudstack.api.response.AccountResponse;
|
||||
import org.apache.cloudstack.api.response.ApplicationLoadBalancerResponse;
|
||||
@ -47,6 +48,7 @@ import org.apache.cloudstack.api.response.FirewallResponse;
|
||||
import org.apache.cloudstack.api.response.FirewallRuleResponse;
|
||||
import org.apache.cloudstack.api.response.GlobalLoadBalancerResponse;
|
||||
import org.apache.cloudstack.api.response.GuestOSResponse;
|
||||
import org.apache.cloudstack.api.response.GuestOsMappingResponse;
|
||||
import org.apache.cloudstack.api.response.GuestVlanRangeResponse;
|
||||
import org.apache.cloudstack.api.response.HostForMigrationResponse;
|
||||
import org.apache.cloudstack.api.response.HostResponse;
|
||||
@ -175,6 +177,7 @@ import com.cloud.projects.ProjectInvitation;
|
||||
import com.cloud.region.ha.GlobalLoadBalancerRule;
|
||||
import com.cloud.server.ResourceTag;
|
||||
import com.cloud.storage.GuestOS;
|
||||
import com.cloud.storage.GuestOSHypervisor;
|
||||
import com.cloud.storage.ImageStore;
|
||||
import com.cloud.storage.Snapshot;
|
||||
import com.cloud.storage.StoragePool;
|
||||
@ -196,7 +199,7 @@ import com.cloud.vm.snapshot.VMSnapshot;
|
||||
public interface ResponseGenerator {
|
||||
UserResponse createUserResponse(UserAccount user);
|
||||
|
||||
AccountResponse createAccountResponse(Account account);
|
||||
AccountResponse createAccountResponse(ResponseView view, Account account);
|
||||
|
||||
DomainResponse createDomainResponse(Domain domain);
|
||||
|
||||
@ -214,9 +217,9 @@ public interface ResponseGenerator {
|
||||
|
||||
SnapshotPolicyResponse createSnapshotPolicyResponse(SnapshotPolicy policy);
|
||||
|
||||
List<UserVmResponse> createUserVmResponse(String objectName, UserVm... userVms);
|
||||
List<UserVmResponse> createUserVmResponse(ResponseView view, String objectName, UserVm... userVms);
|
||||
|
||||
List<UserVmResponse> createUserVmResponse(String objectName, EnumSet<VMDetails> details, UserVm... userVms);
|
||||
List<UserVmResponse> createUserVmResponse(ResponseView view, String objectName, EnumSet<VMDetails> details, UserVm... userVms);
|
||||
|
||||
SystemVmResponse createSystemVmResponse(VirtualMachine systemVM);
|
||||
|
||||
@ -232,7 +235,7 @@ public interface ResponseGenerator {
|
||||
|
||||
VlanIpRangeResponse createVlanIpRangeResponse(Vlan vlan);
|
||||
|
||||
IPAddressResponse createIPAddressResponse(IpAddress ipAddress);
|
||||
IPAddressResponse createIPAddressResponse(ResponseView view, IpAddress ipAddress);
|
||||
|
||||
GuestVlanRangeResponse createDedicatedGuestVlanRangeResponse(GuestVlan result);
|
||||
|
||||
@ -250,9 +253,9 @@ public interface ResponseGenerator {
|
||||
|
||||
PodResponse createPodResponse(Pod pod, Boolean showCapacities);
|
||||
|
||||
ZoneResponse createZoneResponse(DataCenter dataCenter, Boolean showCapacities);
|
||||
ZoneResponse createZoneResponse(ResponseView view, DataCenter dataCenter, Boolean showCapacities);
|
||||
|
||||
VolumeResponse createVolumeResponse(Volume volume);
|
||||
VolumeResponse createVolumeResponse(ResponseView view, Volume volume);
|
||||
|
||||
InstanceGroupResponse createInstanceGroupResponse(InstanceGroup group);
|
||||
|
||||
@ -278,17 +281,13 @@ public interface ResponseGenerator {
|
||||
|
||||
Host findHostById(Long hostId);
|
||||
|
||||
//List<TemplateResponse> createTemplateResponses(long templateId, long zoneId, boolean readyOnly);
|
||||
|
||||
VpnUsersResponse createVpnUserResponse(VpnUser user);
|
||||
|
||||
RemoteAccessVpnResponse createRemoteAccessVpnResponse(RemoteAccessVpn vpn);
|
||||
|
||||
List<TemplateResponse> createTemplateResponses(long templateId, Long zoneId, boolean readyOnly);
|
||||
List<TemplateResponse> createTemplateResponses(ResponseView view, long templateId, Long zoneId, boolean readyOnly);
|
||||
|
||||
List<TemplateResponse> createTemplateResponses(long templateId, Long snapshotId, Long volumeId, boolean readyOnly);
|
||||
|
||||
//ListResponse<SecurityGroupResponse> createSecurityGroupResponses(List<? extends SecurityGroupRules> networkGroups);
|
||||
List<TemplateResponse> createTemplateResponses(ResponseView view, long templateId, Long snapshotId, Long volumeId, boolean readyOnly);
|
||||
|
||||
SecurityGroupResponse createSecurityGroupResponseFromSecurityGroupRule(List<? extends SecurityRule> securityRules);
|
||||
|
||||
@ -302,38 +301,31 @@ public interface ResponseGenerator {
|
||||
|
||||
EventResponse createEventResponse(Event event);
|
||||
|
||||
//List<EventResponse> createEventResponse(EventJoinVO... events);
|
||||
TemplateResponse createTemplateUpdateResponse(ResponseView view, VirtualMachineTemplate result);
|
||||
|
||||
TemplateResponse createTemplateUpdateResponse(VirtualMachineTemplate result);
|
||||
|
||||
List<TemplateResponse> createTemplateResponses(VirtualMachineTemplate result, Long zoneId, boolean readyOnly);
|
||||
List<TemplateResponse> createTemplateResponses(ResponseView view, VirtualMachineTemplate result, Long zoneId, boolean readyOnly);
|
||||
|
||||
List<CapacityResponse> createCapacityResponse(List<? extends Capacity> result, DecimalFormat format);
|
||||
|
||||
TemplatePermissionsResponse createTemplatePermissionsResponse(List<String> accountNames, Long id, boolean isAdmin);
|
||||
TemplatePermissionsResponse createTemplatePermissionsResponse(ResponseView view, List<String> accountNames, Long id);
|
||||
|
||||
AsyncJobResponse queryJobResult(QueryAsyncJobResultCmd cmd);
|
||||
|
||||
NetworkOfferingResponse createNetworkOfferingResponse(NetworkOffering offering);
|
||||
|
||||
NetworkResponse createNetworkResponse(Network network);
|
||||
NetworkResponse createNetworkResponse(ResponseView view, Network network);
|
||||
|
||||
UserResponse createUserResponse(User user);
|
||||
|
||||
//List<UserResponse> createUserResponse(UserAccountJoinVO... users);
|
||||
|
||||
AccountResponse createUserAccountResponse(UserAccount user);
|
||||
AccountResponse createUserAccountResponse(ResponseView view, UserAccount user);
|
||||
|
||||
Long getSecurityGroupId(String groupName, long accountId);
|
||||
|
||||
List<TemplateResponse> createIsoResponses(VirtualMachineTemplate iso, Long zoneId, boolean readyOnly);
|
||||
|
||||
// List<TemplateResponse> createIsoResponses(long isoId, Long zoneId, boolean readyOnly);
|
||||
//List<TemplateResponse> createIsoResponses(VirtualMachineTemplate iso, long zoneId, boolean readyOnly);
|
||||
List<TemplateResponse> createIsoResponses(ResponseView view, VirtualMachineTemplate iso, Long zoneId, boolean readyOnly);
|
||||
|
||||
ProjectResponse createProjectResponse(Project project);
|
||||
|
||||
List<TemplateResponse> createTemplateResponses(long templateId, Long vmId);
|
||||
List<TemplateResponse> createTemplateResponses(ResponseView view, long templateId, Long vmId);
|
||||
|
||||
FirewallResponse createFirewallResponse(FirewallRule fwRule);
|
||||
|
||||
@ -382,7 +374,7 @@ public interface ResponseGenerator {
|
||||
* @param vpc
|
||||
* @return
|
||||
*/
|
||||
VpcResponse createVpcResponse(Vpc vpc);
|
||||
VpcResponse createVpcResponse(ResponseView view, Vpc vpc);
|
||||
|
||||
/**
|
||||
* @param networkACLItem
|
||||
@ -424,6 +416,8 @@ public interface ResponseGenerator {
|
||||
|
||||
GuestOSResponse createGuestOSResponse(GuestOS os);
|
||||
|
||||
GuestOsMappingResponse createGuestOSMappingResponse(GuestOSHypervisor osHypervisor);
|
||||
|
||||
SnapshotScheduleResponse createSnapshotScheduleResponse(SnapshotSchedule sched);
|
||||
|
||||
UsageRecordResponse createUsageResponse(Usage usageRecord);
|
||||
|
||||
@ -75,4 +75,9 @@ public interface ResponseObject {
|
||||
* @param jobStatus
|
||||
*/
|
||||
void setJobStatus(Integer jobStatus);
|
||||
|
||||
public enum ResponseView {
|
||||
Full,
|
||||
Restricted
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,6 +26,7 @@ import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.BaseCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ResponseObject.ResponseView;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.AccountResponse;
|
||||
import org.apache.cloudstack.api.response.DomainResponse;
|
||||
@ -34,7 +35,9 @@ import org.apache.cloudstack.context.CallContext;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.UserAccount;
|
||||
|
||||
@APICommand(name = "createAccount", description = "Creates an account", responseObject = AccountResponse.class)
|
||||
|
||||
@APICommand(name = "createAccount", description = "Creates an account", responseObject = AccountResponse.class, entityType = {Account.class},
|
||||
requestHasSensitiveInfo = true, responseHasSensitiveInfo = true)
|
||||
public class CreateAccountCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(CreateAccountCmd.class.getName());
|
||||
|
||||
@ -176,9 +179,9 @@ public class CreateAccountCmd extends BaseCmd {
|
||||
_accountService.createUserAccount(getUsername(), getPassword(), getFirstName(), getLastName(), getEmail(), getTimeZone(), getAccountName(), getAccountType(),
|
||||
getDomainId(), getNetworkDomain(), getDetails(), getAccountUUID(), getUserUUID());
|
||||
if (userAccount != null) {
|
||||
AccountResponse response = _responseGenerator.createUserAccountResponse(userAccount);
|
||||
AccountResponse response = _responseGenerator.createUserAccountResponse(ResponseView.Full, userAccount);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a user account");
|
||||
}
|
||||
|
||||
@ -20,6 +20,8 @@ import javax.inject.Inject;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
|
||||
import org.apache.cloudstack.api.ACL;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiCommandJobType;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
@ -36,7 +38,8 @@ import com.cloud.event.EventTypes;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.User;
|
||||
|
||||
@APICommand(name = "deleteAccount", description = "Deletes a account, and all users associated with this account", responseObject = SuccessResponse.class)
|
||||
@APICommand(name = "deleteAccount", description = "Deletes a account, and all users associated with this account", responseObject = SuccessResponse.class, entityType = {Account.class},
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class DeleteAccountCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(DeleteAccountCmd.class.getName());
|
||||
private static final String s_name = "deleteaccountresponse";
|
||||
@ -44,7 +47,7 @@ public class DeleteAccountCmd extends BaseAsyncCmd {
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ACL(accessType = AccessType.OperateEntry)
|
||||
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = AccountResponse.class, required = true, description = "Account id")
|
||||
private Long id;
|
||||
|
||||
@ -101,7 +104,7 @@ public class DeleteAccountCmd extends BaseAsyncCmd {
|
||||
boolean result = _regionService.deleteUserAccount(this);
|
||||
if (result) {
|
||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete user account and all corresponding users");
|
||||
}
|
||||
|
||||
@ -20,12 +20,15 @@ import javax.inject.Inject;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
|
||||
import org.apache.cloudstack.api.ACL;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiCommandJobType;
|
||||
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.ResponseObject.ResponseView;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.AccountResponse;
|
||||
import org.apache.cloudstack.api.response.DomainResponse;
|
||||
@ -37,7 +40,8 @@ import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.user.Account;
|
||||
|
||||
@APICommand(name = "disableAccount", description = "Disables an account", responseObject = AccountResponse.class)
|
||||
@APICommand(name = "disableAccount", description = "Disables an account", responseObject = AccountResponse.class, entityType = {Account.class},
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
|
||||
public class DisableAccountCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(DisableAccountCmd.class.getName());
|
||||
private static final String s_name = "disableaccountresponse";
|
||||
@ -45,6 +49,7 @@ public class DisableAccountCmd extends BaseAsyncCmd {
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
@ACL(accessType = AccessType.OperateEntry)
|
||||
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = AccountResponse.class, description = "Account id")
|
||||
private Long id;
|
||||
|
||||
@ -111,17 +116,17 @@ public class DisableAccountCmd extends BaseAsyncCmd {
|
||||
|
||||
@Override
|
||||
public String getEventDescription() {
|
||||
return "disabling account: " + getAccountName() + " in domain: " + getDomainId();
|
||||
return "disabling account: " + getAccountName() + " in domain: " + getDomainId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() throws ConcurrentOperationException, ResourceUnavailableException {
|
||||
CallContext.current().setEventDetails("Account Name: " + getAccountName() + ", Domain Id:" + getDomainId());
|
||||
Account result = _regionService.disableAccount(this);
|
||||
if (result != null) {
|
||||
AccountResponse response = _responseGenerator.createAccountResponse(result);
|
||||
if (result != null){
|
||||
AccountResponse response = _responseGenerator.createAccountResponse(ResponseView.Full, result);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, lockRequested == true ? "Failed to lock account" : "Failed to disable account");
|
||||
}
|
||||
|
||||
@ -20,11 +20,14 @@ import javax.inject.Inject;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
|
||||
import org.apache.cloudstack.api.ACL;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.BaseCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ResponseObject.ResponseView;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.AccountResponse;
|
||||
import org.apache.cloudstack.api.response.DomainResponse;
|
||||
@ -32,7 +35,8 @@ import org.apache.cloudstack.region.RegionService;
|
||||
|
||||
import com.cloud.user.Account;
|
||||
|
||||
@APICommand(name = "enableAccount", description = "Enables an account", responseObject = AccountResponse.class)
|
||||
@APICommand(name = "enableAccount", description = "Enables an account", responseObject = AccountResponse.class, entityType = {Account.class},
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
|
||||
public class EnableAccountCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(EnableAccountCmd.class.getName());
|
||||
private static final String s_name = "enableaccountresponse";
|
||||
@ -40,6 +44,7 @@ public class EnableAccountCmd extends BaseCmd {
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
@ACL(accessType = AccessType.OperateEntry)
|
||||
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = AccountResponse.class, description = "Account id")
|
||||
private Long id;
|
||||
|
||||
@ -95,10 +100,10 @@ public class EnableAccountCmd extends BaseCmd {
|
||||
@Override
|
||||
public void execute() {
|
||||
Account result = _regionService.enableAccount(this);
|
||||
if (result != null) {
|
||||
AccountResponse response = _responseGenerator.createAccountResponse(result);
|
||||
if (result != null){
|
||||
AccountResponse response = _responseGenerator.createAccountResponse(ResponseView.Full, result);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to enable account");
|
||||
}
|
||||
|
||||
@ -0,0 +1,26 @@
|
||||
// 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.account;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ResponseObject.ResponseView;
|
||||
import org.apache.cloudstack.api.command.user.account.ListAccountsCmd;
|
||||
import org.apache.cloudstack.api.response.AccountResponse;
|
||||
|
||||
@APICommand(name = "listAccounts", description = "Lists accounts and provides detailed account information for listed accounts", responseObject = AccountResponse.class, responseView = ResponseView.Full)
|
||||
public class ListAccountsCmdByAdmin extends ListAccountsCmd {
|
||||
}
|
||||
@ -27,7 +27,8 @@ import org.apache.cloudstack.api.response.DomainResponse;
|
||||
|
||||
import com.cloud.user.Account;
|
||||
|
||||
@APICommand(name = "lockAccount", description = "Locks an account", responseObject = AccountResponse.class)
|
||||
@APICommand(name = "lockAccount", description = "Locks an account", responseObject = AccountResponse.class, entityType = {Account.class},
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
|
||||
public class LockAccountCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(LockAccountCmd.class.getName());
|
||||
|
||||
|
||||
@ -23,11 +23,14 @@ import javax.inject.Inject;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
|
||||
import org.apache.cloudstack.api.ACL;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.BaseCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ResponseObject.ResponseView;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.AccountResponse;
|
||||
import org.apache.cloudstack.api.response.DomainResponse;
|
||||
@ -35,7 +38,8 @@ import org.apache.cloudstack.region.RegionService;
|
||||
|
||||
import com.cloud.user.Account;
|
||||
|
||||
@APICommand(name = "updateAccount", description = "Updates account information for the authenticated user", responseObject = AccountResponse.class)
|
||||
@APICommand(name = "updateAccount", description = "Updates account information for the authenticated user", responseObject = AccountResponse.class, entityType = {Account.class},
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
|
||||
public class UpdateAccountCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(UpdateAccountCmd.class.getName());
|
||||
private static final String s_name = "updateaccountresponse";
|
||||
@ -43,7 +47,7 @@ public class UpdateAccountCmd extends BaseCmd {
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ACL(accessType = AccessType.OperateEntry)
|
||||
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = AccountResponse.class, description = "Account id")
|
||||
private Long id;
|
||||
|
||||
@ -127,10 +131,10 @@ public class UpdateAccountCmd extends BaseCmd {
|
||||
@Override
|
||||
public void execute() {
|
||||
Account result = _regionService.updateAccount(this);
|
||||
if (result != null) {
|
||||
AccountResponse response = _responseGenerator.createAccountResponse(result);
|
||||
if (result != null){
|
||||
AccountResponse response = _responseGenerator.createAccountResponse(ResponseView.Full, result);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update account");
|
||||
}
|
||||
|
||||
@ -0,0 +1,68 @@
|
||||
// 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.address;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.ResponseObject.ResponseView;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.command.user.address.AssociateIPAddrCmd;
|
||||
import org.apache.cloudstack.api.response.IPAddressResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.IpAddress;
|
||||
import com.cloud.network.vpc.Vpc;
|
||||
|
||||
@APICommand(name = "associateIpAddress", description = "Acquires and associates a public IP to an account.", responseObject = IPAddressResponse.class, responseView = ResponseView.Full,
|
||||
entityType = {IpAddress.class, Vpc.class},
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class AssociateIPAddrCmdByAdmin extends AssociateIPAddrCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(AssociateIPAddrCmdByAdmin.class.getName());
|
||||
|
||||
|
||||
@Override
|
||||
public void execute() throws ResourceUnavailableException, ResourceAllocationException,
|
||||
ConcurrentOperationException, InsufficientCapacityException {
|
||||
CallContext.current().setEventDetails("Ip Id: " + getEntityId());
|
||||
|
||||
IpAddress result = null;
|
||||
|
||||
if (getVpcId() != null) {
|
||||
result = _vpcService.associateIPToVpc(getEntityId(), getVpcId());
|
||||
} else if (getNetworkId() != null) {
|
||||
result = _networkService.associateIPToNetwork(getEntityId(), getNetworkId());
|
||||
}
|
||||
|
||||
if (result != null) {
|
||||
IPAddressResponse ipResponse = _responseGenerator.createIPAddressResponse(ResponseView.Full, result);
|
||||
ipResponse.setResponseName(getCommandName());
|
||||
setResponseObject(ipResponse);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to assign ip address");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -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 org.apache.cloudstack.api.command.admin.address;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ResponseObject.ResponseView;
|
||||
import org.apache.cloudstack.api.command.user.address.ListPublicIpAddressesCmd;
|
||||
import org.apache.cloudstack.api.response.IPAddressResponse;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
|
||||
import com.cloud.network.IpAddress;
|
||||
import com.cloud.utils.Pair;
|
||||
|
||||
@APICommand(name = "listPublicIpAddresses", description = "Lists all public ip addresses", responseObject = IPAddressResponse.class, responseView = ResponseView.Full)
|
||||
public class ListPublicIpAddressesCmdByAdmin extends ListPublicIpAddressesCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(ListPublicIpAddressesCmdByAdmin.class.getName());
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
Pair<List<? extends IpAddress>, Integer> result = _mgr.searchForIPAddresses(this);
|
||||
ListResponse<IPAddressResponse> response = new ListResponse<IPAddressResponse>();
|
||||
List<IPAddressResponse> ipAddrResponses = new ArrayList<IPAddressResponse>();
|
||||
for (IpAddress ipAddress : result.first()) {
|
||||
IPAddressResponse ipResponse = _responseGenerator.createIPAddressResponse(ResponseView.Full, ipAddress);
|
||||
ipResponse.setObjectName("publicipaddress");
|
||||
ipAddrResponses.add(ipResponse);
|
||||
}
|
||||
|
||||
response.setResponses(ipAddrResponses, result.second());
|
||||
response.setResponseName(getCommandName());
|
||||
setResponseObject(response);
|
||||
}
|
||||
|
||||
}
|
||||
@ -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.command.admin.affinitygroup;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants.VMDetails;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.ResponseObject.ResponseView;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.command.user.affinitygroup.UpdateVMAffinityGroupCmd;
|
||||
import org.apache.cloudstack.api.response.UserVmResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.uservm.UserVm;
|
||||
|
||||
|
||||
@APICommand(name = "updateVMAffinityGroup", description = "Updates the affinity/anti-affinity group associations of a virtual machine. The VM has to be stopped and restarted for the "
|
||||
+ "new properties to take effect.", responseObject = UserVmResponse.class, responseView = ResponseView.Full)
|
||||
public class UpdateVMAffinityGroupCmdByAdmin extends UpdateVMAffinityGroupCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(UpdateVMAffinityGroupCmdByAdmin.class.getName());
|
||||
|
||||
|
||||
@Override
|
||||
public void execute() throws ResourceUnavailableException,
|
||||
InsufficientCapacityException, ServerApiException {
|
||||
CallContext.current().setEventDetails("Vm Id: "+getId());
|
||||
UserVm result = _affinityGroupService.updateVMAffinityGroups(getId(), getAffinityGroupIdList());
|
||||
ArrayList<VMDetails> dc = new ArrayList<VMDetails>();
|
||||
dc.add(VMDetails.valueOf("affgrp"));
|
||||
EnumSet<VMDetails> details = EnumSet.copyOf(dc);
|
||||
|
||||
if (result != null){
|
||||
UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Full, "virtualmachine", details, result).get(0);
|
||||
response.setResponseName(getCommandName());
|
||||
setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update vm's affinity groups");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -31,7 +31,8 @@ import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.event.EventTypes;
|
||||
|
||||
@APICommand(name = "generateAlert", description = "Generates an alert", responseObject = SuccessResponse.class, since = "4.3")
|
||||
@APICommand(name = "generateAlert", description = "Generates an alert", responseObject = SuccessResponse.class, since = "4.3",
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class GenerateAlertCmd extends BaseAsyncCmd {
|
||||
|
||||
public static final Logger s_logger = Logger.getLogger(GenerateAlertCmd.class.getName());
|
||||
@ -48,7 +49,7 @@ public class GenerateAlertCmd extends BaseAsyncCmd {
|
||||
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "Name of the alert", required = true)
|
||||
private String name;
|
||||
|
||||
@Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, description = "Alert description", required = true)
|
||||
@Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, description = "Alert description", required = true, length = 999)
|
||||
private String description;
|
||||
|
||||
@Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "Zone id for which alert is generated")
|
||||
|
||||
@ -32,7 +32,8 @@ import com.cloud.event.EventTypes;
|
||||
import com.cloud.network.as.Counter;
|
||||
import com.cloud.user.Account;
|
||||
|
||||
@APICommand(name = "createCounter", description = "Adds metric counter", responseObject = CounterResponse.class)
|
||||
@APICommand(name = "createCounter", description = "Adds metric counter", responseObject = CounterResponse.class,
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class CreateCounterCmd extends BaseAsyncCreateCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(CreateCounterCmd.class.getName());
|
||||
private static final String s_name = "counterresponse";
|
||||
|
||||
@ -33,7 +33,8 @@ import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.ResourceInUseException;
|
||||
import com.cloud.user.Account;
|
||||
|
||||
@APICommand(name = "deleteCounter", description = "Deletes a counter", responseObject = SuccessResponse.class)
|
||||
@APICommand(name = "deleteCounter", description = "Deletes a counter", responseObject = SuccessResponse.class,
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class DeleteCounterCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(DeleteCounterCmd.class.getName());
|
||||
private static final String s_name = "deletecounterresponse";
|
||||
|
||||
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