diff --git a/.gitignore b/.gitignore
index d6f5d1c8feb..a0307a771de 100644
--- a/.gitignore
+++ b/.gitignore
@@ -64,6 +64,7 @@ awsapi/modules/*
.settings.xml
.settings/
db.properties.override
+replace.properties.override
awsapi/overlays/
tools/marvin/marvin/cloudstackAPI/*
*.egg-info/
diff --git a/LICENSE b/LICENSE
index c970ff13924..497323bffce 100644
--- a/LICENSE
+++ b/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
diff --git a/NOTICE b/NOTICE
index d36048aabda..a74c0dcb52b 100644
--- a/NOTICE
+++ b/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/).
diff --git a/agent/conf/agent.properties b/agent/conf/agent.properties
index a7376b68947..b8b7a7cdad0 100644
--- a/agent/conf/agent.properties
+++ b/agent/conf/agent.properties
@@ -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
diff --git a/agent/distro/centos/SYSCONFDIR/rc.d/init.d/cloud-agent.in b/agent/distro/centos/SYSCONFDIR/rc.d/init.d/cloud-agent.in
index fb82ebfab99..d1769ccdfb0 100755
--- a/agent/distro/centos/SYSCONFDIR/rc.d/init.d/cloud-agent.in
+++ b/agent/distro/centos/SYSCONFDIR/rc.d/init.d/cloud-agent.in
@@ -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
diff --git a/agent/distro/fedora/SYSCONFDIR/rc.d/init.d/cloud-agent.in b/agent/distro/fedora/SYSCONFDIR/rc.d/init.d/cloud-agent.in
index fb82ebfab99..d1769ccdfb0 100755
--- a/agent/distro/fedora/SYSCONFDIR/rc.d/init.d/cloud-agent.in
+++ b/agent/distro/fedora/SYSCONFDIR/rc.d/init.d/cloud-agent.in
@@ -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
diff --git a/agent/distro/opensuse/sles/SYSCONFDIR/init.d/cloud-agent.in b/agent/distro/opensuse/sles/SYSCONFDIR/init.d/cloud-agent.in
index ea1c6059b60..741317bde43 100644
--- a/agent/distro/opensuse/sles/SYSCONFDIR/init.d/cloud-agent.in
+++ b/agent/distro/opensuse/sles/SYSCONFDIR/init.d/cloud-agent.in
@@ -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
diff --git a/agent/distro/rhel/SYSCONFDIR/rc.d/init.d/cloud-agent.in b/agent/distro/rhel/SYSCONFDIR/rc.d/init.d/cloud-agent.in
index fb82ebfab99..d1769ccdfb0 100644
--- a/agent/distro/rhel/SYSCONFDIR/rc.d/init.d/cloud-agent.in
+++ b/agent/distro/rhel/SYSCONFDIR/rc.d/init.d/cloud-agent.in
@@ -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
diff --git a/agent/distro/sles/SYSCONFDIR/init.d/cloud-agent.in b/agent/distro/sles/SYSCONFDIR/init.d/cloud-agent.in
index ea1c6059b60..741317bde43 100644
--- a/agent/distro/sles/SYSCONFDIR/init.d/cloud-agent.in
+++ b/agent/distro/sles/SYSCONFDIR/init.d/cloud-agent.in
@@ -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
diff --git a/agent/findbugsExcludeFilter.xml b/agent/findbugsExcludeFilter.xml
new file mode 100644
index 00000000000..d37285017e8
--- /dev/null
+++ b/agent/findbugsExcludeFilter.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
diff --git a/agent/pom.xml b/agent/pom.xml
index 2036ae0ca39..347c0f0fbf0 100644
--- a/agent/pom.xml
+++ b/agent/pom.xml
@@ -23,7 +23,7 @@
org.apache.cloudstack
cloudstack
- 4.4.0-SNAPSHOT
+ 4.5.0-SNAPSHOT
diff --git a/api/findbugsExcludeFilter.xml b/api/findbugsExcludeFilter.xml
new file mode 100644
index 00000000000..d37285017e8
--- /dev/null
+++ b/api/findbugsExcludeFilter.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
diff --git a/api/pom.xml b/api/pom.xml
index 7629e9fd07d..abfa2c59e02 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -23,7 +23,7 @@
org.apache.cloudstack
cloudstack
- 4.4.0-SNAPSHOT
+ 4.5.0-SNAPSHOT
diff --git a/api/src/com/cloud/agent/api/HostVmStateReportEntry.java b/api/src/com/cloud/agent/api/HostVmStateReportEntry.java
index 4f0fb911225..08acfef6c86 100644
--- a/api/src/com/cloud/agent/api/HostVmStateReportEntry.java
+++ b/api/src/com/cloud/agent/api/HostVmStateReportEntry.java
@@ -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;
- }
}
diff --git a/api/src/com/cloud/agent/api/to/GPUDeviceTO.java b/api/src/com/cloud/agent/api/to/GPUDeviceTO.java
new file mode 100644
index 00000000000..8bc9e5229de
--- /dev/null
+++ b/api/src/com/cloud/agent/api/to/GPUDeviceTO.java
@@ -0,0 +1,56 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api.to;
+
+import java.util.HashMap;
+
+public class GPUDeviceTO {
+
+ private String gpuGroup;
+ private String vgpuType;
+ private HashMap> groupDetails = new HashMap>();
+
+ public GPUDeviceTO( String gpuGroup, String vgpuType, HashMap> 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> getGroupDetails() {
+ return groupDetails;
+ }
+
+ public void setGroupDetails(HashMap> groupDetails) {
+ this.groupDetails = groupDetails;
+ }
+}
diff --git a/api/src/com/cloud/agent/api/to/NicTO.java b/api/src/com/cloud/agent/api/to/NicTO.java
index bd8f24ec563..67660c85307 100644
--- a/api/src/com/cloud/agent/api/to/NicTO.java
+++ b/api/src/com/cloud/agent/api/to/NicTO.java
@@ -80,4 +80,12 @@ public class NicTO extends NetworkTO {
public List getNicSecIps() {
return nicSecIps;
}
+
+ public String getNetworkUuid() {
+ return super.getUuid();
+ }
+
+ public void setNetworkUuid(String uuid) {
+ super.setUuid(uuid);
+ }
}
diff --git a/api/src/com/cloud/agent/api/to/VirtualMachineTO.java b/api/src/com/cloud/agent/api/to/VirtualMachineTO.java
index bed3e1d6aaf..bbd83852abf 100644
--- a/api/src/com/cloud/agent/api/to/VirtualMachineTO.java
+++ b/api/src/com/cloud/agent/api/to/VirtualMachineTO.java
@@ -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;
+ }
+
}
diff --git a/api/src/com/cloud/domain/Domain.java b/api/src/com/cloud/domain/Domain.java
index c4755d79c96..365a705041c 100644
--- a/api/src/com/cloud/domain/Domain.java
+++ b/api/src/com/cloud/domain/Domain.java
@@ -60,7 +60,4 @@ public interface Domain extends OwnedBy, Identity, InternalIdentity {
String getNetworkDomain();
- @Override
- public String getUuid();
-
}
diff --git a/api/src/com/cloud/event/EventTypes.java b/api/src/com/cloud/event/EventTypes.java
index e88f0104ea7..39ef710f8a9 100755
--- a/api/src/com/cloud/event/EventTypes.java
+++ b/api/src/com/cloud/event/EventTypes.java
@@ -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();
@@ -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) {
diff --git a/api/src/com/cloud/gpu/GPU.java b/api/src/com/cloud/gpu/GPU.java
new file mode 100644
index 00000000000..0eb466758fc
--- /dev/null
+++ b/api/src/com/cloud/gpu/GPU.java
@@ -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;
+ }
+ }
+}
diff --git a/api/src/com/cloud/network/IpAddress.java b/api/src/com/cloud/network/IpAddress.java
index a3816cb3ded..5aae7842798 100644
--- a/api/src/com/cloud/network/IpAddress.java
+++ b/api/src/com/cloud/network/IpAddress.java
@@ -85,4 +85,6 @@ public interface IpAddress extends ControlledEntity, Identity, InternalIdentity
Long getNetworkId();
+ boolean isDisplay();
+
}
diff --git a/api/src/com/cloud/network/MonitoringService.java b/api/src/com/cloud/network/MonitoringService.java
index 63f2ec10425..b33e8ffe139 100644
--- a/api/src/com/cloud/network/MonitoringService.java
+++ b/api/src/com/cloud/network/MonitoringService.java
@@ -39,7 +39,7 @@ public interface MonitoringService extends ControlledEntity, Identity, InternalI
String getServiceName();
- String getPidFile();
+ String getServicePidFile();
String getServicePath();
}
diff --git a/api/src/com/cloud/network/Network.java b/api/src/com/cloud/network/Network.java
index 62151a4f0c0..ef3bcdf51c4 100644
--- a/api/src/com/cloud/network/Network.java
+++ b/api/src/com/cloud/network/Network.java
@@ -57,7 +57,7 @@ public interface Network extends ControlledEntity, StateObject, 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, 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, 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, I
Long getNetworkACLId();
void setNetworkACLId(Long networkACLId);
+
+ boolean isStrechedL2Network();
}
diff --git a/api/src/com/cloud/network/NetworkModel.java b/api/src/com/cloud/network/NetworkModel.java
index f6555db565e..f48bc9a7e5a 100644
--- a/api/src/com/cloud/network/NetworkModel.java
+++ b/api/src/com/cloud/network/NetworkModel.java
@@ -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> 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);
}
\ No newline at end of file
diff --git a/api/src/com/cloud/network/NetworkProfile.java b/api/src/com/cloud/network/NetworkProfile.java
index 1b66c7c5f7c..db3cba56e1a 100644
--- a/api/src/com/cloud/network/NetworkProfile.java
+++ b/api/src/com/cloud/network/NetworkProfile.java
@@ -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;
+ }
+
}
diff --git a/api/src/com/cloud/network/NetworkService.java b/api/src/com/cloud/network/NetworkService.java
index 1731b119d5e..1e126f52aee 100755
--- a/api/src/com/cloud/network/NetworkService.java
+++ b/api/src/com/cloud/network/NetworkService.java
@@ -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 isolationMethods, String broadcastDomainRange, Long domainId,
List tags, String name);
@@ -176,4 +176,6 @@ public interface NetworkService {
List extends Nic> listNics(ListNicsCmd listNicsCmd);
Map getNetworkOfferingServiceCapabilities(NetworkOffering offering, Service service);
+
+ IpAddress updateIP(Long id, String customId, Boolean displayIp);
}
diff --git a/api/src/com/cloud/network/RemoteAccessVpn.java b/api/src/com/cloud/network/RemoteAccessVpn.java
index d3262b75e3e..4d7e4d49b12 100644
--- a/api/src/com/cloud/network/RemoteAccessVpn.java
+++ b/api/src/com/cloud/network/RemoteAccessVpn.java
@@ -38,4 +38,6 @@ public interface RemoteAccessVpn extends ControlledEntity, InternalIdentity, Ide
Long getVpcId();
State getState();
+
+ boolean isDisplay();
}
diff --git a/api/src/com/cloud/network/Site2SiteVpnConnection.java b/api/src/com/cloud/network/Site2SiteVpnConnection.java
index ad1a9825c01..81e81801195 100644
--- a/api/src/com/cloud/network/Site2SiteVpnConnection.java
+++ b/api/src/com/cloud/network/Site2SiteVpnConnection.java
@@ -42,4 +42,6 @@ public interface Site2SiteVpnConnection extends ControlledEntity, InternalIdenti
public Date getRemoved();
public boolean isPassive();
+
+ boolean isDisplay();
}
diff --git a/api/src/com/cloud/network/Site2SiteVpnGateway.java b/api/src/com/cloud/network/Site2SiteVpnGateway.java
index b60db3adf5c..bae12597f27 100644
--- a/api/src/com/cloud/network/Site2SiteVpnGateway.java
+++ b/api/src/com/cloud/network/Site2SiteVpnGateway.java
@@ -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();
}
diff --git a/api/src/com/cloud/network/VpcVirtualNetworkApplianceService.java b/api/src/com/cloud/network/VpcVirtualNetworkApplianceService.java
index eee62ceea76..382c460725d 100644
--- a/api/src/com/cloud/network/VpcVirtualNetworkApplianceService.java
+++ b/api/src/com/cloud/network/VpcVirtualNetworkApplianceService.java
@@ -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 params)
+ throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
/**
* @param router
diff --git a/api/src/com/cloud/network/as/AutoScaleVmGroup.java b/api/src/com/cloud/network/as/AutoScaleVmGroup.java
index e8b328fc267..14c761593b1 100644
--- a/api/src/com/cloud/network/as/AutoScaleVmGroup.java
+++ b/api/src/com/cloud/network/as/AutoScaleVmGroup.java
@@ -53,4 +53,6 @@ public interface AutoScaleVmGroup extends ControlledEntity, InternalIdentity {
String getUuid();
+ boolean isDisplay();
+
}
diff --git a/api/src/com/cloud/network/as/AutoScaleVmProfile.java b/api/src/com/cloud/network/as/AutoScaleVmProfile.java
index 0577080a316..6e0b5ffb91b 100644
--- a/api/src/com/cloud/network/as/AutoScaleVmProfile.java
+++ b/api/src/com/cloud/network/as/AutoScaleVmProfile.java
@@ -48,4 +48,6 @@ public interface AutoScaleVmProfile extends ControlledEntity, InternalIdentity {
public long getAutoScaleUserId();
+ boolean isDisplay();
+
}
diff --git a/api/src/com/cloud/network/element/AggregatedCommandExecutor.java b/api/src/com/cloud/network/element/AggregatedCommandExecutor.java
new file mode 100644
index 00000000000..012908fc268
--- /dev/null
+++ b/api/src/com/cloud/network/element/AggregatedCommandExecutor.java
@@ -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;
+}
diff --git a/api/src/com/cloud/network/firewall/FirewallService.java b/api/src/com/cloud/network/firewall/FirewallService.java
index 917bda3de6d..5ab789121ad 100644
--- a/api/src/com/cloud/network/firewall/FirewallService.java
+++ b/api/src/com/cloud/network/firewall/FirewallService.java
@@ -50,4 +50,6 @@ public interface FirewallService {
boolean revokeRelatedFirewallRule(long ruleId, boolean apply);
+ FirewallRule updateFirewallRule(long ruleId, String customId, Boolean forDisplay);
+
}
diff --git a/api/src/com/cloud/network/lb/LoadBalancingRulesService.java b/api/src/com/cloud/network/lb/LoadBalancingRulesService.java
index cd0a276c73c..98d29c5718d 100644
--- a/api/src/com/cloud/network/lb/LoadBalancingRulesService.java
+++ b/api/src/com/cloud/network/lb/LoadBalancingRulesService.java
@@ -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 to a load balancer.
*/
- boolean assignToLoadBalancer(long lbRuleId, List vmIds);
+ boolean assignToLoadBalancer(long lbRuleId, List vmIds, Map> vmIdIpMap);
boolean assignSSLCertToLoadBalancerRule(Long lbRuleId, String certName, String publicCert, String privateKey);
- boolean removeFromLoadBalancer(long lbRuleId, List vmIds);
+ boolean removeFromLoadBalancer(long lbRuleId, List vmIds, Map> vmIdIpMap);
boolean applyLoadBalancerConfig(long lbRuleId) throws ResourceUnavailableException;
@@ -150,4 +151,8 @@ public interface LoadBalancingRulesService {
public void updateLBHealthChecks(Scheme scheme) throws ResourceUnavailableException;
Map getLbInstances(long lbId);
+
+ boolean isLbRuleMappedToVmGuestIp(String vmSecondaryIp);
+
+ List listLbVmIpAddress(long id, long vmId);
}
diff --git a/api/src/com/cloud/network/rules/FirewallRule.java b/api/src/com/cloud/network/rules/FirewallRule.java
index 274242ad394..b02257b7c89 100644
--- a/api/src/com/cloud/network/rules/FirewallRule.java
+++ b/api/src/com/cloud/network/rules/FirewallRule.java
@@ -87,4 +87,6 @@ public interface FirewallRule extends ControlledEntity, Identity, InternalIdenti
*/
TrafficType getTrafficType();
+ boolean isDisplay();
+
}
diff --git a/api/src/com/cloud/network/rules/RulesService.java b/api/src/com/cloud/network/rules/RulesService.java
index 39329d5e734..2dd0182dbc4 100644
--- a/api/src/com/cloud/network/rules/RulesService.java
+++ b/api/src/com/cloud/network/rules/RulesService.java
@@ -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);
+
}
diff --git a/api/src/com/cloud/network/vpc/NetworkACL.java b/api/src/com/cloud/network/vpc/NetworkACL.java
index a97c57d6ff0..3ebee146ed8 100644
--- a/api/src/com/cloud/network/vpc/NetworkACL.java
+++ b/api/src/com/cloud/network/vpc/NetworkACL.java
@@ -33,4 +33,6 @@ public interface NetworkACL extends InternalIdentity {
long getId();
String getName();
+
+ boolean isDisplay();
}
diff --git a/api/src/com/cloud/network/vpc/NetworkACLItem.java b/api/src/com/cloud/network/vpc/NetworkACLItem.java
index d8dd0fb79d1..faa4d273c9c 100644
--- a/api/src/com/cloud/network/vpc/NetworkACLItem.java
+++ b/api/src/com/cloud/network/vpc/NetworkACLItem.java
@@ -73,4 +73,6 @@ public interface NetworkACLItem extends InternalIdentity {
*/
TrafficType getTrafficType();
+ boolean isDisplay();
+
}
diff --git a/api/src/com/cloud/network/vpc/NetworkACLService.java b/api/src/com/cloud/network/vpc/NetworkACLService.java
index 4d1188018b5..7cd1d3b3141 100644
--- a/api/src/com/cloud/network/vpc/NetworkACLService.java
+++ b/api/src/com/cloud/network/vpc/NetworkACLService.java
@@ -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 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);
+
}
diff --git a/api/src/com/cloud/network/vpc/StaticRouteProfile.java b/api/src/com/cloud/network/vpc/StaticRouteProfile.java
index 05cff4986a2..737541f0a40 100644
--- a/api/src/com/cloud/network/vpc/StaticRouteProfile.java
+++ b/api/src/com/cloud/network/vpc/StaticRouteProfile.java
@@ -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;
+ }
}
diff --git a/api/src/com/cloud/network/vpc/Vpc.java b/api/src/com/cloud/network/vpc/Vpc.java
index fb5f2cc8991..23388787d23 100644
--- a/api/src/com/cloud/network/vpc/Vpc.java
+++ b/api/src/com/cloud/network/vpc/Vpc.java
@@ -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();
}
diff --git a/api/src/com/cloud/network/vpc/VpcOffering.java b/api/src/com/cloud/network/vpc/VpcOffering.java
index 6e75a2f2500..660c79dc1e4 100644
--- a/api/src/com/cloud/network/vpc/VpcOffering.java
+++ b/api/src/com/cloud/network/vpc/VpcOffering.java
@@ -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();
}
diff --git a/api/src/com/cloud/network/vpc/VpcProvisioningService.java b/api/src/com/cloud/network/vpc/VpcProvisioningService.java
index 174b71f34a2..82a7baae959 100644
--- a/api/src/com/cloud/network/vpc/VpcProvisioningService.java
+++ b/api/src/com/cloud/network/vpc/VpcProvisioningService.java
@@ -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 supportedServices, Map> serviceProviders,
- Long serviceOfferingId);
+ public VpcOffering createVpcOffering(String name, String displayText, List supportedServices,
+ Map> serviceProviders,
+ Map serviceCapabilitystList,
+ Long serviceOfferingId);
List extends VpcOffering> listVpcOfferings(Long id, String name, String displayText, List supportedServicesStr, Boolean isDefault, String keyword,
String state, Long startIndex, Long pageSizeVal);
diff --git a/api/src/com/cloud/network/vpc/VpcService.java b/api/src/com/cloud/network/vpc/VpcService.java
index e28f3515271..d1166df4065 100644
--- a/api/src/com/cloud/network/vpc/VpcService.java
+++ b/api/src/com/cloud/network/vpc/VpcService.java
@@ -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 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 tags, Long projectId);
+ Map tags, Long projectId, Boolean display);
/**
* Starts VPC which includes starting VPC provider and applying all the neworking rules on the backend
diff --git a/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java b/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java
index ac9649b171b..acf007bbb33 100644
--- a/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java
+++ b/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java
@@ -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);
+
}
diff --git a/api/src/com/cloud/network/vpn/Site2SiteVpnService.java b/api/src/com/cloud/network/vpn/Site2SiteVpnService.java
index bfc5e2579bd..abdc7568766 100644
--- a/api/src/com/cloud/network/vpn/Site2SiteVpnService.java
+++ b/api/src/com/cloud/network/vpn/Site2SiteVpnService.java
@@ -63,4 +63,8 @@ public interface Site2SiteVpnService {
Pair, Integer> searchForVpnConnections(ListVpnConnectionsCmd listVpnConnectionsCmd);
Site2SiteCustomerGateway updateCustomerGateway(UpdateVpnCustomerGatewayCmd updateVpnCustomerGatewayCmd);
+
+ Site2SiteVpnConnection updateVpnConnection(long id, String customId, Boolean forDisplay);
+
+ Site2SiteVpnGateway updateVpnGateway(Long id, String customId, Boolean forDisplay);
}
diff --git a/api/src/com/cloud/offering/DiskOfferingInfo.java b/api/src/com/cloud/offering/DiskOfferingInfo.java
new file mode 100644
index 00000000000..75a520e2d5a
--- /dev/null
+++ b/api/src/com/cloud/offering/DiskOfferingInfo.java
@@ -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;
+ }
+}
\ No newline at end of file
diff --git a/api/src/com/cloud/offering/NetworkOffering.java b/api/src/com/cloud/offering/NetworkOffering.java
index b4f3863293a..f1ef69c2f68 100644
--- a/api/src/com/cloud/offering/NetworkOffering.java
+++ b/api/src/com/cloud/offering/NetworkOffering.java
@@ -129,4 +129,6 @@ public interface NetworkOffering extends InfrastructureEntity, InternalIdentity,
Integer getConcurrentConnections();
boolean isKeepAliveEnabled();
+
+ boolean getSupportsStrechedL2();
}
diff --git a/api/src/com/cloud/serializer/Param.java b/api/src/com/cloud/serializer/Param.java
index 02deb6f1c1f..3e6f852128a 100644
--- a/api/src/com/cloud/serializer/Param.java
+++ b/api/src/com/cloud/serializer/Param.java
@@ -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 {};
}
diff --git a/api/src/com/cloud/server/ManagementService.java b/api/src/com/cloud/server/ManagementService.java
index 24fad87ea0f..abe6e2cd36e 100755
--- a/api/src/com/cloud/server/ManagementService.java
+++ b/api/src/com/cloud/server/ManagementService.java
@@ -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, Integer> listGuestOSCategoriesByCriteria(ListGuestOsCategoriesCmd cmd);
+ /**
+ * Obtains a list of all guest OS mappings
+ *
+ * @return list of GuestOSHypervisor
+ */
+ Pair, 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();
+
+
}
diff --git a/api/src/com/cloud/server/ResourceMetaDataService.java b/api/src/com/cloud/server/ResourceMetaDataService.java
index 2871d991ab7..56fe1045ab3 100644
--- a/api/src/com/cloud/server/ResourceMetaDataService.java
+++ b/api/src/com/cloud/server/ResourceMetaDataService.java
@@ -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 details);
+ boolean addResourceMetaData(String resourceId, ResourceObjectType resourceType, Map details, boolean forDisplay);
/**
*
diff --git a/api/src/com/cloud/server/ResourceTag.java b/api/src/com/cloud/server/ResourceTag.java
index 41931f0949b..275510e1a1a 100644
--- a/api/src/com/cloud/server/ResourceTag.java
+++ b/api/src/com/cloud/server/ResourceTag.java
@@ -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;
diff --git a/api/src/com/cloud/storage/GuestOS.java b/api/src/com/cloud/storage/GuestOS.java
index 437cd37d1ab..767a60ecf9f 100644
--- a/api/src/com/cloud/storage/GuestOS.java
+++ b/api/src/com/cloud/storage/GuestOS.java
@@ -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();
}
diff --git a/api/src/com/cloud/storage/GuestOSHypervisor.java b/api/src/com/cloud/storage/GuestOSHypervisor.java
index f022722af04..1cfc3a17285 100644
--- a/api/src/com/cloud/storage/GuestOSHypervisor.java
+++ b/api/src/com/cloud/storage/GuestOSHypervisor.java
@@ -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();
}
diff --git a/api/src/com/cloud/storage/Storage.java b/api/src/com/cloud/storage/Storage.java
index 2175c9b1a0c..8ab2463a81b 100755
--- a/api/src/com/cloud/storage/Storage.java
+++ b/api/src/com/cloud/storage/Storage.java
@@ -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;
diff --git a/api/src/com/cloud/storage/StoragePool.java b/api/src/com/cloud/storage/StoragePool.java
index 6ede960c1f0..8e03c3348f3 100644
--- a/api/src/com/cloud/storage/StoragePool.java
+++ b/api/src/com/cloud/storage/StoragePool.java
@@ -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();
}
diff --git a/api/src/com/cloud/storage/Volume.java b/api/src/com/cloud/storage/Volume.java
index 84f0872f909..304dbcfe342 100755
--- a/api/src/com/cloud/storage/Volume.java
+++ b/api/src/com/cloud/storage/Volume.java
@@ -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();
}
diff --git a/api/src/com/cloud/storage/VolumeApiService.java b/api/src/com/cloud/storage/VolumeApiService.java
index 09ac3ee2cbb..5487a4bf9b2 100644
--- a/api/src/com/cloud/storage/VolumeApiService.java
+++ b/api/src/com/cloud/storage/VolumeApiService.java
@@ -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);
}
diff --git a/api/src/com/cloud/template/VirtualMachineTemplate.java b/api/src/com/cloud/template/VirtualMachineTemplate.java
index 9118bb22755..599212bb039 100755
--- a/api/src/com/cloud/template/VirtualMachineTemplate.java
+++ b/api/src/com/cloud/template/VirtualMachineTemplate.java
@@ -99,5 +99,5 @@ public interface VirtualMachineTemplate extends ControlledEntity, Identity, Inte
Map getDetails();
- Boolean isDynamicallyScalable();
+ boolean isDynamicallyScalable();
}
diff --git a/api/src/com/cloud/user/Account.java b/api/src/com/cloud/user/Account.java
index 99ef954feac..b912e515bf3 100755
--- a/api/src/com/cloud/user/Account.java
+++ b/api/src/com/cloud/user/Account.java
@@ -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
diff --git a/api/src/com/cloud/user/AccountService.java b/api/src/com/cloud/user/AccountService.java
index a9be2922edf..49652700ff5 100755
--- a/api/src/com/cloud/user/AccountService.java
+++ b/api/src/com/cloud/user/AccountService.java
@@ -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);
}
diff --git a/api/src/com/cloud/user/ResourceLimitService.java b/api/src/com/cloud/user/ResourceLimitService.java
index de2773a955c..fef16da942f 100644
--- a/api/src/com/cloud/user/ResourceLimitService.java
+++ b/api/src/com/cloud/user/ResourceLimitService.java
@@ -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
diff --git a/api/src/com/cloud/uservm/UserVm.java b/api/src/com/cloud/uservm/UserVm.java
index b1d1712d9cf..16a203746a9 100755
--- a/api/src/com/cloud/uservm/UserVm.java
+++ b/api/src/com/cloud/uservm/UserVm.java
@@ -39,4 +39,5 @@ public interface UserVm extends VirtualMachine, ControlledEntity {
void setAccountId(long accountId);
+ public boolean isDisplayVm();
}
diff --git a/api/src/com/cloud/vm/UserVmService.java b/api/src/com/cloud/vm/UserVmService.java
index 51a8fdfbe38..af4e1d3699e 100755
--- a/api/src/com/cloud/vm/UserVmService.java
+++ b/api/src/com/cloud/vm/UserVmService.java
@@ -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);
+
}
diff --git a/api/src/com/cloud/vm/VirtualMachine.java b/api/src/com/cloud/vm/VirtualMachine.java
index d6e70a8a6cf..e7cfd64c4e7 100755
--- a/api/src/com/cloud/vm/VirtualMachine.java
+++ b/api/src/com/cloud/vm/VirtualMachine.java
@@ -34,7 +34,10 @@ import com.cloud.utils.fsm.StateObject;
public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, InternalIdentity, StateObject {
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();
+
}
diff --git a/api/src/org/apache/cloudstack/acl/ControlledEntity.java b/api/src/org/apache/cloudstack/acl/ControlledEntity.java
index 59575768011..b8a244f3bdd 100644
--- a/api/src/org/apache/cloudstack/acl/ControlledEntity.java
+++ b/api/src/org/apache/cloudstack/acl/ControlledEntity.java
@@ -29,4 +29,5 @@ public interface ControlledEntity extends OwnedBy, PartOf {
Account, Domain
}
+ Class> getEntityType();
}
diff --git a/api/src/org/apache/cloudstack/acl/Role.java b/api/src/org/apache/cloudstack/acl/PermissionScope.java
similarity index 59%
rename from api/src/org/apache/cloudstack/acl/Role.java
rename to api/src/org/apache/cloudstack/acl/PermissionScope.java
index 947a8c2e4d7..6647440d555 100644
--- a/api/src/org/apache/cloudstack/acl/Role.java
+++ b/api/src/org/apache/cloudstack/acl/PermissionScope.java
@@ -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;
+ }
}
diff --git a/api/src/org/apache/cloudstack/acl/QuerySelector.java b/api/src/org/apache/cloudstack/acl/QuerySelector.java
new file mode 100644
index 00000000000..b89aa4e9ef5
--- /dev/null
+++ b/api/src/org/apache/cloudstack/acl/QuerySelector.java
@@ -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 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 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 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 listAclGroupsByAccount(long accountId);
+
+}
diff --git a/api/src/org/apache/cloudstack/acl/RoleType.java b/api/src/org/apache/cloudstack/acl/RoleType.java
index 8505256fa57..90e3d1ef604 100644
--- a/api/src/org/apache/cloudstack/acl/RoleType.java
+++ b/api/src/org/apache/cloudstack/acl/RoleType.java
@@ -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;
}
}
+
diff --git a/api/src/org/apache/cloudstack/acl/SecurityChecker.java b/api/src/org/apache/cloudstack/acl/SecurityChecker.java
index ab3f7c5f320..41708717548 100644
--- a/api/src/org/apache/cloudstack/acl/SecurityChecker.java
+++ b/api/src/org/apache/cloudstack/acl/SecurityChecker.java
@@ -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.
diff --git a/api/src/org/apache/cloudstack/api/ACL.java b/api/src/org/apache/cloudstack/api/ACL.java
index 4955120887e..2b0d4c33609 100644
--- a/api/src/org/apache/cloudstack/api/ACL.java
+++ b/api/src/org/apache/cloudstack/api/ACL.java
@@ -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;
diff --git a/api/src/org/apache/cloudstack/api/APICommand.java b/api/src/org/apache/cloudstack/api/APICommand.java
index 5587a48b765..d451e4b10a3 100644
--- a/api/src/org/apache/cloudstack/api/APICommand.java
+++ b/api/src/org/apache/cloudstack/api/APICommand.java
@@ -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 {};
}
diff --git a/api/src/org/apache/cloudstack/api/ApiCommandJobType.java b/api/src/org/apache/cloudstack/api/ApiCommandJobType.java
index 3067af8a528..227fb30114f 100644
--- a/api/src/org/apache/cloudstack/api/ApiCommandJobType.java
+++ b/api/src/org/apache/cloudstack/api/ApiCommandJobType.java
@@ -49,5 +49,9 @@ public enum ApiCommandJobType {
LoadBalancerRule,
AffinityGroup,
InternalLbVm,
- DedicatedGuestVlanRange
-}
\ No newline at end of file
+ DedicatedGuestVlanRange,
+ IAMPolicy,
+ IAMGroup,
+ GuestOs,
+ GuestOsMapping
+}
diff --git a/api/src/org/apache/cloudstack/api/ApiConstants.java b/api/src/org/apache/cloudstack/api/ApiConstants.java
index d500303bcac..c7d6da1d3c8 100755
--- a/api/src/org/apache/cloudstack/api/ApiConstants.java
+++ b/api/src/org/apache/cloudstack/api/ApiConstants.java
@@ -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;
diff --git a/api/src/org/apache/cloudstack/api/BaseAsyncCmd.java b/api/src/org/apache/cloudstack/api/BaseAsyncCmd.java
index ae0f5d703bc..0b1396fbf83 100644
--- a/api/src/org/apache/cloudstack/api/BaseAsyncCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseAsyncCmd.java
@@ -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);
- }
-
}
diff --git a/api/src/org/apache/cloudstack/api/BaseAsyncCustomIdCmd.java b/api/src/org/apache/cloudstack/api/BaseAsyncCustomIdCmd.java
index 18264da1aa2..b251c6ef2ec 100644
--- a/api/src/org/apache/cloudstack/api/BaseAsyncCustomIdCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseAsyncCustomIdCmd.java
@@ -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();
+
}
diff --git a/api/src/org/apache/cloudstack/api/BaseAsyncVMCmd.java b/api/src/org/apache/cloudstack/api/BaseAsyncVMCmd.java
new file mode 100644
index 00000000000..abfc9530274
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/BaseAsyncVMCmd.java
@@ -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();
+}
diff --git a/api/src/org/apache/cloudstack/api/BaseAsyncVolumeCmd.java b/api/src/org/apache/cloudstack/api/BaseAsyncVolumeCmd.java
new file mode 100644
index 00000000000..1782e4a1348
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/BaseAsyncVolumeCmd.java
@@ -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();
+}
diff --git a/api/src/org/apache/cloudstack/api/BaseCmd.java b/api/src/org/apache/cloudstack/api/BaseCmd.java
index 4229ec9302b..f6f21ae7162 100644
--- a/api/src/org/apache/cloudstack/api/BaseCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseCmd.java
@@ -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, List> fieldsForCmdClass = new HashMap, List>();
+ 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 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 unpackParams(Map params) {
- Map lowercaseParams = new HashMap();
- 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 getAllFieldsForClass(final Class> clazz) {
+ List filteredFields = fieldsForCmdClass.get(clazz);
+
+ // If list of fields was not cached yet
+ if (filteredFields == null) {
+ final List allFields = ReflectUtil.getAllFieldsForClass(this.getClass(), BaseCmd.class);
+ filteredFields = new ArrayList();
+
+ 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 getParamFields() {
+ final List allFields = getAllFieldsForClass(this.getClass());
+ final List validFields = new ArrayList();
+ 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 mapArray = null;
- Map 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();
- mapValue = new HashMap();
- 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();
- 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 map) {
+ public void setFullUrlParams(final Map 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 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 idList = new ArrayList();
- //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;
}
}
diff --git a/api/src/org/apache/cloudstack/api/BaseCustomIdCmd.java b/api/src/org/apache/cloudstack/api/BaseCustomIdCmd.java
index 8ae746f319e..7ca9f1efe7e 100644
--- a/api/src/org/apache/cloudstack/api/BaseCustomIdCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseCustomIdCmd.java
@@ -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();
+
}
diff --git a/api/src/org/apache/cloudstack/api/BaseListAccountResourcesCmd.java b/api/src/org/apache/cloudstack/api/BaseListAccountResourcesCmd.java
index 0586117f0c6..63d2b7f7615 100644
--- a/api/src/org/apache/cloudstack/api/BaseListAccountResourcesCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseListAccountResourcesCmd.java
@@ -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;
+ }
}
diff --git a/api/src/org/apache/cloudstack/api/BaseListCmd.java b/api/src/org/apache/cloudstack/api/BaseListCmd.java
index c1a4b4c440f..407ad22b606 100644
--- a/api/src/org/apache/cloudstack/api/BaseListCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseListCmd.java
@@ -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 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");
+ }
+ }
}
diff --git a/api/src/org/apache/cloudstack/api/BaseListTemplateOrIsoPermissionsCmd.java b/api/src/org/apache/cloudstack/api/BaseListTemplateOrIsoPermissionsCmd.java
index 48c1e02cfd5..d149dffe291 100644
--- a/api/src/org/apache/cloudstack/api/BaseListTemplateOrIsoPermissionsCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseListTemplateOrIsoPermissionsCmd.java
@@ -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 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);
}
+
+
}
diff --git a/api/src/org/apache/cloudstack/api/Parameter.java b/api/src/org/apache/cloudstack/api/Parameter.java
index f1c6e1a4555..7ee6897af29 100644
--- a/api/src/org/apache/cloudstack/api/Parameter.java
+++ b/api/src/org/apache/cloudstack/api/Parameter.java
@@ -48,7 +48,5 @@ public @interface Parameter {
String since() default "";
- String retrieveMethod() default "getById";
-
RoleType[] authorized() default {};
}
diff --git a/api/src/org/apache/cloudstack/api/ResponseGenerator.java b/api/src/org/apache/cloudstack/api/ResponseGenerator.java
index 1cb53886a7c..10fb6df3a18 100644
--- a/api/src/org/apache/cloudstack/api/ResponseGenerator.java
+++ b/api/src/org/apache/cloudstack/api/ResponseGenerator.java
@@ -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 createUserVmResponse(String objectName, UserVm... userVms);
+ List createUserVmResponse(ResponseView view, String objectName, UserVm... userVms);
- List createUserVmResponse(String objectName, EnumSet details, UserVm... userVms);
+ List createUserVmResponse(ResponseView view, String objectName, EnumSet 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 createTemplateResponses(long templateId, long zoneId, boolean readyOnly);
-
VpnUsersResponse createVpnUserResponse(VpnUser user);
RemoteAccessVpnResponse createRemoteAccessVpnResponse(RemoteAccessVpn vpn);
- List createTemplateResponses(long templateId, Long zoneId, boolean readyOnly);
+ List createTemplateResponses(ResponseView view, long templateId, Long zoneId, boolean readyOnly);
- List createTemplateResponses(long templateId, Long snapshotId, Long volumeId, boolean readyOnly);
-
- //ListResponse createSecurityGroupResponses(List extends SecurityGroupRules> networkGroups);
+ List 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 createEventResponse(EventJoinVO... events);
+ TemplateResponse createTemplateUpdateResponse(ResponseView view, VirtualMachineTemplate result);
- TemplateResponse createTemplateUpdateResponse(VirtualMachineTemplate result);
-
- List createTemplateResponses(VirtualMachineTemplate result, Long zoneId, boolean readyOnly);
+ List createTemplateResponses(ResponseView view, VirtualMachineTemplate result, Long zoneId, boolean readyOnly);
List createCapacityResponse(List extends Capacity> result, DecimalFormat format);
- TemplatePermissionsResponse createTemplatePermissionsResponse(List accountNames, Long id, boolean isAdmin);
+ TemplatePermissionsResponse createTemplatePermissionsResponse(ResponseView view, List 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 createUserResponse(UserAccountJoinVO... users);
-
- AccountResponse createUserAccountResponse(UserAccount user);
+ AccountResponse createUserAccountResponse(ResponseView view, UserAccount user);
Long getSecurityGroupId(String groupName, long accountId);
- List createIsoResponses(VirtualMachineTemplate iso, Long zoneId, boolean readyOnly);
-
- // List createIsoResponses(long isoId, Long zoneId, boolean readyOnly);
- //List createIsoResponses(VirtualMachineTemplate iso, long zoneId, boolean readyOnly);
+ List createIsoResponses(ResponseView view, VirtualMachineTemplate iso, Long zoneId, boolean readyOnly);
ProjectResponse createProjectResponse(Project project);
- List createTemplateResponses(long templateId, Long vmId);
+ List 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);
diff --git a/api/src/org/apache/cloudstack/api/ResponseObject.java b/api/src/org/apache/cloudstack/api/ResponseObject.java
index 10867b4abad..ff2e172b70b 100644
--- a/api/src/org/apache/cloudstack/api/ResponseObject.java
+++ b/api/src/org/apache/cloudstack/api/ResponseObject.java
@@ -75,4 +75,9 @@ public interface ResponseObject {
* @param jobStatus
*/
void setJobStatus(Integer jobStatus);
+
+ public enum ResponseView {
+ Full,
+ Restricted
+ }
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java
index c5a2d1a0cc3..50d67d993df 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java
@@ -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");
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java
index 7c1b206d067..5754ec50108 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java
@@ -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");
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java
index 6fdbefe7afe..3e5e1d3d017 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java
@@ -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");
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java
index 59d6acd5d5f..f30c985c961 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java
@@ -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");
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/ListAccountsCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/account/ListAccountsCmdByAdmin.java
new file mode 100644
index 00000000000..555567bb5cc
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/ListAccountsCmdByAdmin.java
@@ -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 {
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java
index 93ec1be9f88..3c185e41bdd 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java
@@ -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());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java
index a8cf63fe5a4..a7ce74a1292 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java
@@ -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");
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/address/AssociateIPAddrCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/address/AssociateIPAddrCmdByAdmin.java
new file mode 100644
index 00000000000..494a6d66e40
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/address/AssociateIPAddrCmdByAdmin.java
@@ -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");
+ }
+ }
+
+
+
+
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/address/ListPublicIpAddressesCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/address/ListPublicIpAddressesCmdByAdmin.java
new file mode 100644
index 00000000000..3762e5f2a1b
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/address/ListPublicIpAddressesCmdByAdmin.java
@@ -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, Integer> result = _mgr.searchForIPAddresses(this);
+ ListResponse response = new ListResponse();
+ List ipAddrResponses = new ArrayList();
+ 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);
+ }
+
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/affinitygroup/UpdateVMAffinityGroupCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/affinitygroup/UpdateVMAffinityGroupCmdByAdmin.java
new file mode 100644
index 00000000000..85b8dd711d1
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/affinitygroup/UpdateVMAffinityGroupCmdByAdmin.java
@@ -0,0 +1,63 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.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 dc = new ArrayList();
+ dc.add(VMDetails.valueOf("affgrp"));
+ EnumSet 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");
+ }
+ }
+
+
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/alert/GenerateAlertCmd.java b/api/src/org/apache/cloudstack/api/command/admin/alert/GenerateAlertCmd.java
index 620c5ed8faa..58920d7dd74 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/alert/GenerateAlertCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/alert/GenerateAlertCmd.java
@@ -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")
diff --git a/api/src/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java
index 6c4b81b4f0e..ea715663d9c 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java
@@ -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";
diff --git a/api/src/org/apache/cloudstack/api/command/admin/autoscale/DeleteCounterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/autoscale/DeleteCounterCmd.java
index 50477f53760..3547ef10c8c 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/autoscale/DeleteCounterCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/autoscale/DeleteCounterCmd.java
@@ -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";
diff --git a/api/src/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java
index d0e73807392..b9df18e01ed 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java
@@ -38,7 +38,8 @@ import com.cloud.exception.ResourceInUseException;
import com.cloud.org.Cluster;
import com.cloud.user.Account;
-@APICommand(name = "addCluster", description = "Adds a new cluster", responseObject = ClusterResponse.class)
+@APICommand(name = "addCluster", description = "Adds a new cluster", responseObject = ClusterResponse.class,
+ requestHasSensitiveInfo = true, responseHasSensitiveInfo = false)
public class AddClusterCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(AddClusterCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/cluster/DeleteClusterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/cluster/DeleteClusterCmd.java
index e1bc5855ee8..5d046758007 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/cluster/DeleteClusterCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/cluster/DeleteClusterCmd.java
@@ -29,7 +29,8 @@ import org.apache.cloudstack.api.response.SuccessResponse;
import com.cloud.user.Account;
-@APICommand(name = "deleteCluster", description = "Deletes a cluster.", responseObject = SuccessResponse.class)
+@APICommand(name = "deleteCluster", description = "Deletes a cluster.", responseObject = SuccessResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteClusterCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(DeleteClusterCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java b/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java
index 8640f371445..432ca921c4d 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java
@@ -34,7 +34,8 @@ import org.apache.cloudstack.api.response.ZoneResponse;
import com.cloud.org.Cluster;
import com.cloud.utils.Pair;
-@APICommand(name = "listClusters", description = "Lists clusters.", responseObject = ClusterResponse.class)
+@APICommand(name = "listClusters", description = "Lists clusters.", responseObject = ClusterResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListClustersCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListServiceOfferingsCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java
index b13f81a16bc..53d01c58a56 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java
@@ -30,7 +30,8 @@ import com.cloud.exception.InvalidParameterValueException;
import com.cloud.org.Cluster;
import com.cloud.user.Account;
-@APICommand(name = "updateCluster", description = "Updates an existing cluster", responseObject = ClusterResponse.class)
+@APICommand(name = "updateCluster", description = "Updates an existing cluster", responseObject = ClusterResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class UpdateClusterCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(AddClusterCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java b/api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java
index 517807d4a78..a34bc3eb622 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java
@@ -35,7 +35,8 @@ import org.apache.cloudstack.config.Configuration;
import com.cloud.utils.Pair;
-@APICommand(name = "listConfigurations", description = "Lists all configurations.", responseObject = ConfigurationResponse.class)
+@APICommand(name = "listConfigurations", description = "Lists all configurations.", responseObject = ConfigurationResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListCfgsByCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListCfgsByCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/config/ListDeploymentPlannersCmd.java b/api/src/org/apache/cloudstack/api/command/admin/config/ListDeploymentPlannersCmd.java
index 1d9d2d935ff..b5a24b9bda8 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/config/ListDeploymentPlannersCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/config/ListDeploymentPlannersCmd.java
@@ -26,7 +26,8 @@ import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.response.DeploymentPlannersResponse;
import org.apache.cloudstack.api.response.ListResponse;
-@APICommand(name = "listDeploymentPlanners", description = "Lists all DeploymentPlanners available.", responseObject = DeploymentPlannersResponse.class)
+@APICommand(name = "listDeploymentPlanners", description = "Lists all DeploymentPlanners available.", responseObject = DeploymentPlannersResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListDeploymentPlannersCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListDeploymentPlannersCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/config/ListHypervisorCapabilitiesCmd.java b/api/src/org/apache/cloudstack/api/command/admin/config/ListHypervisorCapabilitiesCmd.java
index 16adf664bdd..6d3c2012af7 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/config/ListHypervisorCapabilitiesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/config/ListHypervisorCapabilitiesCmd.java
@@ -35,7 +35,9 @@ import com.cloud.utils.Pair;
@APICommand(name = "listHypervisorCapabilities",
description = "Lists all hypervisor capabilities.",
responseObject = HypervisorCapabilitiesResponse.class,
- since = "3.0.0")
+ since = "3.0.0",
+ requestHasSensitiveInfo = false,
+ responseHasSensitiveInfo = false)
public class ListHypervisorCapabilitiesCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListHypervisorCapabilitiesCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java b/api/src/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java
index 9bc9b3cbb5c..0124d5997b3 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java
@@ -33,7 +33,8 @@ import org.apache.cloudstack.config.Configuration;
import com.cloud.user.Account;
-@APICommand(name = "updateConfiguration", description = "Updates a configuration.", responseObject = ConfigurationResponse.class)
+@APICommand(name = "updateConfiguration", description = "Updates a configuration.", responseObject = ConfigurationResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class UpdateCfgCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(UpdateCfgCmd.class.getName());
private static final String s_name = "updateconfigurationresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/admin/config/UpdateHypervisorCapabilitiesCmd.java b/api/src/org/apache/cloudstack/api/command/admin/config/UpdateHypervisorCapabilitiesCmd.java
index 5cb5f9c3e52..6550c89240b 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/config/UpdateHypervisorCapabilitiesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/config/UpdateHypervisorCapabilitiesCmd.java
@@ -32,7 +32,9 @@ import com.cloud.user.Account;
@APICommand(name = "updateHypervisorCapabilities",
description = "Updates a hypervisor capabilities.",
responseObject = HypervisorCapabilitiesResponse.class,
- since = "3.0.0")
+ since = "3.0.0",
+ requestHasSensitiveInfo = false,
+ responseHasSensitiveInfo = false)
public class UpdateHypervisorCapabilitiesCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(UpdateHypervisorCapabilitiesCmd.class.getName());
private static final String s_name = "updatehypervisorcapabilitiesresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/admin/domain/CreateDomainCmd.java b/api/src/org/apache/cloudstack/api/command/admin/domain/CreateDomainCmd.java
index 47375551aea..312c9ee4b09 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/domain/CreateDomainCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/domain/CreateDomainCmd.java
@@ -30,7 +30,8 @@ import org.apache.cloudstack.context.CallContext;
import com.cloud.domain.Domain;
import com.cloud.user.Account;
-@APICommand(name = "createDomain", description = "Creates a domain", responseObject = DomainResponse.class)
+@APICommand(name = "createDomain", description = "Creates a domain", responseObject = DomainResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class CreateDomainCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(CreateDomainCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/domain/DeleteDomainCmd.java b/api/src/org/apache/cloudstack/api/command/admin/domain/DeleteDomainCmd.java
index b1075c10fc5..a6d2b0b10c1 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/domain/DeleteDomainCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/domain/DeleteDomainCmd.java
@@ -35,7 +35,8 @@ import com.cloud.domain.Domain;
import com.cloud.event.EventTypes;
import com.cloud.user.Account;
-@APICommand(name = "deleteDomain", description = "Deletes a specified domain", responseObject = SuccessResponse.class)
+@APICommand(name = "deleteDomain", description = "Deletes a specified domain", responseObject = SuccessResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteDomainCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DeleteDomainCmd.class.getName());
private static final String s_name = "deletedomainresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainChildrenCmd.java b/api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainChildrenCmd.java
index e1ba1789616..cf35295358b 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainChildrenCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainChildrenCmd.java
@@ -31,7 +31,8 @@ import org.apache.cloudstack.api.response.ListResponse;
import com.cloud.domain.Domain;
import com.cloud.utils.Pair;
-@APICommand(name = "listDomainChildren", description = "Lists all children domains belonging to a specified domain", responseObject = DomainResponse.class)
+@APICommand(name = "listDomainChildren", description = "Lists all children domains belonging to a specified domain", responseObject = DomainResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListDomainChildrenCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListDomainChildrenCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainsCmd.java
index 5a3786cda20..1942afd9af3 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainsCmd.java
@@ -31,7 +31,8 @@ import org.apache.cloudstack.api.response.ListResponse;
import com.cloud.domain.Domain;
import com.cloud.utils.Pair;
-@APICommand(name = "listDomains", description = "Lists domains and provides detailed information for listed domains", responseObject = DomainResponse.class)
+@APICommand(name = "listDomains", description = "Lists domains and provides detailed information for listed domains", responseObject = DomainResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListDomainsCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListDomainsCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/domain/UpdateDomainCmd.java b/api/src/org/apache/cloudstack/api/command/admin/domain/UpdateDomainCmd.java
index 8acfcd5acda..409a84d7d80 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/domain/UpdateDomainCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/domain/UpdateDomainCmd.java
@@ -33,7 +33,8 @@ import org.apache.cloudstack.region.RegionService;
import com.cloud.domain.Domain;
import com.cloud.user.Account;
-@APICommand(name = "updateDomain", description = "Updates a domain with a new name", responseObject = DomainResponse.class)
+@APICommand(name = "updateDomain", description = "Updates a domain with a new name", responseObject = DomainResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class UpdateDomainCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(UpdateDomainCmd.class.getName());
private static final String s_name = "updatedomainresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/admin/guest/AddGuestOsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/guest/AddGuestOsCmd.java
new file mode 100644
index 00000000000..3ba9669b305
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/guest/AddGuestOsCmd.java
@@ -0,0 +1,136 @@
+// 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.guest;
+
+import org.apache.log4j.Logger;
+
+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.BaseAsyncCreateCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.GuestOSCategoryResponse;
+import org.apache.cloudstack.api.response.GuestOSResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.event.EventTypes;
+import com.cloud.storage.GuestOS;
+import com.cloud.user.Account;
+
+@APICommand(name = "addGuestOs", description = "Add a new guest OS type", responseObject = GuestOSResponse.class,
+ since = "4.4.0", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class AddGuestOsCmd extends BaseAsyncCreateCmd {
+ public static final Logger s_logger = Logger.getLogger(AddGuestOsCmd.class.getName());
+
+ private static final String s_name = "addguestosresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name = ApiConstants.OS_CATEGORY_ID, type = CommandType.UUID, entityType = GuestOSCategoryResponse.class, required = true, description = "ID of Guest OS category")
+ private Long osCategoryId;
+
+ @Parameter(name = ApiConstants.OS_DISPLAY_NAME, type = CommandType.STRING, required = true, description = "Unique display name for Guest OS")
+ private String osDisplayName;
+
+ @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = false, description = "Optional name for Guest OS")
+ private String osName;
+
+
+/////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getOsCategoryId() {
+ return osCategoryId;
+ }
+
+ public String getOsDisplayName() {
+ return osDisplayName;
+ }
+
+ public String getOsName() {
+ return osName;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void create() {
+ GuestOS guestOs = _mgr.addGuestOs(this);
+ if (guestOs != null) {
+ setEntityId(guestOs.getId());
+ setEntityUuid(guestOs.getUuid());
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add new guest OS type entity");
+ }
+ }
+
+ @Override
+ public void execute() {
+ CallContext.current().setEventDetails("Guest OS Id: " + getEntityId());
+ GuestOS guestOs = _mgr.getAddedGuestOs(getEntityId());
+ if (guestOs != null) {
+ GuestOSResponse response = _responseGenerator.createGuestOSResponse(guestOs);
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add new guest OS type");
+ }
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_GUEST_OS_ADD;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "adding a new guest OS type Id: " + getEntityId();
+ }
+
+ @Override
+ public ApiCommandJobType getInstanceType() {
+ return ApiCommandJobType.GuestOs;
+ }
+
+ @Override
+ public String getCreateEventType() {
+ return EventTypes.EVENT_GUEST_OS_ADD;
+ }
+
+ @Override
+ public String getCreateEventDescription() {
+ return "adding new guest OS type";
+ }
+
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/guest/AddGuestOsMappingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/guest/AddGuestOsMappingCmd.java
new file mode 100644
index 00000000000..8af50a15bfa
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/guest/AddGuestOsMappingCmd.java
@@ -0,0 +1,146 @@
+// 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.guest;
+
+import org.apache.log4j.Logger;
+
+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.BaseAsyncCreateCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.GuestOSResponse;
+import org.apache.cloudstack.api.response.GuestOsMappingResponse;
+
+import com.cloud.event.EventTypes;
+import com.cloud.storage.GuestOSHypervisor;
+import com.cloud.user.Account;
+
+@APICommand(name = "addGuestOsMapping", description = "Adds a guest OS name to hypervisor OS name mapping", responseObject = GuestOsMappingResponse.class,
+ since = "4.4.0", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class AddGuestOsMappingCmd extends BaseAsyncCreateCmd {
+ public static final Logger s_logger = Logger.getLogger(AddGuestOsMappingCmd.class.getName());
+
+ private static final String s_name = "addguestosmappingresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name = ApiConstants.OS_TYPE_ID, type = CommandType.UUID, required = false, entityType = GuestOSResponse.class, description = "UUID of Guest OS type. Either the UUID or Display Name must be passed")
+ private Long osTypeId;
+
+ @Parameter(name = ApiConstants.OS_DISPLAY_NAME, type = CommandType.STRING, required = false, description = "Display Name of Guest OS standard type. Either Display Name or UUID must be passed")
+ private String osStdName;
+
+ @Parameter(name = ApiConstants.HYPERVISOR, type = CommandType.STRING, required = true, description = "Hypervisor type. One of : XenServer, KVM, VMWare")
+ private String hypervisor;
+
+ @Parameter(name = ApiConstants.HYPERVISOR_VERSION, type = CommandType.STRING, required = true, description = "Hypervisor version to create the mapping for. Use 'default' for default versions")
+ private String hypervisorVersion;
+
+ @Parameter(name = ApiConstants.OS_NAME_FOR_HYPERVISOR, type = CommandType.STRING, required = true, description = "OS name specific to the hypervisor")
+ private String osNameForHypervisor;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getOsTypeId() {
+ return osTypeId;
+ }
+
+ public String getOsStdName() {
+ return osStdName;
+ }
+
+ public String getHypervisor() {
+ return hypervisor;
+ }
+
+ public String getHypervisorVersion() {
+ return hypervisorVersion;
+ }
+
+ public String getOsNameForHypervisor() {
+ return osNameForHypervisor;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void create() {
+ GuestOSHypervisor guestOsMapping = _mgr.addGuestOsMapping(this);
+ if (guestOsMapping != null) {
+ setEntityId(guestOsMapping.getId());
+ setEntityUuid(guestOsMapping.getUuid());
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add guest OS mapping entity");
+ }
+ }
+
+ @Override
+ public void execute() {
+ GuestOSHypervisor guestOsMapping = _mgr.getAddedGuestOsMapping(getEntityId());
+ if (guestOsMapping != null) {
+ GuestOsMappingResponse response = _responseGenerator.createGuestOSMappingResponse(guestOsMapping);
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add guest OS mapping");
+ }
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_GUEST_OS_MAPPING_ADD;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "adding a new guest OS mapping Id: " + getEntityId();
+ }
+
+ @Override
+ public ApiCommandJobType getInstanceType() {
+ return ApiCommandJobType.GuestOsMapping;
+ }
+
+ @Override
+ public String getCreateEventType() {
+ return EventTypes.EVENT_GUEST_OS_MAPPING_ADD;
+ }
+
+ @Override
+ public String getCreateEventDescription() {
+ return "adding new guest OS mapping";
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/guest/ListGuestOsMappingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/guest/ListGuestOsMappingCmd.java
new file mode 100644
index 00000000000..a7fc9e0decd
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/guest/ListGuestOsMappingCmd.java
@@ -0,0 +1,101 @@
+// 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.guest;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseListCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.GuestOSResponse;
+import org.apache.cloudstack.api.response.GuestOsMappingResponse;
+import org.apache.cloudstack.api.response.ListResponse;
+
+import com.cloud.storage.GuestOSHypervisor;
+import com.cloud.utils.Pair;
+
+@APICommand(name = "listGuestOsMapping", description = "Lists all available OS mappings for given hypervisor", responseObject = GuestOsMappingResponse.class,
+ since = "4.4.0", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class ListGuestOsMappingCmd extends BaseListCmd {
+ public static final Logger s_logger = Logger.getLogger(ListGuestOsMappingCmd.class.getName());
+
+ private static final String s_name = "listguestosmappingresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = GuestOsMappingResponse.class, required = false, description = "list mapping by its UUID")
+ private Long id;
+
+ @Parameter(name = ApiConstants.OS_TYPE_ID, type = CommandType.UUID, entityType = GuestOSResponse.class, required = false, description = "list mapping by Guest OS Type UUID")
+ private Long osTypeId;
+
+ @Parameter(name = ApiConstants.HYPERVISOR, type = CommandType.STRING, required = false, description = "list Guest OS mapping by hypervisor")
+ private String hypervisor;
+
+ @Parameter(name = ApiConstants.HYPERVISOR_VERSION, type = CommandType.STRING, required = false, description = "list Guest OS mapping by hypervisor version. Must be used with hypervisor parameter")
+ private String hypervisorVersion;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getId() {
+ return id;
+ }
+
+ public Long getOsTypeId() {
+ return osTypeId;
+ }
+
+ public String getHypervisor() {
+ return hypervisor;
+ }
+
+ public String getHypervisorVersion() {
+ return hypervisorVersion;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public void execute() {
+ Pair, Integer> result = _mgr.listGuestOSMappingByCriteria(this);
+ ListResponse response = new ListResponse();
+ List osMappingResponses = new ArrayList();
+ for (GuestOSHypervisor guestOSHypervisor : result.first()) {
+ GuestOsMappingResponse guestOsMappingResponse = _responseGenerator.createGuestOSMappingResponse(guestOSHypervisor);
+ osMappingResponses.add(guestOsMappingResponse);
+ }
+
+ response.setResponses(osMappingResponses, result.second());
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+ }
+}
\ No newline at end of file
diff --git a/api/src/org/apache/cloudstack/api/command/admin/guest/RemoveGuestOsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/guest/RemoveGuestOsCmd.java
new file mode 100644
index 00000000000..3de7f7a68da
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/guest/RemoveGuestOsCmd.java
@@ -0,0 +1,98 @@
+// 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.guest;
+
+import org.apache.log4j.Logger;
+
+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.ServerApiException;
+import org.apache.cloudstack.api.response.GuestOSResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.event.EventTypes;
+import com.cloud.user.Account;
+
+@APICommand(name = "removeGuestOs", description = "Removes a Guest OS from listing.", responseObject = SuccessResponse.class, since = "4.4.0",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class RemoveGuestOsCmd extends BaseAsyncCmd {
+
+ public static final Logger s_logger = Logger.getLogger(RemoveGuestOsCmd.class.getName());
+ private static final String s_name = "removeguestosresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = GuestOSResponse.class, required = true, description = "ID of the guest OS")
+ private Long id;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getId() {
+ return id;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute() {
+ CallContext.current().setEventDetails("Guest OS Id: " + id);
+ boolean result = _mgr.removeGuestOs(this);
+ if (result) {
+ SuccessResponse response = new SuccessResponse(getCommandName());
+ setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove guest OS");
+ }
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "Removing Guest OS: " + getId();
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_GUEST_OS_REMOVE;
+ }
+
+ @Override
+ public ApiCommandJobType getInstanceType() {
+ return ApiCommandJobType.GuestOs;
+ }
+
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/guest/RemoveGuestOsMappingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/guest/RemoveGuestOsMappingCmd.java
new file mode 100644
index 00000000000..ddd45399de2
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/guest/RemoveGuestOsMappingCmd.java
@@ -0,0 +1,98 @@
+// 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.guest;
+
+import org.apache.log4j.Logger;
+
+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.ServerApiException;
+import org.apache.cloudstack.api.response.GuestOsMappingResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.event.EventTypes;
+import com.cloud.user.Account;
+
+@APICommand(name = "removeGuestOsMapping", description = "Removes a Guest OS Mapping.", responseObject = SuccessResponse.class, since = "4.4.0",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class RemoveGuestOsMappingCmd extends BaseAsyncCmd {
+
+ public static final Logger s_logger = Logger.getLogger(RemoveGuestOsMappingCmd.class.getName());
+ private static final String s_name = "removeguestosmappingresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = GuestOsMappingResponse.class, required = true, description = "ID of the guest OS mapping")
+ private Long id;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getId() {
+ return id;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute() {
+ CallContext.current().setEventDetails("Guest OS Mapping Id: " + id);
+ boolean result = _mgr.removeGuestOsMapping(this);
+ if (result) {
+ SuccessResponse response = new SuccessResponse(getCommandName());
+ setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove guest OS mapping");
+ }
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "Removing Guest OS Mapping: " + getId();
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_GUEST_OS_MAPPING_REMOVE;
+ }
+
+ @Override
+ public ApiCommandJobType getInstanceType() {
+ return ApiCommandJobType.GuestOsMapping;
+ }
+
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/guest/UpdateGuestOsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/guest/UpdateGuestOsCmd.java
new file mode 100644
index 00000000000..e4b1ecd5719
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/guest/UpdateGuestOsCmd.java
@@ -0,0 +1,104 @@
+// 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.guest;
+
+import org.apache.log4j.Logger;
+
+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.ServerApiException;
+import org.apache.cloudstack.api.response.GuestOSResponse;
+
+import com.cloud.event.EventTypes;
+import com.cloud.storage.GuestOS;
+import com.cloud.user.Account;
+
+@APICommand(name = "updateGuestOs", description = "Updates the information about Guest OS", responseObject = GuestOSResponse.class,
+ since = "4.4.0", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class UpdateGuestOsCmd extends BaseAsyncCmd {
+
+ public static final Logger s_logger = Logger.getLogger(UpdateGuestOsCmd.class.getName());
+
+ private static final String s_name = "updateguestosresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = GuestOSResponse.class, required = true, description = "UUID of the Guest OS")
+ private Long id;
+
+ @Parameter(name = ApiConstants.OS_DISPLAY_NAME, type = CommandType.STRING, required = true, description = "Unique display name for Guest OS")
+ private String osDisplayName;
+
+/////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getId() {
+ return id;
+ }
+
+ public String getOsDisplayName() {
+ return osDisplayName;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute() {
+ GuestOS guestOs = _mgr.updateGuestOs(this);
+ if (guestOs != null) {
+ GuestOSResponse response = _responseGenerator.createGuestOSResponse(guestOs);
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update guest OS type");
+ }
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "Updating guest OS: " + getId();
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_GUEST_OS_UPDATE;
+ }
+
+ @Override
+ public ApiCommandJobType getInstanceType() {
+ return ApiCommandJobType.GuestOs;
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/guest/UpdateGuestOsMappingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/guest/UpdateGuestOsMappingCmd.java
new file mode 100644
index 00000000000..d760d534cfb
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/guest/UpdateGuestOsMappingCmd.java
@@ -0,0 +1,102 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.admin.guest;
+
+import org.apache.log4j.Logger;
+
+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.ServerApiException;
+import org.apache.cloudstack.api.response.GuestOsMappingResponse;
+
+import com.cloud.event.EventTypes;
+import com.cloud.storage.GuestOSHypervisor;
+import com.cloud.user.Account;
+
+@APICommand(name = "updateGuestOsMapping", description = "Updates the information about Guest OS to Hypervisor specific name mapping", responseObject = GuestOsMappingResponse.class,
+ since = "4.4.0", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class UpdateGuestOsMappingCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger.getLogger(UpdateGuestOsMappingCmd.class.getName());
+
+ private static final String s_name = "updateguestosmappingresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = GuestOsMappingResponse.class, required = true, description = "UUID of the Guest OS to hypervisor name Mapping")
+ private Long id;
+
+ @Parameter(name = ApiConstants.OS_NAME_FOR_HYPERVISOR, type = CommandType.STRING, required = true, description = "Hypervisor specific name for this Guest OS")
+ private String osNameForHypervisor;
+
+/////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getId() {
+ return id;
+ }
+
+ public String getOsNameForHypervisor() {
+ return osNameForHypervisor;
+ }
+
+ @Override
+ public void execute() {
+ GuestOSHypervisor guestOsMapping = _mgr.updateGuestOsMapping(this);
+ if (guestOsMapping != null) {
+ GuestOsMappingResponse response = _responseGenerator.createGuestOSMappingResponse(guestOsMapping);
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+ }
+ else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update guest OS mapping");
+ }
+
+ }
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "Updating Guest OS Mapping: " + getId();
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_GUEST_OS_MAPPING_UPDATE;
+ }
+
+ @Override
+ public ApiCommandJobType getInstanceType() {
+ return ApiCommandJobType.GuestOsMapping;
+ }
+
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/AddHostCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/AddHostCmd.java
index 363bcd6db50..960be8df577 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/host/AddHostCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/host/AddHostCmd.java
@@ -37,7 +37,8 @@ import com.cloud.exception.DiscoveryException;
import com.cloud.host.Host;
import com.cloud.user.Account;
-@APICommand(name = "addHost", description = "Adds a new host.", responseObject = HostResponse.class)
+@APICommand(name = "addHost", description = "Adds a new host.", responseObject = HostResponse.class,
+ requestHasSensitiveInfo = true, responseHasSensitiveInfo = false)
public class AddHostCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(AddHostCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/AddSecondaryStorageCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/AddSecondaryStorageCmd.java
index b573bea3e84..9108d600419 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/host/AddSecondaryStorageCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/host/AddSecondaryStorageCmd.java
@@ -31,7 +31,8 @@ import com.cloud.exception.DiscoveryException;
import com.cloud.storage.ImageStore;
import com.cloud.user.Account;
-@APICommand(name = "addSecondaryStorage", description = "Adds secondary storage.", responseObject = ImageStoreResponse.class)
+@APICommand(name = "addSecondaryStorage", description = "Adds secondary storage.", responseObject = ImageStoreResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class AddSecondaryStorageCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(AddSecondaryStorageCmd.class.getName());
private static final String s_name = "addsecondarystorageresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/CancelMaintenanceCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/CancelMaintenanceCmd.java
index 46289ee49bd..d23a7651bbc 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/host/CancelMaintenanceCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/host/CancelMaintenanceCmd.java
@@ -32,7 +32,8 @@ import com.cloud.event.EventTypes;
import com.cloud.host.Host;
import com.cloud.user.Account;
-@APICommand(name = "cancelHostMaintenance", description = "Cancels host maintenance.", responseObject = HostResponse.class)
+@APICommand(name = "cancelHostMaintenance", description = "Cancels host maintenance.", responseObject = HostResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class CancelMaintenanceCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(CancelMaintenanceCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/DeleteHostCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/DeleteHostCmd.java
index 5a4478e21a3..b9945281296 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/host/DeleteHostCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/host/DeleteHostCmd.java
@@ -29,7 +29,8 @@ import org.apache.cloudstack.api.response.SuccessResponse;
import com.cloud.user.Account;
-@APICommand(name = "deleteHost", description = "Deletes a host.", responseObject = SuccessResponse.class)
+@APICommand(name = "deleteHost", description = "Deletes a host.", responseObject = SuccessResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteHostCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(DeleteHostCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/FindHostsForMigrationCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/FindHostsForMigrationCmd.java
index 0faf72cc245..dbb94384523 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/host/FindHostsForMigrationCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/host/FindHostsForMigrationCmd.java
@@ -34,7 +34,8 @@ import com.cloud.host.Host;
import com.cloud.utils.Pair;
import com.cloud.utils.Ternary;
-@APICommand(name = "findHostsForMigration", description = "Find hosts suitable for migrating a virtual machine.", responseObject = HostForMigrationResponse.class)
+@APICommand(name = "findHostsForMigration", description = "Find hosts suitable for migrating a virtual machine.", responseObject = HostForMigrationResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class FindHostsForMigrationCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(FindHostsForMigrationCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java
index eda821b0498..d7aa18bbfef 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java
@@ -42,7 +42,8 @@ import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.utils.Pair;
import com.cloud.utils.Ternary;
-@APICommand(name = "listHosts", description = "Lists hosts.", responseObject = HostResponse.class)
+@APICommand(name = "listHosts", description = "Lists hosts.", responseObject = HostResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListHostsCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListHostsCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/PrepareForMaintenanceCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/PrepareForMaintenanceCmd.java
index 23cfacfa87a..e49aabc49d4 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/host/PrepareForMaintenanceCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/host/PrepareForMaintenanceCmd.java
@@ -32,7 +32,8 @@ import com.cloud.event.EventTypes;
import com.cloud.host.Host;
import com.cloud.user.Account;
-@APICommand(name = "prepareHostForMaintenance", description = "Prepares a host for maintenance.", responseObject = HostResponse.class)
+@APICommand(name = "prepareHostForMaintenance", description = "Prepares a host for maintenance.", responseObject = HostResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class PrepareForMaintenanceCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(PrepareForMaintenanceCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java
index 1ce888b1570..5e156372681 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java
@@ -32,7 +32,8 @@ import com.cloud.event.EventTypes;
import com.cloud.host.Host;
import com.cloud.user.Account;
-@APICommand(name = "reconnectHost", description = "Reconnects a host.", responseObject = HostResponse.class)
+@APICommand(name = "reconnectHost", description = "Reconnects a host.", responseObject = HostResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ReconnectHostCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(ReconnectHostCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/ReleaseHostReservationCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/ReleaseHostReservationCmd.java
index b60feca5977..6aeff6312c9 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/host/ReleaseHostReservationCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/host/ReleaseHostReservationCmd.java
@@ -32,7 +32,8 @@ import org.apache.cloudstack.context.CallContext;
import com.cloud.event.EventTypes;
import com.cloud.user.Account;
-@APICommand(name = "releaseHostReservation", description = "Releases host reservation.", responseObject = SuccessResponse.class)
+@APICommand(name = "releaseHostReservation", description = "Releases host reservation.", responseObject = SuccessResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ReleaseHostReservationCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(ReleaseHostReservationCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/UpdateHostCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/UpdateHostCmd.java
index d778b37bed1..c6f6530dc50 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/host/UpdateHostCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/host/UpdateHostCmd.java
@@ -32,7 +32,8 @@ import org.apache.cloudstack.api.response.HostResponse;
import com.cloud.host.Host;
import com.cloud.user.Account;
-@APICommand(name = "updateHost", description = "Updates a host.", responseObject = HostResponse.class)
+@APICommand(name = "updateHost", description = "Updates a host.", responseObject = HostResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class UpdateHostCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(UpdateHostCmd.class.getName());
private static final String s_name = "updatehostresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/UpdateHostPasswordCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/UpdateHostPasswordCmd.java
index 69480b14f4b..94f58254896 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/host/UpdateHostPasswordCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/host/UpdateHostPasswordCmd.java
@@ -28,7 +28,8 @@ import org.apache.cloudstack.api.response.SuccessResponse;
import com.cloud.user.Account;
-@APICommand(name = "updateHostPassword", description = "Update password of a host/pool on management server.", responseObject = SuccessResponse.class)
+@APICommand(name = "updateHostPassword", description = "Update password of a host/pool on management server.", responseObject = SuccessResponse.class,
+ requestHasSensitiveInfo = true, responseHasSensitiveInfo = false)
public class UpdateHostPasswordCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(UpdateHostPasswordCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/internallb/ConfigureInternalLoadBalancerElementCmd.java b/api/src/org/apache/cloudstack/api/command/admin/internallb/ConfigureInternalLoadBalancerElementCmd.java
index 51da7608dac..7e39749ff17 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/internallb/ConfigureInternalLoadBalancerElementCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/internallb/ConfigureInternalLoadBalancerElementCmd.java
@@ -43,7 +43,9 @@ import com.cloud.user.Account;
@APICommand(name = "configureInternalLoadBalancerElement",
responseObject = InternalLoadBalancerElementResponse.class,
description = "Configures an Internal Load Balancer element.",
- since = "4.2.0")
+ since = "4.2.0",
+ requestHasSensitiveInfo = false,
+ responseHasSensitiveInfo = false)
public class ConfigureInternalLoadBalancerElementCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(ConfigureInternalLoadBalancerElementCmd.class.getName());
private static final String s_name = "configureinternalloadbalancerelementresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/admin/internallb/CreateInternalLoadBalancerElementCmd.java b/api/src/org/apache/cloudstack/api/command/admin/internallb/CreateInternalLoadBalancerElementCmd.java
index a6ece720455..b9c61f3bf90 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/internallb/CreateInternalLoadBalancerElementCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/internallb/CreateInternalLoadBalancerElementCmd.java
@@ -41,7 +41,9 @@ import com.cloud.user.Account;
@APICommand(name = "createInternalLoadBalancerElement",
responseObject = InternalLoadBalancerElementResponse.class,
description = "Create an Internal Load Balancer element.",
- since = "4.2.0")
+ since = "4.2.0",
+ requestHasSensitiveInfo = false,
+ responseHasSensitiveInfo = false)
public class CreateInternalLoadBalancerElementCmd extends BaseAsyncCreateCmd {
public static final Logger s_logger = Logger.getLogger(CreateInternalLoadBalancerElementCmd.class.getName());
private static final String s_name = "createinternalloadbalancerelementresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/admin/internallb/ListInternalLBVMsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/internallb/ListInternalLBVMsCmd.java
index 0e01be142ee..0b59b73f9d2 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/internallb/ListInternalLBVMsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/internallb/ListInternalLBVMsCmd.java
@@ -33,8 +33,10 @@ import org.apache.cloudstack.api.response.VpcResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import com.cloud.network.router.VirtualRouter.Role;
+import com.cloud.vm.VirtualMachine;
-@APICommand(name = "listInternalLoadBalancerVMs", description = "List internal LB VMs.", responseObject = DomainRouterResponse.class)
+@APICommand(name = "listInternalLoadBalancerVMs", description = "List internal LB VMs.", responseObject = DomainRouterResponse.class, entityType = {VirtualMachine.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListInternalLBVMsCmd extends BaseListProjectAndAccountResourcesCmd {
public static final Logger s_logger = Logger.getLogger(ListInternalLBVMsCmd.class.getName());
@@ -133,6 +135,6 @@ public class ListInternalLBVMsCmd extends BaseListProjectAndAccountResourcesCmd
public void execute() {
ListResponse response = _queryService.searchForInternalLbVms(this);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/internallb/ListInternalLoadBalancerElementsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/internallb/ListInternalLoadBalancerElementsCmd.java
index a42a0b306af..8f62b419691 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/internallb/ListInternalLoadBalancerElementsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/internallb/ListInternalLoadBalancerElementsCmd.java
@@ -42,10 +42,12 @@ import com.cloud.network.VirtualRouterProvider;
@APICommand(name = "listInternalLoadBalancerElements",
description = "Lists all available Internal Load Balancer elements.",
responseObject = InternalLoadBalancerElementResponse.class,
- since = "4.2.0")
+ since = "4.2.0",
+ requestHasSensitiveInfo = false,
+ responseHasSensitiveInfo = false)
public class ListInternalLoadBalancerElementsCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListInternalLoadBalancerElementsCmd.class.getName());
- private static final String Name = "listinternalloadbalancerelementsresponse";
+ private static final String s_name = "listinternalloadbalancerelementsresponse";
@Inject
private InternalLoadBalancerElementService _service;
@@ -86,7 +88,7 @@ public class ListInternalLoadBalancerElementsCmd extends BaseListCmd {
@Override
public String getCommandName() {
- return Name;
+ return s_name;
}
@Override
diff --git a/api/src/org/apache/cloudstack/api/command/admin/internallb/StartInternalLBVMCmd.java b/api/src/org/apache/cloudstack/api/command/admin/internallb/StartInternalLBVMCmd.java
index 56dcb4f8403..7040e7cf29a 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/internallb/StartInternalLBVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/internallb/StartInternalLBVMCmd.java
@@ -18,6 +18,8 @@ package org.apache.cloudstack.api.command.admin.internallb;
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;
@@ -35,8 +37,10 @@ import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.router.VirtualRouter;
import com.cloud.network.router.VirtualRouter.Role;
+import com.cloud.vm.VirtualMachine;
-@APICommand(name = "startInternalLoadBalancerVM", responseObject = DomainRouterResponse.class, description = "Starts an existing internal lb vm.")
+@APICommand(name = "startInternalLoadBalancerVM", responseObject = DomainRouterResponse.class, description = "Starts an existing internal lb vm.", entityType = {VirtualMachine.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class StartInternalLBVMCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(StartInternalLBVMCmd.class.getName());
private static final String s_name = "startinternallbvmresponse";
@@ -44,7 +48,7 @@ public class StartInternalLBVMCmd extends BaseAsyncCmd {
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
-
+ @ACL(accessType = AccessType.OperateEntry)
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = DomainRouterResponse.class, required = true, description = "the ID of the internal lb vm")
private Long id;
@@ -113,7 +117,7 @@ public class StartInternalLBVMCmd extends BaseAsyncCmd {
if (result != null) {
DomainRouterResponse routerResponse = _responseGenerator.createDomainRouterResponse(result);
routerResponse.setResponseName(getCommandName());
- this.setResponseObject(routerResponse);
+ setResponseObject(routerResponse);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to start internal lb vm");
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/internallb/StopInternalLBVMCmd.java b/api/src/org/apache/cloudstack/api/command/admin/internallb/StopInternalLBVMCmd.java
index 9da4db072db..51a3d9f8fa0 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/internallb/StopInternalLBVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/internallb/StopInternalLBVMCmd.java
@@ -18,6 +18,8 @@ package org.apache.cloudstack.api.command.admin.internallb;
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;
@@ -34,8 +36,10 @@ import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.router.VirtualRouter;
import com.cloud.network.router.VirtualRouter.Role;
+import com.cloud.vm.VirtualMachine;
-@APICommand(name = "stopInternalLoadBalancerVM", description = "Stops an Internal LB vm.", responseObject = DomainRouterResponse.class)
+@APICommand(name = "stopInternalLoadBalancerVM", description = "Stops an Internal LB vm.", responseObject = DomainRouterResponse.class, entityType = {VirtualMachine.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class StopInternalLBVMCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(StopInternalLBVMCmd.class.getName());
private static final String s_name = "stopinternallbvmresponse";
@@ -43,7 +47,7 @@ public class StopInternalLBVMCmd extends BaseAsyncCmd {
// ///////////////////////////////////////////////////
// ////////////// API parameters /////////////////////
// ///////////////////////////////////////////////////
-
+ @ACL(accessType = AccessType.OperateEntry)
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = DomainRouterResponse.class, required = true, description = "the ID of the internal lb vm")
private Long id;
@@ -115,7 +119,7 @@ public class StopInternalLBVMCmd extends BaseAsyncCmd {
if (result != null) {
DomainRouterResponse response = _responseGenerator.createDomainRouterResponse(result);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to stop internal lb vm");
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/iso/AttachIsoCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/iso/AttachIsoCmdByAdmin.java
new file mode 100644
index 00000000000..7c3db62d1af
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/iso/AttachIsoCmdByAdmin.java
@@ -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.iso;
+
+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.iso.AttachIsoCmd;
+import org.apache.cloudstack.api.command.user.vm.DeployVMCmd;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.uservm.UserVm;
+
+@APICommand(name = "attachIso", description = "Attaches an ISO to a virtual machine.", responseObject = UserVmResponse.class, responseView = ResponseView.Full)
+public class AttachIsoCmdByAdmin extends AttachIsoCmd {
+ public static final Logger s_logger = Logger.getLogger(AttachIsoCmdByAdmin.class.getName());
+
+ @Override
+ public void execute(){
+ CallContext.current().setEventDetails("Vm Id: " +getVirtualMachineId()+ " ISO Id: "+getId());
+ boolean result = _templateService.attachIso(id, virtualMachineId);
+ if (result) {
+ UserVm userVm = _responseGenerator.findUserVmById(virtualMachineId);
+ if (userVm != null) {
+ UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Full, "virtualmachine", userVm).get(0);
+ response.setResponseName(DeployVMCmd.getResultObjectName());
+ setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to attach iso");
+ }
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to attach iso");
+ }
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/iso/CopyIsoCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/iso/CopyIsoCmdByAdmin.java
new file mode 100644
index 00000000000..f27c0c5c234
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/iso/CopyIsoCmdByAdmin.java
@@ -0,0 +1,28 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.admin.iso;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.command.user.iso.CopyIsoCmd;
+import org.apache.cloudstack.api.response.TemplateResponse;
+
+@APICommand(name = "copyIso", description = "Copies an iso from one zone to another.", responseObject = TemplateResponse.class, responseView = ResponseView.Full,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class CopyIsoCmdByAdmin extends CopyIsoCmd {
+
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/iso/DetachIsoCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/iso/DetachIsoCmdByAdmin.java
new file mode 100644
index 00000000000..144e3f98663
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/iso/DetachIsoCmdByAdmin.java
@@ -0,0 +1,47 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.admin.iso;
+
+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.iso.DetachIsoCmd;
+import org.apache.cloudstack.api.command.user.vm.DeployVMCmd;
+import org.apache.cloudstack.api.response.UserVmResponse;
+
+import com.cloud.uservm.UserVm;
+
+@APICommand(name = "detachIso", description = "Detaches any ISO file (if any) currently attached to a virtual machine.", responseObject = UserVmResponse.class, responseView = ResponseView.Full)
+public class DetachIsoCmdByAdmin extends DetachIsoCmd {
+ public static final Logger s_logger = Logger.getLogger(DetachIsoCmdByAdmin.class.getName());
+
+ @Override
+ public void execute(){
+ boolean result = _templateService.detachIso(virtualMachineId);
+ if (result) {
+ UserVm userVm = _entityMgr.findById(UserVm.class, virtualMachineId);
+ UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Full, "virtualmachine", userVm).get(0);
+ response.setResponseName(DeployVMCmd.getResultObjectName());
+ setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to detach iso");
+ }
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/iso/ListIsoPermissionsCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/iso/ListIsoPermissionsCmdByAdmin.java
new file mode 100644
index 00000000000..613a4a7942c
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/iso/ListIsoPermissionsCmdByAdmin.java
@@ -0,0 +1,31 @@
+// Licensedname = "listIsoPermissions", 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.iso;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.command.user.iso.ListIsoPermissionsCmd;
+import org.apache.cloudstack.api.response.TemplatePermissionsResponse;
+
+@APICommand(name = "listIsoPermissions", description = "List iso visibility and all accounts that have permissions to view this iso.", responseObject = TemplatePermissionsResponse.class, responseView = ResponseView.Full)
+public class ListIsoPermissionsCmdByAdmin extends ListIsoPermissionsCmd {
+
+ @Override
+ public void execute() {
+ executeWithView(ResponseView.Full);
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/iso/ListIsosCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/iso/ListIsosCmdByAdmin.java
new file mode 100644
index 00000000000..6d87bcd4241
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/iso/ListIsosCmdByAdmin.java
@@ -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.iso;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.command.user.iso.ListIsosCmd;
+import org.apache.cloudstack.api.response.TemplateResponse;
+
+@APICommand(name = "listIsos", description = "Lists all available ISO files.", responseObject = TemplateResponse.class, responseView = ResponseView.Full)
+public class ListIsosCmdByAdmin extends ListIsosCmd {
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/iso/RegisterIsoCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/iso/RegisterIsoCmdByAdmin.java
new file mode 100644
index 00000000000..79687f19fed
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/iso/RegisterIsoCmdByAdmin.java
@@ -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.iso;
+
+import java.util.List;
+
+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.iso.RegisterIsoCmd;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.TemplateResponse;
+
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.template.VirtualMachineTemplate;
+
+@APICommand(name = "registerIso", responseObject = TemplateResponse.class, description = "Registers an existing ISO into the CloudStack Cloud.", responseView = ResponseView.Full)
+public class RegisterIsoCmdByAdmin extends RegisterIsoCmd {
+ public static final Logger s_logger = Logger.getLogger(RegisterIsoCmdByAdmin.class.getName());
+
+
+ @Override
+ public void execute() throws ResourceAllocationException{
+ VirtualMachineTemplate template = _templateService.registerIso(this);
+ if (template != null) {
+ ListResponse response = new ListResponse();
+ List templateResponses = _responseGenerator.createIsoResponses(ResponseView.Full, template, zoneId, false);
+ response.setResponses(templateResponses);
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to register iso");
+ }
+
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/iso/UpdateIsoCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/iso/UpdateIsoCmdByAdmin.java
new file mode 100644
index 00000000000..1caf3982d4b
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/iso/UpdateIsoCmdByAdmin.java
@@ -0,0 +1,45 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.admin.iso;
+
+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.iso.UpdateIsoCmd;
+import org.apache.cloudstack.api.response.TemplateResponse;
+
+import com.cloud.template.VirtualMachineTemplate;
+
+@APICommand(name = "updateIso", description = "Updates an ISO file.", responseObject = TemplateResponse.class, responseView = ResponseView.Full)
+public class UpdateIsoCmdByAdmin extends UpdateIsoCmd {
+ public static final Logger s_logger = Logger.getLogger(UpdateIsoCmdByAdmin.class.getName());
+
+ @Override
+ public void execute(){
+ VirtualMachineTemplate result = _templateService.updateTemplate(this);
+ if (result != null) {
+ TemplateResponse response = _responseGenerator.createTemplateUpdateResponse(ResponseView.Full, result);
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update iso");
+ }
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/loadbalancer/ListLoadBalancerRuleInstancesCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/loadbalancer/ListLoadBalancerRuleInstancesCmdByAdmin.java
new file mode 100644
index 00000000000..6c0d8a4888e
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/loadbalancer/ListLoadBalancerRuleInstancesCmdByAdmin.java
@@ -0,0 +1,92 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.admin.loadbalancer;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.cloud.vm.VirtualMachine;
+import org.apache.cloudstack.api.response.LoadBalancerRuleVmMapResponse;
+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.loadbalancer.ListLoadBalancerRuleInstancesCmd;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.UserVmResponse;
+
+import com.cloud.uservm.UserVm;
+import com.cloud.utils.Pair;
+
+@APICommand(name = "listLoadBalancerRuleInstances", description = "List all virtual machine instances that are assigned to a load balancer rule.", responseObject = LoadBalancerRuleVmMapResponse.class, responseView = ResponseView.Full)
+public class ListLoadBalancerRuleInstancesCmdByAdmin extends ListLoadBalancerRuleInstancesCmd {
+ public static final Logger s_logger = Logger.getLogger (ListLoadBalancerRuleInstancesCmdByAdmin.class.getName());
+
+
+
+ @Override
+ public void execute(){
+ Pair, List> vmServiceMap = _lbService.listLoadBalancerInstances(this);
+ List extends UserVm> result = vmServiceMap.first();
+ List serviceStates = vmServiceMap.second();
+
+
+ if (!isListLbVmip()) {
+ // list lb instances
+ ListResponse response = new ListResponse();
+ List vmResponses = new ArrayList();
+ if (result != null) {
+ vmResponses = _responseGenerator.createUserVmResponse(ResponseView.Restricted, "loadbalancerruleinstance", result.toArray(new UserVm[result.size()]));
+
+
+ for (int i = 0; i < result.size(); i++) {
+ vmResponses.get(i).setServiceState(serviceStates.get(i));
+ }
+ }
+ response.setResponses(vmResponses);
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+
+ } else {
+ ListResponse lbRes = new ListResponse();
+
+ List vmResponses = new ArrayList();
+ List listlbVmRes = new ArrayList();
+
+ if (result != null) {
+ vmResponses = _responseGenerator.createUserVmResponse(ResponseView.Full, "loadbalancerruleinstance", result.toArray(new UserVm[result.size()]));
+
+ List ipaddr = null;
+
+ for (int i=0;i, Integer> networks = _networkService.searchForNetworks(this);
+ ListResponse response = new ListResponse();
+ List networkResponses = new ArrayList();
+ for (Network network : networks.first()) {
+ NetworkResponse networkResponse = _responseGenerator.createNetworkResponse(ResponseView.Full, network);
+ networkResponses.add(networkResponse);
+ }
+ response.setResponses(networkResponses, networks.second());
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/ListPhysicalNetworksCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/ListPhysicalNetworksCmd.java
index 3ac2faaacd9..e495fd6a398 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/ListPhysicalNetworksCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/ListPhysicalNetworksCmd.java
@@ -35,7 +35,8 @@ import com.cloud.network.PhysicalNetwork;
import com.cloud.user.Account;
import com.cloud.utils.Pair;
-@APICommand(name = "listPhysicalNetworks", description = "Lists physical networks", responseObject = PhysicalNetworkResponse.class, since = "3.0.0")
+@APICommand(name = "listPhysicalNetworks", description = "Lists physical networks", responseObject = PhysicalNetworkResponse.class, since = "3.0.0",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListPhysicalNetworksCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListPhysicalNetworksCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/ListStorageNetworkIpRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/ListStorageNetworkIpRangeCmd.java
index 89cba471041..b3f8b8197a4 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/ListStorageNetworkIpRangeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/ListStorageNetworkIpRangeCmd.java
@@ -39,7 +39,8 @@ import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.user.Account;
-@APICommand(name = "listStorageNetworkIpRange", description = "List a storage network IP range.", responseObject = StorageNetworkIpRangeResponse.class, since = "3.0.0")
+@APICommand(name = "listStorageNetworkIpRange", description = "List a storage network IP range.", responseObject = StorageNetworkIpRangeResponse.class, since = "3.0.0",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListStorageNetworkIpRangeCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListStorageNetworkIpRangeCmd.class);
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/ListSupportedNetworkServicesCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/ListSupportedNetworkServicesCmd.java
index 342f9b04d88..39e99a43a6c 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/ListSupportedNetworkServicesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/ListSupportedNetworkServicesCmd.java
@@ -36,10 +36,12 @@ import com.cloud.user.Account;
@APICommand(name = "listSupportedNetworkServices",
description = "Lists all network services provided by CloudStack or for the given Provider.",
responseObject = ServiceResponse.class,
- since = "3.0.0")
+ since = "3.0.0",
+ requestHasSensitiveInfo = false,
+ responseHasSensitiveInfo = false)
public class ListSupportedNetworkServicesCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListSupportedNetworkServicesCmd.class.getName());
- private static final String Name = "listsupportednetworkservicesresponse";
+ private static final String s_name = "listsupportednetworkservicesresponse";
@Parameter(name = ApiConstants.PROVIDER, type = CommandType.STRING, description = "network service provider name")
private String providerName;
@@ -72,7 +74,7 @@ public class ListSupportedNetworkServicesCmd extends BaseListCmd {
/////////////////////////////////////////////////////
@Override
public String getCommandName() {
- return Name;
+ return s_name;
}
@Override
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/ReleaseDedicatedGuestVlanRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/ReleaseDedicatedGuestVlanRangeCmd.java
index 43e1149a1ec..263d46a7509 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/ReleaseDedicatedGuestVlanRangeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/ReleaseDedicatedGuestVlanRangeCmd.java
@@ -33,7 +33,8 @@ import org.apache.cloudstack.context.CallContext;
import com.cloud.event.EventTypes;
import com.cloud.user.Account;
-@APICommand(name = "releaseDedicatedGuestVlanRange", description = "Releases a dedicated guest vlan range to the system", responseObject = SuccessResponse.class)
+@APICommand(name = "releaseDedicatedGuestVlanRange", description = "Releases a dedicated guest vlan range to the system", responseObject = SuccessResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ReleaseDedicatedGuestVlanRangeCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(ReleaseDedicatedGuestVlanRangeCmd.class.getName());
private static final String s_name = "releasededicatedguestvlanrangeresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkCmdByAdmin.java
new file mode 100644
index 00000000000..644a0fa4cfd
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkCmdByAdmin.java
@@ -0,0 +1,63 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.admin.network;
+
+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.network.UpdateNetworkCmd;
+import org.apache.cloudstack.api.response.NetworkResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.network.Network;
+import com.cloud.user.Account;
+import com.cloud.user.User;
+
+@APICommand(name = "updateNetwork", description = "Updates a network", responseObject = NetworkResponse.class, responseView = ResponseView.Full)
+public class UpdateNetworkCmdByAdmin extends UpdateNetworkCmd {
+ public static final Logger s_logger = Logger.getLogger(UpdateNetworkCmdByAdmin.class.getName());
+
+
+ @Override
+ public void execute() throws InsufficientCapacityException, ConcurrentOperationException{
+ User callerUser = _accountService.getActiveUser(CallContext.current().getCallingUserId());
+ Account callerAccount = _accountService.getActiveAccountById(callerUser.getAccountId());
+ Network network = _networkService.getNetwork(id);
+ if (network == null) {
+ throw new InvalidParameterValueException("Couldn't find network by id");
+ }
+
+ Network result = _networkService.updateGuestNetwork(getId(), getNetworkName(), getDisplayText(), callerAccount,
+ callerUser, getNetworkDomain(), getNetworkOfferingId(), getChangeCidr(), getGuestVmCidr(), getDisplayNetwork(), getCustomId());
+
+
+ if (result != null) {
+ NetworkResponse response = _responseGenerator.createNetworkResponse(ResponseView.Full, result);
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update network");
+ }
+ }
+
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkOfferingCmd.java
index 957450f78f7..411da4fd36b 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkOfferingCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkOfferingCmd.java
@@ -29,10 +29,11 @@ import org.apache.cloudstack.api.response.NetworkOfferingResponse;
import com.cloud.offering.NetworkOffering;
import com.cloud.user.Account;
-@APICommand(name = "updateNetworkOffering", description = "Updates a network offering.", responseObject = NetworkOfferingResponse.class)
+@APICommand(name = "updateNetworkOffering", description = "Updates a network offering.", responseObject = NetworkOfferingResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class UpdateNetworkOfferingCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(UpdateNetworkOfferingCmd.class.getName());
- private static final String Name = "updatenetworkofferingresponse";
+ private static final String s_name = "updatenetworkofferingresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
@@ -109,7 +110,7 @@ public class UpdateNetworkOfferingCmd extends BaseCmd {
/////////////////////////////////////////////////////
@Override
public String getCommandName() {
- return Name;
+ return s_name;
}
@Override
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkServiceProviderCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkServiceProviderCmd.java
index c530c53b7f3..bb4f64e0400 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkServiceProviderCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkServiceProviderCmd.java
@@ -36,7 +36,9 @@ import com.cloud.user.Account;
@APICommand(name = "updateNetworkServiceProvider",
description = "Updates a network serviceProvider of a physical network",
responseObject = ProviderResponse.class,
- since = "3.0.0")
+ since = "3.0.0",
+ requestHasSensitiveInfo = false,
+ responseHasSensitiveInfo = false)
public class UpdateNetworkServiceProviderCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(UpdateNetworkServiceProviderCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/UpdatePhysicalNetworkCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/UpdatePhysicalNetworkCmd.java
index f808424fc86..8e29c393813 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/UpdatePhysicalNetworkCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/UpdatePhysicalNetworkCmd.java
@@ -31,7 +31,8 @@ import com.cloud.event.EventTypes;
import com.cloud.network.PhysicalNetwork;
import com.cloud.user.Account;
-@APICommand(name = "updatePhysicalNetwork", description = "Updates a physical network", responseObject = PhysicalNetworkResponse.class, since = "3.0.0")
+@APICommand(name = "updatePhysicalNetwork", description = "Updates a physical network", responseObject = PhysicalNetworkResponse.class, since = "3.0.0",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class UpdatePhysicalNetworkCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(UpdatePhysicalNetworkCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/UpdateStorageNetworkIpRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/UpdateStorageNetworkIpRangeCmd.java
index 9fd084a104f..d82c28d1bff 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/UpdateStorageNetworkIpRangeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/UpdateStorageNetworkIpRangeCmd.java
@@ -37,7 +37,9 @@ import com.cloud.user.Account;
@APICommand(name = "updateStorageNetworkIpRange",
description = "Update a Storage network IP range, only allowed when no IPs in this range have been allocated.",
responseObject = StorageNetworkIpRangeResponse.class,
- since = "3.0.0")
+ since = "3.0.0",
+ requestHasSensitiveInfo = false,
+ responseHasSensitiveInfo = false)
public class UpdateStorageNetworkIpRangeCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(UpdateStorageNetworkIpRangeCmd.class);
private static final String s_name = "updatestoragenetworkiprangeresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java
index 1d959a0589b..67c97923c06 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java
@@ -31,7 +31,8 @@ import com.cloud.offering.DiskOffering;
import com.cloud.offering.ServiceOffering;
import com.cloud.user.Account;
-@APICommand(name = "createDiskOffering", description = "Creates a disk offering.", responseObject = DiskOfferingResponse.class)
+@APICommand(name = "createDiskOffering", description = "Creates a disk offering.", responseObject = DiskOfferingResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class CreateDiskOfferingCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(CreateDiskOfferingCmd.class.getName());
@@ -92,9 +93,9 @@ public class CreateDiskOfferingCmd extends BaseCmd {
private Long maxIops;
@Parameter(name = ApiConstants.HYPERVISOR_SNAPSHOT_RESERVE,
- type = CommandType.INTEGER,
- required = false,
- description = "Hypervisor snapshot reserve space as a percent of a volume (for managed storage using Xen or VMware)")
+ type = CommandType.INTEGER,
+ required = false,
+ description = "Hypervisor snapshot reserve space as a percent of a volume (for managed storage using Xen or VMware)")
private Integer hypervisorSnapshotReserve;
/////////////////////////////////////////////////////
diff --git a/api/src/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java
index 6f9693cbcb0..6cd5d84a07c 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java
@@ -17,10 +17,10 @@
package org.apache.cloudstack.api.command.admin.offering;
import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
import java.util.Map;
-import org.apache.log4j.Logger;
-
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
@@ -29,14 +29,16 @@ import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.api.response.ServiceOfferingResponse;
+import org.apache.log4j.Logger;
import com.cloud.offering.ServiceOffering;
import com.cloud.user.Account;
-@APICommand(name = "createServiceOffering", description = "Creates a service offering.", responseObject = ServiceOfferingResponse.class)
+@APICommand(name = "createServiceOffering", description = "Creates a service offering.", responseObject = ServiceOfferingResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class CreateServiceOfferingCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(CreateServiceOfferingCmd.class.getName());
- private static final String Name = "createserviceofferingresponse";
+ private static final String s_name = "createserviceofferingresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
@@ -102,7 +104,7 @@ public class CreateServiceOfferingCmd extends BaseCmd {
private String deploymentPlanner;
@Parameter(name = ApiConstants.SERVICE_OFFERING_DETAILS, type = CommandType.MAP, description = "details for planner, used to store specific parameters")
- private Map details;
+ private Map details;
@Parameter(name = ApiConstants.BYTES_READ_RATE, type = CommandType.LONG, required = false, description = "bytes read rate of the disk offering")
private Long bytesReadRate;
@@ -116,6 +118,22 @@ public class CreateServiceOfferingCmd extends BaseCmd {
@Parameter(name = ApiConstants.IOPS_WRITE_RATE, type = CommandType.LONG, required = false, description = "io requests write rate of the disk offering")
private Long iopsWriteRate;
+ @Parameter(name = ApiConstants.CUSTOMIZED_IOPS, type = CommandType.BOOLEAN, required = false, description = "whether compute offering iops is custom or not", since = "4.4")
+ private Boolean customizedIops;
+
+ @Parameter(name = ApiConstants.MIN_IOPS, type = CommandType.LONG, required = false, description = "min iops of the compute offering", since = "4.4")
+ private Long minIops;
+
+ @Parameter(name = ApiConstants.MAX_IOPS, type = CommandType.LONG, required = false, description = "max iops of the compute offering", since = "4.4")
+ private Long maxIops;
+
+ @Parameter(name = ApiConstants.HYPERVISOR_SNAPSHOT_RESERVE,
+ type = CommandType.INTEGER,
+ required = false,
+ description = "Hypervisor snapshot reserve space as a percent of a volume (for managed storage using Xen or VMware)",
+ since = "4.4")
+ private Integer hypervisorSnapshotReserve;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -189,13 +207,17 @@ public class CreateServiceOfferingCmd extends BaseCmd {
}
public Map getDetails() {
- if (details == null || details.isEmpty()) {
- return null;
+ Map detailsMap = null;
+ if (details != null && !details.isEmpty()) {
+ detailsMap = new HashMap();
+ Collection> props = details.values();
+ Iterator> iter = props.iterator();
+ while (iter.hasNext()) {
+ HashMap detail = (HashMap) iter.next();
+ detailsMap.put(detail.get("key"), detail.get("value"));
+ }
}
-
- Collection paramsCollection = details.values();
- Map params = (Map)(paramsCollection.toArray())[0];
- return params;
+ return detailsMap;
}
public Long getBytesReadRate() {
@@ -214,13 +236,29 @@ public class CreateServiceOfferingCmd extends BaseCmd {
return iopsWriteRate;
}
+ public Boolean isCustomizedIops() {
+ return customizedIops;
+ }
+
+ public Long getMinIops() {
+ return minIops;
+ }
+
+ public Long getMaxIops() {
+ return maxIops;
+ }
+
+ public Integer getHypervisorSnapshotReserve() {
+ return hypervisorSnapshotReserve;
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public String getCommandName() {
- return Name;
+ return s_name;
}
@Override
diff --git a/api/src/org/apache/cloudstack/api/command/admin/offering/DeleteDiskOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/offering/DeleteDiskOfferingCmd.java
index 9845aa49e2b..8987d50066e 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/offering/DeleteDiskOfferingCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/offering/DeleteDiskOfferingCmd.java
@@ -29,7 +29,8 @@ import org.apache.cloudstack.api.response.SuccessResponse;
import com.cloud.user.Account;
-@APICommand(name = "deleteDiskOffering", description = "Updates a disk offering.", responseObject = SuccessResponse.class)
+@APICommand(name = "deleteDiskOffering", description = "Updates a disk offering.", responseObject = SuccessResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteDiskOfferingCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(DeleteDiskOfferingCmd.class.getName());
private static final String s_name = "deletediskofferingresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/admin/offering/DeleteServiceOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/offering/DeleteServiceOfferingCmd.java
index 0f81409d264..2a07fff9b15 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/offering/DeleteServiceOfferingCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/offering/DeleteServiceOfferingCmd.java
@@ -29,7 +29,8 @@ import org.apache.cloudstack.api.response.SuccessResponse;
import com.cloud.user.Account;
-@APICommand(name = "deleteServiceOffering", description = "Deletes a service offering.", responseObject = SuccessResponse.class)
+@APICommand(name = "deleteServiceOffering", description = "Deletes a service offering.", responseObject = SuccessResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteServiceOfferingCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(DeleteServiceOfferingCmd.class.getName());
private static final String s_name = "deleteserviceofferingresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/admin/offering/UpdateDiskOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/offering/UpdateDiskOfferingCmd.java
index 6d45fb5d55d..6e1fde55a30 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/offering/UpdateDiskOfferingCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/offering/UpdateDiskOfferingCmd.java
@@ -29,7 +29,8 @@ import org.apache.cloudstack.api.response.DiskOfferingResponse;
import com.cloud.offering.DiskOffering;
import com.cloud.user.Account;
-@APICommand(name = "updateDiskOffering", description = "Updates a disk offering.", responseObject = DiskOfferingResponse.class)
+@APICommand(name = "updateDiskOffering", description = "Updates a disk offering.", responseObject = DiskOfferingResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class UpdateDiskOfferingCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(UpdateDiskOfferingCmd.class.getName());
private static final String s_name = "updatediskofferingresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/admin/offering/UpdateServiceOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/offering/UpdateServiceOfferingCmd.java
index fbc88450fea..f4f4bdfac88 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/offering/UpdateServiceOfferingCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/offering/UpdateServiceOfferingCmd.java
@@ -29,7 +29,8 @@ import org.apache.cloudstack.api.response.ServiceOfferingResponse;
import com.cloud.offering.ServiceOffering;
import com.cloud.user.Account;
-@APICommand(name = "updateServiceOffering", description = "Updates a service offering.", responseObject = ServiceOfferingResponse.class)
+@APICommand(name = "updateServiceOffering", description = "Updates a service offering.", responseObject = ServiceOfferingResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class UpdateServiceOfferingCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(UpdateServiceOfferingCmd.class.getName());
private static final String s_name = "updateserviceofferingresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/admin/pod/CreatePodCmd.java b/api/src/org/apache/cloudstack/api/command/admin/pod/CreatePodCmd.java
index 835a3b98bc4..d912b44132f 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/pod/CreatePodCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/pod/CreatePodCmd.java
@@ -30,7 +30,8 @@ import org.apache.cloudstack.api.response.ZoneResponse;
import com.cloud.dc.Pod;
import com.cloud.user.Account;
-@APICommand(name = "createPod", description = "Creates a new Pod.", responseObject = PodResponse.class)
+@APICommand(name = "createPod", description = "Creates a new Pod.", responseObject = PodResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class CreatePodCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(CreatePodCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/pod/DeletePodCmd.java b/api/src/org/apache/cloudstack/api/command/admin/pod/DeletePodCmd.java
index 584eed41e7d..c2edacba353 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/pod/DeletePodCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/pod/DeletePodCmd.java
@@ -29,7 +29,8 @@ import org.apache.cloudstack.api.response.SuccessResponse;
import com.cloud.user.Account;
-@APICommand(name = "deletePod", description = "Deletes a Pod.", responseObject = SuccessResponse.class)
+@APICommand(name = "deletePod", description = "Deletes a Pod.", responseObject = SuccessResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeletePodCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(DeletePodCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/pod/ListPodsByCmd.java b/api/src/org/apache/cloudstack/api/command/admin/pod/ListPodsByCmd.java
index 75b5efd2fab..3cc03f24d7c 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/pod/ListPodsByCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/pod/ListPodsByCmd.java
@@ -32,7 +32,8 @@ import org.apache.cloudstack.api.response.ZoneResponse;
import com.cloud.dc.Pod;
import com.cloud.utils.Pair;
-@APICommand(name = "listPods", description = "Lists all Pods.", responseObject = PodResponse.class)
+@APICommand(name = "listPods", description = "Lists all Pods.", responseObject = PodResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListPodsByCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListPodsByCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/pod/UpdatePodCmd.java b/api/src/org/apache/cloudstack/api/command/admin/pod/UpdatePodCmd.java
index 7b8f6eb0f97..c89694c56bb 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/pod/UpdatePodCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/pod/UpdatePodCmd.java
@@ -29,7 +29,8 @@ import org.apache.cloudstack.api.response.PodResponse;
import com.cloud.dc.Pod;
import com.cloud.user.Account;
-@APICommand(name = "updatePod", description = "Updates a Pod.", responseObject = PodResponse.class)
+@APICommand(name = "updatePod", description = "Updates a Pod.", responseObject = PodResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class UpdatePodCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(UpdatePodCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/region/AddRegionCmd.java b/api/src/org/apache/cloudstack/api/command/admin/region/AddRegionCmd.java
index 9e7c035bb9d..f6743baf625 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/region/AddRegionCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/region/AddRegionCmd.java
@@ -32,7 +32,8 @@ import org.apache.cloudstack.region.RegionService;
import com.cloud.user.Account;
-@APICommand(name = "addRegion", description = "Adds a Region", responseObject = RegionResponse.class)
+@APICommand(name = "addRegion", description = "Adds a Region", responseObject = RegionResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class AddRegionCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(AddRegionCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/region/CreatePortableIpRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/region/CreatePortableIpRangeCmd.java
index e900f47476f..955bb9c292c 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/region/CreatePortableIpRangeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/region/CreatePortableIpRangeCmd.java
@@ -38,7 +38,9 @@ import com.cloud.user.Account;
@APICommand(name = "createPortableIpRange",
responseObject = PortableIpRangeResponse.class,
description = "adds a range of portable public IP's to a region",
- since = "4.2.0")
+ since = "4.2.0",
+ requestHasSensitiveInfo = false,
+ responseHasSensitiveInfo = false)
public class CreatePortableIpRangeCmd extends BaseAsyncCreateCmd {
public static final Logger s_logger = Logger.getLogger(CreatePortableIpRangeCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/region/DeletePortableIpRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/region/DeletePortableIpRangeCmd.java
index 5408eda5658..413818b8242 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/region/DeletePortableIpRangeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/region/DeletePortableIpRangeCmd.java
@@ -32,7 +32,8 @@ import org.apache.cloudstack.api.response.SuccessResponse;
import com.cloud.event.EventTypes;
import com.cloud.user.Account;
-@APICommand(name = "deletePortableIpRange", description = "deletes a range of portable public IP's associated with a region", responseObject = SuccessResponse.class)
+@APICommand(name = "deletePortableIpRange", description = "deletes a range of portable public IP's associated with a region", responseObject = SuccessResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeletePortableIpRangeCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DeletePortableIpRangeCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/region/ListPortableIpRangesCmd.java b/api/src/org/apache/cloudstack/api/command/admin/region/ListPortableIpRangesCmd.java
index 42a92e62873..100572ef5ad 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/region/ListPortableIpRangesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/region/ListPortableIpRangesCmd.java
@@ -33,7 +33,8 @@ import org.apache.cloudstack.region.PortableIpRange;
import com.cloud.user.Account;
-@APICommand(name = "listPortableIpRanges", description = "list portable IP ranges", responseObject = PortableIpRangeResponse.class)
+@APICommand(name = "listPortableIpRanges", description = "list portable IP ranges", responseObject = PortableIpRangeResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListPortableIpRangesCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListPortableIpRangesCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/region/RemoveRegionCmd.java b/api/src/org/apache/cloudstack/api/command/admin/region/RemoveRegionCmd.java
index e9126595f9f..415456f9414 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/region/RemoveRegionCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/region/RemoveRegionCmd.java
@@ -31,7 +31,8 @@ import org.apache.cloudstack.region.RegionService;
import com.cloud.user.Account;
-@APICommand(name = "removeRegion", description = "Removes specified region", responseObject = SuccessResponse.class)
+@APICommand(name = "removeRegion", description = "Removes specified region", responseObject = SuccessResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class RemoveRegionCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(RemoveRegionCmd.class.getName());
private static final String s_name = "removeregionresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/admin/region/UpdateRegionCmd.java b/api/src/org/apache/cloudstack/api/command/admin/region/UpdateRegionCmd.java
index 527e142ee8b..b08cbbbb10c 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/region/UpdateRegionCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/region/UpdateRegionCmd.java
@@ -32,7 +32,8 @@ import org.apache.cloudstack.region.RegionService;
import com.cloud.user.Account;
-@APICommand(name = "updateRegion", description = "Updates a region", responseObject = RegionResponse.class)
+@APICommand(name = "updateRegion", description = "Updates a region", responseObject = RegionResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class UpdateRegionCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(UpdateRegionCmd.class.getName());
private static final String s_name = "updateregionresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/admin/resource/ArchiveAlertsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/resource/ArchiveAlertsCmd.java
index b1177b9e3eb..79b3520b0b4 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/resource/ArchiveAlertsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/resource/ArchiveAlertsCmd.java
@@ -33,7 +33,8 @@ import org.apache.cloudstack.api.response.SuccessResponse;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.user.Account;
-@APICommand(name = "archiveAlerts", description = "Archive one or more alerts.", responseObject = SuccessResponse.class)
+@APICommand(name = "archiveAlerts", description = "Archive one or more alerts.", responseObject = SuccessResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ArchiveAlertsCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(ArchiveAlertsCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/resource/CleanVMReservationsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/resource/CleanVMReservationsCmd.java
index edc3bcf42d0..9acc71ce693 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/resource/CleanVMReservationsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/resource/CleanVMReservationsCmd.java
@@ -28,7 +28,8 @@ import org.apache.cloudstack.context.CallContext;
import com.cloud.event.EventTypes;
import com.cloud.user.Account;
-@APICommand(name = "cleanVMReservations", description = "Cleanups VM reservations in the database.", responseObject = SuccessResponse.class)
+@APICommand(name = "cleanVMReservations", description = "Cleanups VM reservations in the database.", responseObject = SuccessResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class CleanVMReservationsCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(CleanVMReservationsCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/resource/DeleteAlertsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/resource/DeleteAlertsCmd.java
index 8ba25251a70..246b25785b3 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/resource/DeleteAlertsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/resource/DeleteAlertsCmd.java
@@ -33,7 +33,8 @@ import org.apache.cloudstack.api.response.SuccessResponse;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.user.Account;
-@APICommand(name = "deleteAlerts", description = "Delete one or more alerts.", responseObject = SuccessResponse.class)
+@APICommand(name = "deleteAlerts", description = "Delete one or more alerts.", responseObject = SuccessResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteAlertsCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(DeleteAlertsCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/resource/ListAlertsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/resource/ListAlertsCmd.java
index 397b00a034e..8f21263b85c 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/resource/ListAlertsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/resource/ListAlertsCmd.java
@@ -30,7 +30,8 @@ import org.apache.log4j.Logger;
import com.cloud.alert.Alert;
import com.cloud.utils.Pair;
-@APICommand(name = "listAlerts", description = "Lists all alerts.", responseObject = AlertResponse.class)
+@APICommand(name = "listAlerts", description = "Lists all alerts.", responseObject = AlertResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListAlertsCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListAlertsCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/resource/ListCapacityCmd.java b/api/src/org/apache/cloudstack/api/command/admin/resource/ListCapacityCmd.java
index 2b0f82715aa..d79ff07fbcc 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/resource/ListCapacityCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/resource/ListCapacityCmd.java
@@ -34,7 +34,8 @@ import org.apache.cloudstack.api.response.ZoneResponse;
import com.cloud.capacity.Capacity;
import com.cloud.exception.InvalidParameterValueException;
-@APICommand(name = "listCapacity", description = "Lists all the system wide capacities.", responseObject = CapacityResponse.class)
+@APICommand(name = "listCapacity", description = "Lists all the system wide capacities.", responseObject = CapacityResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListCapacityCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListCapacityCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/resource/UploadCustomCertificateCmd.java b/api/src/org/apache/cloudstack/api/command/admin/resource/UploadCustomCertificateCmd.java
index 68ef5accb17..e11876a6816 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/resource/UploadCustomCertificateCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/resource/UploadCustomCertificateCmd.java
@@ -31,7 +31,8 @@ import com.cloud.user.Account;
@APICommand(name = "uploadCustomCertificate",
responseObject = CustomCertificateResponse.class,
- description = "Uploads a custom certificate for the console proxy VMs to use for SSL. Can be used to upload a single certificate signed by a known CA. Can also be used, through multiple calls, to upload a chain of certificates from CA to the custom certificate itself.")
+ description = "Uploads a custom certificate for the console proxy VMs to use for SSL. Can be used to upload a single certificate signed by a known CA. Can also be used, through multiple calls, to upload a chain of certificates from CA to the custom certificate itself.",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class UploadCustomCertificateCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(UploadCustomCertificateCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/ConfigureOvsElementCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/ConfigureOvsElementCmd.java
index 75b08b1fab5..7577f2eb884 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/router/ConfigureOvsElementCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/router/ConfigureOvsElementCmd.java
@@ -39,7 +39,8 @@ import com.cloud.network.OvsProvider;
import com.cloud.network.element.VirtualRouterElementService;
import com.cloud.user.Account;
-@APICommand(name = "configureOvsElement", responseObject = OvsProviderResponse.class, description = "Configures an ovs element.")
+@APICommand(name = "configureOvsElement", responseObject = OvsProviderResponse.class, description = "Configures an ovs element.",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ConfigureOvsElementCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger
.getLogger(ConfigureOvsElementCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/ConfigureVirtualRouterElementCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/ConfigureVirtualRouterElementCmd.java
index 2cfefda8c40..b8fafb63a6f 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/router/ConfigureVirtualRouterElementCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/router/ConfigureVirtualRouterElementCmd.java
@@ -40,7 +40,8 @@ import com.cloud.network.VirtualRouterProvider;
import com.cloud.network.element.VirtualRouterElementService;
import com.cloud.user.Account;
-@APICommand(name = "configureVirtualRouterElement", responseObject = VirtualRouterProviderResponse.class, description = "Configures a virtual router element.")
+@APICommand(name = "configureVirtualRouterElement", responseObject = VirtualRouterProviderResponse.class, description = "Configures a virtual router element.",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ConfigureVirtualRouterElementCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(ConfigureVirtualRouterElementCmd.class.getName());
private static final String s_name = "configurevirtualrouterelementresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/CreateVirtualRouterElementCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/CreateVirtualRouterElementCmd.java
index bf5eb188a01..f43b143d4ec 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/router/CreateVirtualRouterElementCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/router/CreateVirtualRouterElementCmd.java
@@ -40,7 +40,8 @@ import com.cloud.network.VirtualRouterProvider.Type;
import com.cloud.network.element.VirtualRouterElementService;
import com.cloud.user.Account;
-@APICommand(name = "createVirtualRouterElement", responseObject = VirtualRouterProviderResponse.class, description = "Create a virtual router element.")
+@APICommand(name = "createVirtualRouterElement", responseObject = VirtualRouterProviderResponse.class, description = "Create a virtual router element.",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class CreateVirtualRouterElementCmd extends BaseAsyncCreateCmd {
public static final Logger s_logger = Logger.getLogger(CreateVirtualRouterElementCmd.class.getName());
private static final String s_name = "createvirtualrouterelementresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/DestroyRouterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/DestroyRouterCmd.java
index 2ad312ee282..4513e2e85e2 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/router/DestroyRouterCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/router/DestroyRouterCmd.java
@@ -33,8 +33,10 @@ import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.router.VirtualRouter;
import com.cloud.user.Account;
+import com.cloud.vm.VirtualMachine;
-@APICommand(name = "destroyRouter", description = "Destroys a router.", responseObject = DomainRouterResponse.class)
+@APICommand(name = "destroyRouter", description = "Destroys a router.", responseObject = DomainRouterResponse.class, entityType = {VirtualMachine.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DestroyRouterCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DestroyRouterCmd.class.getName());
private static final String s_name = "destroyrouterresponse";
@@ -102,7 +104,7 @@ public class DestroyRouterCmd extends BaseAsyncCmd {
if (result != null) {
DomainRouterResponse response = _responseGenerator.createDomainRouterResponse(result);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to destroy router");
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/ListOvsElementsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/ListOvsElementsCmd.java
index d5f73fd742a..75c69564188 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/router/ListOvsElementsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/router/ListOvsElementsCmd.java
@@ -39,7 +39,8 @@ import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.OvsProvider;
import com.cloud.network.element.VirtualRouterElementService;
-@APICommand(name = "listOvsElements", description = "Lists all available ovs elements.", responseObject = OvsProviderResponse.class)
+@APICommand(name = "listOvsElements", description = "Lists all available ovs elements.", responseObject = OvsProviderResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListOvsElementsCmd extends BaseListCmd {
public static final Logger s_logger = Logger
.getLogger(ListNetworkOfferingsCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java
index 9c91e0fb2c7..121fc5bc14d 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java
@@ -34,8 +34,10 @@ import org.apache.cloudstack.api.response.VpcResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import com.cloud.network.router.VirtualRouter.Role;
+import com.cloud.vm.VirtualMachine;
-@APICommand(name = "listRouters", description = "List routers.", responseObject = DomainRouterResponse.class)
+@APICommand(name = "listRouters", description = "List routers.", responseObject = DomainRouterResponse.class, entityType = {VirtualMachine.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListRoutersCmd extends BaseListProjectAndAccountResourcesCmd {
public static final Logger s_logger = Logger.getLogger(ListRoutersCmd.class.getName());
@@ -148,6 +150,6 @@ public class ListRoutersCmd extends BaseListProjectAndAccountResourcesCmd {
public void execute() {
ListResponse response = _queryService.searchForRouters(this);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/ListVirtualRouterElementsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/ListVirtualRouterElementsCmd.java
index 6f1792145be..24bbf5ae2ed 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/router/ListVirtualRouterElementsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/router/ListVirtualRouterElementsCmd.java
@@ -40,10 +40,11 @@ import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.VirtualRouterProvider;
import com.cloud.network.element.VirtualRouterElementService;
-@APICommand(name = "listVirtualRouterElements", description = "Lists all available virtual router elements.", responseObject = VirtualRouterProviderResponse.class)
+@APICommand(name = "listVirtualRouterElements", description = "Lists all available virtual router elements.", responseObject = VirtualRouterProviderResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListVirtualRouterElementsCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListNetworkOfferingsCmd.class.getName());
- private static final String Name = "listvirtualrouterelementsresponse";
+ private static final String s_name = "listvirtualrouterelementsresponse";
// TODO, VirtualRouterElementServer is not singleton in system!
@Inject
@@ -94,7 +95,7 @@ public class ListVirtualRouterElementsCmd extends BaseListCmd {
@Override
public String getCommandName() {
- return Name;
+ return s_name;
}
@Override
diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/RebootRouterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/RebootRouterCmd.java
index 15527d3de36..4b138f3cfc1 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/router/RebootRouterCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/router/RebootRouterCmd.java
@@ -34,8 +34,10 @@ import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.router.VirtualRouter;
import com.cloud.user.Account;
+import com.cloud.vm.VirtualMachine;
-@APICommand(name = "rebootRouter", description = "Starts a router.", responseObject = DomainRouterResponse.class)
+@APICommand(name = "rebootRouter", description = "Starts a router.", responseObject = DomainRouterResponse.class, entityType = {VirtualMachine.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class RebootRouterCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(RebootRouterCmd.class.getName());
private static final String s_name = "rebootrouterresponse";
@@ -97,11 +99,11 @@ public class RebootRouterCmd extends BaseAsyncCmd {
@Override
public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
CallContext.current().setEventDetails("Router Id: " + getId());
- VirtualRouter result = _routerService.rebootRouter(this.getId(), true);
+ VirtualRouter result = _routerService.rebootRouter(getId(), true);
if (result != null) {
DomainRouterResponse response = _responseGenerator.createDomainRouterResponse(result);
response.setResponseName("router");
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reboot router");
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/StartRouterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/StartRouterCmd.java
index 9196cd0dbde..173833cb42c 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/router/StartRouterCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/router/StartRouterCmd.java
@@ -36,8 +36,10 @@ import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.router.VirtualRouter;
import com.cloud.network.router.VirtualRouter.Role;
import com.cloud.user.Account;
+import com.cloud.vm.VirtualMachine;
-@APICommand(name = "startRouter", responseObject = DomainRouterResponse.class, description = "Starts a router.")
+@APICommand(name = "startRouter", responseObject = DomainRouterResponse.class, description = "Starts a router.", entityType = {VirtualMachine.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class StartRouterCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(StartRouterCmd.class.getName());
private static final String s_name = "startrouterresponse";
@@ -113,7 +115,7 @@ public class StartRouterCmd extends BaseAsyncCmd {
if (result != null) {
DomainRouterResponse routerResponse = _responseGenerator.createDomainRouterResponse(result);
routerResponse.setResponseName(getCommandName());
- this.setResponseObject(routerResponse);
+ setResponseObject(routerResponse);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to start router");
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/StopRouterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/StopRouterCmd.java
index ee2b9ebc83a..2592cae545a 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/router/StopRouterCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/router/StopRouterCmd.java
@@ -35,8 +35,10 @@ import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.router.VirtualRouter;
import com.cloud.network.router.VirtualRouter.Role;
import com.cloud.user.Account;
+import com.cloud.vm.VirtualMachine;
-@APICommand(name = "stopRouter", description = "Stops a router.", responseObject = DomainRouterResponse.class)
+@APICommand(name = "stopRouter", description = "Stops a router.", responseObject = DomainRouterResponse.class, entityType = {VirtualMachine.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class StopRouterCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(StopRouterCmd.class.getName());
private static final String s_name = "stoprouterresponse";
@@ -116,7 +118,7 @@ public class StopRouterCmd extends BaseAsyncCmd {
if (result != null) {
DomainRouterResponse response = _responseGenerator.createDomainRouterResponse(result);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to stop router");
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/UpgradeRouterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/UpgradeRouterCmd.java
index 04a4e6706f6..067d344337b 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/router/UpgradeRouterCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/router/UpgradeRouterCmd.java
@@ -29,8 +29,10 @@ import org.apache.cloudstack.api.response.ServiceOfferingResponse;
import com.cloud.network.router.VirtualRouter;
import com.cloud.user.Account;
+import com.cloud.vm.VirtualMachine;
-@APICommand(name = "changeServiceForRouter", description = "Upgrades domain router to a new service offering", responseObject = DomainRouterResponse.class)
+@APICommand(name = "changeServiceForRouter", description = "Upgrades domain router to a new service offering", responseObject = DomainRouterResponse.class, entityType = {VirtualMachine.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class UpgradeRouterCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(UpgradeRouterCmd.class.getName());
private static final String s_name = "changeserviceforrouterresponse";
@@ -86,7 +88,7 @@ public class UpgradeRouterCmd extends BaseCmd {
if (router != null) {
DomainRouterResponse routerResponse = _responseGenerator.createDomainRouterResponse(router);
routerResponse.setResponseName(getCommandName());
- this.setResponseObject(routerResponse);
+ setResponseObject(routerResponse);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to upgrade router");
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/UpgradeRouterTemplateCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/UpgradeRouterTemplateCmd.java
index 49477452142..65d26cc7f96 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/router/UpgradeRouterTemplateCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/router/UpgradeRouterTemplateCmd.java
@@ -40,7 +40,8 @@ import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.user.Account;
-@APICommand(name = "upgradeRouterTemplate", description = "Upgrades router to use newer template", responseObject = BaseResponse.class)
+@APICommand(name = "upgradeRouterTemplate", description = "Upgrades router to use newer template", responseObject = BaseResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class UpgradeRouterTemplateCmd extends org.apache.cloudstack.api.BaseCmd {
public static final Logger s_logger = Logger.getLogger(UpgradeRouterTemplateCmd.class.getName());
private static final String s_name = "upgraderoutertemplateresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/AddImageStoreCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/AddImageStoreCmd.java
index 5e5bd3dcde5..6b673cf6322 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/storage/AddImageStoreCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/storage/AddImageStoreCmd.java
@@ -36,7 +36,8 @@ import com.cloud.exception.DiscoveryException;
import com.cloud.storage.ImageStore;
import com.cloud.user.Account;
-@APICommand(name = "addImageStore", description = "Adds backup image store.", responseObject = ImageStoreResponse.class, since = "4.2.0")
+@APICommand(name = "addImageStore", description = "Adds backup image store.", responseObject = ImageStoreResponse.class, since = "4.2.0",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class AddImageStoreCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(AddImageStoreCmd.class.getName());
private static final String s_name = "addimagestoreresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/AddS3Cmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/AddS3Cmd.java
index 32897e4d59d..4164394f5ec 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/storage/AddS3Cmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/storage/AddS3Cmd.java
@@ -52,11 +52,12 @@ import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.storage.ImageStore;
-@APICommand(name = "addS3", description = "Adds S3", responseObject = ImageStoreResponse.class, since = "4.0.0")
+@APICommand(name = "addS3", description = "Adds S3", responseObject = ImageStoreResponse.class, since = "4.0.0",
+ requestHasSensitiveInfo = true, responseHasSensitiveInfo = false)
public final class AddS3Cmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(AddS3Cmd.class.getName());
- private static final String COMMAND_NAME = "adds3response";
+ private static final String s_name = "adds3response";
@Parameter(name = S3_ACCESS_KEY, type = STRING, required = true, description = "S3 access key")
private String accessKey;
@@ -189,7 +190,7 @@ public final class AddS3Cmd extends BaseCmd {
@Override
public String getCommandName() {
- return COMMAND_NAME;
+ return s_name;
}
@Override
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/CancelPrimaryStorageMaintenanceCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/CancelPrimaryStorageMaintenanceCmd.java
index b1c55944638..91348ecf6b0 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/storage/CancelPrimaryStorageMaintenanceCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/storage/CancelPrimaryStorageMaintenanceCmd.java
@@ -33,7 +33,8 @@ import com.cloud.exception.ResourceUnavailableException;
import com.cloud.storage.StoragePool;
import com.cloud.user.Account;
-@APICommand(name = "cancelStorageMaintenance", description = "Cancels maintenance for primary storage", responseObject = StoragePoolResponse.class)
+@APICommand(name = "cancelStorageMaintenance", description = "Cancels maintenance for primary storage", responseObject = StoragePoolResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class CancelPrimaryStorageMaintenanceCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(CancelPrimaryStorageMaintenanceCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/CreateSecondaryStagingStoreCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/CreateSecondaryStagingStoreCmd.java
index 1480e75c063..39ec6098516 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/storage/CreateSecondaryStagingStoreCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/storage/CreateSecondaryStagingStoreCmd.java
@@ -37,7 +37,8 @@ import org.apache.cloudstack.api.response.ZoneResponse;
import com.cloud.storage.ImageStore;
import com.cloud.user.Account;
-@APICommand(name = "createSecondaryStagingStore", description = "create secondary staging store.", responseObject = ImageStoreResponse.class)
+@APICommand(name = "createSecondaryStagingStore", description = "create secondary staging store.", responseObject = ImageStoreResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class CreateSecondaryStagingStoreCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(AddImageStoreCmd.class.getName());
private static final String s_name = "createsecondarystagingstoreresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/CreateStoragePoolCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/CreateStoragePoolCmd.java
index dfd00266835..ae44bc93732 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/storage/CreateStoragePoolCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/storage/CreateStoragePoolCmd.java
@@ -38,7 +38,8 @@ import com.cloud.storage.StoragePool;
import com.cloud.user.Account;
@SuppressWarnings("rawtypes")
-@APICommand(name = "createStoragePool", description = "Creates a storage pool.", responseObject = StoragePoolResponse.class)
+@APICommand(name = "createStoragePool", description = "Creates a storage pool.", responseObject = StoragePoolResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class CreateStoragePoolCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(CreateStoragePoolCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/DeleteImageStoreCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/DeleteImageStoreCmd.java
index 602da8350e9..669c0ec7b81 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/storage/DeleteImageStoreCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/storage/DeleteImageStoreCmd.java
@@ -29,7 +29,8 @@ import org.apache.cloudstack.api.response.SuccessResponse;
import com.cloud.user.Account;
-@APICommand(name = "deleteImageStore", description = "Deletes an image store .", responseObject = SuccessResponse.class, since = "4.2.0")
+@APICommand(name = "deleteImageStore", description = "Deletes an image store .", responseObject = SuccessResponse.class, since = "4.2.0",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteImageStoreCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(DeleteImageStoreCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/DeletePoolCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/DeletePoolCmd.java
index fb63daa51d2..5465fd1440f 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/storage/DeletePoolCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/storage/DeletePoolCmd.java
@@ -31,7 +31,8 @@ import com.cloud.storage.StoragePool;
import com.cloud.storage.StoragePoolStatus;
import com.cloud.user.Account;
-@APICommand(name = "deleteStoragePool", description = "Deletes a storage pool.", responseObject = SuccessResponse.class)
+@APICommand(name = "deleteStoragePool", description = "Deletes a storage pool.", responseObject = SuccessResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeletePoolCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(DeletePoolCmd.class.getName());
private static final String s_name = "deletestoragepoolresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/DeleteSecondaryStagingStoreCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/DeleteSecondaryStagingStoreCmd.java
index caf937fed00..16398623359 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/storage/DeleteSecondaryStagingStoreCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/storage/DeleteSecondaryStagingStoreCmd.java
@@ -29,7 +29,8 @@ import org.apache.cloudstack.api.response.SuccessResponse;
import com.cloud.user.Account;
-@APICommand(name = "deleteSecondaryStagingStore", description = "Deletes a secondary staging store .", responseObject = SuccessResponse.class, since = "4.2.0")
+@APICommand(name = "deleteSecondaryStagingStore", description = "Deletes a secondary staging store .", responseObject = SuccessResponse.class, since = "4.2.0",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteSecondaryStagingStoreCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(DeleteSecondaryStagingStoreCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/FindStoragePoolsForMigrationCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/FindStoragePoolsForMigrationCmd.java
index 10813cadc04..47fa965e7dd 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/storage/FindStoragePoolsForMigrationCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/storage/FindStoragePoolsForMigrationCmd.java
@@ -33,7 +33,8 @@ import org.apache.cloudstack.api.response.VolumeResponse;
import com.cloud.storage.StoragePool;
import com.cloud.utils.Pair;
-@APICommand(name = "findStoragePoolsForMigration", description = "Lists storage pools available for migration of a volume.", responseObject = StoragePoolResponse.class)
+@APICommand(name = "findStoragePoolsForMigration", description = "Lists storage pools available for migration of a volume.", responseObject = StoragePoolResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class FindStoragePoolsForMigrationCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(FindStoragePoolsForMigrationCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/ListImageStoresCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/ListImageStoresCmd.java
index bf470844e68..8c37c78c763 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/storage/ListImageStoresCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/storage/ListImageStoresCmd.java
@@ -26,7 +26,8 @@ import org.apache.cloudstack.api.response.ImageStoreResponse;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
-@APICommand(name = "listImageStores", description = "Lists image stores.", responseObject = ImageStoreResponse.class, since = "4.2.0")
+@APICommand(name = "listImageStores", description = "Lists image stores.", responseObject = ImageStoreResponse.class, since = "4.2.0",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListImageStoresCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListImageStoresCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/ListS3sCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/ListS3sCmd.java
index 362d69ef6fc..c1889e72a0b 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/storage/ListS3sCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/storage/ListS3sCmd.java
@@ -30,7 +30,8 @@ import com.cloud.exception.NetworkRuleConflictException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
-@APICommand(name = "listS3s", description = "Lists S3s", responseObject = ImageStoreResponse.class, since = "4.0.0")
+@APICommand(name = "listS3s", description = "Lists S3s", responseObject = ImageStoreResponse.class, since = "4.0.0",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListS3sCmd extends BaseListCmd {
private static final String COMMAND_NAME = "lists3sresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/ListSecondaryStagingStoresCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/ListSecondaryStagingStoresCmd.java
index 171f9714aef..e315c8a6d47 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/storage/ListSecondaryStagingStoresCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/storage/ListSecondaryStagingStoresCmd.java
@@ -26,7 +26,8 @@ import org.apache.cloudstack.api.response.ImageStoreResponse;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
-@APICommand(name = "listSecondaryStagingStores", description = "Lists secondary staging stores.", responseObject = ImageStoreResponse.class, since = "4.2.0")
+@APICommand(name = "listSecondaryStagingStores", description = "Lists secondary staging stores.", responseObject = ImageStoreResponse.class, since = "4.2.0",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListSecondaryStagingStoresCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListSecondaryStagingStoresCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/ListStoragePoolsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/ListStoragePoolsCmd.java
index 868b402b9db..ed123dbb6c3 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/storage/ListStoragePoolsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/storage/ListStoragePoolsCmd.java
@@ -29,7 +29,8 @@ import org.apache.cloudstack.api.response.PodResponse;
import org.apache.cloudstack.api.response.StoragePoolResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
-@APICommand(name = "listStoragePools", description = "Lists storage pools.", responseObject = StoragePoolResponse.class)
+@APICommand(name = "listStoragePools", description = "Lists storage pools.", responseObject = StoragePoolResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListStoragePoolsCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListStoragePoolsCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/ListStorageProvidersCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/ListStorageProvidersCmd.java
index bac6b7c46ac..3e960ee84a8 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/storage/ListStorageProvidersCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/storage/ListStorageProvidersCmd.java
@@ -37,7 +37,8 @@ import com.cloud.exception.NetworkRuleConflictException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
-@APICommand(name = "listStorageProviders", description = "Lists storage providers.", responseObject = StorageProviderResponse.class)
+@APICommand(name = "listStorageProviders", description = "Lists storage providers.", responseObject = StorageProviderResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListStorageProvidersCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListStorageProvidersCmd.class.getName());
private static final String s_name = "liststorageprovidersresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/PreparePrimaryStorageForMaintenanceCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/PreparePrimaryStorageForMaintenanceCmd.java
index 9d1196648ce..cf5fdf66c64 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/storage/PreparePrimaryStorageForMaintenanceCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/storage/PreparePrimaryStorageForMaintenanceCmd.java
@@ -34,7 +34,8 @@ import com.cloud.exception.ResourceUnavailableException;
import com.cloud.storage.StoragePool;
import com.cloud.user.Account;
-@APICommand(name = "enableStorageMaintenance", description = "Puts storage pool into maintenance state", responseObject = StoragePoolResponse.class)
+@APICommand(name = "enableStorageMaintenance", description = "Puts storage pool into maintenance state", responseObject = StoragePoolResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class PreparePrimaryStorageForMaintenanceCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(PreparePrimaryStorageForMaintenanceCmd.class.getName());
private static final String s_name = "prepareprimarystorageformaintenanceresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/UpdateCloudToUseObjectStoreCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/UpdateCloudToUseObjectStoreCmd.java
index 983a01c7fbe..a99c5e5d75c 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/storage/UpdateCloudToUseObjectStoreCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/storage/UpdateCloudToUseObjectStoreCmd.java
@@ -35,7 +35,8 @@ import com.cloud.exception.DiscoveryException;
import com.cloud.storage.ImageStore;
import com.cloud.user.Account;
-@APICommand(name = "updateCloudToUseObjectStore", description = "Migrate current NFS secondary storages to use object store.", responseObject = ImageStoreResponse.class, since = "4.3.0")
+@APICommand(name = "updateCloudToUseObjectStore", description = "Migrate current NFS secondary storages to use object store.", responseObject = ImageStoreResponse.class, since = "4.3.0",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class UpdateCloudToUseObjectStoreCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(UpdateCloudToUseObjectStoreCmd.class.getName());
private static final String s_name = "updatecloudtouseobjectstoreresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/UpdateStoragePoolCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/UpdateStoragePoolCmd.java
index 50be6ba13f7..3d1a7735325 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/storage/UpdateStoragePoolCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/storage/UpdateStoragePoolCmd.java
@@ -31,7 +31,8 @@ import org.apache.cloudstack.api.response.StoragePoolResponse;
import com.cloud.storage.StoragePool;
import com.cloud.user.Account;
-@APICommand(name = "updateStoragePool", description = "Updates a storage pool.", responseObject = StoragePoolResponse.class, since = "3.0.0")
+@APICommand(name = "updateStoragePool", description = "Updates a storage pool.", responseObject = StoragePoolResponse.class, since = "3.0.0",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class UpdateStoragePoolCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(UpdateStoragePoolCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/swift/AddSwiftCmd.java b/api/src/org/apache/cloudstack/api/command/admin/swift/AddSwiftCmd.java
index 173c95e2c0d..19a84252dd7 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/swift/AddSwiftCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/swift/AddSwiftCmd.java
@@ -33,7 +33,8 @@ import com.cloud.exception.DiscoveryException;
import com.cloud.storage.ImageStore;
import com.cloud.user.Account;
-@APICommand(name = "addSwift", description = "Adds Swift.", responseObject = ImageStoreResponse.class, since = "3.0.0")
+@APICommand(name = "addSwift", description = "Adds Swift.", responseObject = ImageStoreResponse.class, since = "3.0.0",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class AddSwiftCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(AddSwiftCmd.class.getName());
private static final String s_name = "addswiftresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/admin/swift/ListSwiftsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/swift/ListSwiftsCmd.java
index fcc8e465903..f80cfab4bdd 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/swift/ListSwiftsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/swift/ListSwiftsCmd.java
@@ -28,7 +28,8 @@ import org.apache.cloudstack.api.response.ListResponse;
import com.cloud.user.Account;
-@APICommand(name = "listSwifts", description = "List Swift.", responseObject = ImageStoreResponse.class, since = "3.0.0")
+@APICommand(name = "listSwifts", description = "List Swift.", responseObject = ImageStoreResponse.class, since = "3.0.0",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListSwiftsCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListSwiftsCmd.class.getName());
private static final String s_name = "listswiftsresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/DestroySystemVmCmd.java b/api/src/org/apache/cloudstack/api/command/admin/systemvm/DestroySystemVmCmd.java
index 07e111cbccd..47dfe8b7241 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/systemvm/DestroySystemVmCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/systemvm/DestroySystemVmCmd.java
@@ -18,6 +18,8 @@ package org.apache.cloudstack.api.command.admin.systemvm;
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;
@@ -32,12 +34,14 @@ import com.cloud.event.EventTypes;
import com.cloud.user.Account;
import com.cloud.vm.VirtualMachine;
-@APICommand(name = "destroySystemVm", responseObject = SystemVmResponse.class, description = "Destroyes a system virtual machine.")
+@APICommand(name = "destroySystemVm", responseObject = SystemVmResponse.class, description = "Destroyes a system virtual machine.", entityType = {VirtualMachine.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DestroySystemVmCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DestroySystemVmCmd.class.getName());
private static final String s_name = "destroysystemvmresponse";
+ @ACL(accessType = AccessType.OperateEntry)
@Parameter(name = ApiConstants.ID,
type = CommandType.UUID,
entityType = SystemVmResponse.class,
@@ -100,7 +104,7 @@ public class DestroySystemVmCmd extends BaseAsyncCmd {
if (instance != null) {
SystemVmResponse response = _responseGenerator.createSystemVmResponse(instance);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Fail to destroy system vm");
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java
index 9480497cdd5..2b2faf50113 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java
@@ -36,7 +36,8 @@ import org.apache.cloudstack.api.response.ZoneResponse;
import com.cloud.utils.Pair;
import com.cloud.vm.VirtualMachine;
-@APICommand(name = "listSystemVms", description = "List system virtual machines.", responseObject = SystemVmResponse.class)
+@APICommand(name = "listSystemVms", description = "List system virtual machines.", responseObject = SystemVmResponse.class, entityType = {VirtualMachine.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListSystemVMsCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListSystemVMsCmd.class.getName());
@@ -139,6 +140,6 @@ public class ListSystemVMsCmd extends BaseListCmd {
response.setResponses(vmResponses, systemVMs.second());
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/MigrateSystemVMCmd.java b/api/src/org/apache/cloudstack/api/command/admin/systemvm/MigrateSystemVMCmd.java
index 8199e683caf..97acfe0c46a 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/systemvm/MigrateSystemVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/systemvm/MigrateSystemVMCmd.java
@@ -18,6 +18,8 @@ package org.apache.cloudstack.api.command.admin.systemvm;
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;
@@ -38,7 +40,8 @@ import com.cloud.host.Host;
import com.cloud.user.Account;
import com.cloud.vm.VirtualMachine;
-@APICommand(name = "migrateSystemVm", description = "Attempts Migration of a system virtual machine to the host specified.", responseObject = SystemVmResponse.class)
+@APICommand(name = "migrateSystemVm", description = "Attempts Migration of a system virtual machine to the host specified.", responseObject = SystemVmResponse.class, entityType = {VirtualMachine.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class MigrateSystemVMCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(MigrateSystemVMCmd.class.getName());
@@ -55,6 +58,7 @@ public class MigrateSystemVMCmd extends BaseAsyncCmd {
description = "destination Host ID to migrate VM to")
private Long hostId;
+ @ACL(accessType = AccessType.OperateEntry)
@Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID,
type = CommandType.UUID,
entityType = SystemVmResponse.class,
@@ -118,7 +122,7 @@ public class MigrateSystemVMCmd extends BaseAsyncCmd {
// return the generic system VM instance response
SystemVmResponse response = _responseGenerator.createSystemVmResponse(migratedVm);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to migrate the system vm");
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/RebootSystemVmCmd.java b/api/src/org/apache/cloudstack/api/command/admin/systemvm/RebootSystemVmCmd.java
index 1c38b056f04..f439ddf4def 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/systemvm/RebootSystemVmCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/systemvm/RebootSystemVmCmd.java
@@ -18,6 +18,8 @@ package org.apache.cloudstack.api.command.admin.systemvm;
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;
@@ -32,7 +34,8 @@ import com.cloud.event.EventTypes;
import com.cloud.user.Account;
import com.cloud.vm.VirtualMachine;
-@APICommand(name = "rebootSystemVm", description = "Reboots a system VM.", responseObject = SystemVmResponse.class)
+@APICommand(name = "rebootSystemVm", description = "Reboots a system VM.", responseObject = SystemVmResponse.class, entityType = {VirtualMachine.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class RebootSystemVmCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(RebootSystemVmCmd.class.getName());
@@ -41,7 +44,7 @@ public class RebootSystemVmCmd extends BaseAsyncCmd {
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
-
+ @ACL(accessType = AccessType.OperateEntry)
@Parameter(name = ApiConstants.ID,
type = CommandType.UUID,
entityType = SystemVmResponse.class,
@@ -108,7 +111,7 @@ public class RebootSystemVmCmd extends BaseAsyncCmd {
if (result != null) {
SystemVmResponse response = _responseGenerator.createSystemVmResponse(result);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Fail to reboot system vm");
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/ScaleSystemVMCmd.java b/api/src/org/apache/cloudstack/api/command/admin/systemvm/ScaleSystemVMCmd.java
index 370815d625c..68e9f94a8ba 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/systemvm/ScaleSystemVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/systemvm/ScaleSystemVMCmd.java
@@ -21,6 +21,10 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
+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;
@@ -31,7 +35,6 @@ import org.apache.cloudstack.api.command.user.vm.UpgradeVMCmd;
import org.apache.cloudstack.api.response.ServiceOfferingResponse;
import org.apache.cloudstack.api.response.SystemVmResponse;
import org.apache.cloudstack.context.CallContext;
-import org.apache.log4j.Logger;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
@@ -44,7 +47,8 @@ import com.cloud.user.Account;
import com.cloud.vm.VirtualMachine;
@APICommand(name = "scaleSystemVm", responseObject = SystemVmResponse.class, description = "Scale the service offering for a system vm (console proxy or secondary storage). "
- + "The system vm must be in a \"Stopped\" state for " + "this command to take effect.")
+ + "The system vm must be in a \"Stopped\" state for " + "this command to take effect.", entityType = {VirtualMachine.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ScaleSystemVMCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(UpgradeVMCmd.class.getName());
private static final String s_name = "changeserviceforsystemvmresponse";
@@ -53,6 +57,7 @@ public class ScaleSystemVMCmd extends BaseAsyncCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
+ @ACL(accessType = AccessType.OperateEntry)
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = SystemVmResponse.class, required = true, description = "The ID of the system vm")
private Long id;
diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/StartSystemVMCmd.java b/api/src/org/apache/cloudstack/api/command/admin/systemvm/StartSystemVMCmd.java
index 2e65928af68..c456592d105 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/systemvm/StartSystemVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/systemvm/StartSystemVMCmd.java
@@ -18,6 +18,8 @@ package org.apache.cloudstack.api.command.admin.systemvm;
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;
@@ -32,7 +34,8 @@ import com.cloud.event.EventTypes;
import com.cloud.user.Account;
import com.cloud.vm.VirtualMachine;
-@APICommand(name = "startSystemVm", responseObject = SystemVmResponse.class, description = "Starts a system virtual machine.")
+@APICommand(name = "startSystemVm", responseObject = SystemVmResponse.class, description = "Starts a system virtual machine.", entityType = {VirtualMachine.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class StartSystemVMCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(StartSystemVMCmd.class.getName());
@@ -41,7 +44,7 @@ public class StartSystemVMCmd extends BaseAsyncCmd {
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
-
+ @ACL(accessType = AccessType.OperateEntry)
@Parameter(name = ApiConstants.ID,
type = CommandType.UUID,
entityType = SystemVmResponse.class,
@@ -112,7 +115,7 @@ public class StartSystemVMCmd extends BaseAsyncCmd {
if (instance != null) {
SystemVmResponse response = _responseGenerator.createSystemVmResponse(instance);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Fail to start system vm");
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/StopSystemVmCmd.java b/api/src/org/apache/cloudstack/api/command/admin/systemvm/StopSystemVmCmd.java
index 7709ebe5cfe..d60460ced1e 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/systemvm/StopSystemVmCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/systemvm/StopSystemVmCmd.java
@@ -18,6 +18,8 @@ package org.apache.cloudstack.api.command.admin.systemvm;
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;
@@ -34,7 +36,8 @@ import com.cloud.exception.ResourceUnavailableException;
import com.cloud.user.Account;
import com.cloud.vm.VirtualMachine;
-@APICommand(name = "stopSystemVm", description = "Stops a system VM.", responseObject = SystemVmResponse.class)
+@APICommand(name = "stopSystemVm", description = "Stops a system VM.", responseObject = SystemVmResponse.class, entityType = {VirtualMachine.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class StopSystemVmCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(StopSystemVmCmd.class.getName());
@@ -44,6 +47,7 @@ public class StopSystemVmCmd extends BaseAsyncCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
+ @ACL(accessType = AccessType.OperateEntry)
@Parameter(name = ApiConstants.ID,
type = CommandType.UUID,
entityType = SystemVmResponse.class,
@@ -117,7 +121,7 @@ public class StopSystemVmCmd extends BaseAsyncCmd {
if (result != null) {
SystemVmResponse response = _responseGenerator.createSystemVmResponse(result);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Fail to stop system vm");
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java b/api/src/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java
index da0564e9e67..d71ef03244b 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java
@@ -21,6 +21,10 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
+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;
@@ -31,7 +35,6 @@ import org.apache.cloudstack.api.command.user.vm.UpgradeVMCmd;
import org.apache.cloudstack.api.response.ServiceOfferingResponse;
import org.apache.cloudstack.api.response.SystemVmResponse;
import org.apache.cloudstack.context.CallContext;
-import org.apache.log4j.Logger;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.offering.ServiceOffering;
@@ -39,7 +42,8 @@ import com.cloud.user.Account;
import com.cloud.vm.VirtualMachine;
@APICommand(name = "changeServiceForSystemVm", responseObject = SystemVmResponse.class, description = "Changes the service offering for a system vm (console proxy or secondary storage). "
- + "The system vm must be in a \"Stopped\" state for " + "this command to take effect.")
+ + "The system vm must be in a \"Stopped\" state for " + "this command to take effect.", entityType = {VirtualMachine.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class UpgradeSystemVMCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(UpgradeVMCmd.class.getName());
private static final String s_name = "changeserviceforsystemvmresponse";
@@ -48,6 +52,7 @@ public class UpgradeSystemVMCmd extends BaseCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
+ @ACL(accessType = AccessType.OperateEntry)
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = SystemVmResponse.class, required = true, description = "The ID of the system vm")
private Long id;
diff --git a/api/src/org/apache/cloudstack/api/command/admin/template/CopyTemplateCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/template/CopyTemplateCmdByAdmin.java
new file mode 100644
index 00000000000..c6a5ee753d9
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/template/CopyTemplateCmdByAdmin.java
@@ -0,0 +1,63 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.admin.template;
+
+import java.util.List;
+
+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.template.CopyTemplateCmd;
+import org.apache.cloudstack.api.response.TemplateResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.StorageUnavailableException;
+import com.cloud.template.VirtualMachineTemplate;
+
+@APICommand(name = "copyTemplate", description = "Copies a template from one zone to another.", responseObject = TemplateResponse.class, responseView = ResponseView.Full)
+public class CopyTemplateCmdByAdmin extends CopyTemplateCmd {
+ public static final Logger s_logger = Logger.getLogger(CopyTemplateCmdByAdmin.class.getName());
+
+ @Override
+ public void execute() throws ResourceAllocationException{
+ try {
+ CallContext.current().setEventDetails(getEventDescription());
+ VirtualMachineTemplate template = _templateService.copyTemplate(this);
+
+ if (template != null){
+ List listResponse = _responseGenerator.createTemplateResponses(ResponseView.Full, template, getDestinationZoneId(), false);
+ TemplateResponse response = new TemplateResponse();
+ if (listResponse != null && !listResponse.isEmpty()) {
+ response = listResponse.get(0);
+ }
+
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to copy template");
+ }
+ } catch (StorageUnavailableException ex) {
+ s_logger.warn("Exception: ", ex);
+ throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
+ }
+ }
+}
+
diff --git a/api/src/org/apache/cloudstack/api/command/admin/template/CreateTemplateCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/template/CreateTemplateCmdByAdmin.java
new file mode 100644
index 00000000000..d316278aa32
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/template/CreateTemplateCmdByAdmin.java
@@ -0,0 +1,62 @@
+// 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.template;
+
+import java.util.List;
+
+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.template.CreateTemplateCmd;
+import org.apache.cloudstack.api.response.TemplateResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.template.VirtualMachineTemplate;
+
+@APICommand(name = "createTemplate", responseObject = TemplateResponse.class, description = "Creates a template of a virtual machine. " + "The virtual machine must be in a STOPPED state. "
+ + "A template created from this command is automatically designated as a private template visible to the account that created it.", responseView = ResponseView.Full)
+public class CreateTemplateCmdByAdmin extends CreateTemplateCmd {
+ public static final Logger s_logger = Logger.getLogger(CreateTemplateCmdByAdmin.class.getName());
+
+ @Override
+ public void execute() {
+ CallContext.current().setEventDetails("Template Id: "+getEntityId()+((getSnapshotId() == null) ? " from volume Id: " + getVolumeId() : " from snapshot Id: " + getSnapshotId()));
+ VirtualMachineTemplate template = null;
+ template = _templateService.createPrivateTemplate(this);
+
+ if (template != null){
+ List templateResponses;
+ if (isBareMetal()) {
+ templateResponses = _responseGenerator.createTemplateResponses(ResponseView.Full, template.getId(), vmId);
+ } else {
+ templateResponses = _responseGenerator.createTemplateResponses(ResponseView.Full, template.getId(), snapshotId, volumeId, false);
+ }
+ TemplateResponse response = new TemplateResponse();
+ if (templateResponses != null && !templateResponses.isEmpty()) {
+ response = templateResponses.get(0);
+ }
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create private template");
+ }
+
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/template/ListTemplatePermissionsCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/template/ListTemplatePermissionsCmdByAdmin.java
new file mode 100644
index 00000000000..1b6fbab3605
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/template/ListTemplatePermissionsCmdByAdmin.java
@@ -0,0 +1,32 @@
+// Licensedname = "listTemplatePermissions", 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.template;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.command.user.template.ListTemplatePermissionsCmd;
+import org.apache.cloudstack.api.response.TemplatePermissionsResponse;
+
+@APICommand(name = "listTemplatePermissions", description = "List template visibility and all accounts that have permissions to view this template.", responseObject = TemplatePermissionsResponse.class, responseView = ResponseView.Full)
+public class ListTemplatePermissionsCmdByAdmin extends ListTemplatePermissionsCmd {
+
+ @Override
+ public void execute() {
+ executeWithView(ResponseView.Full);
+ }
+
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/template/ListTemplatesCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/template/ListTemplatesCmdByAdmin.java
new file mode 100644
index 00000000000..4e2bb018d07
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/template/ListTemplatesCmdByAdmin.java
@@ -0,0 +1,29 @@
+// 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.template;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.command.user.template.ListTemplatesCmd;
+import org.apache.cloudstack.api.response.TemplateResponse;
+
+import com.cloud.template.VirtualMachineTemplate;
+
+@APICommand(name = "listTemplates", description = "List all public, private, and privileged templates.", responseObject = TemplateResponse.class, entityType = {VirtualMachineTemplate.class}, responseView = ResponseView.Full)
+public class ListTemplatesCmdByAdmin extends ListTemplatesCmd {
+
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/template/PrepareTemplateCmd.java b/api/src/org/apache/cloudstack/api/command/admin/template/PrepareTemplateCmd.java
index 16761bab373..d4c26966d91 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/template/PrepareTemplateCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/template/PrepareTemplateCmd.java
@@ -20,10 +20,13 @@ import java.util.List;
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.BaseCmd;
import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.TemplateResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
@@ -31,7 +34,8 @@ import org.apache.cloudstack.api.response.ZoneResponse;
import com.cloud.template.VirtualMachineTemplate;
import com.cloud.user.Account;
-@APICommand(name = "prepareTemplate", responseObject = TemplateResponse.class, description = "load template into primary storage")
+@APICommand(name = "prepareTemplate", responseObject = TemplateResponse.class, description = "load template into primary storage", entityType = {VirtualMachineTemplate.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class PrepareTemplateCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(PrepareTemplateCmd.class.getName());
@@ -48,6 +52,7 @@ public class PrepareTemplateCmd extends BaseCmd {
description = "zone ID of the template to be prepared in primary storage(s).")
private Long zoneId;
+ @ACL(accessType = AccessType.OperateEntry)
@Parameter(name = ApiConstants.TEMPLATE_ID,
type = CommandType.UUID,
entityType = TemplateResponse.class,
@@ -86,9 +91,9 @@ public class PrepareTemplateCmd extends BaseCmd {
ListResponse response = new ListResponse();
VirtualMachineTemplate vmTemplate = _templateService.prepareTemplate(templateId, zoneId);
- List templateResponses = _responseGenerator.createTemplateResponses(vmTemplate, zoneId, true);
+ List templateResponses = _responseGenerator.createTemplateResponses(ResponseView.Full, vmTemplate, zoneId, true);
response.setResponses(templateResponses);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/template/RegisterTemplateCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/template/RegisterTemplateCmdByAdmin.java
new file mode 100644
index 00000000000..c6239383d13
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/template/RegisterTemplateCmdByAdmin.java
@@ -0,0 +1,57 @@
+// 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.template;
+
+import java.net.URISyntaxException;
+import java.util.List;
+
+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.template.RegisterTemplateCmd;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.TemplateResponse;
+
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.template.VirtualMachineTemplate;
+
+@APICommand(name = "registerTemplate", description = "Registers an existing template into the CloudStack cloud. ", responseObject = TemplateResponse.class, responseView = ResponseView.Full)
+public class RegisterTemplateCmdByAdmin extends RegisterTemplateCmd {
+ public static final Logger s_logger = Logger.getLogger(RegisterTemplateCmdByAdmin.class.getName());
+
+ @Override
+ public void execute() throws ResourceAllocationException{
+ try {
+ VirtualMachineTemplate template = _templateService.registerTemplate(this);
+ if (template != null){
+ ListResponse response = new ListResponse();
+ List templateResponses = _responseGenerator.createTemplateResponses(ResponseView.Full, template, zoneId, false);
+ response.setResponses(templateResponses);
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to register template");
+ }
+ } catch (URISyntaxException ex1) {
+ s_logger.info(ex1);
+ throw new ServerApiException(ApiErrorCode.PARAM_ERROR, ex1.getMessage());
+ }
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/template/UpdateTemplateCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/template/UpdateTemplateCmdByAdmin.java
new file mode 100644
index 00000000000..6587020b1d3
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/template/UpdateTemplateCmdByAdmin.java
@@ -0,0 +1,47 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.admin.template;
+
+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.template.UpdateTemplateCmd;
+import org.apache.cloudstack.api.response.TemplateResponse;
+
+import com.cloud.template.VirtualMachineTemplate;
+
+@APICommand(name = "updateTemplate", description = "Updates attributes of a template.", responseObject = TemplateResponse.class, responseView = ResponseView.Full)
+public class UpdateTemplateCmdByAdmin extends UpdateTemplateCmd {
+ public static final Logger s_logger = Logger.getLogger(UpdateTemplateCmdByAdmin.class.getName());
+
+ @Override
+ public void execute(){
+ VirtualMachineTemplate result = _templateService.updateTemplate(this);
+ if (result != null) {
+ TemplateResponse response = _responseGenerator.createTemplateUpdateResponse(ResponseView.Full, result);
+ response.setObjectName("template");
+ response.setTemplateType(result.getTemplateType().toString());//Template can be either USER or ROUTING type
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update template");
+ }
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficMonitorCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficMonitorCmd.java
index 031fc8d752a..e0d755518f9 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficMonitorCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficMonitorCmd.java
@@ -32,7 +32,8 @@ import com.cloud.host.Host;
import com.cloud.user.Account;
import com.cloud.utils.exception.CloudRuntimeException;
-@APICommand(name = "addTrafficMonitor", description = "Adds Traffic Monitor Host for Direct Network Usage", responseObject = TrafficMonitorResponse.class)
+@APICommand(name = "addTrafficMonitor", description = "Adds Traffic Monitor Host for Direct Network Usage", responseObject = TrafficMonitorResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class AddTrafficMonitorCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(AddTrafficMonitorCmd.class.getName());
private static final String s_name = "addtrafficmonitorresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficTypeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficTypeCmd.java
index 0fcb8f87e54..a71d5bb6c26 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficTypeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficTypeCmd.java
@@ -34,7 +34,8 @@ import com.cloud.exception.ResourceAllocationException;
import com.cloud.network.PhysicalNetworkTrafficType;
import com.cloud.user.Account;
-@APICommand(name = "addTrafficType", description = "Adds traffic type to a physical network", responseObject = TrafficTypeResponse.class, since = "3.0.0")
+@APICommand(name = "addTrafficType", description = "Adds traffic type to a physical network", responseObject = TrafficTypeResponse.class, since = "3.0.0",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class AddTrafficTypeCmd extends BaseAsyncCreateCmd {
public static final Logger s_logger = Logger.getLogger(AddTrafficTypeCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficMonitorCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficMonitorCmd.java
index debaf0030f1..4c2bac23a17 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficMonitorCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficMonitorCmd.java
@@ -30,7 +30,8 @@ import org.apache.cloudstack.api.response.SuccessResponse;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.user.Account;
-@APICommand(name = "deleteTrafficMonitor", description = "Deletes an traffic monitor host.", responseObject = SuccessResponse.class)
+@APICommand(name = "deleteTrafficMonitor", description = "Deletes an traffic monitor host.", responseObject = SuccessResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteTrafficMonitorCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(DeleteTrafficMonitorCmd.class.getName());
private static final String s_name = "deletetrafficmonitorresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficTypeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficTypeCmd.java
index 111e1774268..46383cca725 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficTypeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficTypeCmd.java
@@ -31,7 +31,8 @@ import org.apache.cloudstack.api.response.TrafficTypeResponse;
import com.cloud.event.EventTypes;
import com.cloud.user.Account;
-@APICommand(name = "deleteTrafficType", description = "Deletes traffic type of a physical network", responseObject = SuccessResponse.class, since = "3.0.0")
+@APICommand(name = "deleteTrafficType", description = "Deletes traffic type of a physical network", responseObject = SuccessResponse.class, since = "3.0.0",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteTrafficTypeCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DeleteTrafficTypeCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/GenerateUsageRecordsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/GenerateUsageRecordsCmd.java
index 4fc36ab5582..184f88aed24 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/usage/GenerateUsageRecordsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/usage/GenerateUsageRecordsCmd.java
@@ -33,7 +33,9 @@ import com.cloud.user.Account;
@APICommand(name = "generateUsageRecords",
description = "Generates usage records. This will generate records only if there any records to be generated, i.e if the scheduled usage job was not run or failed",
- responseObject = SuccessResponse.class)
+ responseObject = SuccessResponse.class,
+ requestHasSensitiveInfo = false,
+ responseHasSensitiveInfo = false)
public class GenerateUsageRecordsCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(GenerateUsageRecordsCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/GetUsageRecordsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/GetUsageRecordsCmd.java
index a8bd1e52358..21a7e4a1b06 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/usage/GetUsageRecordsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/usage/GetUsageRecordsCmd.java
@@ -35,7 +35,8 @@ import org.apache.cloudstack.usage.Usage;
import com.cloud.utils.Pair;
-@APICommand(name = "listUsageRecords", description = "Lists usage records for accounts", responseObject = UsageRecordResponse.class)
+@APICommand(name = "listUsageRecords", description = "Lists usage records for accounts", responseObject = UsageRecordResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class GetUsageRecordsCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(GetUsageRecordsCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficMonitorsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficMonitorsCmd.java
index 3592539aab4..4c398633f14 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficMonitorsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficMonitorsCmd.java
@@ -32,7 +32,8 @@ import org.apache.cloudstack.api.response.ZoneResponse;
import com.cloud.host.Host;
-@APICommand(name = "listTrafficMonitors", description = "List traffic monitor Hosts.", responseObject = TrafficMonitorResponse.class)
+@APICommand(name = "listTrafficMonitors", description = "List traffic monitor Hosts.", responseObject = TrafficMonitorResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListTrafficMonitorsCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListServiceOfferingsCmd.class.getName());
private static final String s_name = "listtrafficmonitorsresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficTypeImplementorsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficTypeImplementorsCmd.java
index 159608ec589..bd634bbe5c2 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficTypeImplementorsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficTypeImplementorsCmd.java
@@ -40,10 +40,12 @@ import com.cloud.utils.Pair;
@APICommand(name = "listTrafficTypeImplementors",
description = "Lists implementors of implementor of a network traffic type or implementors of all network traffic types",
responseObject = TrafficTypeImplementorResponse.class,
- since = "3.0.0")
+ since = "3.0.0",
+ requestHasSensitiveInfo = false,
+ responseHasSensitiveInfo = false)
public class ListTrafficTypeImplementorsCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListTrafficTypeImplementorsCmd.class);
- private static final String Name = "listtraffictypeimplementorsresponse";
+ private static final String s_name = "listtraffictypeimplementorsresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
@@ -87,6 +89,6 @@ public class ListTrafficTypeImplementorsCmd extends BaseListCmd {
@Override
public String getCommandName() {
- return Name;
+ return s_name;
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficTypesCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficTypesCmd.java
index 47ba781cdef..fd0635959b8 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficTypesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficTypesCmd.java
@@ -34,10 +34,11 @@ import com.cloud.network.PhysicalNetworkTrafficType;
import com.cloud.user.Account;
import com.cloud.utils.Pair;
-@APICommand(name = "listTrafficTypes", description = "Lists traffic types of a given physical network.", responseObject = ProviderResponse.class, since = "3.0.0")
+@APICommand(name = "listTrafficTypes", description = "Lists traffic types of a given physical network.", responseObject = ProviderResponse.class, since = "3.0.0",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListTrafficTypesCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListTrafficTypesCmd.class.getName());
- private static final String Name = "listtraffictypesresponse";
+ private static final String s_name = "listtraffictypesresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
@@ -66,7 +67,7 @@ public class ListTrafficTypesCmd extends BaseListCmd {
/////////////////////////////////////////////////////
@Override
public String getCommandName() {
- return Name;
+ return s_name;
}
@Override
diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/ListUsageTypesCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/ListUsageTypesCmd.java
index b5e445bbb53..2c5a7866cbb 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/usage/ListUsageTypesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/usage/ListUsageTypesCmd.java
@@ -27,7 +27,8 @@ import org.apache.cloudstack.api.response.UsageTypeResponse;
import com.cloud.user.Account;
-@APICommand(name = "listUsageTypes", description = "List Usage Types", responseObject = UsageTypeResponse.class)
+@APICommand(name = "listUsageTypes", description = "List Usage Types", responseObject = UsageTypeResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListUsageTypesCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(ListUsageTypesCmd.class.getName());
private static final String s_name = "listusagetypesresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/UpdateTrafficTypeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/UpdateTrafficTypeCmd.java
index 2ad470ea761..3de8905fa95 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/usage/UpdateTrafficTypeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/usage/UpdateTrafficTypeCmd.java
@@ -31,7 +31,8 @@ import com.cloud.event.EventTypes;
import com.cloud.network.PhysicalNetworkTrafficType;
import com.cloud.user.Account;
-@APICommand(name = "updateTrafficType", description = "Updates traffic type of a physical network", responseObject = TrafficTypeResponse.class, since = "3.0.0")
+@APICommand(name = "updateTrafficType", description = "Updates traffic type of a physical network", responseObject = TrafficTypeResponse.class, since = "3.0.0",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class UpdateTrafficTypeCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(UpdateTrafficTypeCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/CreateUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/CreateUserCmd.java
index 03512db321a..51e218d7de8 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/user/CreateUserCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/user/CreateUserCmd.java
@@ -16,8 +16,6 @@
// under the License.
package org.apache.cloudstack.api.command.admin.user;
-import org.apache.log4j.Logger;
-
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
@@ -27,11 +25,13 @@ import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.api.response.UserResponse;
import org.apache.cloudstack.context.CallContext;
+import org.apache.log4j.Logger;
import com.cloud.user.Account;
import com.cloud.user.User;
-@APICommand(name = "createUser", description = "Creates a user for an account that already exists", responseObject = UserResponse.class)
+@APICommand(name = "createUser", description = "Creates a user for an account that already exists", responseObject = UserResponse.class,
+ requestHasSensitiveInfo = true, responseHasSensitiveInfo = true)
public class CreateUserCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(CreateUserCmd.class.getName());
@@ -131,7 +131,7 @@ public class CreateUserCmd extends BaseCmd {
@Override
public long getEntityOwnerId() {
Account account = CallContext.current().getCallingAccount();
- if ((account == null) || isAdmin(account.getType())) {
+ if ((account == null) || _accountService.isAdmin(account.getType())) {
if ((domainId != null) && (accountName != null)) {
Account userAccount = _responseGenerator.findAccountByNameDomain(accountName, domainId);
if (userAccount != null) {
diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java
index 6ba382aec71..08ba521ed62 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java
@@ -34,7 +34,8 @@ import org.apache.cloudstack.region.RegionService;
import com.cloud.user.Account;
import com.cloud.user.User;
-@APICommand(name = "deleteUser", description = "Deletes a user for an account", responseObject = SuccessResponse.class)
+@APICommand(name = "deleteUser", description = "Deletes a user for an account", responseObject = SuccessResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteUserCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(DeleteUserCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java
index 599328d1c35..c6e09ef0f9e 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java
@@ -36,7 +36,8 @@ import com.cloud.user.Account;
import com.cloud.user.User;
import com.cloud.user.UserAccount;
-@APICommand(name = "disableUser", description = "Disables a user account", responseObject = UserResponse.class)
+@APICommand(name = "disableUser", description = "Disables a user account", responseObject = UserResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
public class DisableUserCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DisableUserCmd.class.getName());
private static final String s_name = "disableuserresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java
index 8d37eda36e9..d69eccf9342 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java
@@ -34,7 +34,8 @@ import com.cloud.user.Account;
import com.cloud.user.User;
import com.cloud.user.UserAccount;
-@APICommand(name = "enableUser", description = "Enables a user account", responseObject = UserResponse.class)
+@APICommand(name = "enableUser", description = "Enables a user account", responseObject = UserResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
public class EnableUserCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(EnableUserCmd.class.getName());
private static final String s_name = "enableuserresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/GetUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/GetUserCmd.java
index 592b8285727..b2c6734c9e6 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/user/GetUserCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/user/GetUserCmd.java
@@ -27,7 +27,8 @@ import org.apache.cloudstack.api.response.UserResponse;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.user.UserAccount;
-@APICommand(name = "getUser", description = "Find user account by API key", responseObject = UserResponse.class)
+@APICommand(name = "getUser", description = "Find user account by API key", responseObject = UserResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
public class GetUserCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(GetUserCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/ListUsersCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/ListUsersCmd.java
index 41d6acda1f4..c0c2b24814a 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/user/ListUsersCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/user/ListUsersCmd.java
@@ -25,7 +25,8 @@ import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.UserResponse;
-@APICommand(name = "listUsers", description = "Lists user accounts", responseObject = UserResponse.class)
+@APICommand(name = "listUsers", description = "Lists user accounts", responseObject = UserResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
public class ListUsersCmd extends BaseListAccountResourcesCmd {
public static final Logger s_logger = Logger.getLogger(ListUsersCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/LockUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/LockUserCmd.java
index 9533004907f..69623d013d4 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/user/LockUserCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/user/LockUserCmd.java
@@ -30,7 +30,8 @@ import com.cloud.user.Account;
import com.cloud.user.User;
import com.cloud.user.UserAccount;
-@APICommand(name = "lockUser", description = "Locks a user account", responseObject = UserResponse.class)
+@APICommand(name = "lockUser", description = "Locks a user account", responseObject = UserResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
public class LockUserCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(LockUserCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/RegisterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/RegisterCmd.java
index facdc876759..2090d21e4a6 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/user/RegisterCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/user/RegisterCmd.java
@@ -30,7 +30,8 @@ import com.cloud.user.User;
@APICommand(name = "registerUserKeys",
responseObject = RegisterResponse.class,
- description = "This command allows a user to register for the developer API, returning a secret key and an API key. This request is made through the integration API port, so it is a privileged command and must be made on behalf of a user. It is up to the implementer just how the username and password are entered, and then how that translates to an integration API request. Both secret key and API key should be returned to the user")
+ description = "This command allows a user to register for the developer API, returning a secret key and an API key. This request is made through the integration API port, so it is a privileged command and must be made on behalf of a user. It is up to the implementer just how the username and password are entered, and then how that translates to an integration API request. Both secret key and API key should be returned to the user",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
public class RegisterCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(RegisterCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java
index de6e550018a..cf5d355e260 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java
@@ -34,7 +34,8 @@ import com.cloud.user.Account;
import com.cloud.user.User;
import com.cloud.user.UserAccount;
-@APICommand(name = "updateUser", description = "Updates a user account", responseObject = UserResponse.class)
+@APICommand(name = "updateUser", description = "Updates a user account", responseObject = UserResponse.class,
+ requestHasSensitiveInfo = true, responseHasSensitiveInfo = true)
public class UpdateUserCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(UpdateUserCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vlan/CreateVlanIpRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vlan/CreateVlanIpRangeCmd.java
index cd3dd7ea9bf..75edfce3f96 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/vlan/CreateVlanIpRangeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/vlan/CreateVlanIpRangeCmd.java
@@ -39,7 +39,8 @@ import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.user.Account;
-@APICommand(name = "createVlanIpRange", description = "Creates a VLAN IP range.", responseObject = VlanIpRangeResponse.class)
+@APICommand(name = "createVlanIpRange", description = "Creates a VLAN IP range.", responseObject = VlanIpRangeResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class CreateVlanIpRangeCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(CreateVlanIpRangeCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vlan/DedicatePublicIpRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vlan/DedicatePublicIpRangeCmd.java
index 2650482e9bb..2cba8e69e45 100755
--- a/api/src/org/apache/cloudstack/api/command/admin/vlan/DedicatePublicIpRangeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/vlan/DedicatePublicIpRangeCmd.java
@@ -33,7 +33,8 @@ import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.user.Account;
-@APICommand(name = "dedicatePublicIpRange", description = "Dedicates a Public IP range to an account", responseObject = VlanIpRangeResponse.class)
+@APICommand(name = "dedicatePublicIpRange", description = "Dedicates a Public IP range to an account", responseObject = VlanIpRangeResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DedicatePublicIpRangeCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(DedicatePublicIpRangeCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vlan/DeleteVlanIpRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vlan/DeleteVlanIpRangeCmd.java
index 8d291309f4d..af32fc4ebd7 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/vlan/DeleteVlanIpRangeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/vlan/DeleteVlanIpRangeCmd.java
@@ -29,7 +29,8 @@ import org.apache.cloudstack.api.response.VlanIpRangeResponse;
import com.cloud.user.Account;
-@APICommand(name = "deleteVlanIpRange", description = "Creates a VLAN IP range.", responseObject = SuccessResponse.class)
+@APICommand(name = "deleteVlanIpRange", description = "Creates a VLAN IP range.", responseObject = SuccessResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteVlanIpRangeCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(DeleteVlanIpRangeCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vlan/ListVlanIpRangesCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vlan/ListVlanIpRangesCmd.java
index 9d6eae66e76..d4f2d5ad611 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/vlan/ListVlanIpRangesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/vlan/ListVlanIpRangesCmd.java
@@ -37,7 +37,8 @@ import org.apache.cloudstack.api.response.ZoneResponse;
import com.cloud.dc.Vlan;
import com.cloud.utils.Pair;
-@APICommand(name = "listVlanIpRanges", description = "Lists all VLAN IP ranges.", responseObject = VlanIpRangeResponse.class)
+@APICommand(name = "listVlanIpRanges", description = "Lists all VLAN IP ranges.", responseObject = VlanIpRangeResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListVlanIpRangesCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListVlanIpRangesCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vlan/ReleasePublicIpRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vlan/ReleasePublicIpRangeCmd.java
index 2c160be3a73..15cfbc64e30 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/vlan/ReleasePublicIpRangeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/vlan/ReleasePublicIpRangeCmd.java
@@ -29,7 +29,8 @@ import org.apache.cloudstack.api.response.VlanIpRangeResponse;
import com.cloud.user.Account;
-@APICommand(name = "releasePublicIpRange", description = "Releases a Public IP range back to the system pool", responseObject = SuccessResponse.class)
+@APICommand(name = "releasePublicIpRange", description = "Releases a Public IP range back to the system pool", responseObject = SuccessResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ReleasePublicIpRangeCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(ReleasePublicIpRangeCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vm/AddNicToVMCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/vm/AddNicToVMCmdByAdmin.java
new file mode 100644
index 00000000000..ee6d0e78e09
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/vm/AddNicToVMCmdByAdmin.java
@@ -0,0 +1,55 @@
+// 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.vm;
+
+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.vm.AddNicToVMCmd;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.uservm.UserVm;
+
+@APICommand(name = "addNicToVirtualMachine", description = "Adds VM to specified network by creating a NIC", responseObject = UserVmResponse.class, responseView = ResponseView.Full,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
+public class AddNicToVMCmdByAdmin extends AddNicToVMCmd {
+ public static final Logger s_logger = Logger.getLogger(AddNicToVMCmdByAdmin.class);
+
+ @Override
+ public void execute(){
+ CallContext.current().setEventDetails("Vm Id: " + getVmId() + " Network Id: " + getNetworkId());
+ UserVm result = _userVmService.addNicToVirtualMachine(this);
+ ArrayList dc = new ArrayList();
+ dc.add(VMDetails.valueOf("nics"));
+ EnumSet 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 add NIC to vm. Refer to server logs for details.");
+ }
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vm/AssignVMCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vm/AssignVMCmd.java
index c9b5c9f8f47..435b7f18484 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/vm/AssignVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/vm/AssignVMCmd.java
@@ -25,6 +25,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.DomainResponse;
import org.apache.cloudstack.api.response.NetworkResponse;
@@ -33,12 +34,15 @@ import org.apache.cloudstack.api.response.UserVmResponse;
import com.cloud.user.Account;
import com.cloud.uservm.UserVm;
+import com.cloud.vm.VirtualMachine;
@APICommand(name = "assignVirtualMachine",
description = "Change ownership of a VM from one account to another. This API is available for Basic zones with security groups and Advanced zones with guest networks. A root administrator can reassign a VM from any account to any other account in any domain. A domain administrator can reassign a VM to any account in the same domain.",
responseObject = UserVmResponse.class,
- since = "3.0.0")
-public class AssignVMCmd extends BaseCmd {
+ since = "3.0.0", entityType = {VirtualMachine.class},
+ requestHasSensitiveInfo = false,
+ responseHasSensitiveInfo = true)
+public class AssignVMCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(AssignVMCmd.class.getName());
private static final String s_name = "assignvirtualmachineresponse";
@@ -118,7 +122,7 @@ public class AssignVMCmd extends BaseCmd {
if (userVm == null) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to move vm");
}
- UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", userVm).get(0);
+ UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Full, "virtualmachine", userVm).get(0);
response.setResponseName(getCommandName());
setResponseObject(response);
} catch (Exception e) {
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vm/DeployVMCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/vm/DeployVMCmdByAdmin.java
new file mode 100755
index 00000000000..99fec6b5a7d
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/vm/DeployVMCmdByAdmin.java
@@ -0,0 +1,79 @@
+// 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.vm;
+
+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.vm.DeployVMCmd;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InsufficientServerCapacityException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.uservm.UserVm;
+
+
+@APICommand(name = "deployVirtualMachine", description = "Creates and automatically starts a virtual machine based on a service offering, disk offering, and template.", responseObject = UserVmResponse.class, responseView = ResponseView.Full)
+public class DeployVMCmdByAdmin extends DeployVMCmd {
+ public static final Logger s_logger = Logger.getLogger(DeployVMCmdByAdmin.class.getName());
+
+
+ @Override
+ public void execute(){
+ UserVm result;
+
+ if (getStartVm()) {
+ try {
+ CallContext.current().setEventDetails("Vm Id: "+getEntityId());
+ result = _userVmService.startVirtualMachine(this);
+ } catch (ResourceUnavailableException ex) {
+ s_logger.warn("Exception: ", ex);
+ throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
+ } catch (ConcurrentOperationException ex) {
+ s_logger.warn("Exception: ", ex);
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
+ } catch (InsufficientCapacityException ex) {
+ StringBuilder message = new StringBuilder(ex.getMessage());
+ if (ex instanceof InsufficientServerCapacityException) {
+ if(((InsufficientServerCapacityException)ex).isAffinityApplied()){
+ message.append(", Please check the affinity groups provided, there may not be sufficient capacity to follow them");
+ }
+ }
+ s_logger.info(ex);
+ s_logger.info(message.toString(), ex);
+ throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, message.toString());
+ }
+ } else {
+ result = _userVmService.getUserVm(getEntityId());
+ }
+
+ if (result != null) {
+ UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Restricted, "virtualmachine", result).get(0);
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to deploy vm");
+ }
+ }
+
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vm/DestroyVMCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/vm/DestroyVMCmdByAdmin.java
new file mode 100644
index 00000000000..b14e5b02511
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/vm/DestroyVMCmdByAdmin.java
@@ -0,0 +1,57 @@
+// 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.vm;
+
+import java.util.List;
+
+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.vm.DestroyVMCmd;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.uservm.UserVm;
+
+@APICommand(name = "destroyVirtualMachine", description = "Destroys a virtual machine. Once destroyed, only the administrator can recover it.", responseObject = UserVmResponse.class, responseView = ResponseView.Full)
+public class DestroyVMCmdByAdmin extends DestroyVMCmd {
+ public static final Logger s_logger = Logger.getLogger(DestroyVMCmdByAdmin.class.getName());
+
+
+ @Override
+ public void execute() throws ResourceUnavailableException, ConcurrentOperationException{
+ CallContext.current().setEventDetails("Vm Id: "+getId());
+ UserVm result = _userVmService.destroyVm(this);
+
+ UserVmResponse response = new UserVmResponse();
+ if (result != null) {
+ List responses = _responseGenerator.createUserVmResponse(ResponseView.Full, "virtualmachine", result);
+ if (responses != null && !responses.isEmpty()) {
+ response = responses.get(0);
+ }
+ response.setResponseName("virtualmachine");
+ setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to destroy vm");
+ }
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vm/ExpungeVMCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vm/ExpungeVMCmd.java
index 7b166864a28..40b9bb82562 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/vm/ExpungeVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/vm/ExpungeVMCmd.java
@@ -18,6 +18,8 @@ package org.apache.cloudstack.api.command.admin.vm;
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,8 +38,10 @@ import com.cloud.exception.ResourceUnavailableException;
import com.cloud.user.Account;
import com.cloud.uservm.UserVm;
import com.cloud.utils.exception.CloudRuntimeException;
+import com.cloud.vm.VirtualMachine;
-@APICommand(name = "expungeVirtualMachine", description = "Expunge a virtual machine. Once expunged, it cannot be recoverd.", responseObject = SuccessResponse.class)
+@APICommand(name = "expungeVirtualMachine", description = "Expunge a virtual machine. Once expunged, it cannot be recoverd.", responseObject = SuccessResponse.class, entityType = {VirtualMachine.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ExpungeVMCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(ExpungeVMCmd.class.getName());
@@ -47,6 +51,7 @@ public class ExpungeVMCmd extends BaseAsyncCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
+ @ACL(accessType = AccessType.OperateEntry)
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = UserVmResponse.class, required = true, description = "The ID of the virtual machine")
private Long id;
@@ -105,7 +110,7 @@ public class ExpungeVMCmd extends BaseAsyncCmd {
if (result != null) {
SuccessResponse response = new SuccessResponse(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to expunge vm");
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vm/GetVMUserDataCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vm/GetVMUserDataCmd.java
index 0e527149821..bf39f99519f 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/vm/GetVMUserDataCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/vm/GetVMUserDataCmd.java
@@ -29,7 +29,8 @@ import org.apache.log4j.Logger;
import com.cloud.user.Account;
import com.cloud.uservm.UserVm;
-@APICommand(name = "getVirtualMachineUserData", description = "Returns user data associated with the VM", responseObject = VMUserDataResponse.class, since = "4.4")
+@APICommand(name = "getVirtualMachineUserData", description = "Returns user data associated with the VM", responseObject = VMUserDataResponse.class, since = "4.4",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class GetVMUserDataCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(GetVMUserDataCmd.class);
private static final String s_name = "getvirtualmachineuserdataresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vm/ListVMsCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/vm/ListVMsCmdByAdmin.java
new file mode 100644
index 00000000000..489af297b8d
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/vm/ListVMsCmdByAdmin.java
@@ -0,0 +1,69 @@
+// 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.vm;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.command.user.vm.ListVMsCmd;
+import org.apache.cloudstack.api.response.HostResponse;
+import org.apache.cloudstack.api.response.PodResponse;
+import org.apache.cloudstack.api.response.StoragePoolResponse;
+import org.apache.cloudstack.api.response.UserVmResponse;
+
+
+@APICommand(name = "listVirtualMachines", description = "List the virtual machines owned by the account.", responseObject = UserVmResponse.class, responseView = ResponseView.Full)
+public class ListVMsCmdByAdmin extends ListVMsCmd {
+ public static final Logger s_logger = Logger.getLogger(ListVMsCmdByAdmin.class.getName());
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name=ApiConstants.HOST_ID, type=CommandType.UUID, entityType=HostResponse.class,
+ description="the host ID")
+ private Long hostId;
+
+ @Parameter(name=ApiConstants.POD_ID, type=CommandType.UUID, entityType=PodResponse.class,
+ description="the pod ID")
+ private Long podId;
+
+ @Parameter(name=ApiConstants.STORAGE_ID, type=CommandType.UUID, entityType=StoragePoolResponse.class,
+ description="the storage ID where vm's volumes belong to")
+ private Long storageId;
+
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getHostId() {
+ return hostId;
+ }
+
+ public Long getPodId() {
+ return podId;
+ }
+
+ public Long getStorageId() {
+ return storageId;
+ }
+
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vm/MigrateVMCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vm/MigrateVMCmd.java
index 3706d5060f7..ef9619effa2 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/vm/MigrateVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/vm/MigrateVMCmd.java
@@ -23,6 +23,7 @@ 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.HostResponse;
import org.apache.cloudstack.api.response.StoragePoolResponse;
@@ -43,7 +44,9 @@ import com.cloud.vm.VirtualMachine;
@APICommand(name = "migrateVirtualMachine",
description = "Attempts Migration of a VM to a different host or Root volume of the vm to a different storage pool",
- responseObject = UserVmResponse.class)
+ responseObject = UserVmResponse.class, entityType = {VirtualMachine.class},
+ requestHasSensitiveInfo = false,
+ responseHasSensitiveInfo = true)
public class MigrateVMCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(MigrateVMCmd.class.getName());
@@ -160,9 +163,9 @@ public class MigrateVMCmd extends BaseAsyncCmd {
migratedVm = _userVmService.vmStorageMigration(getVirtualMachineId(), destStoragePool);
}
if (migratedVm != null) {
- UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", (UserVm)migratedVm).get(0);
+ UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Full, "virtualmachine", (UserVm)migratedVm).get(0);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to migrate vm");
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vm/MigrateVirtualMachineWithVolumeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vm/MigrateVirtualMachineWithVolumeCmd.java
index 90918bfa8d8..f1d3fe975fd 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/vm/MigrateVirtualMachineWithVolumeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/vm/MigrateVirtualMachineWithVolumeCmd.java
@@ -28,6 +28,7 @@ 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.HostResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
@@ -45,7 +46,9 @@ import com.cloud.vm.VirtualMachine;
@APICommand(name = "migrateVirtualMachineWithVolume",
description = "Attempts Migration of a VM with its volumes to a different host",
- responseObject = UserVmResponse.class)
+ responseObject = UserVmResponse.class, entityType = {VirtualMachine.class},
+ requestHasSensitiveInfo = false,
+ responseHasSensitiveInfo = true)
public class MigrateVirtualMachineWithVolumeCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(MigrateVMCmd.class.getName());
@@ -72,7 +75,7 @@ public class MigrateVirtualMachineWithVolumeCmd extends BaseAsyncCmd {
@Parameter(name = ApiConstants.MIGRATE_TO,
type = CommandType.MAP,
required = false,
- description = "Map of pool to which each volume should be migrated (volume/pool pair)")
+ description = "Map of pool to which each volume should be migrated (volume/pool pair)")
private Map migrateVolumeTo;
/////////////////////////////////////////////////////
@@ -146,9 +149,9 @@ public class MigrateVirtualMachineWithVolumeCmd extends BaseAsyncCmd {
try {
VirtualMachine migratedVm = _userVmService.migrateVirtualMachineWithVolume(getVirtualMachineId(), destinationHost, getVolumeToPool());
if (migratedVm != null) {
- UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", (UserVm)migratedVm).get(0);
+ UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Full, "virtualmachine", (UserVm)migratedVm).get(0);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to migrate vm");
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vm/RebootVMCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/vm/RebootVMCmdByAdmin.java
new file mode 100644
index 00000000000..7fa8edad839
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/vm/RebootVMCmdByAdmin.java
@@ -0,0 +1,51 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.admin.vm;
+
+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.vm.RebootVMCmd;
+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 = "rebootVirtualMachine", description = "Reboots a virtual machine.", responseObject = UserVmResponse.class, responseView = ResponseView.Full)
+public class RebootVMCmdByAdmin extends RebootVMCmd {
+ public static final Logger s_logger = Logger.getLogger(RebootVMCmdByAdmin.class.getName());
+
+ @Override
+ public void execute() throws ResourceUnavailableException, InsufficientCapacityException{
+ CallContext.current().setEventDetails("Vm Id: "+getId());
+ UserVm result;
+ result = _userVmService.rebootVirtualMachine(this);
+
+ if (result !=null){
+ UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Full, "virtualmachine", result).get(0);
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reboot vm instance");
+ }
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vm/RecoverVMCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vm/RecoverVMCmd.java
index abf5168ff28..4ad09171540 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/vm/RecoverVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/vm/RecoverVMCmd.java
@@ -23,14 +23,17 @@ 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.UserVmResponse;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.user.Account;
import com.cloud.uservm.UserVm;
+import com.cloud.vm.VirtualMachine;
-@APICommand(name = "recoverVirtualMachine", description = "Recovers a virtual machine.", responseObject = UserVmResponse.class)
+@APICommand(name = "recoverVirtualMachine", description = "Recovers a virtual machine.", responseObject = UserVmResponse.class, entityType = {VirtualMachine.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
public class RecoverVMCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(RecoverVMCmd.class.getName());
@@ -73,10 +76,10 @@ public class RecoverVMCmd extends BaseCmd {
@Override
public void execute() throws ResourceAllocationException {
UserVm result = _userVmService.recoverVirtualMachine(this);
- if (result != null) {
- UserVmResponse recoverVmResponse = _responseGenerator.createUserVmResponse("virtualmachine", result).get(0);
+ if (result != null){
+ UserVmResponse recoverVmResponse = _responseGenerator.createUserVmResponse(ResponseView.Full, "virtualmachine", result).get(0);
recoverVmResponse.setResponseName(getCommandName());
- this.setResponseObject(recoverVmResponse);
+ setResponseObject(recoverVmResponse);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to recover vm");
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vm/RemoveNicFromVMCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/vm/RemoveNicFromVMCmdByAdmin.java
new file mode 100644
index 00000000000..ba0ff27f12b
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/vm/RemoveNicFromVMCmdByAdmin.java
@@ -0,0 +1,55 @@
+// 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.vm;
+
+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.vm.RemoveNicFromVMCmd;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.uservm.UserVm;
+
+@APICommand(name = "removeNicFromVirtualMachine", description = "Removes VM from specified network by deleting a NIC", responseObject = UserVmResponse.class, responseView = ResponseView.Full)
+
+public class RemoveNicFromVMCmdByAdmin extends RemoveNicFromVMCmd {
+ public static final Logger s_logger = Logger.getLogger(RemoveNicFromVMCmdByAdmin.class);
+
+ @Override
+ public void execute(){
+ CallContext.current().setEventDetails("Vm Id: "+getVmId() + " Nic Id: " + getNicId());
+ UserVm result = _userVmService.removeNicFromVirtualMachine(this);
+ ArrayList dc = new ArrayList();
+ dc.add(VMDetails.valueOf("nics"));
+ EnumSet 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 remove NIC from vm, see error log for details");
+ }
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vm/ResetVMPasswordCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/vm/ResetVMPasswordCmdByAdmin.java
new file mode 100644
index 00000000000..1b3e1cc1dcf
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/vm/ResetVMPasswordCmdByAdmin.java
@@ -0,0 +1,54 @@
+// 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.vm;
+
+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.vm.ResetVMPasswordCmd;
+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 = "resetPasswordForVirtualMachine", responseObject=UserVmResponse.class, description="Resets the password for virtual machine. " +
+ "The virtual machine must be in a \"Stopped\" state and the template must already " +
+ "support this feature for this command to take effect. [async]", responseView = ResponseView.Full)
+public class ResetVMPasswordCmdByAdmin extends ResetVMPasswordCmd {
+ public static final Logger s_logger = Logger.getLogger(ResetVMPasswordCmdByAdmin.class.getName());
+
+
+
+ @Override
+ public void execute() throws ResourceUnavailableException, InsufficientCapacityException{
+ password = _mgr.generateRandomPassword();
+ CallContext.current().setEventDetails("Vm Id: "+getId());
+ UserVm result = _userVmService.resetVMPassword(this, password);
+ if (result != null){
+ UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Full, "virtualmachine", result).get(0);
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reset vm password");
+ }
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vm/ResetVMSSHKeyCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/vm/ResetVMSSHKeyCmdByAdmin.java
new file mode 100644
index 00000000000..1da083cec34
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/vm/ResetVMSSHKeyCmdByAdmin.java
@@ -0,0 +1,57 @@
+// 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.vm;
+
+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.vm.ResetVMSSHKeyCmd;
+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 = "resetSSHKeyForVirtualMachine", responseObject = UserVmResponse.class, description = "Resets the SSH Key for virtual machine. " +
+ "The virtual machine must be in a \"Stopped\" state. [async]", responseView = ResponseView.Full)
+public class ResetVMSSHKeyCmdByAdmin extends ResetVMSSHKeyCmd {
+
+ public static final Logger s_logger = Logger.getLogger(ResetVMSSHKeyCmdByAdmin.class.getName());
+
+
+ @Override
+ public void execute() throws ResourceUnavailableException,
+ InsufficientCapacityException {
+
+ CallContext.current().setEventDetails("Vm Id: " + getId());
+ UserVm result = _userVmService.resetVMSSHKey(this);
+
+ if (result != null) {
+ UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Full, "virtualmachine", result).get(0);
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reset vm SSHKey");
+ }
+ }
+
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vm/RestoreVMCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/vm/RestoreVMCmdByAdmin.java
new file mode 100644
index 00000000000..fea2016c8c3
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/vm/RestoreVMCmdByAdmin.java
@@ -0,0 +1,54 @@
+// 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.vm;
+
+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.vm.RestoreVMCmd;
+import org.apache.cloudstack.api.response.UserVmResponse;
+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.uservm.UserVm;
+
+@APICommand(name = "restoreVirtualMachine", description = "Restore a VM to original template/ISO or new template/ISO", responseObject = UserVmResponse.class, since = "3.0.0", responseView = ResponseView.Full)
+public class RestoreVMCmdByAdmin extends RestoreVMCmd {
+ public static final Logger s_logger = Logger.getLogger(RestoreVMCmdByAdmin.class);
+
+ @Override
+ public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
+ ResourceAllocationException {
+ UserVm result;
+ CallContext.current().setEventDetails("Vm Id: " + getVmId());
+ result = _userVmService.restoreVM(this);
+ if (result != null) {
+ UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Full, "virtualmachine", result).get(0);
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to restore vm " + getVmId());
+ }
+ }
+
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vm/ScaleVMCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/vm/ScaleVMCmdByAdmin.java
new file mode 100644
index 00000000000..68d3c332ddf
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/vm/ScaleVMCmdByAdmin.java
@@ -0,0 +1,69 @@
+// 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.vm;
+
+import java.util.List;
+
+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.vm.ScaleVMCmd;
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.cloudstack.api.response.UserVmResponse;
+
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.ManagementServerException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.exception.VirtualMachineMigrationException;
+import com.cloud.uservm.UserVm;
+
+
+@APICommand(name = "scaleVirtualMachine", description = "Scales the virtual machine to a new service offering.", responseObject = SuccessResponse.class, responseView = ResponseView.Full)
+public class ScaleVMCmdByAdmin extends ScaleVMCmd {
+ public static final Logger s_logger = Logger.getLogger(ScaleVMCmdByAdmin.class.getName());
+
+ @Override
+ public void execute(){
+ UserVm result;
+ try {
+ result = _userVmService.upgradeVirtualMachine(this);
+ } catch (ResourceUnavailableException ex) {
+ s_logger.warn("Exception: ", ex);
+ throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
+ } catch (ConcurrentOperationException ex) {
+ s_logger.warn("Exception: ", ex);
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
+ } catch (ManagementServerException ex) {
+ s_logger.warn("Exception: ", ex);
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
+ } catch (VirtualMachineMigrationException ex) {
+ s_logger.warn("Exception: ", ex);
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
+ }
+ if (result != null){
+ List responseList = _responseGenerator.createUserVmResponse(ResponseView.Full, "virtualmachine", result);
+ UserVmResponse response = responseList.get(0);
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to scale vm");
+ }
+ }
+}
\ No newline at end of file
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vm/StartVMCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/vm/StartVMCmdByAdmin.java
new file mode 100644
index 00000000000..e814784ba3d
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/vm/StartVMCmdByAdmin.java
@@ -0,0 +1,80 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.admin.vm;
+
+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.vm.StartVMCmd;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InsufficientServerCapacityException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.exception.StorageUnavailableException;
+import com.cloud.uservm.UserVm;
+import com.cloud.utils.exception.ExecutionException;
+
+@APICommand(name = "startVirtualMachine", responseObject = UserVmResponse.class, description = "Starts a virtual machine.", responseView = ResponseView.Full)
+public class StartVMCmdByAdmin extends StartVMCmd {
+ public static final Logger s_logger = Logger.getLogger(StartVMCmdByAdmin.class.getName());
+
+
+ @Override
+ public void execute() throws ResourceUnavailableException, ResourceAllocationException {
+ try {
+ CallContext.current().setEventDetails("Vm Id: " + getId());
+
+ UserVm result ;
+ result = _userVmService.startVirtualMachine(this);
+
+ if (result != null) {
+ UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Full, "virtualmachine", result).get(0);
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to start a vm");
+ }
+ } catch (ConcurrentOperationException ex) {
+ s_logger.warn("Exception: ", ex);
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
+ } catch (StorageUnavailableException ex) {
+ s_logger.warn("Exception: ", ex);
+ throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
+ } catch (ExecutionException ex) {
+ s_logger.warn("Exception: ", ex);
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
+ } catch (InsufficientCapacityException ex) {
+ StringBuilder message = new StringBuilder(ex.getMessage());
+ if (ex instanceof InsufficientServerCapacityException) {
+ if (((InsufficientServerCapacityException) ex).isAffinityApplied()) {
+ message.append(", Please check the affinity groups provided, there may not be sufficient capacity to follow them");
+ }
+ }
+ s_logger.info(ex);
+ s_logger.info(message.toString(), ex);
+ throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, message.toString());
+ }
+ }
+
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vm/StopVMCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/vm/StopVMCmdByAdmin.java
new file mode 100644
index 00000000000..6c906c74227
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/vm/StopVMCmdByAdmin.java
@@ -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.vm;
+
+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.vm.StopVMCmd;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.uservm.UserVm;
+
+@APICommand(name = "stopVirtualMachine", responseObject = UserVmResponse.class, description = "Stops a virtual machine.", responseView = ResponseView.Full)
+public class StopVMCmdByAdmin extends StopVMCmd {
+ public static final Logger s_logger = Logger.getLogger(StopVMCmdByAdmin.class.getName());
+
+
+
+ @Override
+ public void execute() throws ServerApiException, ConcurrentOperationException {
+ CallContext.current().setEventDetails("Vm Id: " + getId());
+ UserVm result;
+
+ result = _userVmService.stopVirtualMachine(getId(), isForced());
+
+ if (result != null) {
+ UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Full, "virtualmachine", result).get(0);
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to stop vm");
+ }
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vm/UpdateDefaultNicForVMCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/vm/UpdateDefaultNicForVMCmdByAdmin.java
new file mode 100644
index 00000000000..82385ba8f26
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/vm/UpdateDefaultNicForVMCmdByAdmin.java
@@ -0,0 +1,56 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.admin.vm;
+
+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.vm.UpdateDefaultNicForVMCmd;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.uservm.UserVm;
+
+@APICommand(name = "updateDefaultNicForVirtualMachine", description = "Changes the default NIC on a VM", responseObject = UserVmResponse.class, responseView = ResponseView.Full)
+
+public class UpdateDefaultNicForVMCmdByAdmin extends UpdateDefaultNicForVMCmd {
+ public static final Logger s_logger = Logger.getLogger(UpdateDefaultNicForVMCmdByAdmin.class);
+
+
+ @Override
+ public void execute(){
+ CallContext.current().setEventDetails("Vm Id: "+getVmId() + " Nic Id: " + getNicId());
+ UserVm result = _userVmService.updateDefaultNicForVirtualMachine(this);
+ ArrayList dc = new ArrayList();
+ dc.add(VMDetails.valueOf("nics"));
+ EnumSet 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 set default nic for VM. Refer to server logs for details.");
+ }
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vm/UpdateVMCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/vm/UpdateVMCmdByAdmin.java
new file mode 100644
index 00000000000..ef598b1a2ae
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/vm/UpdateVMCmdByAdmin.java
@@ -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.vm;
+
+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.vm.UpdateVMCmd;
+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 = "updateVirtualMachine", description="Updates properties of a virtual machine. The VM has to be stopped and restarted for the " +
+ "new properties to take effect. UpdateVirtualMachine does not first check whether the VM is stopped. " +
+ "Therefore, stop the VM manually before issuing this call.", responseObject = UserVmResponse.class, responseView = ResponseView.Full)
+public class UpdateVMCmdByAdmin extends UpdateVMCmd {
+ public static final Logger s_logger = Logger.getLogger(UpdateVMCmdByAdmin.class.getName());
+
+ @Override
+ public void execute() throws ResourceUnavailableException,
+ InsufficientCapacityException, ServerApiException {
+ CallContext.current().setEventDetails("Vm Id: "+getId());
+ UserVm result = _userVmService.updateVirtualMachine(this);
+ if (result != null){
+ UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Full, "virtualmachine", result).get(0);
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update vm");
+ }
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vm/UpgradeVMCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/vm/UpgradeVMCmdByAdmin.java
new file mode 100644
index 00000000000..bfbe3d6ff0b
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/vm/UpgradeVMCmdByAdmin.java
@@ -0,0 +1,59 @@
+// 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.vm;
+
+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.vm.UpgradeVMCmd;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.offering.ServiceOffering;
+import com.cloud.uservm.UserVm;
+
+@APICommand(name = "changeServiceForVirtualMachine", responseObject=UserVmResponse.class, description="Changes the service offering for a virtual machine. " +
+ "The virtual machine must be in a \"Stopped\" state for " +
+ "this command to take effect.", responseView = ResponseView.Full)
+public class UpgradeVMCmdByAdmin extends UpgradeVMCmd {
+ public static final Logger s_logger = Logger.getLogger(UpgradeVMCmdByAdmin.class.getName());
+
+
+ @Override
+ public void execute() throws ResourceAllocationException{
+ CallContext.current().setEventDetails("Vm Id: "+getId());
+
+ ServiceOffering serviceOffering = _entityMgr.findById(ServiceOffering.class, serviceOfferingId);
+ if (serviceOffering == null) {
+ throw new InvalidParameterValueException("Unable to find service offering: " + serviceOfferingId);
+ }
+
+ UserVm result = _userVmService.upgradeVirtualMachine(this);
+ if (result != null){
+ UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Full, "virtualmachine", result).get(0);
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to upgrade vm");
+ }
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vmsnapshot/RevertToVMSnapshotCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/vmsnapshot/RevertToVMSnapshotCmdByAdmin.java
new file mode 100644
index 00000000000..92df872b0b5
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/vmsnapshot/RevertToVMSnapshotCmdByAdmin.java
@@ -0,0 +1,57 @@
+// 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.vmsnapshot;
+
+import java.util.logging.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.vmsnapshot.RevertToVMSnapshotCmd;
+import org.apache.cloudstack.api.response.UserVmResponse;
+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.uservm.UserVm;
+
+@APICommand(name = "revertToVMSnapshot", description = "Revert VM from a vmsnapshot.", responseObject = UserVmResponse.class, since = "4.2.0", responseView = ResponseView.Full)
+public class RevertToVMSnapshotCmdByAdmin extends RevertToVMSnapshotCmd {
+ public static final Logger s_logger = Logger
+ .getLogger(RevertToVMSnapshotCmdByAdmin.class.getName());
+
+
+ @Override
+ public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ResourceAllocationException, ConcurrentOperationException {
+ CallContext.current().setEventDetails(
+ "vmsnapshot id: " + getVmSnapShotId());
+ UserVm result = _vmSnapshotService.revertToSnapshot(getVmSnapShotId());
+ if (result != null) {
+ UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Full,
+ "virtualmachine", result).get(0);
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,"Failed to revert VM snapshot");
+ }
+ }
+
+
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/volume/AttachVolumeCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/volume/AttachVolumeCmdByAdmin.java
new file mode 100644
index 00000000000..3634a976c63
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/volume/AttachVolumeCmdByAdmin.java
@@ -0,0 +1,47 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.admin.volume;
+
+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.volume.AttachVolumeCmd;
+import org.apache.cloudstack.api.response.VolumeResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.storage.Volume;
+
+@APICommand(name = "attachVolume", description = "Attaches a disk volume to a virtual machine.", responseObject = VolumeResponse.class, responseView = ResponseView.Full)
+public class AttachVolumeCmdByAdmin extends AttachVolumeCmd {
+ public static final Logger s_logger = Logger.getLogger(AttachVolumeCmdByAdmin.class.getName());
+
+ @Override
+ public void execute(){
+ CallContext.current().setEventDetails("Volume Id: "+getId()+" VmId: "+getVirtualMachineId());
+ Volume result = _volumeService.attachVolumeToVM(this);
+ if (result != null) {
+ VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Full, result);
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to attach volume");
+ }
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/volume/CreateVolumeCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/volume/CreateVolumeCmdByAdmin.java
new file mode 100644
index 00000000000..5df7481497c
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/volume/CreateVolumeCmdByAdmin.java
@@ -0,0 +1,61 @@
+// 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.volume;
+
+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.volume.CreateVolumeCmd;
+import org.apache.cloudstack.api.response.VolumeResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.storage.Snapshot;
+import com.cloud.storage.Volume;
+
+@APICommand(name = "createVolume", responseObject = VolumeResponse.class, description = "Creates a disk volume from a disk offering. This disk volume must still be attached to a virtual machine to make use of it.", responseView = ResponseView.Full)
+public class CreateVolumeCmdByAdmin extends CreateVolumeCmd {
+ public static final Logger s_logger = Logger.getLogger(CreateVolumeCmdByAdmin.class.getName());
+
+ @Override
+ public void execute(){
+ CallContext.current().setEventDetails("Volume Id: "+getEntityId()+((getSnapshotId() == null) ? "" : " from snapshot: " + getSnapshotId()));
+ Volume volume = _volumeService.createVolume(this);
+ if (volume != null) {
+ VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Full, volume);
+ //FIXME - have to be moved to ApiResponseHelper
+ if (getSnapshotId() != null) {
+ Snapshot snap = _entityMgr.findById(Snapshot.class, getSnapshotId());
+ if (snap != null) {
+ response.setSnapshotId(snap.getUuid()); // if the volume was
+ // created from a
+ // snapshot,
+ // snapshotId will
+ // be set so we pass
+ // it back in the
+ // response
+ }
+ }
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a volume");
+ }
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/volume/DetachVolumeCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/volume/DetachVolumeCmdByAdmin.java
new file mode 100644
index 00000000000..ab07a786639
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/volume/DetachVolumeCmdByAdmin.java
@@ -0,0 +1,48 @@
+// 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.volume;
+
+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.volume.DetachVolumeCmd;
+import org.apache.cloudstack.api.response.VolumeResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.storage.Volume;
+
+@APICommand(name = "detachVolume", description = "Detaches a disk volume from a virtual machine.", responseObject = VolumeResponse.class, responseView = ResponseView.Full)
+public class DetachVolumeCmdByAdmin extends DetachVolumeCmd {
+ public static final Logger s_logger = Logger.getLogger(DetachVolumeCmdByAdmin.class.getName());
+
+
+ @Override
+ public void execute(){
+ CallContext.current().setEventDetails("Volume Id: "+getId()+" VmId: "+getVirtualMachineId());
+ Volume result = _volumeService.detachVolumeFromVM(this);
+ if (result != null){
+ VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Full, result);
+ response.setResponseName("volume");
+ setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to detach volume");
+ }
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/volume/ListVolumesCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/volume/ListVolumesCmdByAdmin.java
new file mode 100644
index 00000000000..1cd54d1e22a
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/volume/ListVolumesCmdByAdmin.java
@@ -0,0 +1,63 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.admin.volume;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.acl.RoleType;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.command.user.volume.ListVolumesCmd;
+import org.apache.cloudstack.api.response.PodResponse;
+import org.apache.cloudstack.api.response.StoragePoolResponse;
+import org.apache.cloudstack.api.response.VolumeResponse;
+
+
+
+@APICommand(name = "listVolumes", description = "Lists all volumes.", responseObject = VolumeResponse.class, responseView = ResponseView.Full)
+public class ListVolumesCmdByAdmin extends ListVolumesCmd {
+ public static final Logger s_logger = Logger.getLogger(ListVolumesCmdByAdmin.class.getName());
+
+ @Parameter(name=ApiConstants.POD_ID, type=CommandType.UUID, entityType=PodResponse.class,
+ description="the pod id the disk volume belongs to")
+ private Long podId;
+
+
+ @Parameter(name=ApiConstants.STORAGE_ID, type=CommandType.UUID, entityType=StoragePoolResponse.class,
+ description="the ID of the storage pool, available to ROOT admin only", since="4.3", authorized = { RoleType.Admin })
+ private Long storageId;
+
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+
+ @Override
+ public Long getPodId() {
+ return podId;
+ }
+
+
+ @Override
+ public Long getStorageId() {
+ return storageId;
+ }
+
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/volume/MigrateVolumeCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/volume/MigrateVolumeCmdByAdmin.java
new file mode 100644
index 00000000000..44a08e802db
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/volume/MigrateVolumeCmdByAdmin.java
@@ -0,0 +1,47 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.admin.volume;
+
+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.volume.MigrateVolumeCmd;
+import org.apache.cloudstack.api.response.VolumeResponse;
+
+import com.cloud.storage.Volume;
+
+
+@APICommand(name = "migrateVolume", description = "Migrate volume", responseObject = VolumeResponse.class, since = "3.0.0", responseView = ResponseView.Full)
+public class MigrateVolumeCmdByAdmin extends MigrateVolumeCmd {
+
+
+ @Override
+ public void execute(){
+ Volume result;
+
+ result = _volumeService.migrateVolume(this);
+ if (result != null) {
+ VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Full, result);
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to migrate volume");
+ }
+ }
+
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/volume/ResizeVolumeCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/volume/ResizeVolumeCmdByAdmin.java
new file mode 100644
index 00000000000..d1d253c02b7
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/volume/ResizeVolumeCmdByAdmin.java
@@ -0,0 +1,47 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.admin.volume;
+
+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.volume.ResizeVolumeCmd;
+import org.apache.cloudstack.api.response.VolumeResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.storage.Volume;
+
+
+@APICommand(name = "resizeVolume", description = "Resizes a volume", responseObject = VolumeResponse.class, responseView = ResponseView.Full)
+public class ResizeVolumeCmdByAdmin extends ResizeVolumeCmd {
+
+ @Override
+ public void execute() throws ResourceAllocationException{
+ CallContext.current().setEventDetails("Volume Id: " + getEntityId() + " to size " + getSize() + "G");
+ Volume volume = _volumeService.resizeVolume(this);
+ if (volume != null) {
+ VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Full, volume);
+ //FIXME - have to be moved to ApiResponseHelper
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to resize volume");
+ }
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/volume/UpdateVolumeCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/volume/UpdateVolumeCmdByAdmin.java
new file mode 100644
index 00000000000..16b2d5db10e
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/volume/UpdateVolumeCmdByAdmin.java
@@ -0,0 +1,45 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.admin.volume;
+
+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.volume.UpdateVolumeCmd;
+import org.apache.cloudstack.api.response.VolumeResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.storage.Volume;
+
+@APICommand(name = "updateVolume", description = "Updates the volume.", responseObject = VolumeResponse.class, responseView = ResponseView.Full)
+public class UpdateVolumeCmdByAdmin extends UpdateVolumeCmd {
+
+ @Override
+ public void execute(){
+ CallContext.current().setEventDetails("Volume Id: "+getId());
+ Volume result = _volumeService.updateVolume(getId(), getPath(), getState(), getStorageId(), getDisplayVolume(),
+ getCustomId(), getEntityOwnerId(), getChainInfo());
+ if (result != null) {
+ VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Full, result);
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update volume");
+ }
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/volume/UploadVolumeCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/volume/UploadVolumeCmdByAdmin.java
new file mode 100644
index 00000000000..e3e0c9b8ade
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/volume/UploadVolumeCmdByAdmin.java
@@ -0,0 +1,57 @@
+// 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.volume;
+
+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.volume.UploadVolumeCmd;
+import org.apache.cloudstack.api.response.VolumeResponse;
+
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.NetworkRuleConflictException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.storage.Volume;
+
+@APICommand(name = "uploadVolume", description = "Uploads a data disk.", responseObject = VolumeResponse.class, responseView = ResponseView.Full)
+public class UploadVolumeCmdByAdmin extends UploadVolumeCmd {
+ public static final Logger s_logger = Logger.getLogger(UploadVolumeCmdByAdmin.class.getName());
+
+
+ @Override
+ public void execute() throws ResourceUnavailableException,
+ InsufficientCapacityException, ServerApiException,
+ ConcurrentOperationException, ResourceAllocationException,
+ NetworkRuleConflictException {
+
+ Volume volume = _volumeService.uploadVolume(this);
+ if (volume != null){
+ VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Full, volume);
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to upload volume");
+ }
+ }
+
+
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayCmd.java
index c3201f13ffc..01db44e25df 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayCmd.java
@@ -40,9 +40,11 @@ import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.vpc.PrivateGateway;
import com.cloud.network.vpc.Vpc;
+import com.cloud.network.vpc.VpcGateway;
import com.cloud.user.Account;
-@APICommand(name = "createPrivateGateway", description = "Creates a private gateway", responseObject = PrivateGatewayResponse.class)
+@APICommand(name = "createPrivateGateway", description = "Creates a private gateway", responseObject = PrivateGatewayResponse.class, entityType = {VpcGateway.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class CreatePrivateGatewayCmd extends BaseAsyncCreateCmd {
public static final Logger s_logger = Logger.getLogger(CreatePrivateGatewayCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/CreateVPCCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/vpc/CreateVPCCmdByAdmin.java
new file mode 100644
index 00000000000..f063cdbde44
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/vpc/CreateVPCCmdByAdmin.java
@@ -0,0 +1,64 @@
+// 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.vpc;
+
+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.vpc.CreateVPCCmd;
+import org.apache.cloudstack.api.response.VpcResponse;
+
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.vpc.Vpc;
+
+@APICommand(name = "createVPC", description = "Creates a VPC", responseObject = VpcResponse.class, responseView = ResponseView.Full)
+public class CreateVPCCmdByAdmin extends CreateVPCCmd {
+ public static final Logger s_logger = Logger.getLogger(CreateVPCCmdByAdmin.class.getName());
+
+ @Override
+ public void execute() {
+ Vpc vpc = null;
+ try {
+ if (_vpcService.startVpc(getEntityId(), true)) {
+ vpc = _entityMgr.findById(Vpc.class, getEntityId());
+ }
+ } catch (ResourceUnavailableException ex) {
+ s_logger.warn("Exception: ", ex);
+ throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
+ } catch (ConcurrentOperationException ex) {
+ s_logger.warn("Exception: ", ex);
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
+ } catch (InsufficientCapacityException ex) {
+ s_logger.info(ex);
+ s_logger.trace(ex);
+ throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage());
+ }
+
+ if (vpc != null) {
+ VpcResponse response = _responseGenerator.createVpcResponse(ResponseView.Full, vpc);
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create VPC");
+ }
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java
index 96d5c6acece..13e4c0e04b1 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java
@@ -39,10 +39,11 @@ import com.cloud.exception.ResourceAllocationException;
import com.cloud.network.vpc.VpcOffering;
import com.cloud.user.Account;
-@APICommand(name = "createVPCOffering", description = "Creates VPC offering", responseObject = VpcOfferingResponse.class)
+@APICommand(name = "createVPCOffering", description = "Creates VPC offering", responseObject = VpcOfferingResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd {
public static final Logger s_logger = Logger.getLogger(CreateVPCOfferingCmd.class.getName());
- private static final String Name = "createvpcofferingresponse";
+ private static final String s_name = "createvpcofferingresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
@@ -65,6 +66,9 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd {
+ "If not specified, the provider for the service will be mapped to the default provider on the physical network")
private Map serviceProviderList;
+ @Parameter(name = ApiConstants.SERVICE_CAPABILITY_LIST, type = CommandType.MAP, description = "desired service capabilities as part of vpc offering", since = "4.4")
+ private Map serviceCapabilitystList;
+
@Parameter(name = ApiConstants.SERVICE_OFFERING_ID,
type = CommandType.UUID,
entityType = ServiceOfferingResponse.class,
@@ -111,13 +115,18 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd {
return serviceProviderMap;
}
+ public Map> getServiceCapabilitystList() {
+ return serviceCapabilitystList;
+ }
+
public Long getServiceOfferingId() {
return serviceOfferingId;
}
@Override
public void create() throws ResourceAllocationException {
- VpcOffering vpcOff = _vpcProvSvc.createVpcOffering(getVpcOfferingName(), getDisplayText(), getSupportedServices(), getServiceProviders(), getServiceOfferingId());
+ VpcOffering vpcOff = _vpcProvSvc.createVpcOffering(getVpcOfferingName(), getDisplayText(),
+ getSupportedServices(), getServiceProviders(), getServiceCapabilitystList(), getServiceOfferingId());
if (vpcOff != null) {
setEntityId(vpcOff.getId());
setEntityUuid(vpcOff.getUuid());
@@ -150,7 +159,7 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd {
@Override
public String getCommandName() {
- return Name;
+ return s_name;
}
@Override
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/DeletePrivateGatewayCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vpc/DeletePrivateGatewayCmd.java
index a5bb00c9ac4..8d67a4ed8c5 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/vpc/DeletePrivateGatewayCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/vpc/DeletePrivateGatewayCmd.java
@@ -36,7 +36,8 @@ import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.vpc.VpcGateway;
import com.cloud.user.Account;
-@APICommand(name = "deletePrivateGateway", description = "Deletes a Private gateway", responseObject = SuccessResponse.class)
+@APICommand(name = "deletePrivateGateway", description = "Deletes a Private gateway", responseObject = SuccessResponse.class, entityType = {VpcGateway.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeletePrivateGatewayCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DeletePrivateGatewayCmd.class.getName());
private static final String s_name = "deleteprivategatewayresponse";
@@ -85,7 +86,7 @@ public class DeletePrivateGatewayCmd extends BaseAsyncCmd {
boolean result = _vpcService.deleteVpcPrivateGateway(id);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete private gateway");
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/DeleteVPCOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vpc/DeleteVPCOfferingCmd.java
index 7abaa7d565c..0959f5f8c07 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/vpc/DeleteVPCOfferingCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/vpc/DeleteVPCOfferingCmd.java
@@ -30,7 +30,8 @@ import org.apache.cloudstack.api.response.VpcOfferingResponse;
import com.cloud.event.EventTypes;
import com.cloud.user.Account;
-@APICommand(name = "deleteVPCOffering", description = "Deletes VPC offering", responseObject = SuccessResponse.class)
+@APICommand(name = "deleteVPCOffering", description = "Deletes VPC offering", responseObject = SuccessResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteVPCOfferingCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DeleteVPCOfferingCmd.class.getName());
private static final String s_name = "deletevpcofferingresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/ListVPCsCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/vpc/ListVPCsCmdByAdmin.java
new file mode 100644
index 00000000000..3a95e44df45
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/vpc/ListVPCsCmdByAdmin.java
@@ -0,0 +1,55 @@
+// 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.vpc;
+
+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.vpc.ListVPCsCmd;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.VpcResponse;
+
+import com.cloud.network.vpc.Vpc;
+
+
+@APICommand(name = "listVPCs", description = "Lists VPCs", responseObject = VpcResponse.class, responseView = ResponseView.Full)
+public class ListVPCsCmdByAdmin extends ListVPCsCmd {
+ public static final Logger s_logger = Logger.getLogger(ListVPCsCmdByAdmin.class.getName());
+
+ @Override
+ public void execute() {
+ List extends Vpc> vpcs =
+ _vpcService.listVpcs(getId(), getVpcName(), getDisplayText(), getSupportedServices(), getCidr(), getVpcOffId(), getState(), getAccountName(), getDomainId(),
+ getKeyword(), getStartIndex(), getPageSizeVal(), getZoneId(), isRecursive(), listAll(), getRestartRequired(), getTags(),
+ getProjectId(), getDisplay());
+ ListResponse response = new ListResponse();
+ List offeringResponses = new ArrayList();
+ for (Vpc vpc : vpcs) {
+ VpcResponse offeringResponse = _responseGenerator.createVpcResponse(ResponseView.Full, vpc);
+ offeringResponses.add(offeringResponse);
+ }
+
+ response.setResponses(offeringResponses);
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+ }
+
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCCmdByAdmin.java
new file mode 100644
index 00000000000..b94cdcf8d20
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCCmdByAdmin.java
@@ -0,0 +1,47 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.admin.vpc;
+
+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.vpc.UpdateVPCCmd;
+import org.apache.cloudstack.api.response.VpcResponse;
+
+import com.cloud.network.vpc.Vpc;
+
+@APICommand(name = "updateVPC", description = "Updates a VPC", responseObject = VpcResponse.class, responseView = ResponseView.Full)
+public class UpdateVPCCmdByAdmin extends UpdateVPCCmd {
+ public static final Logger s_logger = Logger.getLogger(UpdateVPCCmdByAdmin.class.getName());
+
+ @Override
+ public void execute(){
+ Vpc result = _vpcService.updateVpc(getId(), getVpcName(), getDisplayText(), getCustomId(), getDisplayVpc());
+ if (result != null) {
+ VpcResponse response = _responseGenerator.createVpcResponse(ResponseView.Full, result);
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update VPC");
+ }
+ }
+
+
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCOfferingCmd.java
index 3526b4b3ac9..5af47d3a4c7 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCOfferingCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCOfferingCmd.java
@@ -30,10 +30,11 @@ import com.cloud.event.EventTypes;
import com.cloud.network.vpc.VpcOffering;
import com.cloud.user.Account;
-@APICommand(name = "updateVPCOffering", description = "Updates VPC offering", responseObject = VpcOfferingResponse.class)
+@APICommand(name = "updateVPCOffering", description = "Updates VPC offering", responseObject = VpcOfferingResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class UpdateVPCOfferingCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(UpdateVPCOfferingCmd.class.getName());
- private static final String Name = "updatevpcofferingresponse";
+ private static final String s_name = "updatevpcofferingresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
@@ -76,7 +77,7 @@ public class UpdateVPCOfferingCmd extends BaseAsyncCmd {
/////////////////////////////////////////////////////
@Override
public String getCommandName() {
- return Name;
+ return s_name;
}
@Override
diff --git a/api/src/org/apache/cloudstack/api/command/admin/zone/CreateZoneCmd.java b/api/src/org/apache/cloudstack/api/command/admin/zone/CreateZoneCmd.java
index 0846102652f..414c058e66d 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/zone/CreateZoneCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/zone/CreateZoneCmd.java
@@ -23,6 +23,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.DomainResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
@@ -31,7 +32,8 @@ import org.apache.cloudstack.context.CallContext;
import com.cloud.dc.DataCenter;
import com.cloud.user.Account;
-@APICommand(name = "createZone", description = "Creates a Zone.", responseObject = ZoneResponse.class)
+@APICommand(name = "createZone", description = "Creates a Zone.", responseObject = ZoneResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class CreateZoneCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(CreateZoneCmd.class.getName());
@@ -168,10 +170,10 @@ public class CreateZoneCmd extends BaseCmd {
public void execute() {
CallContext.current().setEventDetails("Zone Name: " + getZoneName());
DataCenter result = _configService.createZone(this);
- if (result != null) {
- ZoneResponse response = _responseGenerator.createZoneResponse(result, false);
+ if (result != null){
+ ZoneResponse response = _responseGenerator.createZoneResponse(ResponseView.Full, result, false);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a zone");
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/zone/DeleteZoneCmd.java b/api/src/org/apache/cloudstack/api/command/admin/zone/DeleteZoneCmd.java
index 3e7462567e1..c7029b052ec 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/zone/DeleteZoneCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/zone/DeleteZoneCmd.java
@@ -30,7 +30,8 @@ import org.apache.cloudstack.context.CallContext;
import com.cloud.user.Account;
-@APICommand(name = "deleteZone", description = "Deletes a Zone.", responseObject = SuccessResponse.class)
+@APICommand(name = "deleteZone", description = "Deletes a Zone.", responseObject = SuccessResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteZoneCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(DeleteZoneCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/zone/ListZonesCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/zone/ListZonesCmdByAdmin.java
new file mode 100644
index 00000000000..772a4dcfeb3
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/zone/ListZonesCmdByAdmin.java
@@ -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.zone;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
+import org.apache.cloudstack.api.command.user.zone.ListZonesCmd;
+import org.apache.cloudstack.api.response.ZoneResponse;
+
+@APICommand(name = "listZones", description = "Lists zones", responseObject = ZoneResponse.class, responseView = ResponseView.Full)
+public class ListZonesCmdByAdmin extends ListZonesCmd {
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/zone/MarkDefaultZoneForAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/zone/MarkDefaultZoneForAccountCmd.java
index fe2bc6a7eb6..28a6d6ccc13 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/zone/MarkDefaultZoneForAccountCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/zone/MarkDefaultZoneForAccountCmd.java
@@ -25,6 +25,7 @@ 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;
@@ -33,7 +34,8 @@ import org.apache.cloudstack.api.response.ZoneResponse;
import com.cloud.event.EventTypes;
import com.cloud.user.Account;
-@APICommand(name = "markDefaultZoneForAccount", description = "Marks a default zone for this account", responseObject = AccountResponse.class, since = "4.0")
+@APICommand(name = "markDefaultZoneForAccount", description = "Marks a default zone for this account", responseObject = AccountResponse.class, since = "4.0",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
public class MarkDefaultZoneForAccountCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(MarkDefaultZoneForAccountCmd.class.getName());
@@ -101,7 +103,7 @@ public class MarkDefaultZoneForAccountCmd extends BaseAsyncCmd {
@Override
public String getEventDescription() {
- return "Marking account with the default zone: " + getDefaultZoneId();
+ return "Marking account with the default zone: " + getDefaultZoneId();
}
@Override
@@ -113,10 +115,11 @@ public class MarkDefaultZoneForAccountCmd extends BaseAsyncCmd {
public void execute() {
Account result = _configService.markDefaultZone(getAccountName(), getDomainId(), getDefaultZoneId());
if (result != null) {
- AccountResponse response = _responseGenerator.createAccountResponse(result);
+ AccountResponse response = _responseGenerator.createAccountResponse(ResponseView.Full, result);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
- } else {
+ setResponseObject(response);
+ }
+ else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to mark the account with the default zone");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/zone/UpdateZoneCmd.java b/api/src/org/apache/cloudstack/api/command/admin/zone/UpdateZoneCmd.java
index f0074c5c6da..9ad8972ecfd 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/zone/UpdateZoneCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/zone/UpdateZoneCmd.java
@@ -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.ZoneResponse;
import org.apache.cloudstack.context.CallContext;
@@ -33,7 +34,8 @@ import org.apache.cloudstack.context.CallContext;
import com.cloud.dc.DataCenter;
import com.cloud.user.Account;
-@APICommand(name = "updateZone", description = "Updates a Zone.", responseObject = ZoneResponse.class)
+@APICommand(name = "updateZone", description = "Updates a Zone.", responseObject = ZoneResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class UpdateZoneCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(UpdateZoneCmd.class.getName());
@@ -180,9 +182,9 @@ public class UpdateZoneCmd extends BaseCmd {
CallContext.current().setEventDetails("Zone Id: " + getId());
DataCenter result = _configService.editZone(this);
if (result != null) {
- ZoneResponse response = _responseGenerator.createZoneResponse(result, false);
+ ZoneResponse response = _responseGenerator.createZoneResponse(ResponseView.Full, result, false);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update zone; internal error.");
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/account/AddAccountToProjectCmd.java b/api/src/org/apache/cloudstack/api/command/user/account/AddAccountToProjectCmd.java
index 36df579d2a6..ef36038c5c4 100644
--- a/api/src/org/apache/cloudstack/api/command/user/account/AddAccountToProjectCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/account/AddAccountToProjectCmd.java
@@ -32,7 +32,8 @@ import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.projects.Project;
-@APICommand(name = "addAccountToProject", description = "Adds acoount to a project", responseObject = SuccessResponse.class, since = "3.0.0")
+@APICommand(name = "addAccountToProject", description = "Adds acoount to a project", responseObject = SuccessResponse.class, since = "3.0.0",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class AddAccountToProjectCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(AddAccountToProjectCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/user/account/DeleteAccountFromProjectCmd.java b/api/src/org/apache/cloudstack/api/command/user/account/DeleteAccountFromProjectCmd.java
index f6aa36c2ea0..5c891733b5a 100644
--- a/api/src/org/apache/cloudstack/api/command/user/account/DeleteAccountFromProjectCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/account/DeleteAccountFromProjectCmd.java
@@ -33,7 +33,8 @@ import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.projects.Project;
-@APICommand(name = "deleteAccountFromProject", description = "Deletes account from the project", responseObject = SuccessResponse.class, since = "3.0.0")
+@APICommand(name = "deleteAccountFromProject", description = "Deletes account from the project", responseObject = SuccessResponse.class, since = "3.0.0",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteAccountFromProjectCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DeleteProjectCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/user/account/ListAccountsCmd.java b/api/src/org/apache/cloudstack/api/command/user/account/ListAccountsCmd.java
index bc93d2147f7..0b5ae7c0baf 100644
--- a/api/src/org/apache/cloudstack/api/command/user/account/ListAccountsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/account/ListAccountsCmd.java
@@ -22,10 +22,14 @@ import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListDomainResourcesCmd;
import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
import org.apache.cloudstack.api.response.AccountResponse;
import org.apache.cloudstack.api.response.ListResponse;
-@APICommand(name = "listAccounts", description = "Lists accounts and provides detailed account information for listed accounts", responseObject = AccountResponse.class)
+import com.cloud.user.Account;
+
+@APICommand(name = "listAccounts", description = "Lists accounts and provides detailed account information for listed accounts", responseObject = AccountResponse.class, responseView = ResponseView.Restricted, entityType = {Account.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
public class ListAccountsCmd extends BaseListDomainResourcesCmd {
public static final Logger s_logger = Logger.getLogger(ListAccountsCmd.class.getName());
private static final String s_name = "listaccountsresponse";
@@ -88,6 +92,6 @@ public class ListAccountsCmd extends BaseListDomainResourcesCmd {
public void execute() {
ListResponse response = _queryService.searchForAccounts(this);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/account/ListProjectAccountsCmd.java b/api/src/org/apache/cloudstack/api/command/user/account/ListProjectAccountsCmd.java
index aa600166a6f..a70024edd51 100644
--- a/api/src/org/apache/cloudstack/api/command/user/account/ListProjectAccountsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/account/ListProjectAccountsCmd.java
@@ -28,7 +28,8 @@ import org.apache.cloudstack.api.response.ProjectResponse;
import com.cloud.user.Account;
-@APICommand(name = "listProjectAccounts", description = "Lists project's accounts", responseObject = ProjectResponse.class, since = "3.0.0")
+@APICommand(name = "listProjectAccounts", description = "Lists project's accounts", responseObject = ProjectResponse.class, since = "3.0.0",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListProjectAccountsCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListProjectAccountsCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java b/api/src/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java
index 4df658bcbb4..091229f6817 100644
--- a/api/src/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java
@@ -20,6 +20,7 @@ import java.util.List;
import org.apache.log4j.Logger;
+import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants;
@@ -28,6 +29,7 @@ import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.BaseAsyncCreateCmd;
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.DomainResponse;
import org.apache.cloudstack.api.response.IPAddressResponse;
@@ -55,7 +57,9 @@ import com.cloud.offering.NetworkOffering;
import com.cloud.projects.Project;
import com.cloud.user.Account;
-@APICommand(name = "associateIpAddress", description = "Acquires and associates a public IP to an account.", responseObject = IPAddressResponse.class)
+@APICommand(name = "associateIpAddress", description = "Acquires and associates a public IP to an account.", responseObject = IPAddressResponse.class, responseView = ResponseView.Restricted,
+ entityType = {IpAddress.class, Vpc.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class AssociateIPAddrCmd extends BaseAsyncCreateCmd {
public static final Logger s_logger = Logger.getLogger(AssociateIPAddrCmd.class.getName());
private static final String s_name = "associateipaddressresponse";
@@ -103,6 +107,9 @@ public class AssociateIPAddrCmd extends BaseAsyncCreateCmd {
description = "region ID from where portable ip is to be associated.")
private Integer regionId;
+ @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the ip to the end user or not", since = "4.4", authorized = {RoleType.Admin})
+ private Boolean display;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -195,6 +202,10 @@ public class AssociateIPAddrCmd extends BaseAsyncCreateCmd {
}
}
+ public Boolean getDisplayIp() {
+ return display;
+ }
+
@Override
public long getEntityOwnerId() {
Account caller = CallContext.current().getCallingAccount();
@@ -252,7 +263,7 @@ public class AssociateIPAddrCmd extends BaseAsyncCreateCmd {
@Override
public String getEventDescription() {
- return "associating ip to network id: " + getNetworkId() + " in zone " + getZoneId();
+ return "associating ip to network id: " + getNetworkId() + " in zone " + getZoneId();
}
/////////////////////////////////////////////////////
@@ -274,7 +285,7 @@ public class AssociateIPAddrCmd extends BaseAsyncCreateCmd {
IpAddress ip = null;
if (!isPortable()) {
- ip = _networkService.allocateIP(_accountService.getAccount(getEntityOwnerId()), getZoneId(), getNetworkId());
+ ip = _networkService.allocateIP(_accountService.getAccount(getEntityOwnerId()), getZoneId(), getNetworkId(), getDisplayIp());
} else {
ip = _networkService.allocatePortableIP(_accountService.getAccount(getEntityOwnerId()), 1, getZoneId(), getNetworkId(), getVpcId());
}
@@ -308,7 +319,7 @@ public class AssociateIPAddrCmd extends BaseAsyncCreateCmd {
}
if (result != null) {
- IPAddressResponse ipResponse = _responseGenerator.createIPAddressResponse(result);
+ IPAddressResponse ipResponse = _responseGenerator.createIPAddressResponse(ResponseView.Restricted, result);
ipResponse.setResponseName(getCommandName());
setResponseObject(ipResponse);
} else {
diff --git a/api/src/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java b/api/src/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java
index e3669be4bb0..269fcb552b3 100644
--- a/api/src/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java
@@ -36,7 +36,8 @@ import com.cloud.exception.InvalidParameterValueException;
import com.cloud.network.IpAddress;
import com.cloud.user.Account;
-@APICommand(name = "disassociateIpAddress", description = "Disassociates an ip address from the account.", responseObject = SuccessResponse.class)
+@APICommand(name = "disassociateIpAddress", description = "Disassociates an ip address from the account.", responseObject = SuccessResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DisassociateIPAddrCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DisassociateIPAddrCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/user/address/ListPublicIpAddressesCmd.java b/api/src/org/apache/cloudstack/api/command/user/address/ListPublicIpAddressesCmd.java
index a5c54ad2fd0..321871380da 100644
--- a/api/src/org/apache/cloudstack/api/command/user/address/ListPublicIpAddressesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/address/ListPublicIpAddressesCmd.java
@@ -21,11 +21,13 @@ import java.util.List;
import org.apache.log4j.Logger;
+import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
import org.apache.cloudstack.api.response.IPAddressResponse;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.NetworkResponse;
@@ -37,7 +39,8 @@ import org.apache.cloudstack.api.response.ZoneResponse;
import com.cloud.network.IpAddress;
import com.cloud.utils.Pair;
-@APICommand(name = "listPublicIpAddresses", description = "Lists all public ip addresses", responseObject = IPAddressResponse.class)
+@APICommand(name = "listPublicIpAddresses", description = "Lists all public ip addresses", responseObject = IPAddressResponse.class, responseView = ResponseView.Restricted,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListPublicIpAddressesCmd extends BaseListTaggedResourcesCmd {
public static final Logger s_logger = Logger.getLogger(ListPublicIpAddressesCmd.class.getName());
@@ -89,6 +92,9 @@ public class ListPublicIpAddressesCmd extends BaseListTaggedResourcesCmd {
@Parameter(name = ApiConstants.VPC_ID, type = CommandType.UUID, entityType = VpcResponse.class, description = "List ips belonging to the VPC")
private Long vpcId;
+ @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin})
+ private Boolean display;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -136,6 +142,14 @@ public class ListPublicIpAddressesCmd extends BaseListTaggedResourcesCmd {
return vpcId;
}
+ @Override
+ public Boolean getDisplay() {
+ if (display != null) {
+ return display;
+ }
+ return super.getDisplay();
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -150,14 +164,14 @@ public class ListPublicIpAddressesCmd extends BaseListTaggedResourcesCmd {
ListResponse response = new ListResponse();
List ipAddrResponses = new ArrayList();
for (IpAddress ipAddress : result.first()) {
- IPAddressResponse ipResponse = _responseGenerator.createIPAddressResponse(ipAddress);
+ IPAddressResponse ipResponse = _responseGenerator.createIPAddressResponse(ResponseView.Restricted, ipAddress);
ipResponse.setObjectName("publicipaddress");
ipAddrResponses.add(ipResponse);
}
response.setResponses(ipAddrResponses, result.second());
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
}
@Override
diff --git a/api/src/org/apache/cloudstack/api/command/user/address/UpdateIPAddrCmd.java b/api/src/org/apache/cloudstack/api/command/user/address/UpdateIPAddrCmd.java
new file mode 100644
index 00000000000..cc736d0d64a
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/address/UpdateIPAddrCmd.java
@@ -0,0 +1,134 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.user.address;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.acl.RoleType;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseAsyncCustomIdCmd;
+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.IPAddressResponse;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.NetworkRuleConflictException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.IpAddress;
+import com.cloud.user.Account;
+
+@APICommand(name = "updatePublicIpAddress", description = "Updates an ip address", responseObject = IPAddressResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class UpdateIPAddrCmd extends BaseAsyncCustomIdCmd {
+ public static final Logger s_logger = Logger.getLogger(UpdateIPAddrCmd.class.getName());
+ private static final String s_name = "updateipaddressresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = IPAddressResponse.class, required = true, description = "the id of the public ip address"
+ + " to update")
+ private Long id;
+ // unexposed parameter needed for events logging
+ @Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.UUID, entityType = AccountResponse.class, expose = false)
+ private Long ownerId;
+
+ @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the ip to the end user or not", since = "4.4", authorized = {RoleType.Admin})
+ private Boolean display;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public Boolean getDisplayIp() {
+ return display;
+ }
+
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_NET_IP_UPDATE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return ("Updating ip address with id=" + id);
+ }
+
+
+ @Override
+ public long getEntityOwnerId() {
+ if (ownerId == null) {
+ IpAddress ip = getIpAddress(id);
+ if (ip == null) {
+ throw new InvalidParameterValueException("Unable to find ip address by id=" + id);
+ }
+ ownerId = ip.getAccountId();
+ }
+
+ if (ownerId == null) {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+ return ownerId;
+ }
+
+ private IpAddress getIpAddress(long id) {
+ IpAddress ip = _entityMgr.findById(IpAddress.class, id);
+
+ if (ip == null) {
+ throw new InvalidParameterValueException("Unable to find ip address by id=" + id);
+ } else {
+ return ip;
+ }
+ }
+
+ @Override
+ public void checkUuid() {
+ if (getCustomId() != null) {
+ _uuidMgr.checkUuid(getCustomId(), IpAddress.class);
+ }
+ }
+
+ @Override
+ public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException,
+ NetworkRuleConflictException {
+
+ IpAddress result = _networkService.updateIP(getId(), getCustomId(), getDisplayIp());
+ IPAddressResponse ipResponse = _responseGenerator.createIPAddressResponse(ResponseView.Restricted, result);
+ ipResponse.setResponseName(getCommandName());
+ setResponseObject(ipResponse);
+ }
+}
\ No newline at end of file
diff --git a/api/src/org/apache/cloudstack/api/command/user/affinitygroup/CreateAffinityGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/affinitygroup/CreateAffinityGroupCmd.java
index a2542a87bc9..c30e52820eb 100644
--- a/api/src/org/apache/cloudstack/api/command/user/affinitygroup/CreateAffinityGroupCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/affinitygroup/CreateAffinityGroupCmd.java
@@ -34,7 +34,8 @@ import com.cloud.event.EventTypes;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.user.Account;
-@APICommand(name = "createAffinityGroup", responseObject = AffinityGroupResponse.class, description = "Creates an affinity/anti-affinity group")
+@APICommand(name = "createAffinityGroup", responseObject = AffinityGroupResponse.class, description = "Creates an affinity/anti-affinity group", entityType = {AffinityGroup.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class CreateAffinityGroupCmd extends BaseAsyncCreateCmd {
public static final Logger s_logger = Logger.getLogger(CreateAffinityGroupCmd.class.getName());
@@ -101,7 +102,7 @@ public class CreateAffinityGroupCmd extends BaseAsyncCreateCmd {
@Override
public long getEntityOwnerId() {
Account account = CallContext.current().getCallingAccount();
- if ((account == null) || isAdmin(account.getType())) {
+ if ((account == null) || _accountService.isAdmin(account.getType())) {
if ((domainId != null) && (accountName != null)) {
Account userAccount = _responseGenerator.findAccountByNameDomain(accountName, domainId);
if (userAccount != null) {
@@ -125,7 +126,7 @@ public class CreateAffinityGroupCmd extends BaseAsyncCreateCmd {
if (group != null) {
AffinityGroupResponse response = _responseGenerator.createAffinityGroupResponse(group);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create affinity group:" + affinityGroupName);
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/affinitygroup/DeleteAffinityGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/affinitygroup/DeleteAffinityGroupCmd.java
index a6cf1bb29cb..945592b7f93 100644
--- a/api/src/org/apache/cloudstack/api/command/user/affinitygroup/DeleteAffinityGroupCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/affinitygroup/DeleteAffinityGroupCmd.java
@@ -16,9 +16,13 @@
// under the License.
package org.apache.cloudstack.api.command.user.affinitygroup;
+
import org.apache.log4j.Logger;
+import org.apache.cloudstack.acl.SecurityChecker.AccessType;
+import org.apache.cloudstack.affinity.AffinityGroup;
import org.apache.cloudstack.affinity.AffinityGroupResponse;
+import org.apache.cloudstack.api.ACL;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants;
@@ -34,7 +38,8 @@ import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.user.Account;
-@APICommand(name = "deleteAffinityGroup", description = "Deletes affinity group", responseObject = SuccessResponse.class)
+@APICommand(name = "deleteAffinityGroup", description = "Deletes affinity group", responseObject = SuccessResponse.class, entityType = {AffinityGroup.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteAffinityGroupCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DeleteAffinityGroupCmd.class.getName());
private static final String s_name = "deleteaffinitygroupresponse";
@@ -52,6 +57,7 @@ public class DeleteAffinityGroupCmd extends BaseAsyncCmd {
entityType = DomainResponse.class)
private Long domainId;
+ @ACL(accessType = AccessType.OperateEntry)
@Parameter(name = ApiConstants.ID,
type = CommandType.UUID,
description = "The ID of the affinity group. Mutually exclusive with name parameter",
@@ -104,7 +110,7 @@ public class DeleteAffinityGroupCmd extends BaseAsyncCmd {
@Override
public long getEntityOwnerId() {
Account account = CallContext.current().getCallingAccount();
- if ((account == null) || isAdmin(account.getType())) {
+ if ((account == null) || _accountService.isAdmin(account.getType())) {
if ((domainId != null) && (accountName != null)) {
Account userAccount = _responseGenerator.findAccountByNameDomain(accountName, domainId);
if (userAccount != null) {
@@ -128,7 +134,7 @@ public class DeleteAffinityGroupCmd extends BaseAsyncCmd {
boolean result = _affinityGroupService.deleteAffinityGroup(id, accountName, domainId, name);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete affinity group");
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/affinitygroup/ListAffinityGroupTypesCmd.java b/api/src/org/apache/cloudstack/api/command/user/affinitygroup/ListAffinityGroupTypesCmd.java
index 87de7f7acbd..84ad0328463 100644
--- a/api/src/org/apache/cloudstack/api/command/user/affinitygroup/ListAffinityGroupTypesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/affinitygroup/ListAffinityGroupTypesCmd.java
@@ -28,7 +28,8 @@ import org.apache.cloudstack.api.response.ListResponse;
import com.cloud.user.Account;
-@APICommand(name = "listAffinityGroupTypes", description = "Lists affinity group types available", responseObject = AffinityGroupTypeResponse.class)
+@APICommand(name = "listAffinityGroupTypes", description = "Lists affinity group types available", responseObject = AffinityGroupTypeResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListAffinityGroupTypesCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListAffinityGroupTypesCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/user/affinitygroup/ListAffinityGroupsCmd.java b/api/src/org/apache/cloudstack/api/command/user/affinitygroup/ListAffinityGroupsCmd.java
index 0761a643452..6313c4812e9 100644
--- a/api/src/org/apache/cloudstack/api/command/user/affinitygroup/ListAffinityGroupsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/affinitygroup/ListAffinityGroupsCmd.java
@@ -17,6 +17,8 @@
package org.apache.cloudstack.api.command.user.affinitygroup;
import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.affinity.AffinityGroup;
import org.apache.cloudstack.affinity.AffinityGroupResponse;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType;
@@ -26,7 +28,8 @@ import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
-@APICommand(name = "listAffinityGroups", description = "Lists affinity groups", responseObject = AffinityGroupResponse.class)
+@APICommand(name = "listAffinityGroups", description = "Lists affinity groups", responseObject = AffinityGroupResponse.class, entityType = {AffinityGroup.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListAffinityGroupsCmd extends BaseListAccountResourcesCmd {
public static final Logger s_logger = Logger.getLogger(ListAffinityGroupsCmd.class.getName());
@@ -79,10 +82,10 @@ public class ListAffinityGroupsCmd extends BaseListAccountResourcesCmd {
public void execute() {
ListResponse response = _queryService.listAffinityGroups(id, affinityGroupName,
- affinityGroupType, virtualMachineId, this.getAccountName(), this.getDomainId(), this.isRecursive(),
- this.listAll(), this.getStartIndex(), this.getPageSizeVal(), this.getKeyword());
+ affinityGroupType, virtualMachineId, getAccountName(), getDomainId(), isRecursive(),
+ listAll(), getStartIndex(), getPageSizeVal(), getKeyword());
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/affinitygroup/UpdateVMAffinityGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/affinitygroup/UpdateVMAffinityGroupCmd.java
index 7bb1c5bb4a0..66201477b97 100644
--- a/api/src/org/apache/cloudstack/api/command/user/affinitygroup/UpdateVMAffinityGroupCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/affinitygroup/UpdateVMAffinityGroupCmd.java
@@ -22,6 +22,7 @@ import java.util.List;
import org.apache.log4j.Logger;
+import org.apache.cloudstack.acl.SecurityChecker.AccessType;
import org.apache.cloudstack.affinity.AffinityGroupResponse;
import org.apache.cloudstack.api.ACL;
import org.apache.cloudstack.api.APICommand;
@@ -31,6 +32,7 @@ import org.apache.cloudstack.api.ApiConstants.VMDetails;
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.UserVmResponse;
import org.apache.cloudstack.context.CallContext;
@@ -41,11 +43,16 @@ import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.user.Account;
import com.cloud.uservm.UserVm;
+import com.cloud.vm.VirtualMachine;
@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)
+ responseObject = UserVmResponse.class,
+ responseView = ResponseView.Restricted,
+ entityType = {VirtualMachine.class},
+ requestHasSensitiveInfo = false,
+ responseHasSensitiveInfo = true)
public class UpdateVMAffinityGroupCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(UpdateVMAffinityGroupCmd.class.getName());
private static final String s_name = "updatevirtualmachineresponse";
@@ -54,7 +61,7 @@ public class UpdateVMAffinityGroupCmd extends BaseAsyncCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @ACL
+ @ACL(accessType = AccessType.OperateEntry)
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = UserVmResponse.class, required = true, description = "The ID of the virtual machine")
private Long id;
@@ -137,10 +144,10 @@ public class UpdateVMAffinityGroupCmd extends BaseAsyncCmd {
dc.add(VMDetails.valueOf("affgrp"));
EnumSet details = EnumSet.copyOf(dc);
- if (result != null) {
- UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", details, result).get(0);
+ if (result != null){
+ UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Restricted, "virtualmachine", details, result).get(0);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update vm's affinity groups");
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScalePolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScalePolicyCmd.java
index ce6dc68b074..4541efa7980 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScalePolicyCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScalePolicyCmd.java
@@ -39,7 +39,9 @@ import com.cloud.user.Account;
@APICommand(name = "createAutoScalePolicy",
description = "Creates an autoscale policy for a provision or deprovision action, the action is taken when the all the conditions evaluates to true for the specified duration. The policy is in effect once it is attached to a autscale vm group.",
- responseObject = AutoScalePolicyResponse.class)
+ responseObject = AutoScalePolicyResponse.class, entityType = {AutoScalePolicy.class},
+ requestHasSensitiveInfo = false,
+ responseHasSensitiveInfo = false)
public class CreateAutoScalePolicyCmd extends BaseAsyncCreateCmd {
public static final Logger s_logger = Logger.getLogger(CreateAutoScalePolicyCmd.class.getName());
@@ -163,15 +165,15 @@ public class CreateAutoScalePolicyCmd extends BaseAsyncCreateCmd {
AutoScalePolicy result = _entityMgr.findById(AutoScalePolicy.class, getEntityId());
AutoScalePolicyResponse response = _responseGenerator.createAutoScalePolicyResponse(result);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
}
@Override
public void create() throws ResourceAllocationException {
AutoScalePolicy result = _autoScaleService.createAutoScalePolicy(this);
if (result != null) {
- this.setEntityId(result.getId());
- this.setEntityUuid(result.getUuid());
+ setEntityId(result.getId());
+ setEntityUuid(result.getUuid());
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create AutoScale Policy");
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmGroupCmd.java
index 55479748990..1fd0029e342 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmGroupCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmGroupCmd.java
@@ -20,6 +20,7 @@ import java.util.List;
import org.apache.log4j.Logger;
+import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants;
@@ -40,7 +41,9 @@ import com.cloud.network.rules.LoadBalancer;
@APICommand(name = "createAutoScaleVmGroup",
description = "Creates and automatically starts a virtual machine based on a service offering, disk offering, and template.",
- responseObject = AutoScaleVmGroupResponse.class)
+ responseObject = AutoScaleVmGroupResponse.class, entityType = {AutoScaleVmGroup.class},
+ requestHasSensitiveInfo = false,
+ responseHasSensitiveInfo = false)
public class CreateAutoScaleVmGroupCmd extends BaseAsyncCreateCmd {
public static final Logger s_logger = Logger.getLogger(CreateAutoScaleVmGroupCmd.class.getName());
@@ -95,6 +98,9 @@ public class CreateAutoScaleVmGroupCmd extends BaseAsyncCreateCmd {
description = "the autoscale profile that contains information about the vms in the vm group.")
private long profileId;
+ @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the group to the end user or not", since = "4.4", authorized = {RoleType.Admin})
+ private Boolean display;
+
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
@@ -178,12 +184,16 @@ public class CreateAutoScaleVmGroupCmd extends BaseAsyncCreateCmd {
return ApiCommandJobType.AutoScaleVmGroup;
}
+ public Boolean getDisplay() {
+ return display;
+ }
+
@Override
public void create() throws ResourceAllocationException {
AutoScaleVmGroup result = _autoScaleService.createAutoScaleVmGroup(this);
if (result != null) {
- this.setEntityId(result.getId());
- this.setEntityUuid(result.getUuid());
+ setEntityId(result.getId());
+ setEntityUuid(result.getUuid());
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create Autoscale Vm Group");
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java
index bee1b22ea85..189217a2022 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java
@@ -21,6 +21,7 @@ import java.util.Map;
import org.apache.log4j.Logger;
+import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants;
@@ -44,7 +45,9 @@ import com.cloud.user.User;
@APICommand(name = "createAutoScaleVmProfile",
description = "Creates a profile that contains information about the virtual machine which will be provisioned automatically by autoscale feature.",
- responseObject = AutoScaleVmProfileResponse.class)
+ responseObject = AutoScaleVmProfileResponse.class, entityType = {AutoScaleVmProfile.class},
+ requestHasSensitiveInfo = false,
+ responseHasSensitiveInfo = false)
@SuppressWarnings("rawtypes")
public class CreateAutoScaleVmProfileCmd extends BaseAsyncCreateCmd {
public static final Logger s_logger = Logger.getLogger(CreateAutoScaleVmProfileCmd.class.getName());
@@ -97,6 +100,9 @@ public class CreateAutoScaleVmProfileCmd extends BaseAsyncCreateCmd {
description = "the ID of the user used to launch and destroy the VMs")
private Long autoscaleUserId;
+ @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the profile to the end user or not", since = "4.4", authorized = {RoleType.Admin})
+ private Boolean display;
+
private Map otherDeployParamMap;
// ///////////////////////////////////////////////////
@@ -125,6 +131,10 @@ public class CreateAutoScaleVmProfileCmd extends BaseAsyncCreateCmd {
return templateId;
}
+ public Boolean getDisplay() {
+ return display;
+ }
+
public Map getCounterParamList() {
return counterParamList;
}
@@ -235,7 +245,7 @@ public class CreateAutoScaleVmProfileCmd extends BaseAsyncCreateCmd {
AutoScaleVmProfile result = _entityMgr.findById(AutoScaleVmProfile.class, getEntityId());
AutoScaleVmProfileResponse response = _responseGenerator.createAutoScaleVmProfileResponse(result);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
}
@Override
@@ -243,8 +253,8 @@ public class CreateAutoScaleVmProfileCmd extends BaseAsyncCreateCmd {
AutoScaleVmProfile result = _autoScaleService.createAutoScaleVmProfile(this);
if (result != null) {
- this.setEntityId(result.getId());
- this.setEntityUuid(result.getUuid());
+ setEntityId(result.getId());
+ setEntityUuid(result.getUuid());
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create Autoscale Vm Profile");
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateConditionCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateConditionCmd.java
index 914848a40c8..847866ef3ae 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateConditionCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateConditionCmd.java
@@ -35,7 +35,8 @@ import com.cloud.event.EventTypes;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.network.as.Condition;
-@APICommand(name = "createCondition", description = "Creates a condition", responseObject = ConditionResponse.class)
+@APICommand(name = "createCondition", description = "Creates a condition", responseObject = ConditionResponse.class, entityType = {Condition.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class CreateConditionCmd extends BaseAsyncCreateCmd {
public static final Logger s_logger = Logger.getLogger(CreateConditionCmd.class.getName());
private static final String s_name = "conditionresponse";
@@ -69,8 +70,8 @@ public class CreateConditionCmd extends BaseAsyncCreateCmd {
condition = _autoScaleService.createCondition(this);
if (condition != null) {
- this.setEntityId(condition.getId());
- this.setEntityUuid(condition.getUuid());
+ setEntityId(condition.getId());
+ setEntityUuid(condition.getUuid());
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create condition.");
}
@@ -81,7 +82,7 @@ public class CreateConditionCmd extends BaseAsyncCreateCmd {
Condition condition = _entityMgr.findById(Condition.class, getEntityId());
ConditionResponse response = _responseGenerator.createConditionResponse(condition);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
}
// /////////////////////////////////////////////////
@@ -137,7 +138,7 @@ public class CreateConditionCmd extends BaseAsyncCreateCmd {
@Override
public long getEntityOwnerId() {
- Long accountId = finalyzeAccountId(accountName, domainId, null, true);
+ Long accountId = _accountService.finalyzeAccountId(accountName, domainId, null, true);
if (accountId == null) {
return CallContext.current().getCallingAccount().getId();
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScalePolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScalePolicyCmd.java
index 1aedf574682..c0a3a00f7d4 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScalePolicyCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScalePolicyCmd.java
@@ -18,6 +18,8 @@ package org.apache.cloudstack.api.command.user.autoscale;
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;
@@ -33,7 +35,8 @@ import com.cloud.event.EventTypes;
import com.cloud.network.as.AutoScalePolicy;
import com.cloud.user.Account;
-@APICommand(name = "deleteAutoScalePolicy", description = "Deletes a autoscale policy.", responseObject = SuccessResponse.class)
+@APICommand(name = "deleteAutoScalePolicy", description = "Deletes a autoscale policy.", responseObject = SuccessResponse.class, entityType = {AutoScalePolicy.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteAutoScalePolicyCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DeleteAutoScalePolicyCmd.class.getName());
private static final String s_name = "deleteautoscalepolicyresponse";
@@ -41,6 +44,7 @@ public class DeleteAutoScalePolicyCmd extends BaseAsyncCmd {
// ////////////// API parameters /////////////////////
// ///////////////////////////////////////////////////
+ @ACL(accessType = AccessType.OperateEntry)
@Parameter(name = ApiConstants.ID,
type = CommandType.UUID,
entityType = AutoScalePolicyResponse.class,
@@ -93,7 +97,7 @@ public class DeleteAutoScalePolicyCmd extends BaseAsyncCmd {
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
s_logger.warn("Failed to delete autoscale policy " + getId());
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete AutoScale Policy");
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmGroupCmd.java
index a7823b4920c..a9d2f4e2329 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmGroupCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmGroupCmd.java
@@ -18,6 +18,8 @@ package org.apache.cloudstack.api.command.user.autoscale;
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;
@@ -33,7 +35,8 @@ import com.cloud.event.EventTypes;
import com.cloud.network.as.AutoScaleVmGroup;
import com.cloud.user.Account;
-@APICommand(name = "deleteAutoScaleVmGroup", description = "Deletes a autoscale vm group.", responseObject = SuccessResponse.class)
+@APICommand(name = "deleteAutoScaleVmGroup", description = "Deletes a autoscale vm group.", responseObject = SuccessResponse.class, entityType = {AutoScaleVmGroup.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteAutoScaleVmGroupCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DeleteAutoScaleVmGroupCmd.class.getName());
private static final String s_name = "deleteautoscalevmgroupresponse";
@@ -41,6 +44,7 @@ public class DeleteAutoScaleVmGroupCmd extends BaseAsyncCmd {
// ////////////// API parameters /////////////////////
// ///////////////////////////////////////////////////
+ @ACL(accessType = AccessType.OperateEntry)
@Parameter(name = ApiConstants.ID,
type = CommandType.UUID,
entityType = AutoScaleVmGroupResponse.class,
@@ -93,7 +97,7 @@ public class DeleteAutoScaleVmGroupCmd extends BaseAsyncCmd {
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
s_logger.warn("Failed to delete autoscale vm group " + getId());
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete autoscale vm group");
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmProfileCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmProfileCmd.java
index 3d6d0305f88..779315a96dd 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmProfileCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmProfileCmd.java
@@ -18,6 +18,8 @@ package org.apache.cloudstack.api.command.user.autoscale;
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;
@@ -33,7 +35,8 @@ import com.cloud.event.EventTypes;
import com.cloud.network.as.AutoScaleVmProfile;
import com.cloud.user.Account;
-@APICommand(name = "deleteAutoScaleVmProfile", description = "Deletes a autoscale vm profile.", responseObject = SuccessResponse.class)
+@APICommand(name = "deleteAutoScaleVmProfile", description = "Deletes a autoscale vm profile.", responseObject = SuccessResponse.class, entityType = {AutoScaleVmProfile.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteAutoScaleVmProfileCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DeleteAutoScaleVmProfileCmd.class.getName());
private static final String s_name = "deleteautoscalevmprofileresponse";
@@ -41,6 +44,7 @@ public class DeleteAutoScaleVmProfileCmd extends BaseAsyncCmd {
// ////////////// API parameters /////////////////////
// ///////////////////////////////////////////////////
+ @ACL(accessType = AccessType.OperateEntry)
@Parameter(name = ApiConstants.ID,
type = CommandType.UUID,
entityType = AutoScaleVmProfileResponse.class,
@@ -92,7 +96,7 @@ public class DeleteAutoScaleVmProfileCmd extends BaseAsyncCmd {
boolean result = _autoScaleService.deleteAutoScaleVmProfile(id);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
s_logger.warn("Failed to delete autoscale vm profile " + getId());
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete autoscale vm profile");
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteConditionCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteConditionCmd.java
index 0cc23195c5a..24f4cc68784 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteConditionCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteConditionCmd.java
@@ -19,6 +19,8 @@ package org.apache.cloudstack.api.command.user.autoscale;
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;
@@ -34,7 +36,8 @@ import com.cloud.exception.ResourceInUseException;
import com.cloud.network.as.Condition;
import com.cloud.user.Account;
-@APICommand(name = "deleteCondition", description = "Removes a condition", responseObject = SuccessResponse.class)
+@APICommand(name = "deleteCondition", description = "Removes a condition", responseObject = SuccessResponse.class, entityType = {Condition.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteConditionCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DeleteConditionCmd.class.getName());
private static final String s_name = "deleteconditionresponse";
@@ -43,6 +46,7 @@ public class DeleteConditionCmd extends BaseAsyncCmd {
// ////////////// API parameters /////////////////////
// ///////////////////////////////////////////////////
+ @ACL(accessType = AccessType.OperateEntry)
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ConditionResponse.class, required = true, description = "the ID of the condition.")
private Long id;
@@ -61,7 +65,7 @@ public class DeleteConditionCmd extends BaseAsyncCmd {
}
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
s_logger.warn("Failed to delete condition " + getId());
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete condition.");
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/DisableAutoScaleVmGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/DisableAutoScaleVmGroupCmd.java
index 2bd6f87b01c..8eb1809f887 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/DisableAutoScaleVmGroupCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/DisableAutoScaleVmGroupCmd.java
@@ -19,6 +19,8 @@ package org.apache.cloudstack.api.command.user.autoscale;
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;
@@ -32,7 +34,8 @@ import com.cloud.event.EventTypes;
import com.cloud.network.as.AutoScaleVmGroup;
import com.cloud.user.Account;
-@APICommand(name = "disableAutoScaleVmGroup", description = "Disables an AutoScale Vm Group", responseObject = AutoScaleVmGroupResponse.class)
+@APICommand(name = "disableAutoScaleVmGroup", description = "Disables an AutoScale Vm Group", responseObject = AutoScaleVmGroupResponse.class, entityType = {AutoScaleVmGroup.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DisableAutoScaleVmGroupCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DisableAutoScaleVmGroupCmd.class.getName());
private static final String s_name = "disableautoscalevmGroupresponse";
@@ -41,6 +44,7 @@ public class DisableAutoScaleVmGroupCmd extends BaseAsyncCmd {
// ////////////// API parameters /////////////////////
// ///////////////////////////////////////////////////
+ @ACL(accessType = AccessType.OperateEntry)
@Parameter(name = ApiConstants.ID,
type = CommandType.UUID,
entityType = AutoScaleVmGroupResponse.class,
@@ -58,7 +62,7 @@ public class DisableAutoScaleVmGroupCmd extends BaseAsyncCmd {
if (result != null) {
AutoScaleVmGroupResponse response = _responseGenerator.createAutoScaleVmGroupResponse(result);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to disable AutoScale Vm Group");
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/EnableAutoScaleVmGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/EnableAutoScaleVmGroupCmd.java
index dc89f2b0794..59c9f7a9aa3 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/EnableAutoScaleVmGroupCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/EnableAutoScaleVmGroupCmd.java
@@ -19,6 +19,8 @@ package org.apache.cloudstack.api.command.user.autoscale;
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;
@@ -32,7 +34,8 @@ import com.cloud.event.EventTypes;
import com.cloud.network.as.AutoScaleVmGroup;
import com.cloud.user.Account;
-@APICommand(name = "enableAutoScaleVmGroup", description = "Enables an AutoScale Vm Group", responseObject = AutoScaleVmGroupResponse.class)
+@APICommand(name = "enableAutoScaleVmGroup", description = "Enables an AutoScale Vm Group", responseObject = AutoScaleVmGroupResponse.class, entityType = {AutoScaleVmGroup.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class EnableAutoScaleVmGroupCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(EnableAutoScaleVmGroupCmd.class.getName());
private static final String s_name = "enableautoscalevmGroupresponse";
@@ -41,6 +44,7 @@ public class EnableAutoScaleVmGroupCmd extends BaseAsyncCmd {
// ////////////// API parameters /////////////////////
// ///////////////////////////////////////////////////
+ @ACL(accessType = AccessType.OperateEntry)
@Parameter(name = ApiConstants.ID,
type = CommandType.UUID,
entityType = AutoScaleVmGroupResponse.class,
@@ -58,7 +62,7 @@ public class EnableAutoScaleVmGroupCmd extends BaseAsyncCmd {
if (result != null) {
AutoScaleVmGroupResponse response = _responseGenerator.createAutoScaleVmGroupResponse(result);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to enable AutoScale Vm Group");
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScalePoliciesCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScalePoliciesCmd.java
index 84ed30a25ce..c2b244f2a7f 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScalePoliciesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScalePoliciesCmd.java
@@ -32,7 +32,8 @@ import org.apache.cloudstack.api.response.ListResponse;
import com.cloud.network.as.AutoScalePolicy;
-@APICommand(name = "listAutoScalePolicies", description = "Lists autoscale policies.", responseObject = AutoScalePolicyResponse.class)
+@APICommand(name = "listAutoScalePolicies", description = "Lists autoscale policies.", responseObject = AutoScalePolicyResponse.class, entityType = {AutoScalePolicy.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListAutoScalePoliciesCmd extends BaseListAccountResourcesCmd {
public static final Logger s_logger = Logger.getLogger(ListAutoScalePoliciesCmd.class.getName());
@@ -99,7 +100,7 @@ public class ListAutoScalePoliciesCmd extends BaseListAccountResourcesCmd {
}
response.setResponses(responses);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmGroupsCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmGroupsCmd.java
index 4eda7a80608..37c90b9bfdb 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmGroupsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmGroupsCmd.java
@@ -21,6 +21,7 @@ import java.util.List;
import org.apache.log4j.Logger;
+import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd;
@@ -35,7 +36,8 @@ import org.apache.cloudstack.api.response.ZoneResponse;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.network.as.AutoScaleVmGroup;
-@APICommand(name = "listAutoScaleVmGroups", description = "Lists autoscale vm groups.", responseObject = AutoScaleVmGroupResponse.class)
+@APICommand(name = "listAutoScaleVmGroups", description = "Lists autoscale vm groups.", responseObject = AutoScaleVmGroupResponse.class, entityType = {AutoScaleVmGroup.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListAutoScaleVmGroupsCmd extends BaseListProjectAndAccountResourcesCmd {
public static final Logger s_logger = Logger.getLogger(ListAutoScaleVmGroupsCmd.class.getName());
@@ -60,6 +62,9 @@ public class ListAutoScaleVmGroupsCmd extends BaseListProjectAndAccountResources
@Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "the availability zone ID")
private Long zoneId;
+ @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin})
+ private Boolean display;
+
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
@@ -84,6 +89,14 @@ public class ListAutoScaleVmGroupsCmd extends BaseListProjectAndAccountResources
return zoneId;
}
+ @Override
+ public Boolean getDisplay() {
+ if (display != null) {
+ return display;
+ }
+ return super.getDisplay();
+ }
+
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@@ -110,6 +123,6 @@ public class ListAutoScaleVmGroupsCmd extends BaseListProjectAndAccountResources
}
response.setResponses(responses);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmProfilesCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmProfilesCmd.java
index 651f98703e8..554b48854a4 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmProfilesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmProfilesCmd.java
@@ -21,17 +21,21 @@ import java.util.List;
import org.apache.log4j.Logger;
+import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.AutoScaleVmProfileResponse;
import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.ServiceOfferingResponse;
import org.apache.cloudstack.api.response.TemplateResponse;
+import org.apache.cloudstack.api.response.ZoneResponse;
import com.cloud.network.as.AutoScaleVmProfile;
-@APICommand(name = "listAutoScaleVmProfiles", description = "Lists autoscale vm profiles.", responseObject = AutoScaleVmProfileResponse.class)
+@APICommand(name = "listAutoScaleVmProfiles", description = "Lists autoscale vm profiles.", responseObject = AutoScaleVmProfileResponse.class, entityType = {AutoScaleVmProfile.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListAutoScaleVmProfilesCmd extends BaseListProjectAndAccountResourcesCmd {
public static final Logger s_logger = Logger.getLogger(ListAutoScaleVmProfilesCmd.class.getName());
@@ -47,9 +51,18 @@ public class ListAutoScaleVmProfilesCmd extends BaseListProjectAndAccountResourc
@Parameter(name = ApiConstants.TEMPLATE_ID, type = CommandType.UUID, entityType = TemplateResponse.class, description = "the templateid of the autoscale vm profile")
private Long templateId;
+ @Parameter(name = ApiConstants.SERVICE_OFFERING_ID, type = CommandType.UUID, entityType = ServiceOfferingResponse.class, description = "list profiles by service offering id", since = "4.4")
+ private Long serviceOffId;
+
@Parameter(name = ApiConstants.OTHER_DEPLOY_PARAMS, type = CommandType.STRING, description = "the otherdeployparameters of the autoscale vm profile")
private String otherDeployParams;
+ @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, since = "4.4", description = "availability zone for the auto deployed virtual machine")
+ private Long zoneId;
+
+ @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin})
+ private Boolean display;
+
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
@@ -66,10 +79,27 @@ public class ListAutoScaleVmProfilesCmd extends BaseListProjectAndAccountResourc
return otherDeployParams;
}
+ public Long getServiceOfferingId() {
+ return serviceOffId;
+ }
+
+ public Long getZoneId() {
+ return zoneId;
+ }
+
+ @Override
+ public Boolean getDisplay() {
+ if (display != null) {
+ return display;
+ }
+ return super.getDisplay();
+ }
+
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
+
@Override
public String getCommandName() {
return s_name;
@@ -89,7 +119,7 @@ public class ListAutoScaleVmProfilesCmd extends BaseListProjectAndAccountResourc
}
response.setResponses(responses);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListConditionsCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListConditionsCmd.java
index 015f3ed2c6a..d75d64942f9 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListConditionsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListConditionsCmd.java
@@ -33,7 +33,8 @@ import org.apache.cloudstack.api.response.ListResponse;
import com.cloud.network.as.Condition;
-@APICommand(name = "listConditions", description = "List Conditions for the specific user", responseObject = ConditionResponse.class)
+@APICommand(name = "listConditions", description = "List Conditions for the specific user", responseObject = ConditionResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListConditionsCmd extends BaseListAccountResourcesCmd {
public static final Logger s_logger = Logger.getLogger(ListConditionsCmd.class.getName());
private static final String s_name = "listconditionsresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListCountersCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListCountersCmd.java
index f503b2bc81e..6a9ac8dfdcb 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListCountersCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListCountersCmd.java
@@ -32,7 +32,8 @@ import org.apache.cloudstack.api.response.ListResponse;
import com.cloud.network.as.Counter;
import com.cloud.user.Account;
-@APICommand(name = "listCounters", description = "List the counters", responseObject = CounterResponse.class)
+@APICommand(name = "listCounters", description = "List the counters", responseObject = CounterResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListCountersCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListCountersCmd.class.getName());
private static final String s_name = "counterresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScalePolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScalePolicyCmd.java
index 91adeb130b7..24858f4656b 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScalePolicyCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScalePolicyCmd.java
@@ -21,6 +21,8 @@ import java.util.List;
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.network.as.AutoScalePolicy;
import com.cloud.user.Account;
-@APICommand(name = "updateAutoScalePolicy", description = "Updates an existing autoscale policy.", responseObject = AutoScalePolicyResponse.class)
+@APICommand(name = "updateAutoScalePolicy", description = "Updates an existing autoscale policy.", responseObject = AutoScalePolicyResponse.class, entityType = {AutoScalePolicy.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class UpdateAutoScalePolicyCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(UpdateAutoScalePolicyCmd.class.getName());
@@ -61,6 +64,7 @@ public class UpdateAutoScalePolicyCmd extends BaseAsyncCmd {
description = "the list of IDs of the conditions that are being evaluated on every interval")
private List conditionIds;
+ @ACL(accessType = AccessType.OperateEntry)
@Parameter(name = ApiConstants.ID,
type = CommandType.UUID,
entityType = AutoScalePolicyResponse.class,
@@ -75,7 +79,7 @@ public class UpdateAutoScalePolicyCmd extends BaseAsyncCmd {
if (result != null) {
AutoScalePolicyResponse response = _responseGenerator.createAutoScalePolicyResponse(result);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update autoscale policy");
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmGroupCmd.java
index dbbd85f1c3a..76fa3d75d18 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmGroupCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmGroupCmd.java
@@ -21,11 +21,14 @@ import java.util.List;
import org.apache.log4j.Logger;
+import org.apache.cloudstack.acl.RoleType;
+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.BaseAsyncCustomIdCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.AutoScalePolicyResponse;
@@ -36,8 +39,9 @@ import com.cloud.event.EventTypes;
import com.cloud.network.as.AutoScaleVmGroup;
import com.cloud.user.Account;
-@APICommand(name = "updateAutoScaleVmGroup", description = "Updates an existing autoscale vm group.", responseObject = AutoScaleVmGroupResponse.class)
-public class UpdateAutoScaleVmGroupCmd extends BaseAsyncCmd {
+@APICommand(name = "updateAutoScaleVmGroup", description = "Updates an existing autoscale vm group.", responseObject = AutoScaleVmGroupResponse.class, entityType = {AutoScaleVmGroup.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class UpdateAutoScaleVmGroupCmd extends BaseAsyncCustomIdCmd {
public static final Logger s_logger = Logger.getLogger(UpdateAutoScaleVmGroupCmd.class.getName());
private static final String s_name = "updateautoscalevmgroupresponse";
@@ -73,6 +77,7 @@ public class UpdateAutoScaleVmGroupCmd extends BaseAsyncCmd {
description = "list of scaledown autoscale policies")
private List scaleDownPolicyIds;
+ @ACL(accessType = AccessType.OperateEntry)
@Parameter(name = ApiConstants.ID,
type = CommandType.UUID,
entityType = AutoScaleVmGroupResponse.class,
@@ -80,6 +85,9 @@ public class UpdateAutoScaleVmGroupCmd extends BaseAsyncCmd {
description = "the ID of the autoscale group")
private Long id;
+ @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the group to the end user or not", since = "4.4", authorized = {RoleType.Admin})
+ private Boolean display;
+
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@@ -91,7 +99,7 @@ public class UpdateAutoScaleVmGroupCmd extends BaseAsyncCmd {
if (result != null) {
AutoScaleVmGroupResponse response = _responseGenerator.createAutoScaleVmGroupResponse(result);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update autoscale VmGroup");
}
@@ -125,6 +133,10 @@ public class UpdateAutoScaleVmGroupCmd extends BaseAsyncCmd {
return scaleDownPolicyIds;
}
+ public Boolean getDisplay() {
+ return display;
+ }
+
@Override
public String getEventType() {
return EventTypes.EVENT_AUTOSCALEVMGROUP_UPDATE;
@@ -154,4 +166,11 @@ public class UpdateAutoScaleVmGroupCmd extends BaseAsyncCmd {
public ApiCommandJobType getInstanceType() {
return ApiCommandJobType.AutoScaleVmGroup;
}
+
+ @Override
+ public void checkUuid() {
+ if (getCustomId() != null) {
+ _uuidMgr.checkUuid(getCustomId(), AutoScaleVmGroup.class);
+ }
+ }
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmProfileCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmProfileCmd.java
index f3361d82fd9..deebe2ecc9a 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmProfileCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmProfileCmd.java
@@ -21,11 +21,14 @@ import java.util.Map;
import org.apache.log4j.Logger;
+import org.apache.cloudstack.acl.RoleType;
+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.BaseAsyncCustomIdCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.AutoScaleVmProfileResponse;
@@ -37,8 +40,9 @@ import com.cloud.event.EventTypes;
import com.cloud.network.as.AutoScaleVmProfile;
import com.cloud.user.Account;
-@APICommand(name = "updateAutoScaleVmProfile", description = "Updates an existing autoscale vm profile.", responseObject = AutoScaleVmProfileResponse.class)
-public class UpdateAutoScaleVmProfileCmd extends BaseAsyncCmd {
+@APICommand(name = "updateAutoScaleVmProfile", description = "Updates an existing autoscale vm profile.", responseObject = AutoScaleVmProfileResponse.class, entityType = {AutoScaleVmProfile.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class UpdateAutoScaleVmProfileCmd extends BaseAsyncCustomIdCmd {
public static final Logger s_logger = Logger.getLogger(UpdateAutoScaleVmProfileCmd.class.getName());
private static final String s_name = "updateautoscalevmprofileresponse";
@@ -47,6 +51,7 @@ public class UpdateAutoScaleVmProfileCmd extends BaseAsyncCmd {
// ////////////// API parameters /////////////////////
// ///////////////////////////////////////////////////
+ @ACL(accessType = AccessType.OperateEntry)
@Parameter(name = ApiConstants.ID,
type = CommandType.UUID,
entityType = AutoScaleVmProfileResponse.class,
@@ -76,6 +81,9 @@ public class UpdateAutoScaleVmProfileCmd extends BaseAsyncCmd {
description = "the ID of the user used to launch and destroy the VMs")
private Long autoscaleUserId;
+ @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the profile to the end user or not", since = "4.4", authorized = {RoleType.Admin})
+ private Boolean display;
+
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@@ -87,7 +95,7 @@ public class UpdateAutoScaleVmProfileCmd extends BaseAsyncCmd {
if (result != null) {
AutoScaleVmProfileResponse response = _responseGenerator.createAutoScaleVmProfileResponse(result);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update autoscale vm profile");
}
@@ -117,6 +125,10 @@ public class UpdateAutoScaleVmProfileCmd extends BaseAsyncCmd {
return destroyVmGraceperiod;
}
+ public Boolean getDisplay() {
+ return display;
+ }
+
@Override
public String getEventType() {
return EventTypes.EVENT_AUTOSCALEVMPROFILE_UPDATE;
@@ -146,4 +158,11 @@ public class UpdateAutoScaleVmProfileCmd extends BaseAsyncCmd {
public ApiCommandJobType getInstanceType() {
return ApiCommandJobType.AutoScaleVmProfile;
}
+
+ @Override
+ public void checkUuid() {
+ if (getCustomId() != null) {
+ _uuidMgr.checkUuid(getCustomId(), AutoScaleVmProfile.class);
+ }
+ }
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/config/ListCapabilitiesCmd.java b/api/src/org/apache/cloudstack/api/command/user/config/ListCapabilitiesCmd.java
index 5c008148207..e6696e17ff0 100644
--- a/api/src/org/apache/cloudstack/api/command/user/config/ListCapabilitiesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/config/ListCapabilitiesCmd.java
@@ -26,7 +26,8 @@ import org.apache.cloudstack.api.response.CapabilitiesResponse;
import com.cloud.user.Account;
-@APICommand(name = "listCapabilities", description = "Lists capabilities", responseObject = CapabilitiesResponse.class)
+@APICommand(name = "listCapabilities", description = "Lists capabilities", responseObject = CapabilitiesResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListCapabilitiesCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(ListCapabilitiesCmd.class.getName());
@@ -52,6 +53,7 @@ public class ListCapabilitiesCmd extends BaseCmd {
response.setSupportELB((String)capabilities.get("supportELB"));
response.setProjectInviteRequired((Boolean)capabilities.get("projectInviteRequired"));
response.setAllowUsersCreateProjects((Boolean)capabilities.get("allowusercreateprojects"));
+ response.setDiskOffMinSize((Long)capabilities.get("customDiskOffMinSize"));
response.setDiskOffMaxSize((Long)capabilities.get("customDiskOffMaxSize"));
response.setRegionSecondaryEnabled((Boolean)capabilities.get("regionSecondaryEnabled"));
response.setKVMSnapshotEnabled((Boolean)capabilities.get("KVMSnapshotEnabled"));
diff --git a/api/src/org/apache/cloudstack/api/command/user/event/ArchiveEventsCmd.java b/api/src/org/apache/cloudstack/api/command/user/event/ArchiveEventsCmd.java
index e51f85071de..e4970d6530e 100644
--- a/api/src/org/apache/cloudstack/api/command/user/event/ArchiveEventsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/event/ArchiveEventsCmd.java
@@ -31,10 +31,12 @@ import org.apache.cloudstack.api.response.EventResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.cloudstack.context.CallContext;
+import com.cloud.event.Event;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.user.Account;
-@APICommand(name = "archiveEvents", description = "Archive one or more events.", responseObject = SuccessResponse.class)
+@APICommand(name = "archiveEvents", description = "Archive one or more events.", responseObject = SuccessResponse.class, entityType = {Event.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ArchiveEventsCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(ArchiveEventsCmd.class.getName());
@@ -111,7 +113,7 @@ public class ArchiveEventsCmd extends BaseCmd {
boolean result = _mgr.archiveEvents(this);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Unable to archive Events, one or more parameters has invalid values");
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/event/DeleteEventsCmd.java b/api/src/org/apache/cloudstack/api/command/user/event/DeleteEventsCmd.java
index d00b58dd826..defb0096962 100644
--- a/api/src/org/apache/cloudstack/api/command/user/event/DeleteEventsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/event/DeleteEventsCmd.java
@@ -31,10 +31,12 @@ import org.apache.cloudstack.api.response.EventResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.cloudstack.context.CallContext;
+import com.cloud.event.Event;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.user.Account;
-@APICommand(name = "deleteEvents", description = "Delete one or more events.", responseObject = SuccessResponse.class)
+@APICommand(name = "deleteEvents", description = "Delete one or more events.", responseObject = SuccessResponse.class, entityType = {Event.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteEventsCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(DeleteEventsCmd.class.getName());
@@ -111,7 +113,7 @@ public class DeleteEventsCmd extends BaseCmd {
boolean result = _mgr.deleteEvents(this);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Unable to delete Events, one or more parameters has invalid values");
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/event/ListEventTypesCmd.java b/api/src/org/apache/cloudstack/api/command/user/event/ListEventTypesCmd.java
index 7a58d4c32ed..91f316c3d00 100644
--- a/api/src/org/apache/cloudstack/api/command/user/event/ListEventTypesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/event/ListEventTypesCmd.java
@@ -27,7 +27,8 @@ import org.apache.cloudstack.api.response.ListResponse;
import com.cloud.user.Account;
-@APICommand(name = "listEventTypes", description = "List Event Types", responseObject = EventTypeResponse.class)
+@APICommand(name = "listEventTypes", description = "List Event Types", responseObject = EventTypeResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListEventTypesCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(ListEventTypesCmd.class.getName());
private static final String s_name = "listeventtypesresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/user/event/ListEventsCmd.java b/api/src/org/apache/cloudstack/api/command/user/event/ListEventsCmd.java
index 0e45e4e86f4..a4934fa1dd9 100644
--- a/api/src/org/apache/cloudstack/api/command/user/event/ListEventsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/event/ListEventsCmd.java
@@ -27,7 +27,10 @@ import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.EventResponse;
import org.apache.cloudstack.api.response.ListResponse;
-@APICommand(name = "listEvents", description = "A command to list events.", responseObject = EventResponse.class)
+import com.cloud.event.Event;
+
+@APICommand(name = "listEvents", description = "A command to list events.", responseObject = EventResponse.class, entityType = {Event.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListEventsCmd extends BaseListProjectAndAccountResourcesCmd {
public static final Logger s_logger = Logger.getLogger(ListEventsCmd.class.getName());
@@ -108,6 +111,6 @@ public class ListEventsCmd extends BaseListProjectAndAccountResourcesCmd {
ListResponse response = _queryService.searchForEvents(this);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/CreateEgressFirewallRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/CreateEgressFirewallRuleCmd.java
index 778a18bc07c..579cccbfb25 100644
--- a/api/src/org/apache/cloudstack/api/command/user/firewall/CreateEgressFirewallRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/firewall/CreateEgressFirewallRuleCmd.java
@@ -22,6 +22,7 @@ import java.util.List;
import org.apache.log4j.Logger;
+import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants;
@@ -43,7 +44,8 @@ import com.cloud.network.rules.FirewallRule;
import com.cloud.user.Account;
import com.cloud.utils.net.NetUtils;
-@APICommand(name = "createEgressFirewallRule", description = "Creates a egress firewall rule for a given network ", responseObject = FirewallResponse.class)
+@APICommand(name = "createEgressFirewallRule", description = "Creates a egress firewall rule for a given network ", responseObject = FirewallResponse.class, entityType = {FirewallRule.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class CreateEgressFirewallRuleCmd extends BaseAsyncCreateCmd implements FirewallRule {
public static final Logger s_logger = Logger.getLogger(CreateEgressFirewallRuleCmd.class.getName());
@@ -84,6 +86,9 @@ public class CreateEgressFirewallRuleCmd extends BaseAsyncCreateCmd implements F
@Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "type of firewallrule: system/user")
private String type;
+ @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin})
+ private Boolean display;
+
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
@@ -221,8 +226,8 @@ public class CreateEgressFirewallRuleCmd extends BaseAsyncCreateCmd implements F
@Override
public long getDomainId() {
Network network = _networkService.getNetwork(networkId);
- return network.getDomainId();
- }
+ return network.getDomainId();
+ }
@Override
public void create() {
@@ -249,9 +254,9 @@ public class CreateEgressFirewallRuleCmd extends BaseAsyncCreateCmd implements F
}
if (getVpcId() != null) {
- throw new InvalidParameterValueException("Unable to create firewall rule for the network id=" + networkId +
- " as firewall egress rule can be created only for non vpc networks.");
- }
+ throw new InvalidParameterValueException("Unable to create firewall rule for the network id=" + networkId +
+ " as firewall egress rule can be created only for non vpc networks.");
+ }
try {
FirewallRule result = _firewallService.createEgressFirewallRule(this);
@@ -270,8 +275,8 @@ public class CreateEgressFirewallRuleCmd extends BaseAsyncCreateCmd implements F
@Override
public String getEventDescription() {
- Network network = _networkService.getNetwork(networkId);
- return ("Creating firewall rule for network: " + network + " for protocol:" + this.getProtocol());
+ Network network = _networkService.getNetwork(networkId);
+ return ("Creating firewall rule for network: " + network + " for protocol:" + getProtocol());
}
@Override
@@ -287,7 +292,7 @@ public class CreateEgressFirewallRuleCmd extends BaseAsyncCreateCmd implements F
@Override
public Long getSyncObjId() {
- return getNetworkId();
+ return getNetworkId();
}
@Override
@@ -332,7 +337,7 @@ public class CreateEgressFirewallRuleCmd extends BaseAsyncCreateCmd implements F
@Override
public TrafficType getTrafficType() {
- return TrafficType.Egress;
+ return TrafficType.Egress;
}
@Override
@@ -341,4 +346,18 @@ public class CreateEgressFirewallRuleCmd extends BaseAsyncCreateCmd implements F
return null;
}
+ @Override
+ public boolean isDisplay() {
+ if (display != null) {
+ return display;
+ } else {
+ return true;
+ }
+ }
+
+ @Override
+ public Class> getEntityType() {
+ return FirewallRule.class;
+ }
+
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java
index 44aa26fa519..b09d3a73a76 100644
--- a/api/src/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java
@@ -21,6 +21,7 @@ import java.util.List;
import org.apache.log4j.Logger;
+import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants;
@@ -42,7 +43,8 @@ import com.cloud.network.rules.FirewallRule;
import com.cloud.user.Account;
import com.cloud.utils.net.NetUtils;
-@APICommand(name = "createFirewallRule", description = "Creates a firewall rule for a given ip address", responseObject = FirewallResponse.class)
+@APICommand(name = "createFirewallRule", description = "Creates a firewall rule for a given ip address", responseObject = FirewallResponse.class, entityType = {FirewallRule.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class CreateFirewallRuleCmd extends BaseAsyncCreateCmd implements FirewallRule {
public static final Logger s_logger = Logger.getLogger(CreateFirewallRuleCmd.class.getName());
@@ -83,10 +85,14 @@ public class CreateFirewallRuleCmd extends BaseAsyncCreateCmd implements Firewal
@Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "type of firewallrule: system/user")
private String type;
+ @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin})
+ private Boolean display;
+
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
+
public Long getIpAddressId() {
return ipAddressId;
}
@@ -210,7 +216,7 @@ public class CreateFirewallRuleCmd extends BaseAsyncCreateCmd implements Firewal
if (ntwkId == null) {
throw new InvalidParameterValueException("Unable to create firewall rule for the ipAddress id=" + ipAddressId +
- " as ip is not associated with any network and no networkId is passed in");
+ " as ip is not associated with any network and no networkId is passed in");
}
return ntwkId;
}
@@ -261,7 +267,7 @@ public class CreateFirewallRuleCmd extends BaseAsyncCreateCmd implements Firewal
@Override
public String getEventDescription() {
IpAddress ip = _networkService.getIp(ipAddressId);
- return ("Creating firewall rule for Ip: " + ip.getAddress() + " for protocol:" + this.getProtocol());
+ return ("Creating firewall rule for Ip: " + ip.getAddress() + " for protocol:" + getProtocol());
}
@Override
@@ -303,7 +309,7 @@ public class CreateFirewallRuleCmd extends BaseAsyncCreateCmd implements Firewal
if (icmpType != null) {
return icmpType;
} else if (protocol.equalsIgnoreCase(NetUtils.ICMP_PROTO)) {
- return -1;
+ return -1;
}
return null;
@@ -333,4 +339,18 @@ public class CreateFirewallRuleCmd extends BaseAsyncCreateCmd implements Firewal
return FirewallRule.TrafficType.Ingress;
}
+ @Override
+ public boolean isDisplay() {
+ if (display != null) {
+ return display;
+ } else {
+ return true;
+ }
+ }
+
+ @Override
+ public Class> getEntityType() {
+ return FirewallRule.class;
+ }
+
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java
index 89dc0772562..f18767e1da6 100644
--- a/api/src/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java
@@ -20,6 +20,7 @@ import java.util.List;
import org.apache.log4j.Logger;
+import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants;
@@ -39,11 +40,16 @@ import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.NetworkRuleConflictException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.IpAddress;
+import com.cloud.network.rules.FirewallRule;
import com.cloud.network.rules.PortForwardingRule;
import com.cloud.user.Account;
import com.cloud.utils.net.Ip;
+import com.cloud.utils.net.NetUtils;
+import com.cloud.vm.VirtualMachine;
-@APICommand(name = "createPortForwardingRule", description = "Creates a port forwarding rule", responseObject = FirewallRuleResponse.class)
+@APICommand(name = "createPortForwardingRule", description = "Creates a port forwarding rule", responseObject = FirewallRuleResponse.class, entityType = {FirewallRule.class,
+ VirtualMachine.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class CreatePortForwardingRuleCmd extends BaseAsyncCreateCmd implements PortForwardingRule {
public static final Logger s_logger = Logger.getLogger(CreatePortForwardingRuleCmd.class.getName());
@@ -56,20 +62,20 @@ public class CreatePortForwardingRuleCmd extends BaseAsyncCreateCmd implements P
@Parameter(name = ApiConstants.IP_ADDRESS_ID,
type = CommandType.UUID,
entityType = IPAddressResponse.class,
- required = true,
- description = "the IP address id of the port forwarding rule")
+ required = true,
+ description = "the IP address id of the port forwarding rule")
private Long ipAddressId;
@Parameter(name = ApiConstants.PRIVATE_START_PORT,
type = CommandType.INTEGER,
required = true,
- description = "the starting port of port forwarding rule's private port range")
+ description = "the starting port of port forwarding rule's private port range")
private Integer privateStartPort;
@Parameter(name = ApiConstants.PROTOCOL,
type = CommandType.STRING,
required = true,
- description = "the protocol for the port fowarding rule. Valid values are TCP or UDP.")
+ description = "the protocol for the port fowarding rule. Valid values are TCP or UDP.")
private String protocol;
@Parameter(name = ApiConstants.PRIVATE_END_PORT,
@@ -81,7 +87,7 @@ public class CreatePortForwardingRuleCmd extends BaseAsyncCreateCmd implements P
@Parameter(name = ApiConstants.PUBLIC_START_PORT,
type = CommandType.INTEGER,
required = true,
- description = "the starting port of port forwarding rule's public port range")
+ description = "the starting port of port forwarding rule's public port range")
private Integer publicStartPort;
@Parameter(name = ApiConstants.PUBLIC_END_PORT,
@@ -93,8 +99,8 @@ public class CreatePortForwardingRuleCmd extends BaseAsyncCreateCmd implements P
@Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID,
type = CommandType.UUID,
entityType = UserVmResponse.class,
- required = true,
- description = "the ID of the virtual machine for the port forwarding rule")
+ required = true,
+ description = "the ID of the virtual machine for the port forwarding rule")
private Long virtualMachineId;
@Parameter(name = ApiConstants.CIDR_LIST, type = CommandType.LIST, collectionType = CommandType.STRING, description = "the cidr list to forward traffic from")
@@ -114,9 +120,12 @@ public class CreatePortForwardingRuleCmd extends BaseAsyncCreateCmd implements P
@Parameter(name = ApiConstants.VM_GUEST_IP,
type = CommandType.STRING,
required = false,
- description = "VM guest nic Secondary ip address for the port forwarding rule")
+ description = "VM guest nic Secondary ip address for the port forwarding rule")
private String vmSecondaryIp;
+ @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin})
+ private Boolean display;
+
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
@@ -281,7 +290,7 @@ public class CreatePortForwardingRuleCmd extends BaseAsyncCreateCmd implements P
}
if (ntwkId == null) {
throw new InvalidParameterValueException("Unable to create port forwarding rule for the ipAddress id=" + ipAddressId +
- " as ip is not associated with any network and no networkId is passed in");
+ " as ip is not associated with any network and no networkId is passed in");
}
return ntwkId;
}
@@ -334,13 +343,13 @@ public class CreatePortForwardingRuleCmd extends BaseAsyncCreateCmd implements P
Ip privateIp = getVmSecondaryIp();
if (privateIp != null) {
- if (!privateIp.isIp4()) {
+ if (!NetUtils.isValidIp(privateIp.toString())) {
throw new InvalidParameterValueException("Invalid vm ip address");
}
}
try {
- PortForwardingRule result = _rulesService.createPortForwardingRule(this, virtualMachineId, privateIp, getOpenFirewall());
+ PortForwardingRule result = _rulesService.createPortForwardingRule(this, virtualMachineId, privateIp, getOpenFirewall(), isDisplay());
setEntityId(result.getId());
setEntityUuid(result.getUuid());
} catch (NetworkRuleConflictException ex) {
@@ -415,4 +424,18 @@ public class CreatePortForwardingRuleCmd extends BaseAsyncCreateCmd implements P
return null;
}
+ @Override
+ public boolean isDisplay() {
+ if (display != null) {
+ return display;
+ } else {
+ return true;
+ }
+ }
+
+ @Override
+ public Class> getEntityType() {
+ return FirewallRule.class;
+ }
+
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/DeleteEgressFirewallRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/DeleteEgressFirewallRuleCmd.java
index 8e7b67996be..4d227722f8f 100644
--- a/api/src/org/apache/cloudstack/api/command/user/firewall/DeleteEgressFirewallRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/firewall/DeleteEgressFirewallRuleCmd.java
@@ -19,6 +19,8 @@ package org.apache.cloudstack.api.command.user.firewall;
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.exception.InvalidParameterValueException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.rules.FirewallRule;
-@APICommand(name = "deleteEgressFirewallRule", description = "Deletes an ggress firewall rule", responseObject = SuccessResponse.class)
+@APICommand(name = "deleteEgressFirewallRule", description = "Deletes an ggress firewall rule", responseObject = SuccessResponse.class, entityType = {FirewallRule.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteEgressFirewallRuleCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DeleteEgressFirewallRuleCmd.class.getName());
private static final String s_name = "deleteegressfirewallruleresponse";
@@ -45,6 +48,7 @@ public class DeleteEgressFirewallRuleCmd extends BaseAsyncCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
+ @ACL(accessType = AccessType.OperateEntry)
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, description = "the ID of the firewall rule")
private Long id;
@@ -98,7 +102,7 @@ public class DeleteEgressFirewallRuleCmd extends BaseAsyncCmd {
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete egress firewall rule");
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/DeleteFirewallRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/DeleteFirewallRuleCmd.java
index c3029b87d61..66dcc039c35 100644
--- a/api/src/org/apache/cloudstack/api/command/user/firewall/DeleteFirewallRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/firewall/DeleteFirewallRuleCmd.java
@@ -18,6 +18,8 @@ package org.apache.cloudstack.api.command.user.firewall;
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;
@@ -35,7 +37,8 @@ import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.rules.FirewallRule;
-@APICommand(name = "deleteFirewallRule", description = "Deletes a firewall rule", responseObject = SuccessResponse.class)
+@APICommand(name = "deleteFirewallRule", description = "Deletes a firewall rule", responseObject = SuccessResponse.class, entityType = {FirewallRule.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteFirewallRuleCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DeleteFirewallRuleCmd.class.getName());
private static final String s_name = "deletefirewallruleresponse";
@@ -43,7 +46,7 @@ public class DeleteFirewallRuleCmd extends BaseAsyncCmd {
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
-
+ @ACL(accessType = AccessType.OperateEntry)
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, description = "the ID of the firewall rule")
private Long id;
@@ -97,7 +100,7 @@ public class DeleteFirewallRuleCmd extends BaseAsyncCmd {
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete firewall rule");
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/DeletePortForwardingRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/DeletePortForwardingRuleCmd.java
index c493dd08970..4c7b07f14f0 100644
--- a/api/src/org/apache/cloudstack/api/command/user/firewall/DeletePortForwardingRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/firewall/DeletePortForwardingRuleCmd.java
@@ -18,6 +18,8 @@ package org.apache.cloudstack.api.command.user.firewall;
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;
@@ -34,7 +36,8 @@ import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.network.rules.PortForwardingRule;
-@APICommand(name = "deletePortForwardingRule", description = "Deletes a port forwarding rule", responseObject = SuccessResponse.class)
+@APICommand(name = "deletePortForwardingRule", description = "Deletes a port forwarding rule", responseObject = SuccessResponse.class, entityType = {PortForwardingRule.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeletePortForwardingRuleCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DeletePortForwardingRuleCmd.class.getName());
private static final String s_name = "deleteportforwardingruleresponse";
@@ -43,6 +46,7 @@ public class DeletePortForwardingRuleCmd extends BaseAsyncCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
+ @ACL(accessType = AccessType.OperateEntry)
@Parameter(name = ApiConstants.ID,
type = CommandType.UUID,
entityType = FirewallRuleResponse.class,
diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/ListEgressFirewallRulesCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/ListEgressFirewallRulesCmd.java
index 4ac94df50d5..e31496e4747 100644
--- a/api/src/org/apache/cloudstack/api/command/user/firewall/ListEgressFirewallRulesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/firewall/ListEgressFirewallRulesCmd.java
@@ -33,7 +33,8 @@ import org.apache.cloudstack.api.response.NetworkResponse;
import com.cloud.network.rules.FirewallRule;
import com.cloud.utils.Pair;
-@APICommand(name = "listEgressFirewallRules", description = "Lists all egress firewall rules for network id.", responseObject = FirewallResponse.class)
+@APICommand(name = "listEgressFirewallRules", description = "Lists all egress firewall rules for network id.", responseObject = FirewallResponse.class, entityType = {FirewallRule.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListEgressFirewallRulesCmd extends ListFirewallRulesCmd {
public static final Logger s_logger = Logger.getLogger(ListEgressFirewallRulesCmd.class.getName());
private static final String s_name = "listegressfirewallrulesresponse";
@@ -91,6 +92,6 @@ public class ListEgressFirewallRulesCmd extends ListFirewallRulesCmd {
}
response.setResponses(fwResponses, result.second());
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/ListFirewallRulesCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/ListFirewallRulesCmd.java
index 44d26e405a4..9c9fbc83971 100644
--- a/api/src/org/apache/cloudstack/api/command/user/firewall/ListFirewallRulesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/firewall/ListFirewallRulesCmd.java
@@ -21,6 +21,7 @@ import java.util.List;
import org.apache.log4j.Logger;
+import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
@@ -34,7 +35,8 @@ import org.apache.cloudstack.api.response.NetworkResponse;
import com.cloud.network.rules.FirewallRule;
import com.cloud.utils.Pair;
-@APICommand(name = "listFirewallRules", description = "Lists all firewall rules for an IP address.", responseObject = FirewallResponse.class)
+@APICommand(name = "listFirewallRules", description = "Lists all firewall rules for an IP address.", responseObject = FirewallResponse.class, entityType = {FirewallRule.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListFirewallRulesCmd extends BaseListTaggedResourcesCmd {
public static final Logger s_logger = Logger.getLogger(ListFirewallRulesCmd.class.getName());
private static final String s_name = "listfirewallrulesresponse";
@@ -58,6 +60,9 @@ public class ListFirewallRulesCmd extends BaseListTaggedResourcesCmd {
since = "4.3")
private Long networkId;
+ @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin})
+ private Boolean display;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -78,6 +83,14 @@ public class ListFirewallRulesCmd extends BaseListTaggedResourcesCmd {
return networkId;
}
+ @Override
+ public Boolean getDisplay() {
+ if (display != null) {
+ return display;
+ }
+ return super.getDisplay();
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -100,6 +113,6 @@ public class ListFirewallRulesCmd extends BaseListTaggedResourcesCmd {
}
response.setResponses(fwResponses, result.second());
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/ListPortForwardingRulesCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/ListPortForwardingRulesCmd.java
index bd8a7a1c7a4..cde2563f9ab 100644
--- a/api/src/org/apache/cloudstack/api/command/user/firewall/ListPortForwardingRulesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/firewall/ListPortForwardingRulesCmd.java
@@ -21,6 +21,7 @@ import java.util.List;
import org.apache.log4j.Logger;
+import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
@@ -33,7 +34,8 @@ import org.apache.cloudstack.api.response.NetworkResponse;
import com.cloud.network.rules.PortForwardingRule;
import com.cloud.utils.Pair;
-@APICommand(name = "listPortForwardingRules", description = "Lists all port forwarding rules for an IP address.", responseObject = FirewallRuleResponse.class)
+@APICommand(name = "listPortForwardingRules", description = "Lists all port forwarding rules for an IP address.", responseObject = FirewallRuleResponse.class, entityType = {PortForwardingRule.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListPortForwardingRulesCmd extends BaseListTaggedResourcesCmd {
public static final Logger s_logger = Logger.getLogger(ListPortForwardingRulesCmd.class.getName());
@@ -59,6 +61,9 @@ public class ListPortForwardingRulesCmd extends BaseListTaggedResourcesCmd {
since = "4.3")
private Long networkId;
+ @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin})
+ private Boolean display;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -75,6 +80,14 @@ public class ListPortForwardingRulesCmd extends BaseListTaggedResourcesCmd {
return networkId;
}
+ @Override
+ public Boolean getDisplay() {
+ if (display != null) {
+ return display;
+ }
+ return super.getDisplay();
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -97,6 +110,6 @@ public class ListPortForwardingRulesCmd extends BaseListTaggedResourcesCmd {
}
response.setResponses(fwResponses, result.second());
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/UpdateEgressFirewallRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/UpdateEgressFirewallRuleCmd.java
new file mode 100644
index 00000000000..079539624c7
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/firewall/UpdateEgressFirewallRuleCmd.java
@@ -0,0 +1,122 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.package org.apache.cloudstack.api.command.user.firewall;
+
+package org.apache.cloudstack.api.command.user.firewall;
+
+import org.apache.cloudstack.acl.RoleType;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseAsyncCustomIdCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.AccountResponse;
+import org.apache.cloudstack.api.response.FirewallResponse;
+import org.apache.cloudstack.api.response.FirewallRuleResponse;
+import org.apache.cloudstack.context.CallContext;
+import org.apache.log4j.Logger;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.rules.FirewallRule;
+import com.cloud.network.rules.FirewallRule.TrafficType;
+
+@APICommand(name = "updateEgressFirewallRule", description = "Updates egress firewall rule ", responseObject = FirewallResponse.class, since = "4.4",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class UpdateEgressFirewallRuleCmd extends BaseAsyncCustomIdCmd {
+ public static final Logger s_logger = Logger.getLogger(UpdateEgressFirewallRuleCmd.class.getName());
+
+ private static final String s_name = "updateegressfirewallruleresponse";
+
+ // ///////////////////////////////////////////////////
+ // ////////////// API parameters /////////////////////
+ // ///////////////////////////////////////////////////
+
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, description = "the ID of the egress firewall rule")
+ private Long id;
+
+ // unexposed parameter needed for events logging
+ @Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.UUID, entityType = AccountResponse.class, expose = false)
+ private Long ownerId;
+
+ @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin})
+ private Boolean display;
+
+ // ///////////////////////////////////////////////////
+ // ///////////////// Accessors ///////////////////////
+ // ///////////////////////////////////////////////////
+
+ public Long getId() {
+ return id;
+ }
+
+ public Boolean getDisplay() {
+ return display;
+ }
+ // ///////////////////////////////////////////////////
+ // ///////////// API Implementation///////////////////
+ // ///////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public void execute() throws ResourceUnavailableException {
+ CallContext.current().setEventDetails("Rule Id: " + id);
+ FirewallRule rule = _firewallService.updateFirewallRule(id, this.getCustomId(), getDisplay());
+
+ FirewallResponse fwResponse = new FirewallResponse();
+ if (rule != null) {
+ fwResponse = _responseGenerator.createFirewallResponse(rule);
+ setResponseObject(fwResponse);
+ }
+ fwResponse.setResponseName(getCommandName());
+ }
+
+ @Override
+ public void checkUuid() {
+ if (this.getCustomId() != null) {
+ _uuidMgr.checkUuid(this.getCustomId(), FirewallRule.class);
+ }
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_FIREWALL_UPDATE;
+
+ }
+
+ @Override
+ public String getEventDescription() {
+ return ("Updating egress firewall rule id=" + id);
+
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ if (ownerId == null) {
+ FirewallRule rule = _entityMgr.findById(FirewallRule.class, id);
+ if (rule == null || rule.getTrafficType() != TrafficType.Egress) {
+ throw new InvalidParameterValueException("Unable to find egress firewall rule by id");
+ } else {
+ ownerId = _entityMgr.findById(FirewallRule.class, id).getAccountId();
+ }
+ }
+ return ownerId;
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/UpdateFirewallRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/UpdateFirewallRuleCmd.java
new file mode 100644
index 00000000000..f68437192b7
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/firewall/UpdateFirewallRuleCmd.java
@@ -0,0 +1,123 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.package org.apache.cloudstack.api.command.user.firewall;
+
+package org.apache.cloudstack.api.command.user.firewall;
+
+import org.apache.cloudstack.acl.RoleType;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseAsyncCustomIdCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.AccountResponse;
+import org.apache.cloudstack.api.response.FirewallResponse;
+import org.apache.cloudstack.api.response.FirewallRuleResponse;
+import org.apache.cloudstack.context.CallContext;
+import org.apache.log4j.Logger;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.rules.FirewallRule;
+import com.cloud.network.rules.FirewallRule.TrafficType;
+
+@APICommand(name = "updateFirewallRule", description = "Updates firewall rule ", responseObject = FirewallResponse.class, since = "4.4",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class UpdateFirewallRuleCmd extends BaseAsyncCustomIdCmd {
+ public static final Logger s_logger = Logger.getLogger(UpdateFirewallRuleCmd.class.getName());
+
+ private static final String s_name = "updatefirewallruleresponse";
+
+ // ///////////////////////////////////////////////////
+ // ////////////// API parameters /////////////////////
+ // ///////////////////////////////////////////////////
+
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, description = "the ID of the firewall rule")
+ private Long id;
+
+ // unexposed parameter needed for events logging
+ @Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.UUID, entityType = AccountResponse.class, expose = false)
+ private Long ownerId;
+
+ @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin})
+ private Boolean display;
+
+ // ///////////////////////////////////////////////////
+ // ///////////////// Accessors ///////////////////////
+ // ///////////////////////////////////////////////////
+
+ public Long getId() {
+ return id;
+ }
+
+ public Boolean getDisplay() {
+ return display;
+ }
+
+ // ///////////////////////////////////////////////////
+ // ///////////// API Implementation///////////////////
+ // ///////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public void execute() throws ResourceUnavailableException {
+ CallContext.current().setEventDetails("Rule Id: " + id);
+ FirewallRule rule = _firewallService.updateFirewallRule(id, this.getCustomId(), getDisplay());
+
+ FirewallResponse fwResponse = new FirewallResponse();
+ if (rule != null) {
+ fwResponse = _responseGenerator.createFirewallResponse(rule);
+ setResponseObject(fwResponse);
+ }
+ fwResponse.setResponseName(getCommandName());
+ }
+
+ @Override
+ public void checkUuid() {
+ if (this.getCustomId() != null) {
+ _uuidMgr.checkUuid(this.getCustomId(), FirewallRule.class);
+ }
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_FIREWALL_UPDATE;
+
+ }
+
+ @Override
+ public String getEventDescription() {
+ return ("Updating firewall rule id=" + id);
+
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ if (ownerId == null) {
+ FirewallRule rule = _entityMgr.findById(FirewallRule.class, id);
+ if (rule == null || rule.getTrafficType() != TrafficType.Ingress) {
+ throw new InvalidParameterValueException("Unable to find firewall rule by id");
+ } else {
+ ownerId = _entityMgr.findById(FirewallRule.class, id).getAccountId();
+ }
+ }
+ return ownerId;
+ }
+}
\ No newline at end of file
diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/UpdatePortForwardingRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/UpdatePortForwardingRuleCmd.java
index d7e380feb57..78525ba0d87 100644
--- a/api/src/org/apache/cloudstack/api/command/user/firewall/UpdatePortForwardingRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/firewall/UpdatePortForwardingRuleCmd.java
@@ -18,9 +18,11 @@ package org.apache.cloudstack.api.command.user.firewall;
import org.apache.log4j.Logger;
+import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.BaseAsyncCustomIdCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.FirewallRuleResponse;
import org.apache.cloudstack.api.response.IPAddressResponse;
@@ -29,39 +31,42 @@ import org.apache.cloudstack.api.response.UserVmResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.network.IpAddress;
+import com.cloud.network.rules.FirewallRule;
+import com.cloud.network.rules.PortForwardingRule;
import com.cloud.user.Account;
@APICommand(name = "updatePortForwardingRule",
responseObject = FirewallRuleResponse.class,
- description = "Updates a port forwarding rule. Only the private port and the virtual machine can be updated.")
-public class UpdatePortForwardingRuleCmd extends BaseAsyncCmd {
+ description = "Updates a port forwarding rule. Only the private port and the virtual machine can be updated.", entityType = {PortForwardingRule.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class UpdatePortForwardingRuleCmd extends BaseAsyncCustomIdCmd {
public static final Logger s_logger = Logger.getLogger(UpdatePortForwardingRuleCmd.class.getName());
private static final String s_name = "updateportforwardingruleresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, description = "the ID of the port forwarding rule", since = "4.4")
+ private Long id;
@Parameter(name = ApiConstants.PRIVATE_IP, type = CommandType.STRING, description = "the private IP address of the port forwarding rule")
private String privateIp;
- @Parameter(name = ApiConstants.PRIVATE_PORT, type = CommandType.STRING, required = true, description = "the private port of the port forwarding rule")
+ @Parameter(name = ApiConstants.PRIVATE_PORT, type = CommandType.STRING, description = "the private port of the port forwarding rule")
private String privatePort;
@Parameter(name = ApiConstants.PROTOCOL,
type = CommandType.STRING,
- required = true,
description = "the protocol for the port fowarding rule. Valid values are TCP or UDP.")
private String protocol;
@Parameter(name = ApiConstants.IP_ADDRESS_ID,
type = CommandType.UUID,
entityType = IPAddressResponse.class,
- required = true,
description = "the IP address id of the port forwarding rule")
private Long publicIpId;
- @Parameter(name = ApiConstants.PUBLIC_PORT, type = CommandType.STRING, required = true, description = "the public port of the port forwarding rule")
+ @Parameter(name = ApiConstants.PUBLIC_PORT, type = CommandType.STRING, description = "the public port of the port forwarding rule")
private String publicPort;
@Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID,
@@ -70,6 +75,9 @@ public class UpdatePortForwardingRuleCmd extends BaseAsyncCmd {
description = "the ID of the virtual machine for the port forwarding rule")
private Long virtualMachineId;
+ @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin})
+ private Boolean display;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -98,6 +106,10 @@ public class UpdatePortForwardingRuleCmd extends BaseAsyncCmd {
return virtualMachineId;
}
+ public Boolean getDisplay() {
+ return display;
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -128,8 +140,22 @@ public class UpdatePortForwardingRuleCmd extends BaseAsyncCmd {
return "updating port forwarding rule";
}
+ @Override
+ public void checkUuid() {
+ if (getCustomId() != null) {
+ _uuidMgr.checkUuid(getCustomId(), FirewallRule.class);
+ }
+ }
+
@Override
public void execute() {
+ PortForwardingRule rule = _rulesService.updatePortForwardingRule(id, getCustomId(), getDisplay());
+ FirewallRuleResponse fwResponse = new FirewallRuleResponse();
+ if (rule != null) {
+ fwResponse = _responseGenerator.createPortForwardingRuleResponse(rule);
+ setResponseObject(fwResponse);
+ }
+ fwResponse.setResponseName(getCommandName());
//FIXME: PortForwardingRule result = _mgr.updatePortForwardingRule(this);
// if (result != null) {
// FirewallRuleResponse response = _responseGenerator.createFirewallRuleResponse(result);
diff --git a/api/src/org/apache/cloudstack/api/command/user/guest/ListGuestOsCategoriesCmd.java b/api/src/org/apache/cloudstack/api/command/user/guest/ListGuestOsCategoriesCmd.java
index 604f1ede0df..e82e3c45d1f 100644
--- a/api/src/org/apache/cloudstack/api/command/user/guest/ListGuestOsCategoriesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/guest/ListGuestOsCategoriesCmd.java
@@ -32,7 +32,8 @@ import org.apache.cloudstack.api.response.ListResponse;
import com.cloud.storage.GuestOsCategory;
import com.cloud.utils.Pair;
-@APICommand(name = "listOsCategories", description = "Lists all supported OS categories for this cloud.", responseObject = GuestOSCategoryResponse.class)
+@APICommand(name = "listOsCategories", description = "Lists all supported OS categories for this cloud.", responseObject = GuestOSCategoryResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListGuestOsCategoriesCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListIsosCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/user/guest/ListGuestOsCmd.java b/api/src/org/apache/cloudstack/api/command/user/guest/ListGuestOsCmd.java
index 287fb1e8ef5..15a625abfaa 100644
--- a/api/src/org/apache/cloudstack/api/command/user/guest/ListGuestOsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/guest/ListGuestOsCmd.java
@@ -33,7 +33,8 @@ import org.apache.cloudstack.api.response.ListResponse;
import com.cloud.storage.GuestOS;
import com.cloud.utils.Pair;
-@APICommand(name = "listOsTypes", description = "Lists all supported OS types for this cloud.", responseObject = GuestOSResponse.class)
+@APICommand(name = "listOsTypes", description = "Lists all supported OS types for this cloud.", responseObject = GuestOSResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListGuestOsCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListIsosCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/AttachIsoCmd.java b/api/src/org/apache/cloudstack/api/command/user/iso/AttachIsoCmd.java
index d38c8164273..1b8087b8c12 100644
--- a/api/src/org/apache/cloudstack/api/command/user/iso/AttachIsoCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/iso/AttachIsoCmd.java
@@ -23,6 +23,7 @@ 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.command.user.vm.DeployVMCmd;
import org.apache.cloudstack.api.response.TemplateResponse;
@@ -33,7 +34,8 @@ import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.uservm.UserVm;
-@APICommand(name = "attachIso", description = "Attaches an ISO to a virtual machine.", responseObject = UserVmResponse.class)
+@APICommand(name = "attachIso", description = "Attaches an ISO to a virtual machine.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
public class AttachIsoCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(AttachIsoCmd.class.getName());
@@ -43,15 +45,13 @@ public class AttachIsoCmd extends BaseAsyncCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TemplateResponse.class, required = true, description = "the ID of the ISO file")
- private Long id;
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TemplateResponse.class,
+ required = true, description = "the ID of the ISO file")
+ protected Long id;
- @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID,
- type = CommandType.UUID,
- entityType = UserVmResponse.class,
- required = true,
- description = "the ID of the virtual machine")
- private Long virtualMachineId;
+ @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, entityType = UserVmResponse.class,
+ required = true, description = "the ID of the virtual machine")
+ protected Long virtualMachineId;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
@@ -91,7 +91,7 @@ public class AttachIsoCmd extends BaseAsyncCmd {
@Override
public String getEventDescription() {
- return "attaching ISO: " + getId() + " to vm: " + getVirtualMachineId();
+ return "attaching ISO: " + getId() + " to vm: " + getVirtualMachineId();
}
@Override
@@ -101,9 +101,9 @@ public class AttachIsoCmd extends BaseAsyncCmd {
if (result) {
UserVm userVm = _responseGenerator.findUserVmById(virtualMachineId);
if (userVm != null) {
- UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", userVm).get(0);
+ UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Restricted, "virtualmachine", userVm).get(0);
response.setResponseName(DeployVMCmd.getResultObjectName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to attach iso");
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/CopyIsoCmd.java b/api/src/org/apache/cloudstack/api/command/user/iso/CopyIsoCmd.java
index 36193182be3..9002624c487 100644
--- a/api/src/org/apache/cloudstack/api/command/user/iso/CopyIsoCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/iso/CopyIsoCmd.java
@@ -19,10 +19,12 @@ package org.apache.cloudstack.api.command.user.iso;
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.template.CopyTemplateCmd;
import org.apache.cloudstack.api.response.TemplateResponse;
-@APICommand(name = "copyIso", description = "Copies an iso from one zone to another.", responseObject = TemplateResponse.class)
+@APICommand(name = "copyIso", description = "Copies an iso from one zone to another.", responseObject = TemplateResponse.class, responseView = ResponseView.Restricted,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class CopyIsoCmd extends CopyTemplateCmd {
public static final Logger s_logger = Logger.getLogger(CopyIsoCmd.class.getName());
private static final String s_name = "copyisoresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/DeleteIsoCmd.java b/api/src/org/apache/cloudstack/api/command/user/iso/DeleteIsoCmd.java
index 91ad5f1e11a..b07b08dbf84 100644
--- a/api/src/org/apache/cloudstack/api/command/user/iso/DeleteIsoCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/iso/DeleteIsoCmd.java
@@ -34,7 +34,8 @@ import com.cloud.event.EventTypes;
import com.cloud.template.VirtualMachineTemplate;
import com.cloud.user.Account;
-@APICommand(name = "deleteIso", description = "Deletes an ISO file.", responseObject = SuccessResponse.class)
+@APICommand(name = "deleteIso", description = "Deletes an ISO file.", responseObject = SuccessResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteIsoCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DeleteIsoCmd.class.getName());
private static final String s_name = "deleteisosresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/DetachIsoCmd.java b/api/src/org/apache/cloudstack/api/command/user/iso/DetachIsoCmd.java
index e40195b3185..97db2f37598 100644
--- a/api/src/org/apache/cloudstack/api/command/user/iso/DetachIsoCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/iso/DetachIsoCmd.java
@@ -23,6 +23,7 @@ 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.command.user.vm.DeployVMCmd;
import org.apache.cloudstack.api.response.UserVmResponse;
@@ -31,7 +32,8 @@ import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.uservm.UserVm;
-@APICommand(name = "detachIso", description = "Detaches any ISO file (if any) currently attached to a virtual machine.", responseObject = UserVmResponse.class)
+@APICommand(name = "detachIso", description = "Detaches any ISO file (if any) currently attached to a virtual machine.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
public class DetachIsoCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DetachIsoCmd.class.getName());
@@ -41,12 +43,9 @@ public class DetachIsoCmd extends BaseAsyncCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID,
- type = CommandType.UUID,
- entityType = UserVmResponse.class,
- required = true,
- description = "The ID of the virtual machine")
- private Long virtualMachineId;
+ @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType = UserVmResponse.class,
+ required=true, description="The ID of the virtual machine")
+ protected Long virtualMachineId;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
@@ -82,7 +81,7 @@ public class DetachIsoCmd extends BaseAsyncCmd {
@Override
public String getEventDescription() {
- return "detaching ISO from vm: " + getVirtualMachineId();
+ return "detaching ISO from vm: " + getVirtualMachineId();
}
@Override
@@ -90,9 +89,9 @@ public class DetachIsoCmd extends BaseAsyncCmd {
boolean result = _templateService.detachIso(virtualMachineId);
if (result) {
UserVm userVm = _entityMgr.findById(UserVm.class, virtualMachineId);
- UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", userVm).get(0);
+ UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Restricted, "virtualmachine", userVm).get(0);
response.setResponseName(DeployVMCmd.getResultObjectName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to detach iso");
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/ExtractIsoCmd.java b/api/src/org/apache/cloudstack/api/command/user/iso/ExtractIsoCmd.java
index 2fb215aea5d..b78a3d3db66 100644
--- a/api/src/org/apache/cloudstack/api/command/user/iso/ExtractIsoCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/iso/ExtractIsoCmd.java
@@ -35,7 +35,8 @@ import com.cloud.exception.InternalErrorException;
import com.cloud.template.VirtualMachineTemplate;
import com.cloud.user.Account;
-@APICommand(name = "extractIso", description = "Extracts an ISO", responseObject = ExtractResponse.class)
+@APICommand(name = "extractIso", description = "Extracts an ISO", responseObject = ExtractResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ExtractIsoCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(ExtractIsoCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/ListIsoPermissionsCmd.java b/api/src/org/apache/cloudstack/api/command/user/iso/ListIsoPermissionsCmd.java
index 9d9e44b447a..f8863d1f753 100644
--- a/api/src/org/apache/cloudstack/api/command/user/iso/ListIsoPermissionsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/iso/ListIsoPermissionsCmd.java
@@ -20,14 +20,15 @@ import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.BaseListTemplateOrIsoPermissionsCmd;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
import org.apache.cloudstack.api.response.TemplatePermissionsResponse;
import com.cloud.storage.Storage.ImageFormat;
import com.cloud.template.VirtualMachineTemplate;
-@APICommand(name = "listIsoPermissions",
- description = "List iso visibility and all accounts that have permissions to view this iso.",
- responseObject = TemplatePermissionsResponse.class)
+@APICommand(name = "listIsoPermissions", description = "List iso visibility and all accounts that have permissions to view this iso.", responseObject = TemplatePermissionsResponse.class, responseView = ResponseView.Restricted,
+ requestHasSensitiveInfo = false,
+ responseHasSensitiveInfo = false)
public class ListIsoPermissionsCmd extends BaseListTemplateOrIsoPermissionsCmd {
protected String getResponseName() {
return "listisopermissionsresponse";
@@ -47,4 +48,9 @@ public class ListIsoPermissionsCmd extends BaseListTemplateOrIsoPermissionsCmd {
protected boolean templateIsCorrectType(VirtualMachineTemplate template) {
return template.getFormat().equals(ImageFormat.ISO);
}
+
+ @Override
+ public void execute() {
+ executeWithView(ResponseView.Restricted);
+ }
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java b/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java
index 95b771fcc43..3aabf926fc6 100644
--- a/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java
@@ -23,6 +23,7 @@ import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.TemplateResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
@@ -31,7 +32,8 @@ import org.apache.cloudstack.context.CallContext;
import com.cloud.template.VirtualMachineTemplate.TemplateFilter;
import com.cloud.user.Account;
-@APICommand(name = "listIsos", description = "Lists all available ISO files.", responseObject = TemplateResponse.class)
+@APICommand(name = "listIsos", description = "Lists all available ISO files.", responseObject = TemplateResponse.class, responseView = ResponseView.Restricted,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListIsosCmd extends BaseListTaggedResourcesCmd {
public static final Logger s_logger = Logger.getLogger(ListIsosCmd.class.getName());
@@ -119,7 +121,7 @@ public class ListIsosCmd extends BaseListTaggedResourcesCmd {
public boolean listInReadyState() {
Account account = CallContext.current().getCallingAccount();
// It is account specific if account is admin type and domainId and accountName are not null
- boolean isAccountSpecific = (account == null || isAdmin(account.getType())) && (getAccountName() != null) && (getDomainId() != null);
+ boolean isAccountSpecific = (account == null || _accountService.isAdmin(account.getType())) && (getAccountName() != null) && (getDomainId() != null);
// Show only those that are downloaded.
TemplateFilter templateFilter = TemplateFilter.valueOf(getIsoFilter());
boolean onlyReady =
@@ -153,6 +155,6 @@ public class ListIsosCmd extends BaseListTaggedResourcesCmd {
public void execute() {
ListResponse response = _queryService.listIsos(this);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/RegisterIsoCmd.java b/api/src/org/apache/cloudstack/api/command/user/iso/RegisterIsoCmd.java
index 29e3d678857..37f294c31dc 100644
--- a/api/src/org/apache/cloudstack/api/command/user/iso/RegisterIsoCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/iso/RegisterIsoCmd.java
@@ -18,13 +18,12 @@ package org.apache.cloudstack.api.command.user.iso;
import java.util.List;
-import org.apache.log4j.Logger;
-
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.DomainResponse;
import org.apache.cloudstack.api.response.GuestOSResponse;
@@ -33,11 +32,13 @@ import org.apache.cloudstack.api.response.ProjectResponse;
import org.apache.cloudstack.api.response.TemplateResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.cloudstack.context.CallContext;
+import org.apache.log4j.Logger;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.template.VirtualMachineTemplate;
-@APICommand(name = "registerIso", responseObject = TemplateResponse.class, description = "Registers an existing ISO into the CloudStack Cloud.")
+@APICommand(name = "registerIso", responseObject = TemplateResponse.class, description = "Registers an existing ISO into the CloudStack Cloud.", responseView = ResponseView.Restricted,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class RegisterIsoCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(RegisterIsoCmd.class.getName());
@@ -80,12 +81,9 @@ public class RegisterIsoCmd extends BaseCmd {
@Parameter(name = ApiConstants.URL, type = CommandType.STRING, required = true, description = "the URL to where the ISO is currently being hosted")
private String url;
- @Parameter(name = ApiConstants.ZONE_ID,
- type = CommandType.UUID,
- entityType = ZoneResponse.class,
- required = true,
- description = "the ID of the zone you wish to register the ISO to.")
- private Long zoneId;
+ @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = ZoneResponse.class,
+ required=true, description="the ID of the zone you wish to register the ISO to.")
+ protected Long zoneId;
@Parameter(name = ApiConstants.DOMAIN_ID,
type = CommandType.UUID,
@@ -163,11 +161,11 @@ public class RegisterIsoCmd extends BaseCmd {
}
public String getImageStoreUuid() {
- return this.imageStoreUuid;
+ return imageStoreUuid;
}
public Boolean isDynamicallyScalable() {
- return isDynamicallyScalable == null ? false : isDynamicallyScalable;
+ return isDynamicallyScalable == null ? false : isDynamicallyScalable;
}
/////////////////////////////////////////////////////
@@ -181,7 +179,7 @@ public class RegisterIsoCmd extends BaseCmd {
@Override
public long getEntityOwnerId() {
- Long accountId = finalyzeAccountId(accountName, domainId, projectId, true);
+ Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true);
if (accountId == null) {
return CallContext.current().getCallingAccount().getId();
}
@@ -194,10 +192,10 @@ public class RegisterIsoCmd extends BaseCmd {
VirtualMachineTemplate template = _templateService.registerIso(this);
if (template != null) {
ListResponse response = new ListResponse();
- List templateResponses = _responseGenerator.createIsoResponses(template, zoneId, false);
+ List templateResponses = _responseGenerator.createIsoResponses(ResponseView.Restricted, template, zoneId, false);
response.setResponses(templateResponses);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to register iso");
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoCmd.java b/api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoCmd.java
index 6a471c944f8..b569d657beb 100644
--- a/api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoCmd.java
@@ -21,13 +21,15 @@ import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseUpdateTemplateOrIsoCmd;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.TemplateResponse;
import com.cloud.template.VirtualMachineTemplate;
import com.cloud.user.Account;
-@APICommand(name = "updateIso", description = "Updates an ISO file.", responseObject = TemplateResponse.class)
+@APICommand(name = "updateIso", description = "Updates an ISO file.", responseObject = TemplateResponse.class, responseView = ResponseView.Restricted,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class UpdateIsoCmd extends BaseUpdateTemplateOrIsoCmd {
public static final Logger s_logger = Logger.getLogger(UpdateIsoCmd.class.getName());
private static final String s_name = "updateisoresponse";
@@ -69,9 +71,9 @@ public class UpdateIsoCmd extends BaseUpdateTemplateOrIsoCmd {
public void execute() {
VirtualMachineTemplate result = _templateService.updateTemplate(this);
if (result != null) {
- TemplateResponse response = _responseGenerator.createTemplateUpdateResponse(result);
+ TemplateResponse response = _responseGenerator.createTemplateUpdateResponse(ResponseView.Restricted, result);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update iso");
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoPermissionsCmd.java b/api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoPermissionsCmd.java
index 8267b5c294a..b52bc91c7a5 100644
--- a/api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoPermissionsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoPermissionsCmd.java
@@ -25,7 +25,8 @@ import org.apache.cloudstack.api.response.SuccessResponse;
import com.cloud.template.VirtualMachineTemplate;
import com.cloud.user.Account;
-@APICommand(name = "updateIsoPermissions", description = "Updates iso permissions", responseObject = SuccessResponse.class)
+@APICommand(name = "updateIsoPermissions", description = "Updates iso permissions", responseObject = SuccessResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class UpdateIsoPermissionsCmd extends BaseUpdateTemplateOrIsoPermissionsCmd {
@Override
protected String getResponseName() {
diff --git a/api/src/org/apache/cloudstack/api/command/user/job/ListAsyncJobsCmd.java b/api/src/org/apache/cloudstack/api/command/user/job/ListAsyncJobsCmd.java
index 9d45d506bac..f7bfb94c7a0 100644
--- a/api/src/org/apache/cloudstack/api/command/user/job/ListAsyncJobsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/job/ListAsyncJobsCmd.java
@@ -25,7 +25,8 @@ import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.AsyncJobResponse;
import org.apache.cloudstack.api.response.ListResponse;
-@APICommand(name = "listAsyncJobs", description = "Lists all pending asynchronous jobs for the account.", responseObject = AsyncJobResponse.class)
+@APICommand(name = "listAsyncJobs", description = "Lists all pending asynchronous jobs for the account.", responseObject = AsyncJobResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListAsyncJobsCmd extends BaseListAccountResourcesCmd {
private static final String s_name = "listasyncjobsresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/user/job/QueryAsyncJobResultCmd.java b/api/src/org/apache/cloudstack/api/command/user/job/QueryAsyncJobResultCmd.java
index 1f9f5dbc411..fc46300a7ac 100644
--- a/api/src/org/apache/cloudstack/api/command/user/job/QueryAsyncJobResultCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/job/QueryAsyncJobResultCmd.java
@@ -26,7 +26,8 @@ import org.apache.cloudstack.api.response.AsyncJobResponse;
import com.cloud.user.Account;
-@APICommand(name = "queryAsyncJobResult", description = "Retrieves the current status of asynchronous job.", responseObject = AsyncJobResponse.class)
+@APICommand(name = "queryAsyncJobResult", description = "Retrieves the current status of asynchronous job.", responseObject = AsyncJobResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class QueryAsyncJobResultCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(QueryAsyncJobResultCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/AssignCertToLoadBalancerCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/AssignCertToLoadBalancerCmd.java
index 4ea4a588cea..ddafa72a674 100644
--- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/AssignCertToLoadBalancerCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/AssignCertToLoadBalancerCmd.java
@@ -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
@@ -37,12 +38,13 @@ import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.rules.LoadBalancer;
import com.cloud.user.Account;
-@APICommand(name = "assignCertToLoadBalancer", description = "Assigns a certificate to a Load Balancer Rule", responseObject = SuccessResponse.class)
+@APICommand(name = "assignCertToLoadBalancer", description = "Assigns a certificate to a Load Balancer Rule", responseObject = SuccessResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class AssignCertToLoadBalancerCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(AssignCertToLoadBalancerCmd.class.getName());
- private static final String s_name = "assignCertToLoadBalancer";
+ private static final String s_name = "assigncerttoloadbalancerresponse";
@Parameter(name = ApiConstants.LBID,
type = CommandType.UUID,
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/AssignToLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/AssignToLoadBalancerRuleCmd.java
index bcf6200ca10..a5199937f4e 100644
--- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/AssignToLoadBalancerRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/AssignToLoadBalancerRuleCmd.java
@@ -16,10 +16,17 @@
// under the License.
package org.apache.cloudstack.api.command.user.loadbalancer;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import org.apache.log4j.Logger;
+import 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;
@@ -33,13 +40,17 @@ import org.apache.cloudstack.context.CallContext;
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.network.rules.FirewallRule;
import com.cloud.network.rules.LoadBalancer;
import com.cloud.user.Account;
import com.cloud.utils.StringUtils;
+import com.cloud.vm.VirtualMachine;
@APICommand(name = "assignToLoadBalancerRule",
description = "Assigns virtual machine or a list of virtual machines to a load balancer rule.",
- responseObject = SuccessResponse.class)
+ responseObject = SuccessResponse.class, entityType = {FirewallRule.class, VirtualMachine.class},
+ requestHasSensitiveInfo = false,
+ responseHasSensitiveInfo = false)
public class AssignToLoadBalancerRuleCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(AssignToLoadBalancerRuleCmd.class.getName());
@@ -49,6 +60,7 @@ public class AssignToLoadBalancerRuleCmd extends BaseAsyncCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
+ @ACL(accessType = AccessType.OperateEntry)
@Parameter(name = ApiConstants.ID,
type = CommandType.UUID,
entityType = FirewallRuleResponse.class,
@@ -56,14 +68,20 @@ public class AssignToLoadBalancerRuleCmd extends BaseAsyncCmd {
description = "the ID of the load balancer rule")
private Long id;
+ @ACL(accessType = AccessType.OperateEntry)
@Parameter(name = ApiConstants.VIRTUAL_MACHINE_IDS,
type = CommandType.LIST,
collectionType = CommandType.UUID,
entityType = UserVmResponse.class,
- required = true,
description = "the list of IDs of the virtual machine that are being assigned to the load balancer rule(i.e. virtualMachineIds=1,2,3)")
private List virtualMachineIds;
+ @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID_IP,
+ type = CommandType.MAP,
+ description = "VM ID and IP map, vmidipmap[0].vmid=1 vmidipmap[0].ip=10.1.1.75",
+ since = "4.4")
+ private Map vmIdIpMap;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -76,6 +94,10 @@ public class AssignToLoadBalancerRuleCmd extends BaseAsyncCmd {
return virtualMachineIds;
}
+ public Map getVmIdIpMap() {
+ return vmIdIpMap;
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -104,13 +126,49 @@ public class AssignToLoadBalancerRuleCmd extends BaseAsyncCmd {
return "applying instances for load balancer: " + getLoadBalancerId() + " (ids: " + StringUtils.join(getVirtualMachineIds(), ",") + ")";
}
+
+ public Map> getVmIdIpListMap() {
+ Map> vmIdIpsMap = new HashMap>();
+ if (vmIdIpMap != null && !vmIdIpMap.isEmpty()) {
+ Collection idIpsCollection = vmIdIpMap.values();
+ Iterator iter = idIpsCollection.iterator();
+ while (iter.hasNext()) {
+ HashMap idIpsMap = (HashMap)iter.next();
+ String vmId = idIpsMap.get("vmid");
+ String vmIp = idIpsMap.get("vmip");
+
+ VirtualMachine lbvm = _entityMgr.findByUuid(VirtualMachine.class, vmId);
+ if (lbvm == null) {
+ throw new InvalidParameterValueException("Unable to find virtual machine ID: " + vmId);
+ }
+
+ Long longVmId = lbvm.getId();
+
+ List ipsList = null;
+ if (vmIdIpsMap.containsKey(longVmId)) {
+ ipsList = vmIdIpsMap.get(longVmId);
+ } else {
+ ipsList = new ArrayList();
+ }
+ ipsList.add(vmIp);
+ vmIdIpsMap.put(longVmId, ipsList);
+
+ }
+ }
+
+ return vmIdIpsMap;
+ }
+
@Override
public void execute() {
CallContext.current().setEventDetails("Load balancer Id: " + getLoadBalancerId() + " VmIds: " + StringUtils.join(getVirtualMachineIds(), ","));
- boolean result = _lbService.assignToLoadBalancer(getLoadBalancerId(), virtualMachineIds);
+
+ Map> vmIdIpsMap = getVmIdIpListMap();
+
+ boolean result = _lbService.assignToLoadBalancer(getLoadBalancerId(), virtualMachineIds, vmIdIpsMap);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to assign load balancer rule");
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateApplicationLoadBalancerCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateApplicationLoadBalancerCmd.java
index 0b8d3774dfa..fa9c22eec76 100644
--- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateApplicationLoadBalancerCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateApplicationLoadBalancerCmd.java
@@ -16,8 +16,7 @@
// under the License.
package org.apache.cloudstack.api.command.user.loadbalancer;
-import org.apache.log4j.Logger;
-
+import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants;
@@ -29,6 +28,7 @@ import org.apache.cloudstack.api.response.ApplicationLoadBalancerResponse;
import org.apache.cloudstack.api.response.NetworkResponse;
import org.apache.cloudstack.context.CallContext;
import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRule;
+import org.apache.log4j.Logger;
import com.cloud.event.EventTypes;
import com.cloud.exception.InsufficientAddressCapacityException;
@@ -41,7 +41,8 @@ import com.cloud.network.Network;
import com.cloud.network.rules.LoadBalancerContainer.Scheme;
import com.cloud.utils.net.NetUtils;
-@APICommand(name = "createLoadBalancer", description = "Creates a Load Balancer", responseObject = ApplicationLoadBalancerResponse.class, since = "4.2.0")
+@APICommand(name = "createLoadBalancer", description = "Creates a Load Balancer", responseObject = ApplicationLoadBalancerResponse.class, since = "4.2.0",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class CreateApplicationLoadBalancerCmd extends BaseAsyncCreateCmd {
public static final Logger s_logger = Logger.getLogger(CreateApplicationLoadBalancerCmd.class.getName());
@@ -94,9 +95,15 @@ public class CreateApplicationLoadBalancerCmd extends BaseAsyncCreateCmd {
description = "the load balancer scheme. Supported value in this release is Internal")
private String scheme;
+ @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin})
+ private Boolean display;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
+ public Boolean getDisplay() {
+ return display;
+ }
public String getAlgorithm() {
return algorithm;
@@ -215,7 +222,7 @@ public class CreateApplicationLoadBalancerCmd extends BaseAsyncCreateCmd {
ApplicationLoadBalancerRule result =
_appLbService.createApplicationLoadBalancer(getName(), getDescription(), getScheme(), getSourceIpNetworkId(), getSourceIp(), getSourcePort(),
- getInstancePort(), getAlgorithm(), getNetworkId(), getEntityOwnerId());
+ getInstancePort(), getAlgorithm(), getNetworkId(), getEntityOwnerId(), getDisplay());
this.setEntityId(result.getId());
this.setEntityUuid(result.getUuid());
} catch (NetworkRuleConflictException e) {
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBHealthCheckPolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBHealthCheckPolicyCmd.java
index 5ff7239e832..547274dc530 100644
--- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBHealthCheckPolicyCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBHealthCheckPolicyCmd.java
@@ -39,7 +39,9 @@ import com.cloud.user.Account;
@APICommand(name = "createLBHealthCheckPolicy",
description = "Creates a Load Balancer healthcheck policy ",
responseObject = LBHealthCheckResponse.class,
- since = "4.2.0")
+ since = "4.2.0",
+ requestHasSensitiveInfo = false,
+ responseHasSensitiveInfo = false)
@SuppressWarnings("rawtypes")
public class CreateLBHealthCheckPolicyCmd extends BaseAsyncCreateCmd {
public static final Logger s_logger = Logger.getLogger(CreateLBHealthCheckPolicyCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBStickinessPolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBStickinessPolicyCmd.java
index 159fcf542d6..738f837ccd2 100644
--- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBStickinessPolicyCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBStickinessPolicyCmd.java
@@ -40,7 +40,8 @@ import com.cloud.network.rules.LoadBalancer;
import com.cloud.network.rules.StickinessPolicy;
import com.cloud.user.Account;
-@APICommand(name = "createLBStickinessPolicy", description = "Creates a Load Balancer stickiness policy ", responseObject = LBStickinessResponse.class, since = "3.0.0")
+@APICommand(name = "createLBStickinessPolicy", description = "Creates a Load Balancer stickiness policy ", responseObject = LBStickinessResponse.class, since = "3.0.0",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
@SuppressWarnings("rawtypes")
public class CreateLBStickinessPolicyCmd extends BaseAsyncCreateCmd {
public static final Logger s_logger = Logger.getLogger(CreateLBStickinessPolicyCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLoadBalancerRuleCmd.java
index 764e3793728..a405913f78e 100644
--- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLoadBalancerRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLoadBalancerRuleCmd.java
@@ -18,8 +18,7 @@ package org.apache.cloudstack.api.command.user.loadbalancer;
import java.util.List;
-import org.apache.log4j.Logger;
-
+import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants;
@@ -34,6 +33,7 @@ import org.apache.cloudstack.api.response.LoadBalancerResponse;
import org.apache.cloudstack.api.response.NetworkResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.cloudstack.context.CallContext;
+import org.apache.log4j.Logger;
import com.cloud.dc.DataCenter;
import com.cloud.dc.DataCenter.NetworkType;
@@ -49,7 +49,8 @@ import com.cloud.network.rules.LoadBalancer;
import com.cloud.user.Account;
import com.cloud.utils.net.NetUtils;
-@APICommand(name = "createLoadBalancerRule", description = "Creates a load balancer rule", responseObject = LoadBalancerResponse.class)
+@APICommand(name = "createLoadBalancerRule", description = "Creates a load balancer rule", responseObject = LoadBalancerResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class CreateLoadBalancerRuleCmd extends BaseAsyncCreateCmd /*implements LoadBalancer */{
public static final Logger s_logger = Logger.getLogger(CreateLoadBalancerRuleCmd.class.getName());
@@ -116,10 +117,17 @@ public class CreateLoadBalancerRuleCmd extends BaseAsyncCreateCmd /*implements L
@Parameter(name = ApiConstants.PROTOCOL, type = CommandType.STRING, description = "The protocol for the LB")
private String lbProtocol;
+ @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin})
+ private Boolean display;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
+ public Boolean getDisplay() {
+ return display;
+ }
+
public String getAlgorithm() {
return algorithm;
}
@@ -301,7 +309,7 @@ public class CreateLoadBalancerRuleCmd extends BaseAsyncCreateCmd /*implements L
try {
LoadBalancer result =
_lbService.createPublicLoadBalancerRule(getXid(), getName(), getDescription(), getSourcePortStart(), getSourcePortEnd(), getDefaultPortStart(),
- getDefaultPortEnd(), getSourceIpAddressId(), getProtocol(), getAlgorithm(), getNetworkId(), getEntityOwnerId(), getOpenFirewall(), getLbProtocol());
+ getDefaultPortEnd(), getSourceIpAddressId(), getProtocol(), getAlgorithm(), getNetworkId(), getEntityOwnerId(), getOpenFirewall(), getLbProtocol(), getDisplay());
this.setEntityId(result.getId());
this.setEntityUuid(result.getUuid());
} catch (NetworkRuleConflictException e) {
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteApplicationLoadBalancerCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteApplicationLoadBalancerCmd.java
index 0b53d53f808..8f4ecca58f8 100644
--- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteApplicationLoadBalancerCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteApplicationLoadBalancerCmd.java
@@ -33,7 +33,8 @@ import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRule;
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
-@APICommand(name = "deleteLoadBalancer", description = "Deletes a load balancer", responseObject = SuccessResponse.class, since = "4.2.0")
+@APICommand(name = "deleteLoadBalancer", description = "Deletes a load balancer", responseObject = SuccessResponse.class, since = "4.2.0",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteApplicationLoadBalancerCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DeleteApplicationLoadBalancerCmd.class.getName());
private static final String s_name = "deleteloadbalancerresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLBHealthCheckPolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLBHealthCheckPolicyCmd.java
index d625ed571e4..3f27477903c 100644
--- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLBHealthCheckPolicyCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLBHealthCheckPolicyCmd.java
@@ -34,7 +34,8 @@ import com.cloud.network.rules.HealthCheckPolicy;
import com.cloud.network.rules.LoadBalancer;
import com.cloud.user.Account;
-@APICommand(name = "deleteLBHealthCheckPolicy", description = "Deletes a load balancer HealthCheck policy.", responseObject = SuccessResponse.class, since = "4.2.0")
+@APICommand(name = "deleteLBHealthCheckPolicy", description = "Deletes a load balancer HealthCheck policy.", responseObject = SuccessResponse.class, since = "4.2.0",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteLBHealthCheckPolicyCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DeleteLBHealthCheckPolicyCmd.class.getName());
private static final String s_name = "deletelbhealthcheckpolicyresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLBStickinessPolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLBStickinessPolicyCmd.java
index c4f72d9742b..ffed94bff12 100644
--- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLBStickinessPolicyCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLBStickinessPolicyCmd.java
@@ -34,7 +34,8 @@ import com.cloud.network.rules.LoadBalancer;
import com.cloud.network.rules.StickinessPolicy;
import com.cloud.user.Account;
-@APICommand(name = "deleteLBStickinessPolicy", description = "Deletes a LB stickiness policy.", responseObject = SuccessResponse.class, since = "3.0.0")
+@APICommand(name = "deleteLBStickinessPolicy", description = "Deletes a LB stickiness policy.", responseObject = SuccessResponse.class, since = "3.0.0",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteLBStickinessPolicyCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DeleteLBStickinessPolicyCmd.class.getName());
private static final String s_name = "deleteLBstickinessrruleresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLoadBalancerRuleCmd.java
index 1dc3cd17604..3423cab0518 100644
--- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLoadBalancerRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLoadBalancerRuleCmd.java
@@ -34,7 +34,8 @@ import com.cloud.exception.InvalidParameterValueException;
import com.cloud.network.rules.LoadBalancer;
import com.cloud.user.Account;
-@APICommand(name = "deleteLoadBalancerRule", description = "Deletes a load balancer rule.", responseObject = SuccessResponse.class)
+@APICommand(name = "deleteLoadBalancerRule", description = "Deletes a load balancer rule.", responseObject = SuccessResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteLoadBalancerRuleCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DeleteLoadBalancerRuleCmd.class.getName());
private static final String s_name = "deleteloadbalancerruleresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteSslCertCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteSslCertCmd.java
index d5683b0b198..fab11250687 100644
--- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteSslCertCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteSslCertCmd.java
@@ -37,7 +37,8 @@ import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.lb.CertService;
import com.cloud.utils.exception.CloudRuntimeException;
-@APICommand(name = "deleteSslCert", description = "Delete a certificate to cloudstack", responseObject = SuccessResponse.class)
+@APICommand(name = "deleteSslCert", description = "Delete a certificate to cloudstack", responseObject = SuccessResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteSslCertCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(DeleteSslCertCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListApplicationLoadBalancersCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListApplicationLoadBalancersCmd.java
index 05572c81b13..f8696d4b3f6 100644
--- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListApplicationLoadBalancersCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListApplicationLoadBalancersCmd.java
@@ -19,8 +19,7 @@ package org.apache.cloudstack.api.command.user.loadbalancer;
import java.util.ArrayList;
import java.util.List;
-import org.apache.log4j.Logger;
-
+import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
@@ -30,12 +29,14 @@ import org.apache.cloudstack.api.response.FirewallRuleResponse;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.NetworkResponse;
import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRule;
+import org.apache.log4j.Logger;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.network.rules.LoadBalancerContainer.Scheme;
import com.cloud.utils.Pair;
-@APICommand(name = "listLoadBalancers", description = "Lists Load Balancers", responseObject = ApplicationLoadBalancerResponse.class, since = "4.2.0")
+@APICommand(name = "listLoadBalancers", description = "Lists Load Balancers", responseObject = ApplicationLoadBalancerResponse.class, since = "4.2.0",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListApplicationLoadBalancersCmd extends BaseListTaggedResourcesCmd {
public static final Logger s_logger = Logger.getLogger(ListApplicationLoadBalancersCmd.class.getName());
@@ -66,6 +67,9 @@ public class ListApplicationLoadBalancersCmd extends BaseListTaggedResourcesCmd
@Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, description = "the network id of the Load Balancer")
private Long networkId;
+ @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin})
+ private Boolean display;
+
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
@@ -90,6 +94,14 @@ public class ListApplicationLoadBalancersCmd extends BaseListTaggedResourcesCmd
return sourceIpNetworkId;
}
+ @Override
+ public Boolean getDisplay() {
+ if (display != null) {
+ return display;
+ }
+ return super.getDisplay();
+ }
+
@Override
public String getCommandName() {
return s_name;
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLBHealthCheckPoliciesCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLBHealthCheckPoliciesCmd.java
index 8aa286fb3d7..5f4ca09ec98 100644
--- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLBHealthCheckPoliciesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLBHealthCheckPoliciesCmd.java
@@ -32,7 +32,8 @@ import org.apache.cloudstack.api.response.ListResponse;
import com.cloud.network.rules.HealthCheckPolicy;
import com.cloud.network.rules.LoadBalancer;
-@APICommand(name = "listLBHealthCheckPolicies", description = "Lists load balancer HealthCheck policies.", responseObject = LBHealthCheckResponse.class, since = "4.2.0")
+@APICommand(name = "listLBHealthCheckPolicies", description = "Lists load balancer HealthCheck policies.", responseObject = LBHealthCheckResponse.class, since = "4.2.0",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListLBHealthCheckPoliciesCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListLBHealthCheckPoliciesCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLBStickinessPoliciesCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLBStickinessPoliciesCmd.java
index ade487881b0..1ceb214b306 100644
--- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLBStickinessPoliciesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLBStickinessPoliciesCmd.java
@@ -34,7 +34,8 @@ import com.cloud.network.rules.LoadBalancer;
import com.cloud.network.rules.StickinessPolicy;
import com.cloud.user.Account;
-@APICommand(name = "listLBStickinessPolicies", description = "Lists LBStickiness policies.", responseObject = LBStickinessResponse.class, since = "3.0.0")
+@APICommand(name = "listLBStickinessPolicies", description = "Lists LBStickiness policies.", responseObject = LBStickinessResponse.class, since = "3.0.0",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListLBStickinessPoliciesCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListLBStickinessPoliciesCmd.class.getName());
@@ -75,7 +76,7 @@ public class ListLBStickinessPoliciesCmd extends BaseListCmd {
if (lb != null) {
//check permissions
Account caller = CallContext.current().getCallingAccount();
- _accountService.checkAccess(caller, null, true, lb);
+ _accountService.checkAccess(caller, null, lb);
List extends StickinessPolicy> stickinessPolicies = _lbService.searchForLBStickinessPolicies(this);
LBStickinessResponse spResponse = _responseGenerator.createLBStickinessPolicyResponse(stickinessPolicies, lb);
spResponses.add(spResponse);
@@ -83,7 +84,7 @@ public class ListLBStickinessPoliciesCmd extends BaseListCmd {
}
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRuleInstancesCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRuleInstancesCmd.java
index 2a39e1ac073..cc4203c359c 100644
--- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRuleInstancesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRuleInstancesCmd.java
@@ -19,12 +19,14 @@ package org.apache.cloudstack.api.command.user.loadbalancer;
import java.util.ArrayList;
import java.util.List;
+import org.apache.cloudstack.api.response.LoadBalancerRuleVmMapResponse;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
import org.apache.cloudstack.api.response.FirewallRuleResponse;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
@@ -32,9 +34,9 @@ import org.apache.cloudstack.api.response.UserVmResponse;
import com.cloud.uservm.UserVm;
import com.cloud.utils.Pair;
-@APICommand(name = "listLoadBalancerRuleInstances",
- description = "List all virtual machine instances that are assigned to a load balancer rule.",
- responseObject = UserVmResponse.class)
+@APICommand(name = "listLoadBalancerRuleInstances", description = "List all virtual machine instances that are assigned to a load balancer rule.", responseObject = LoadBalancerRuleVmMapResponse.class, responseView = ResponseView.Restricted,
+ requestHasSensitiveInfo = false,
+ responseHasSensitiveInfo = true)
public class ListLoadBalancerRuleInstancesCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListLoadBalancerRuleInstancesCmd.class.getName());
@@ -56,6 +58,13 @@ public class ListLoadBalancerRuleInstancesCmd extends BaseListCmd {
description = "the ID of the load balancer rule")
private Long id;
+
+ @Parameter(name = ApiConstants.LIST_LB_VMIPS,
+ type = CommandType.BOOLEAN,
+ description = "true if lb rule vm ip information to be included; default is false")
+ private boolean isListLbVmip;
+
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -68,6 +77,10 @@ public class ListLoadBalancerRuleInstancesCmd extends BaseListCmd {
return id;
}
+ public boolean isListLbVmip() {
+ return isListLbVmip;
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -79,20 +92,52 @@ public class ListLoadBalancerRuleInstancesCmd extends BaseListCmd {
@Override
public void execute() {
- Pair, List> vmServiceMap = _lbService.listLoadBalancerInstances(this);
+ Pair, List> vmServiceMap = _lbService.listLoadBalancerInstances(this);
List extends UserVm> result = vmServiceMap.first();
- List serviceStates = vmServiceMap.second();
- ListResponse response = new ListResponse();
- List vmResponses = new ArrayList();
- if (result != null) {
- vmResponses = _responseGenerator.createUserVmResponse("loadbalancerruleinstance", result.toArray(new UserVm[result.size()]));
- }
+ List serviceStates = vmServiceMap.second();
- for (int i = 0; i < result.size(); i++) {
- vmResponses.get(i).setServiceState(serviceStates.get(i));
+ if (!isListLbVmip()) {
+ // list lb instances
+ ListResponse response = new ListResponse();
+ List vmResponses = new ArrayList();
+ if (result != null) {
+ vmResponses = _responseGenerator.createUserVmResponse(ResponseView.Restricted, "loadbalancerruleinstance", result.toArray(new UserVm[result.size()]));
+
+
+ for (int i = 0; i < result.size(); i++) {
+ vmResponses.get(i).setServiceState(serviceStates.get(i));
+ }
+ }
+ response.setResponses(vmResponses);
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+
+
+ } else {
+ ListResponse lbRes = new ListResponse();
+
+ List vmResponses = new ArrayList();
+ List listlbVmRes = new ArrayList();
+
+ if (result != null) {
+ vmResponses = _responseGenerator.createUserVmResponse(ResponseView.Full, "loadbalancerruleinstance", result.toArray(new UserVm[result.size()]));
+
+
+ List ipaddr = null;
+
+ for (int i=0;i virtualMachineIds;
+ @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID_IP,
+ type = CommandType.MAP,
+ description = "VM ID and IP map, vmidipmap[0].vmid=1 vmidipmap[0].ip=10.1.1.75",
+ since = "4.4")
+ private Map vmIdIpMap;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -76,6 +89,10 @@ public class RemoveFromLoadBalancerRuleCmd extends BaseAsyncCmd {
return virtualMachineIds;
}
+ public Map getVmIdIpMap() {
+ return vmIdIpMap;
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -99,20 +116,58 @@ public class RemoveFromLoadBalancerRuleCmd extends BaseAsyncCmd {
return EventTypes.EVENT_REMOVE_FROM_LOAD_BALANCER_RULE;
}
+
+ public Map> getVmIdIpListMap() {
+ Map> vmIdIpsMap = new HashMap>();
+ if (vmIdIpMap != null && !vmIdIpMap.isEmpty()) {
+ Collection idIpsCollection = vmIdIpMap.values();
+ Iterator iter = idIpsCollection.iterator();
+ while (iter.hasNext()) {
+ HashMap idIpsMap = (HashMap)iter.next();
+ String vmId = idIpsMap.get("vmid");
+ String vmIp = idIpsMap.get("vmip");
+
+ VirtualMachine lbvm = _entityMgr.findByUuid(VirtualMachine.class, vmId);
+ if (lbvm == null) {
+ throw new InvalidParameterValueException("Unable to find virtual machine ID: " + vmId);
+ }
+
+ Long longVmId = lbvm.getId();
+
+ List ipsList = null;
+ if (vmIdIpsMap.containsKey(longVmId)) {
+ ipsList = vmIdIpsMap.get(longVmId);
+ } else {
+ ipsList = new ArrayList();
+ }
+ ipsList.add(vmIp);
+ vmIdIpsMap.put(longVmId, ipsList);
+
+ }
+ }
+
+ return vmIdIpsMap;
+ }
+
@Override
public String getEventDescription() {
return "removing instances from load balancer: " + getId() + " (ids: " + StringUtils.join(getVirtualMachineIds(), ",") + ")";
}
@Override
- public void execute() {
+ public void execute() {
CallContext.current().setEventDetails("Load balancer Id: " + getId() + " VmIds: " + StringUtils.join(getVirtualMachineIds(), ","));
- boolean result = _lbService.removeFromLoadBalancer(id, virtualMachineIds);
- if (result) {
- SuccessResponse response = new SuccessResponse(getCommandName());
- this.setResponseObject(response);
- } else {
- throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove instance from load balancer rule");
+ Map> vmIdIpsMap = getVmIdIpListMap();
+ try {
+ boolean result = _lbService.removeFromLoadBalancer(id, virtualMachineIds, vmIdIpsMap);
+ if (result) {
+ SuccessResponse response = new SuccessResponse(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove instance from load balancer rule");
+ }
+ }catch (InvalidParameterValueException ex) {
+ throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Failed to remove instance from load balancer rule");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateApplicationLoadBalancerCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateApplicationLoadBalancerCmd.java
new file mode 100644
index 00000000000..fbda84ddce9
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateApplicationLoadBalancerCmd.java
@@ -0,0 +1,105 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.user.loadbalancer;
+
+import org.apache.cloudstack.acl.RoleType;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseAsyncCustomIdCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.ApplicationLoadBalancerResponse;
+import org.apache.cloudstack.api.response.FirewallRuleResponse;
+import org.apache.cloudstack.context.CallContext;
+import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRule;
+import org.apache.log4j.Logger;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.network.rules.FirewallRule;
+
+@APICommand(name = "updateLoadBalancer", description = "Updates a Load Balancer", responseObject = ApplicationLoadBalancerResponse.class, since = "4.4.0",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class UpdateApplicationLoadBalancerCmd extends BaseAsyncCustomIdCmd {
+ public static final Logger s_logger = Logger.getLogger(UpdateApplicationLoadBalancerCmd.class.getName());
+
+ private static final String s_name = "updateloadbalancerresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, description = "the ID of the Load Balancer")
+ private Long id;
+
+ @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin})
+ private Boolean display;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public Boolean getDisplay() {
+ return display;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ ApplicationLoadBalancerRule lb = _entityMgr.findById(ApplicationLoadBalancerRule.class, getId());
+ if (lb != null) {
+ return lb.getAccountId();
+ } else {
+ throw new InvalidParameterValueException("Can't find load balancer by id specified");
+ }
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_LOAD_BALANCER_UPDATE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "updating load balancer: " + getId();
+ }
+
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+ @Override
+ public void execute() {
+ CallContext.current().setEventDetails("Load balancer Id: " + getId());
+ ApplicationLoadBalancerRule rule = _appLbService.updateApplicationLoadBalancer(getId(), this.getCustomId(), getDisplay());
+ ApplicationLoadBalancerResponse lbResponse = _responseGenerator.createLoadBalancerContainerReponse(rule, _lbService.getLbInstances(getId()));
+ setResponseObject(lbResponse);
+ lbResponse.setResponseName(getCommandName());
+ }
+
+ @Override
+ public void checkUuid() {
+ if (this.getCustomId() != null) {
+ _uuidMgr.checkUuid(this.getCustomId(), FirewallRule.class);
+ }
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLoadBalancerRuleCmd.java
index d68167d425d..03dd62179ea 100644
--- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLoadBalancerRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLoadBalancerRuleCmd.java
@@ -16,25 +16,28 @@
// under the License.
package org.apache.cloudstack.api.command.user.loadbalancer;
-import org.apache.log4j.Logger;
-
+import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.BaseAsyncCustomIdCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.FirewallRuleResponse;
import org.apache.cloudstack.api.response.LoadBalancerResponse;
import org.apache.cloudstack.context.CallContext;
+import org.apache.log4j.Logger;
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.network.rules.FirewallRule;
import com.cloud.network.rules.LoadBalancer;
import com.cloud.user.Account;
-@APICommand(name = "updateLoadBalancerRule", description = "Updates load balancer", responseObject = LoadBalancerResponse.class)
-public class UpdateLoadBalancerRuleCmd extends BaseAsyncCmd {
+@APICommand(name = "updateLoadBalancerRule", description = "Updates load balancer", responseObject = LoadBalancerResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class UpdateLoadBalancerRuleCmd extends BaseAsyncCustomIdCmd {
public static final Logger s_logger = Logger.getLogger(UpdateLoadBalancerRuleCmd.class.getName());
private static final String s_name = "updateloadbalancerruleresponse";
@@ -58,6 +61,9 @@ public class UpdateLoadBalancerRuleCmd extends BaseAsyncCmd {
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the load balancer rule")
private String loadBalancerName;
+ @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin})
+ private Boolean display;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -78,6 +84,10 @@ public class UpdateLoadBalancerRuleCmd extends BaseAsyncCmd {
return loadBalancerName;
}
+ public Boolean getDisplay() {
+ return display;
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -132,4 +142,11 @@ public class UpdateLoadBalancerRuleCmd extends BaseAsyncCmd {
}
return lb.getNetworkId();
}
+
+ @Override
+ public void checkUuid() {
+ if (this.getCustomId() != null) {
+ _uuidMgr.checkUuid(this.getCustomId(), FirewallRule.class);
+ }
+ }
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UploadSslCertCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UploadSslCertCmd.java
index 00bd01343dd..7b150a7fe06 100644
--- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UploadSslCertCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UploadSslCertCmd.java
@@ -36,7 +36,8 @@ import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.lb.CertService;
-@APICommand(name = "uploadSslCert", description = "Upload a certificate to cloudstack", responseObject = SslCertResponse.class)
+@APICommand(name = "uploadSslCert", description = "Upload a certificate to cloudstack", responseObject = SslCertResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class UploadSslCertCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(UploadSslCertCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/user/nat/CreateIpForwardingRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/nat/CreateIpForwardingRuleCmd.java
index 0917d526b13..8925d066fe9 100644
--- a/api/src/org/apache/cloudstack/api/command/user/nat/CreateIpForwardingRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/nat/CreateIpForwardingRuleCmd.java
@@ -42,7 +42,8 @@ import com.cloud.network.rules.FirewallRule;
import com.cloud.network.rules.StaticNatRule;
import com.cloud.user.Account;
-@APICommand(name = "createIpForwardingRule", description = "Creates an ip forwarding rule", responseObject = FirewallRuleResponse.class)
+@APICommand(name = "createIpForwardingRule", description = "Creates an ip forwarding rule", responseObject = FirewallRuleResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class CreateIpForwardingRuleCmd extends BaseAsyncCreateCmd implements StaticNatRule {
public static final Logger s_logger = Logger.getLogger(CreateIpForwardingRuleCmd.class.getName());
@@ -126,7 +127,7 @@ public class CreateIpForwardingRuleCmd extends BaseAsyncCreateCmd implements Sta
StaticNatRule staticNatRule = _rulesService.buildStaticNatRule(rule, false);
IpForwardingRuleResponse fwResponse = _responseGenerator.createIpForwardingRuleResponse(staticNatRule);
fwResponse.setResponseName(getCommandName());
- this.setResponseObject(fwResponse);
+ setResponseObject(fwResponse);
} finally {
if (!result || rule == null) {
@@ -152,8 +153,8 @@ public class CreateIpForwardingRuleCmd extends BaseAsyncCreateCmd implements Sta
try {
StaticNatRule rule = _rulesService.createStaticNatRule(this, getOpenFirewall());
- this.setEntityId(rule.getId());
- this.setEntityUuid(rule.getUuid());
+ setEntityId(rule.getId());
+ setEntityUuid(rule.getUuid());
} catch (NetworkRuleConflictException e) {
s_logger.info("Unable to create Static Nat Rule due to ", e);
throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, e.getMessage());
@@ -179,7 +180,7 @@ public class CreateIpForwardingRuleCmd extends BaseAsyncCreateCmd implements Sta
@Override
public String getEventDescription() {
IpAddress ip = _networkService.getIp(ipAddressId);
- return ("Applying an ipforwarding 1:1 NAT rule for Ip: " + ip.getAddress() + " with virtual machine:" + this.getVirtualMachineId());
+ return ("Applying an ipforwarding 1:1 NAT rule for Ip: " + ip.getAddress() + " with virtual machine:" + getVirtualMachineId());
}
private long getVirtualMachineId() {
@@ -317,4 +318,14 @@ public class CreateIpForwardingRuleCmd extends BaseAsyncCreateCmd implements Sta
return null;
}
+ @Override
+ public boolean isDisplay() {
+ return true;
+ }
+
+ @Override
+ public Class> getEntityType() {
+ return FirewallRule.class;
+ }
+
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/nat/DeleteIpForwardingRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/nat/DeleteIpForwardingRuleCmd.java
index 66a9f8aee9e..52a5ba777e0 100644
--- a/api/src/org/apache/cloudstack/api/command/user/nat/DeleteIpForwardingRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/nat/DeleteIpForwardingRuleCmd.java
@@ -34,7 +34,8 @@ import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.network.rules.FirewallRule;
-@APICommand(name = "deleteIpForwardingRule", description = "Deletes an ip forwarding rule", responseObject = SuccessResponse.class)
+@APICommand(name = "deleteIpForwardingRule", description = "Deletes an ip forwarding rule", responseObject = SuccessResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteIpForwardingRuleCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DeleteIpForwardingRuleCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/user/nat/DisableStaticNatCmd.java b/api/src/org/apache/cloudstack/api/command/user/nat/DisableStaticNatCmd.java
index 351d3ae2c2b..1df77ec0fda 100644
--- a/api/src/org/apache/cloudstack/api/command/user/nat/DisableStaticNatCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/nat/DisableStaticNatCmd.java
@@ -35,7 +35,8 @@ import com.cloud.exception.NetworkRuleConflictException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.IpAddress;
-@APICommand(name = "disableStaticNat", description = "Disables static rule for given ip address", responseObject = SuccessResponse.class)
+@APICommand(name = "disableStaticNat", description = "Disables static rule for given ip address", responseObject = SuccessResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DisableStaticNatCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DeletePortForwardingRuleCmd.class.getName());
private static final String s_name = "disablestaticnatresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/user/nat/EnableStaticNatCmd.java b/api/src/org/apache/cloudstack/api/command/user/nat/EnableStaticNatCmd.java
index 832cbc2d06d..94699ac6ffa 100644
--- a/api/src/org/apache/cloudstack/api/command/user/nat/EnableStaticNatCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/nat/EnableStaticNatCmd.java
@@ -18,6 +18,8 @@ package org.apache.cloudstack.api.command.user.nat;
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;
@@ -35,8 +37,11 @@ import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.IpAddress;
import com.cloud.user.Account;
import com.cloud.uservm.UserVm;
+import com.cloud.vm.VirtualMachine;
-@APICommand(name = "enableStaticNat", description = "Enables static nat for given ip address", responseObject = SuccessResponse.class)
+@APICommand(name = "enableStaticNat", description = "Enables static nat for given ip address", responseObject = SuccessResponse.class,
+ entityType = {IpAddress.class, VirtualMachine.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class EnableStaticNatCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(CreateIpForwardingRuleCmd.class.getName());
@@ -46,10 +51,12 @@ public class EnableStaticNatCmd extends BaseCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
+ @ACL(accessType = AccessType.OperateEntry)
@Parameter(name = ApiConstants.IP_ADDRESS_ID, type = CommandType.UUID, entityType = IPAddressResponse.class, required = true, description = "the public IP "
+ "address id for which static nat feature is being enabled")
private Long ipAddressId;
+ @ACL(accessType = AccessType.OperateEntry)
@Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, entityType = UserVmResponse.class, required = true, description = "the ID of "
+ "the virtual machine for enabling static nat feature")
private Long virtualMachineId;
@@ -132,7 +139,7 @@ public class EnableStaticNatCmd extends BaseCmd {
boolean result = _rulesService.enableStaticNat(ipAddressId, virtualMachineId, getNetworkId(), getVmSecondaryIp());
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to enable static nat");
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/nat/ListIpForwardingRulesCmd.java b/api/src/org/apache/cloudstack/api/command/user/nat/ListIpForwardingRulesCmd.java
index dca1c2379e5..ecb0c44c700 100644
--- a/api/src/org/apache/cloudstack/api/command/user/nat/ListIpForwardingRulesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/nat/ListIpForwardingRulesCmd.java
@@ -35,7 +35,8 @@ import com.cloud.network.rules.FirewallRule;
import com.cloud.network.rules.StaticNatRule;
import com.cloud.utils.Pair;
-@APICommand(name = "listIpForwardingRules", description = "List the ip forwarding rules", responseObject = FirewallRuleResponse.class)
+@APICommand(name = "listIpForwardingRules", description = "List the ip forwarding rules", responseObject = FirewallRuleResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListIpForwardingRulesCmd extends BaseListProjectAndAccountResourcesCmd {
public static final Logger s_logger = Logger.getLogger(ListIpForwardingRulesCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkACLCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkACLCmd.java
index 9934a4fefcc..e47fa8b2cf7 100644
--- a/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkACLCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkACLCmd.java
@@ -19,9 +19,7 @@ package org.apache.cloudstack.api.command.user.network;
import java.util.ArrayList;
import java.util.List;
-import org.apache.commons.lang.StringUtils;
-import org.apache.log4j.Logger;
-
+import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
@@ -32,6 +30,8 @@ import org.apache.cloudstack.api.response.NetworkACLItemResponse;
import org.apache.cloudstack.api.response.NetworkACLResponse;
import org.apache.cloudstack.api.response.NetworkResponse;
import org.apache.cloudstack.context.CallContext;
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
@@ -42,7 +42,9 @@ import com.cloud.utils.net.NetUtils;
@APICommand(name = "createNetworkACL",
description = "Creates a ACL rule in the given network (the network has to belong to VPC)",
- responseObject = NetworkACLItemResponse.class)
+ responseObject = NetworkACLItemResponse.class,
+ requestHasSensitiveInfo = false,
+ responseHasSensitiveInfo = false)
public class CreateNetworkACLCmd extends BaseAsyncCreateCmd {
public static final Logger s_logger = Logger.getLogger(CreateNetworkACLCmd.class.getName());
@@ -95,9 +97,15 @@ public class CreateNetworkACLCmd extends BaseAsyncCreateCmd {
@Parameter(name = ApiConstants.ACTION, type = CommandType.STRING, description = "scl entry action, allow or deny")
private String action;
+ @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin})
+ private Boolean display;
+
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
+ public Boolean getDisplay() {
+ return display;
+ }
public String getProtocol() {
String p = protocol.trim();
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkACLListCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkACLListCmd.java
index cd0eb3237bd..07156cf944f 100644
--- a/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkACLListCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkACLListCmd.java
@@ -16,8 +16,7 @@
// under the License.
package org.apache.cloudstack.api.command.user.network;
-import org.apache.log4j.Logger;
-
+import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
@@ -26,6 +25,7 @@ import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.NetworkACLResponse;
import org.apache.cloudstack.api.response.VpcResponse;
+import org.apache.log4j.Logger;
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
@@ -34,7 +34,8 @@ import com.cloud.network.vpc.NetworkACL;
import com.cloud.network.vpc.Vpc;
import com.cloud.user.Account;
-@APICommand(name = "createNetworkACLList", description = "Creates a Network ACL for the given VPC", responseObject = NetworkACLResponse.class)
+@APICommand(name = "createNetworkACLList", description = "Creates a Network ACL for the given VPC", responseObject = NetworkACLResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class CreateNetworkACLListCmd extends BaseAsyncCreateCmd {
public static final Logger s_logger = Logger.getLogger(CreateNetworkACLListCmd.class.getName());
@@ -57,6 +58,9 @@ public class CreateNetworkACLListCmd extends BaseAsyncCreateCmd {
description = "Id of the VPC associated with this network ACL List")
private Long vpcId;
+ @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the list to the end user or not", since = "4.4", authorized = {RoleType.Admin})
+ private Boolean display;
+
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
@@ -73,6 +77,10 @@ public class CreateNetworkACLListCmd extends BaseAsyncCreateCmd {
return vpcId;
}
+ public Boolean getDisplay() {
+ return display;
+ }
+
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@@ -84,7 +92,7 @@ public class CreateNetworkACLListCmd extends BaseAsyncCreateCmd {
@Override
public void create() {
- NetworkACL result = _networkACLService.createNetworkACL(getName(), getDescription(), getVpcId());
+ NetworkACL result = _networkACLService.createNetworkACL(getName(), getDescription(), getVpcId(), getDisplay());
setEntityId(result.getId());
setEntityUuid(result.getUuid());
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkCmd.java
index c1e56ebd638..43c3d1b09e7 100644
--- a/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkCmd.java
@@ -18,11 +18,13 @@ package org.apache.cloudstack.api.command.user.network;
import org.apache.log4j.Logger;
+import org.apache.cloudstack.acl.RoleType;
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.DomainResponse;
import org.apache.cloudstack.api.response.NetworkACLResponse;
@@ -42,7 +44,8 @@ import com.cloud.network.Network;
import com.cloud.network.Network.GuestType;
import com.cloud.offering.NetworkOffering;
-@APICommand(name = "createNetwork", description = "Creates a network", responseObject = NetworkResponse.class)
+@APICommand(name = "createNetwork", description = "Creates a network", responseObject = NetworkResponse.class, responseView = ResponseView.Restricted, entityType = {Network.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class CreateNetworkCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(CreateNetworkCmd.class.getName());
@@ -136,7 +139,7 @@ public class CreateNetworkCmd extends BaseCmd {
@Parameter(name = ApiConstants.DISPLAY_NETWORK,
type = CommandType.BOOLEAN,
- description = "an optional field, whether to the display the network to the end user or not.")
+ description = "an optional field, whether to the display the network to the end user or not.", authorized = {RoleType.Admin})
private Boolean displayNetwork;
@Parameter(name = ApiConstants.ACL_ID, type = CommandType.UUID, entityType = NetworkACLResponse.class, description = "Network ACL Id associated for the network")
@@ -153,10 +156,6 @@ public class CreateNetworkCmd extends BaseCmd {
return gateway;
}
- public String getVlan() {
- return vlan;
- }
-
public String getIsolatedPvlan() {
return isolatedPvlan;
}
@@ -285,7 +284,7 @@ public class CreateNetworkCmd extends BaseCmd {
@Override
public long getEntityOwnerId() {
- Long accountId = finalyzeAccountId(accountName, domainId, projectId, true);
+ Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true);
if (accountId == null) {
return CallContext.current().getCallingAccount().getId();
}
@@ -299,7 +298,7 @@ public class CreateNetworkCmd extends BaseCmd {
void execute() throws InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException {
Network result = _networkService.createGuestNetwork(this);
if (result != null) {
- NetworkResponse response = _responseGenerator.createNetworkResponse(result);
+ NetworkResponse response = _responseGenerator.createNetworkResponse(ResponseView.Restricted, result);
response.setResponseName(getCommandName());
setResponseObject(response);
} else {
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLCmd.java
index 7413ea55b00..ecc651dbfa8 100644
--- a/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLCmd.java
@@ -32,7 +32,8 @@ import com.cloud.event.EventTypes;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.user.Account;
-@APICommand(name = "deleteNetworkACL", description = "Deletes a Network ACL", responseObject = SuccessResponse.class)
+@APICommand(name = "deleteNetworkACL", description = "Deletes a Network ACL", responseObject = SuccessResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteNetworkACLCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DeleteNetworkACLCmd.class.getName());
private static final String s_name = "deletenetworkaclresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLListCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLListCmd.java
index 632d710c39f..3b3a4ec4ae4 100644
--- a/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLListCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLListCmd.java
@@ -32,7 +32,8 @@ import com.cloud.event.EventTypes;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.user.Account;
-@APICommand(name = "deleteNetworkACLList", description = "Deletes a Network ACL", responseObject = SuccessResponse.class)
+@APICommand(name = "deleteNetworkACLList", description = "Deletes a Network ACL", responseObject = SuccessResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteNetworkACLListCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DeleteNetworkACLListCmd.class.getName());
private static final String s_name = "deletenetworkacllistresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkCmd.java
index 808051ecdef..4c3a292c4a9 100644
--- a/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkCmd.java
@@ -18,6 +18,8 @@ package org.apache.cloudstack.api.command.user.network;
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;
@@ -33,7 +35,8 @@ import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.network.Network;
-@APICommand(name = "deleteNetwork", description = "Deletes a network", responseObject = SuccessResponse.class)
+@APICommand(name = "deleteNetwork", description = "Deletes a network", responseObject = SuccessResponse.class, entityType = {Network.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteNetworkCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DeleteNetworkOfferingCmd.class.getName());
private static final String s_name = "deletenetworkresponse";
@@ -41,7 +44,7 @@ public class DeleteNetworkCmd extends BaseAsyncCmd {
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
-
+ @ACL(accessType = AccessType.OperateEntry)
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = NetworkResponse.class, required = true, description = "the ID of the network")
private Long id;
@@ -76,7 +79,7 @@ public class DeleteNetworkCmd extends BaseAsyncCmd {
boolean result = _networkService.deleteNetwork(id, isForced());
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete network");
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkACLListsCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkACLListsCmd.java
index 2e50bb8cf22..c115fb76165 100644
--- a/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkACLListsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkACLListsCmd.java
@@ -19,8 +19,7 @@ package org.apache.cloudstack.api.command.user.network;
import java.util.ArrayList;
import java.util.List;
-import org.apache.log4j.Logger;
-
+import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd;
@@ -29,11 +28,13 @@ import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.NetworkACLResponse;
import org.apache.cloudstack.api.response.NetworkResponse;
import org.apache.cloudstack.api.response.VpcResponse;
+import org.apache.log4j.Logger;
import com.cloud.network.vpc.NetworkACL;
import com.cloud.utils.Pair;
-@APICommand(name = "listNetworkACLLists", description = "Lists all network ACLs", responseObject = NetworkACLResponse.class)
+@APICommand(name = "listNetworkACLLists", description = "Lists all network ACLs", responseObject = NetworkACLResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListNetworkACLListsCmd extends BaseListProjectAndAccountResourcesCmd {
public static final Logger s_logger = Logger.getLogger(ListNetworkACLListsCmd.class.getName());
@@ -54,6 +55,9 @@ public class ListNetworkACLListsCmd extends BaseListProjectAndAccountResourcesCm
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "list network ACLs by specified name")
private String name;
+ @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin})
+ private Boolean display;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -74,6 +78,13 @@ public class ListNetworkACLListsCmd extends BaseListProjectAndAccountResourcesCm
return name;
}
+ @Override
+ public Boolean getDisplay() {
+ if (display != null) {
+ return display;
+ }
+ return super.getDisplay();
+ }
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkACLsCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkACLsCmd.java
index 7f8aef4cd77..4f9065bf2cd 100644
--- a/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkACLsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkACLsCmd.java
@@ -19,8 +19,7 @@ package org.apache.cloudstack.api.command.user.network;
import java.util.ArrayList;
import java.util.List;
-import org.apache.log4j.Logger;
-
+import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
@@ -29,11 +28,13 @@ import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.NetworkACLItemResponse;
import org.apache.cloudstack.api.response.NetworkACLResponse;
import org.apache.cloudstack.api.response.NetworkResponse;
+import org.apache.log4j.Logger;
import com.cloud.network.vpc.NetworkACLItem;
import com.cloud.utils.Pair;
-@APICommand(name = "listNetworkACLs", description = "Lists all network ACL items", responseObject = NetworkACLItemResponse.class)
+@APICommand(name = "listNetworkACLs", description = "Lists all network ACL items", responseObject = NetworkACLItemResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListNetworkACLsCmd extends BaseListTaggedResourcesCmd {
public static final Logger s_logger = Logger.getLogger(ListNetworkACLsCmd.class.getName());
@@ -61,6 +62,9 @@ public class ListNetworkACLsCmd extends BaseListTaggedResourcesCmd {
@Parameter(name = ApiConstants.ACTION, type = CommandType.STRING, description = "list network ACL Items by Action")
private String action;
+ @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin})
+ private Boolean display;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -89,6 +93,14 @@ public class ListNetworkACLsCmd extends BaseListTaggedResourcesCmd {
return action;
}
+ @Override
+ public Boolean getDisplay() {
+ if (display != null) {
+ return display;
+ }
+ return super.getDisplay();
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkOfferingsCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkOfferingsCmd.java
index 552a64a63b2..6ac0f395b77 100644
--- a/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkOfferingsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkOfferingsCmd.java
@@ -32,10 +32,11 @@ import org.apache.cloudstack.api.response.ZoneResponse;
import com.cloud.offering.NetworkOffering;
-@APICommand(name = "listNetworkOfferings", description = "Lists all available network offerings.", responseObject = NetworkOfferingResponse.class)
+@APICommand(name = "listNetworkOfferings", description = "Lists all available network offerings.", responseObject = NetworkOfferingResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListNetworkOfferingsCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListNetworkOfferingsCmd.class.getName());
- private static final String Name = "listnetworkofferingsresponse";
+ private static final String s_name = "listnetworkofferingsresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
@@ -181,7 +182,7 @@ public class ListNetworkOfferingsCmd extends BaseListCmd {
/////////////////////////////////////////////////////
@Override
public String getCommandName() {
- return Name;
+ return s_name;
}
@Override
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java
index 111fac31174..86f3ba2ad6b 100644
--- a/api/src/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java
@@ -19,24 +19,28 @@ package org.apache.cloudstack.api.command.user.network;
import java.util.ArrayList;
import java.util.List;
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.NetworkResponse;
import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
import org.apache.cloudstack.api.response.VpcResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
-import org.apache.log4j.Logger;
import com.cloud.network.Network;
import com.cloud.utils.Pair;
-@APICommand(name = "listNetworks", description = "Lists all available networks.", responseObject = NetworkResponse.class)
+@APICommand(name = "listNetworks", description = "Lists all available networks.", responseObject = NetworkResponse.class, responseView = ResponseView.Restricted, entityType = {Network.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListNetworksCmd extends BaseListTaggedResourcesCmd {
public static final Logger s_logger = Logger.getLogger(ListNetworksCmd.class.getName());
- private static final String Name = "listnetworksresponse";
+ private static final String s_name = "listnetworksresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
@@ -80,6 +84,9 @@ public class ListNetworksCmd extends BaseListTaggedResourcesCmd {
@Parameter(name = ApiConstants.FOR_VPC, type = CommandType.BOOLEAN, description = "the network belongs to vpc")
private Boolean forVpc;
+ @Parameter(name = ApiConstants.DISPLAY_NETWORK, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin})
+ private Boolean display;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -136,12 +143,19 @@ public class ListNetworksCmd extends BaseListTaggedResourcesCmd {
return forVpc;
}
+ @Override
+ public Boolean getDisplay() {
+ if (display != null) {
+ return display;
+ }
+ return super.getDisplay();
+ }
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public String getCommandName() {
- return Name;
+ return s_name;
}
@Override
@@ -150,11 +164,11 @@ public class ListNetworksCmd extends BaseListTaggedResourcesCmd {
ListResponse response = new ListResponse();
List networkResponses = new ArrayList();
for (Network network : networks.first()) {
- NetworkResponse networkResponse = _responseGenerator.createNetworkResponse(network);
+ NetworkResponse networkResponse = _responseGenerator.createNetworkResponse(ResponseView.Restricted, network);
networkResponses.add(networkResponse);
}
response.setResponses(networkResponses, networks.second());
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/ReplaceNetworkACLListCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/ReplaceNetworkACLListCmd.java
index de1f163ae0b..d005718428e 100644
--- a/api/src/org/apache/cloudstack/api/command/user/network/ReplaceNetworkACLListCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/network/ReplaceNetworkACLListCmd.java
@@ -34,7 +34,8 @@ import com.cloud.event.EventTypes;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.user.Account;
-@APICommand(name = "replaceNetworkACLList", description = "Replaces ACL associated with a Network or private gateway", responseObject = SuccessResponse.class)
+@APICommand(name = "replaceNetworkACLList", description = "Replaces ACL associated with a Network or private gateway", responseObject = SuccessResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ReplaceNetworkACLListCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(ReplaceNetworkACLListCmd.class.getName());
private static final String s_name = "replacenetworkacllistresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/RestartNetworkCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/RestartNetworkCmd.java
index cd508ffbb11..eba83104218 100644
--- a/api/src/org/apache/cloudstack/api/command/user/network/RestartNetworkCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/network/RestartNetworkCmd.java
@@ -18,6 +18,8 @@ package org.apache.cloudstack.api.command.user.network;
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;
@@ -38,7 +40,9 @@ import com.cloud.network.Network;
@APICommand(name = "restartNetwork",
description = "Restarts the network; includes 1) restarting network elements - virtual routers, dhcp servers 2) reapplying all public ips 3) reapplying loadBalancing/portForwarding rules",
- responseObject = IPAddressResponse.class)
+ responseObject = IPAddressResponse.class, entityType = {Network.class},
+ requestHasSensitiveInfo = false,
+ responseHasSensitiveInfo = false)
public class RestartNetworkCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(RestartNetworkCmd.class.getName());
private static final String s_name = "restartnetworkresponse";
@@ -46,7 +50,7 @@ public class RestartNetworkCmd extends BaseAsyncCmd {
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
-
+ @ACL(accessType = AccessType.OperateEntry)
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = NetworkResponse.class, required = true, description = "The id of the network to restart.")
private Long id;
@@ -91,7 +95,7 @@ public class RestartNetworkCmd extends BaseAsyncCmd {
boolean result = _networkService.restartNetwork(this, getCleanup());
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to restart network");
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkACLItemCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkACLItemCmd.java
index 1e559c2da7d..eb095df2091 100644
--- a/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkACLItemCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkACLItemCmd.java
@@ -18,24 +18,25 @@ package org.apache.cloudstack.api.command.user.network;
import java.util.List;
-import org.apache.log4j.Logger;
-
+import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
-import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.BaseAsyncCustomIdCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.NetworkACLItemResponse;
import org.apache.cloudstack.context.CallContext;
+import org.apache.log4j.Logger;
import com.cloud.event.EventTypes;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.vpc.NetworkACLItem;
import com.cloud.user.Account;
-@APICommand(name = "updateNetworkACLItem", description = "Updates ACL Item with specified Id", responseObject = NetworkACLItemResponse.class)
-public class UpdateNetworkACLItemCmd extends BaseAsyncCmd {
+@APICommand(name = "updateNetworkACLItem", description = "Updates ACL Item with specified Id", responseObject = NetworkACLItemResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class UpdateNetworkACLItemCmd extends BaseAsyncCustomIdCmd {
public static final Logger s_logger = Logger.getLogger(UpdateNetworkACLItemCmd.class.getName());
private static final String s_name = "createnetworkaclresponse";
@@ -81,9 +82,15 @@ public class UpdateNetworkACLItemCmd extends BaseAsyncCmd {
@Parameter(name = ApiConstants.ACTION, type = CommandType.STRING, description = "scl entry action, allow or deny")
private String action;
+ @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin})
+ private Boolean display;
+
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
+ public Boolean getDisplay() {
+ return display;
+ }
public Long getId() {
return id;
@@ -165,7 +172,7 @@ public class UpdateNetworkACLItemCmd extends BaseAsyncCmd {
CallContext.current().setEventDetails("Rule Id: " + getId());
NetworkACLItem aclItem =
_networkACLService.updateNetworkACLItem(getId(), getProtocol(), getSourceCidrList(), getTrafficType(), getAction(), getNumber(), getSourcePortStart(),
- getSourcePortEnd(), getIcmpCode(), getIcmpType());
+ getSourcePortEnd(), getIcmpCode(), getIcmpType(), this.getCustomId(), this.getDisplay());
if (aclItem == null) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update network ACL Item");
}
@@ -174,4 +181,11 @@ public class UpdateNetworkACLItemCmd extends BaseAsyncCmd {
aclResponse.setResponseName(getCommandName());
}
+ @Override
+ public void checkUuid() {
+ if (this.getCustomId() != null) {
+ _uuidMgr.checkUuid(this.getCustomId(), NetworkACLItem.class);
+ }
+ }
+
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkACLListCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkACLListCmd.java
new file mode 100644
index 00000000000..c58f9658364
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkACLListCmd.java
@@ -0,0 +1,100 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.user.network;
+
+import org.apache.cloudstack.acl.RoleType;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseAsyncCustomIdCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.NetworkACLResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.cloudstack.context.CallContext;
+import org.apache.log4j.Logger;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.vpc.NetworkACL;
+import com.cloud.user.Account;
+
+@APICommand(name = "updateNetworkACLList", description = "Updates Network ACL list", responseObject = SuccessResponse.class, since = "4.4",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class UpdateNetworkACLListCmd extends BaseAsyncCustomIdCmd {
+ public static final Logger s_logger = Logger.getLogger(UpdateNetworkACLListCmd.class.getName());
+ private static final String s_name = "updatenetworkacllistresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = NetworkACLResponse.class, required = true, description = "the ID of the network ACL")
+ private Long id;
+
+ @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the list to the end user or not", since = "4.4", authorized = {RoleType.Admin})
+ private Boolean display;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getId() {
+ return id;
+ }
+
+ public Boolean getDisplay() {
+ return display;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_NETWORK_ACL_UPDATE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return ("Updating network acl list id=" + id);
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ Account caller = CallContext.current().getCallingAccount();
+ return caller.getAccountId();
+ }
+
+ @Override
+ public void execute() throws ResourceUnavailableException {
+ NetworkACL acl = _networkACLService.updateNetworkACL(id, this.getCustomId(), getDisplay());
+ NetworkACLResponse aclResponse = _responseGenerator.createNetworkACLResponse(acl);
+ setResponseObject(aclResponse);
+ aclResponse.setResponseName(getCommandName());
+ }
+
+ @Override
+ public void checkUuid() {
+ if (this.getCustomId() != null) {
+ _uuidMgr.checkUuid(this.getCustomId(), NetworkACL.class);
+ }
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java
index 2091102f40c..0f73ddef93a 100644
--- a/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java
@@ -18,11 +18,16 @@ package org.apache.cloudstack.api.command.user.network;
import org.apache.log4j.Logger;
+import org.apache.cloudstack.acl.RoleType;
+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.BaseAsyncCmd;
+import org.apache.cloudstack.api.BaseAsyncCustomIdCmd;
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.NetworkOfferingResponse;
import org.apache.cloudstack.api.response.NetworkResponse;
@@ -37,8 +42,9 @@ import com.cloud.offering.NetworkOffering;
import com.cloud.user.Account;
import com.cloud.user.User;
-@APICommand(name = "updateNetwork", description = "Updates a network", responseObject = NetworkResponse.class)
-public class UpdateNetworkCmd extends BaseAsyncCmd {
+@APICommand(name = "updateNetwork", description = "Updates a network", responseObject = NetworkResponse.class, responseView = ResponseView.Restricted, entityType = {Network.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class UpdateNetworkCmd extends BaseAsyncCustomIdCmd {
public static final Logger s_logger = Logger.getLogger(UpdateNetworkCmd.class.getName());
private static final String s_name = "updatenetworkresponse";
@@ -46,8 +52,10 @@ public class UpdateNetworkCmd extends BaseAsyncCmd {
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = NetworkResponse.class, required = true, description = "the ID of the network")
- private Long id;
+ @ACL(accessType = AccessType.OperateEntry)
+ @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = NetworkResponse.class,
+ required=true, description="the ID of the network")
+ protected Long id;
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the new name for the network")
private String name;
@@ -69,7 +77,7 @@ public class UpdateNetworkCmd extends BaseAsyncCmd {
@Parameter(name = ApiConstants.DISPLAY_NETWORK,
type = CommandType.BOOLEAN,
- description = "an optional field, whether to the display the network to the end user or not.")
+ description = "an optional field, whether to the display the network to the end user or not.", authorized = {RoleType.Admin})
private Boolean displayNetwork;
/////////////////////////////////////////////////////
@@ -88,11 +96,11 @@ public class UpdateNetworkCmd extends BaseAsyncCmd {
return displayText;
}
- private String getNetworkDomain() {
+ public String getNetworkDomain() {
return networkDomain;
}
- private Long getNetworkOfferingId() {
+ public Long getNetworkOfferingId() {
return networkOfferingId;
}
@@ -103,7 +111,7 @@ public class UpdateNetworkCmd extends BaseAsyncCmd {
return false;
}
- private String getGuestVmCidr() {
+ public String getGuestVmCidr() {
return guestVmCidr;
}
@@ -141,12 +149,12 @@ public class UpdateNetworkCmd extends BaseAsyncCmd {
Network result =
_networkService.updateGuestNetwork(getId(), getNetworkName(), getDisplayText(), callerAccount, callerUser, getNetworkDomain(), getNetworkOfferingId(),
- getChangeCidr(), getGuestVmCidr(), getDisplayNetwork());
+ getChangeCidr(), getGuestVmCidr(), getDisplayNetwork(), getCustomId());
if (result != null) {
- NetworkResponse response = _responseGenerator.createNetworkResponse(result);
+ NetworkResponse response = _responseGenerator.createNetworkResponse(ResponseView.Restricted, result);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update network");
}
@@ -188,4 +196,11 @@ public class UpdateNetworkCmd extends BaseAsyncCmd {
public Long getSyncObjId() {
return id;
}
+
+ @Override
+ public void checkUuid() {
+ if (getCustomId() != null) {
+ _uuidMgr.checkUuid(getCustomId(), Network.class);
+ }
+ }
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/offering/ListDiskOfferingsCmd.java b/api/src/org/apache/cloudstack/api/command/user/offering/ListDiskOfferingsCmd.java
index 954b64e2a41..0e4806a534c 100644
--- a/api/src/org/apache/cloudstack/api/command/user/offering/ListDiskOfferingsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/offering/ListDiskOfferingsCmd.java
@@ -26,7 +26,8 @@ import org.apache.cloudstack.api.response.DiskOfferingResponse;
import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.api.response.ListResponse;
-@APICommand(name = "listDiskOfferings", description = "Lists all available disk offerings.", responseObject = DiskOfferingResponse.class)
+@APICommand(name = "listDiskOfferings", description = "Lists all available disk offerings.", responseObject = DiskOfferingResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListDiskOfferingsCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListDiskOfferingsCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/user/offering/ListServiceOfferingsCmd.java b/api/src/org/apache/cloudstack/api/command/user/offering/ListServiceOfferingsCmd.java
index 08c69e830c2..abeebcbfae6 100644
--- a/api/src/org/apache/cloudstack/api/command/user/offering/ListServiceOfferingsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/offering/ListServiceOfferingsCmd.java
@@ -27,7 +27,8 @@ import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.ServiceOfferingResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
-@APICommand(name = "listServiceOfferings", description = "Lists all available service offerings.", responseObject = ServiceOfferingResponse.class)
+@APICommand(name = "listServiceOfferings", description = "Lists all available service offerings.", responseObject = ServiceOfferingResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListServiceOfferingsCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListServiceOfferingsCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/user/project/ActivateProjectCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/ActivateProjectCmd.java
index 66c64a6e3f9..5b1b76e95ea 100644
--- a/api/src/org/apache/cloudstack/api/command/user/project/ActivateProjectCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/project/ActivateProjectCmd.java
@@ -31,7 +31,8 @@ import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.projects.Project;
-@APICommand(name = "activateProject", description = "Activates a project", responseObject = ProjectResponse.class, since = "3.0.0")
+@APICommand(name = "activateProject", description = "Activates a project", responseObject = ProjectResponse.class, since = "3.0.0",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ActivateProjectCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(ActivateProjectCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/user/project/CreateProjectCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/CreateProjectCmd.java
index dcb83a89031..e8a045ca1cc 100644
--- a/api/src/org/apache/cloudstack/api/command/user/project/CreateProjectCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/project/CreateProjectCmd.java
@@ -34,7 +34,8 @@ import com.cloud.exception.ResourceAllocationException;
import com.cloud.projects.Project;
import com.cloud.user.Account;
-@APICommand(name = "createProject", description = "Creates a project", responseObject = ProjectResponse.class, since = "3.0.0")
+@APICommand(name = "createProject", description = "Creates a project", responseObject = ProjectResponse.class, since = "3.0.0",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class CreateProjectCmd extends BaseAsyncCreateCmd {
public static final Logger s_logger = Logger.getLogger(CreateProjectCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectCmd.java
index 88205e856bc..3a2e48d51ab 100644
--- a/api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectCmd.java
@@ -32,7 +32,8 @@ import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.projects.Project;
-@APICommand(name = "deleteProject", description = "Deletes a project", responseObject = SuccessResponse.class, since = "3.0.0")
+@APICommand(name = "deleteProject", description = "Deletes a project", responseObject = SuccessResponse.class, since = "3.0.0",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteProjectCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DeleteProjectCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectInvitationCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectInvitationCmd.java
index 9d4d8383283..9f8baad6408 100644
--- a/api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectInvitationCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectInvitationCmd.java
@@ -31,7 +31,8 @@ import org.apache.cloudstack.context.CallContext;
import com.cloud.event.EventTypes;
import com.cloud.user.Account;
-@APICommand(name = "deleteProjectInvitation", description = "Accepts or declines project invitation", responseObject = SuccessResponse.class, since = "3.0.0")
+@APICommand(name = "deleteProjectInvitation", description = "Accepts or declines project invitation", responseObject = SuccessResponse.class, since = "3.0.0",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteProjectInvitationCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DeleteProjectInvitationCmd.class.getName());
private static final String s_name = "deleteprojectinvitationresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/user/project/ListProjectInvitationsCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/ListProjectInvitationsCmd.java
index 0e9e7ae4aeb..dc607e4faf0 100644
--- a/api/src/org/apache/cloudstack/api/command/user/project/ListProjectInvitationsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/project/ListProjectInvitationsCmd.java
@@ -29,7 +29,9 @@ import org.apache.cloudstack.api.response.ProjectResponse;
@APICommand(name = "listProjectInvitations",
description = "Lists projects and provides detailed information for listed projects",
responseObject = ProjectInvitationResponse.class,
- since = "3.0.0")
+ since = "3.0.0",
+ requestHasSensitiveInfo = false,
+ responseHasSensitiveInfo = false)
public class ListProjectInvitationsCmd extends BaseListAccountResourcesCmd {
public static final Logger s_logger = Logger.getLogger(ListProjectInvitationsCmd.class.getName());
private static final String s_name = "listprojectinvitationsresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/user/project/ListProjectsCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/ListProjectsCmd.java
index 2cf610634b7..7b479b1a9ff 100644
--- a/api/src/org/apache/cloudstack/api/command/user/project/ListProjectsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/project/ListProjectsCmd.java
@@ -35,7 +35,9 @@ import com.cloud.exception.InvalidParameterValueException;
@APICommand(name = "listProjects",
description = "Lists projects and provides detailed information for listed projects",
responseObject = ProjectResponse.class,
- since = "3.0.0")
+ since = "3.0.0",
+ requestHasSensitiveInfo = false,
+ responseHasSensitiveInfo = false)
public class ListProjectsCmd extends BaseListAccountResourcesCmd {
public static final Logger s_logger = Logger.getLogger(ListProjectsCmd.class.getName());
private static final String s_name = "listprojectsresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/user/project/SuspendProjectCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/SuspendProjectCmd.java
index c2a1885472d..69a4b77c7a5 100644
--- a/api/src/org/apache/cloudstack/api/command/user/project/SuspendProjectCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/project/SuspendProjectCmd.java
@@ -33,7 +33,8 @@ import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.projects.Project;
-@APICommand(name = "suspendProject", description = "Suspends a project", responseObject = ProjectResponse.class, since = "3.0.0")
+@APICommand(name = "suspendProject", description = "Suspends a project", responseObject = ProjectResponse.class, since = "3.0.0",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class SuspendProjectCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(SuspendProjectCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectCmd.java
index 78903bf80e2..11e5e35bac3 100644
--- a/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectCmd.java
@@ -32,7 +32,8 @@ import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.projects.Project;
-@APICommand(name = "updateProject", description = "Updates a project", responseObject = ProjectResponse.class, since = "3.0.0")
+@APICommand(name = "updateProject", description = "Updates a project", responseObject = ProjectResponse.class, since = "3.0.0",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class UpdateProjectCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(UpdateProjectCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectInvitationCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectInvitationCmd.java
index dda7b5400ba..79e3f8a9cfd 100644
--- a/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectInvitationCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectInvitationCmd.java
@@ -31,7 +31,8 @@ import org.apache.cloudstack.context.CallContext;
import com.cloud.event.EventTypes;
import com.cloud.user.Account;
-@APICommand(name = "updateProjectInvitation", description = "Accepts or declines project invitation", responseObject = SuccessResponse.class, since = "3.0.0")
+@APICommand(name = "updateProjectInvitation", description = "Accepts or declines project invitation", responseObject = SuccessResponse.class, since = "3.0.0",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class UpdateProjectInvitationCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(UpdateProjectInvitationCmd.class.getName());
private static final String s_name = "updateprojectinvitationresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/user/region/ListRegionsCmd.java b/api/src/org/apache/cloudstack/api/command/user/region/ListRegionsCmd.java
index c369b9cf6f3..9a0b186d9ea 100644
--- a/api/src/org/apache/cloudstack/api/command/user/region/ListRegionsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/region/ListRegionsCmd.java
@@ -32,7 +32,8 @@ import org.apache.cloudstack.api.response.RegionResponse;
import org.apache.cloudstack.region.Region;
import org.apache.cloudstack.region.RegionService;
-@APICommand(name = "listRegions", description = "Lists Regions", responseObject = RegionResponse.class)
+@APICommand(name = "listRegions", description = "Lists Regions", responseObject = RegionResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListRegionsCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListRegionsCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/AssignToGlobalLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/AssignToGlobalLoadBalancerRuleCmd.java
index 1fe73b555e1..177939b2327 100644
--- a/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/AssignToGlobalLoadBalancerRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/AssignToGlobalLoadBalancerRuleCmd.java
@@ -49,7 +49,9 @@ import com.cloud.utils.db.EntityManager;
@APICommand(name = "assignToGlobalLoadBalancerRule",
description = "Assign load balancer rule or list of load " + "balancer rules to a global load balancer rules.",
- responseObject = SuccessResponse.class)
+ responseObject = SuccessResponse.class,
+ requestHasSensitiveInfo = false,
+ responseHasSensitiveInfo = false)
public class AssignToGlobalLoadBalancerRuleCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(AssignToGlobalLoadBalancerRuleCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/CreateGlobalLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/CreateGlobalLoadBalancerRuleCmd.java
index 550d81755eb..67825761b8a 100644
--- a/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/CreateGlobalLoadBalancerRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/CreateGlobalLoadBalancerRuleCmd.java
@@ -19,8 +19,6 @@ package org.apache.cloudstack.api.command.user.region.ha.gslb;
import javax.inject.Inject;
-import org.apache.log4j.Logger;
-
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants;
@@ -32,6 +30,7 @@ import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.api.response.GlobalLoadBalancerResponse;
import org.apache.cloudstack.api.response.RegionResponse;
import org.apache.cloudstack.context.CallContext;
+import org.apache.log4j.Logger;
import com.cloud.event.EventTypes;
import com.cloud.exception.ResourceAllocationException;
@@ -39,7 +38,8 @@ import com.cloud.exception.ResourceUnavailableException;
import com.cloud.region.ha.GlobalLoadBalancerRule;
import com.cloud.region.ha.GlobalLoadBalancingRulesService;
-@APICommand(name = "createGlobalLoadBalancerRule", description = "Creates a global load balancer rule", responseObject = GlobalLoadBalancerResponse.class)
+@APICommand(name = "createGlobalLoadBalancerRule", description = "Creates a global load balancer rule", responseObject = GlobalLoadBalancerResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class CreateGlobalLoadBalancerRuleCmd extends BaseAsyncCreateCmd {
public static final Logger s_logger = Logger.getLogger(CreateGlobalLoadBalancerRuleCmd.class.getName());
@@ -191,7 +191,7 @@ public class CreateGlobalLoadBalancerRuleCmd extends BaseAsyncCreateCmd {
@Override
public long getEntityOwnerId() {
- Long accountId = finalyzeAccountId(accountName, domainId, null, true);
+ Long accountId = _accountService.finalyzeAccountId(accountName, domainId, null, true);
if (accountId == null) {
return CallContext.current().getCallingAccount().getId();
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/DeleteGlobalLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/DeleteGlobalLoadBalancerRuleCmd.java
index 2e96965bdce..dfb093d5b16 100644
--- a/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/DeleteGlobalLoadBalancerRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/DeleteGlobalLoadBalancerRuleCmd.java
@@ -37,7 +37,8 @@ import com.cloud.region.ha.GlobalLoadBalancerRule;
import com.cloud.region.ha.GlobalLoadBalancingRulesService;
import com.cloud.user.Account;
-@APICommand(name = "deleteGlobalLoadBalancerRule", description = "Deletes a global load balancer rule.", responseObject = SuccessResponse.class)
+@APICommand(name = "deleteGlobalLoadBalancerRule", description = "Deletes a global load balancer rule.", responseObject = SuccessResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteGlobalLoadBalancerRuleCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DeleteGlobalLoadBalancerRuleCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/ListGlobalLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/ListGlobalLoadBalancerRuleCmd.java
index f37aba2ac09..e5630f87e14 100644
--- a/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/ListGlobalLoadBalancerRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/ListGlobalLoadBalancerRuleCmd.java
@@ -35,7 +35,8 @@ import org.apache.cloudstack.api.response.RegionResponse;
import com.cloud.region.ha.GlobalLoadBalancerRule;
import com.cloud.region.ha.GlobalLoadBalancingRulesService;
-@APICommand(name = "listGlobalLoadBalancerRules", description = "Lists load balancer rules.", responseObject = GlobalLoadBalancerResponse.class)
+@APICommand(name = "listGlobalLoadBalancerRules", description = "Lists load balancer rules.", responseObject = GlobalLoadBalancerResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListGlobalLoadBalancerRuleCmd extends BaseListTaggedResourcesCmd {
public static final Logger s_logger = Logger.getLogger(ListGlobalLoadBalancerRuleCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/RemoveFromGlobalLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/RemoveFromGlobalLoadBalancerRuleCmd.java
index b30f4d8d546..af3fa349322 100644
--- a/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/RemoveFromGlobalLoadBalancerRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/RemoveFromGlobalLoadBalancerRuleCmd.java
@@ -43,7 +43,9 @@ import com.cloud.utils.StringUtils;
@APICommand(name = "removeFromGlobalLoadBalancerRule",
description = "Removes a load balancer rule association with" + " global load balancer rule",
- responseObject = SuccessResponse.class)
+ responseObject = SuccessResponse.class,
+ requestHasSensitiveInfo = false,
+ responseHasSensitiveInfo = false)
public class RemoveFromGlobalLoadBalancerRuleCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(RemoveFromGlobalLoadBalancerRuleCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/UpdateGlobalLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/UpdateGlobalLoadBalancerRuleCmd.java
index e8c5326c604..6c75400c2df 100644
--- a/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/UpdateGlobalLoadBalancerRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/UpdateGlobalLoadBalancerRuleCmd.java
@@ -34,7 +34,8 @@ import com.cloud.region.ha.GlobalLoadBalancerRule;
import com.cloud.region.ha.GlobalLoadBalancingRulesService;
import com.cloud.user.Account;
-@APICommand(name = "updateGlobalLoadBalancerRule", description = "update global load balancer rules.", responseObject = GlobalLoadBalancerResponse.class)
+@APICommand(name = "updateGlobalLoadBalancerRule", description = "update global load balancer rules.", responseObject = GlobalLoadBalancerResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class UpdateGlobalLoadBalancerRuleCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(GlobalLoadBalancerResponse.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/user/resource/GetCloudIdentifierCmd.java b/api/src/org/apache/cloudstack/api/command/user/resource/GetCloudIdentifierCmd.java
index ccaca2dbbcc..366401f3a6f 100644
--- a/api/src/org/apache/cloudstack/api/command/user/resource/GetCloudIdentifierCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/resource/GetCloudIdentifierCmd.java
@@ -31,7 +31,8 @@ import org.apache.cloudstack.api.response.UserResponse;
import com.cloud.user.Account;
-@APICommand(name = "getCloudIdentifier", description = "Retrieves a cloud identifier.", responseObject = CloudIdentifierResponse.class)
+@APICommand(name = "getCloudIdentifier", description = "Retrieves a cloud identifier.", responseObject = CloudIdentifierResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class GetCloudIdentifierCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(GetCloudIdentifierCmd.class.getName());
private static final String s_name = "getcloudidentifierresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/user/resource/ListHypervisorsCmd.java b/api/src/org/apache/cloudstack/api/command/user/resource/ListHypervisorsCmd.java
index 5e546f4dd11..edaa4051c76 100644
--- a/api/src/org/apache/cloudstack/api/command/user/resource/ListHypervisorsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/resource/ListHypervisorsCmd.java
@@ -32,7 +32,8 @@ import org.apache.cloudstack.api.response.ZoneResponse;
import com.cloud.user.Account;
-@APICommand(name = "listHypervisors", description = "List hypervisors", responseObject = HypervisorResponse.class)
+@APICommand(name = "listHypervisors", description = "List hypervisors", responseObject = HypervisorResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListHypervisorsCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(UpgradeRouterCmd.class.getName());
private static final String s_name = "listhypervisorsresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/user/resource/ListResourceLimitsCmd.java b/api/src/org/apache/cloudstack/api/command/user/resource/ListResourceLimitsCmd.java
index ba3cfc8d951..1576d93784b 100644
--- a/api/src/org/apache/cloudstack/api/command/user/resource/ListResourceLimitsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/resource/ListResourceLimitsCmd.java
@@ -19,18 +19,18 @@ package org.apache.cloudstack.api.command.user.resource;
import java.util.ArrayList;
import java.util.List;
-import org.apache.log4j.Logger;
-
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.ResourceLimitResponse;
+import org.apache.log4j.Logger;
import com.cloud.configuration.ResourceLimit;
-@APICommand(name = "listResourceLimits", description = "Lists resource limits.", responseObject = ResourceLimitResponse.class)
+@APICommand(name = "listResourceLimits", description = "Lists resource limits.", responseObject = ResourceLimitResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListResourceLimitsCmd extends BaseListProjectAndAccountResourcesCmd {
public static final Logger s_logger = Logger.getLogger(ListResourceLimitsCmd.class.getName());
@@ -77,7 +77,7 @@ public class ListResourceLimitsCmd extends BaseListProjectAndAccountResourcesCmd
@Override
public void execute() {
List extends ResourceLimit> result =
- _resourceLimitService.searchForLimits(id, finalyzeAccountId(this.getAccountName(), this.getDomainId(), this.getProjectId(), false), this.getDomainId(),
+ _resourceLimitService.searchForLimits(id, _accountService.finalyzeAccountId(this.getAccountName(), this.getDomainId(), this.getProjectId(), false), this.getDomainId(),
resourceType, this.getStartIndex(), this.getPageSizeVal());
ListResponse response = new ListResponse();
List limitResponses = new ArrayList();
diff --git a/api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceCountCmd.java b/api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceCountCmd.java
index bd4f9956442..5a417496eb1 100644
--- a/api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceCountCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceCountCmd.java
@@ -19,8 +19,6 @@ package org.apache.cloudstack.api.command.user.resource;
import java.util.ArrayList;
import java.util.List;
-import org.apache.log4j.Logger;
-
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
@@ -32,11 +30,13 @@ import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.ProjectResponse;
import org.apache.cloudstack.api.response.ResourceCountResponse;
import org.apache.cloudstack.context.CallContext;
+import org.apache.log4j.Logger;
import com.cloud.configuration.ResourceCount;
import com.cloud.user.Account;
-@APICommand(name = "updateResourceCount", description = "Recalculate and update resource count for an account or domain.", responseObject = ResourceCountResponse.class)
+@APICommand(name = "updateResourceCount", description = "Recalculate and update resource count for an account or domain.", responseObject = ResourceCountResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class UpdateResourceCountCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(UpdateResourceCountCmd.class.getName());
@@ -106,7 +106,7 @@ public class UpdateResourceCountCmd extends BaseCmd {
@Override
public long getEntityOwnerId() {
Account account = CallContext.current().getCallingAccount();
- if ((account == null) || isAdmin(account.getType())) {
+ if ((account == null) || _accountService.isAdmin(account.getType())) {
if ((domainId != null) && (accountName != null)) {
Account userAccount = _responseGenerator.findAccountByNameDomain(accountName, domainId);
if (userAccount != null) {
@@ -125,7 +125,7 @@ public class UpdateResourceCountCmd extends BaseCmd {
@Override
public void execute() {
List extends ResourceCount> result =
- _resourceLimitService.recalculateResourceCount(finalyzeAccountId(accountName, domainId, projectId, true), getDomainId(), getResourceType());
+ _resourceLimitService.recalculateResourceCount(_accountService.finalyzeAccountId(accountName, domainId, projectId, true), getDomainId(), getResourceType());
if ((result != null) && (result.size() > 0)) {
ListResponse response = new ListResponse();
diff --git a/api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceLimitCmd.java b/api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceLimitCmd.java
index c33a9e71cc8..22d20d3e8e1 100644
--- a/api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceLimitCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceLimitCmd.java
@@ -16,8 +16,6 @@
// under the License.
package org.apache.cloudstack.api.command.user.resource;
-import org.apache.log4j.Logger;
-
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
@@ -28,10 +26,12 @@ import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.api.response.ProjectResponse;
import org.apache.cloudstack.api.response.ResourceLimitResponse;
import org.apache.cloudstack.context.CallContext;
+import org.apache.log4j.Logger;
import com.cloud.configuration.ResourceLimit;
-@APICommand(name = "updateResourceLimit", description = "Updates resource limits for an account or domain.", responseObject = ResourceLimitResponse.class)
+@APICommand(name = "updateResourceLimit", description = "Updates resource limits for an account or domain.", responseObject = ResourceLimitResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class UpdateResourceLimitCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(UpdateResourceLimitCmd.class.getName());
@@ -95,7 +95,7 @@ public class UpdateResourceLimitCmd extends BaseCmd {
@Override
public long getEntityOwnerId() {
- Long accountId = finalyzeAccountId(accountName, domainId, projectId, true);
+ Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true);
if (accountId == null) {
return CallContext.current().getCallingAccount().getId();
}
@@ -105,7 +105,7 @@ public class UpdateResourceLimitCmd extends BaseCmd {
@Override
public void execute() {
- ResourceLimit result = _resourceLimitService.updateResourceLimit(finalyzeAccountId(accountName, domainId, projectId, true), getDomainId(), resourceType, max);
+ ResourceLimit result = _resourceLimitService.updateResourceLimit(_accountService.finalyzeAccountId(accountName, domainId, projectId, true), getDomainId(), resourceType, max);
if (result != null || (result == null && max != null && max.longValue() == -1L)) {
ResourceLimitResponse response = _responseGenerator.createResourceLimitResponse(result);
response.setResponseName(getCommandName());
diff --git a/api/src/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupEgressCmd.java b/api/src/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupEgressCmd.java
index 6a054a4dbdf..aef0a7c7382 100644
--- a/api/src/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupEgressCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupEgressCmd.java
@@ -24,6 +24,8 @@ import java.util.Map;
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;
@@ -39,13 +41,13 @@ import org.apache.cloudstack.context.CallContext;
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.network.security.SecurityGroup;
import com.cloud.network.security.SecurityRule;
import com.cloud.utils.StringUtils;
-@APICommand(name = "authorizeSecurityGroupEgress",
- responseObject = SecurityGroupRuleResponse.class,
- description = "Authorizes a particular egress rule for this security group",
- since = "3.0.0")
+@APICommand(name = "authorizeSecurityGroupEgress", responseObject = SecurityGroupRuleResponse.class, description = "Authorizes a particular egress rule for this security group", since = "3.0.0", entityType = {SecurityGroup.class},
+ requestHasSensitiveInfo = false,
+ responseHasSensitiveInfo = false)
@SuppressWarnings("rawtypes")
public class AuthorizeSecurityGroupEgressCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(AuthorizeSecurityGroupIngressCmd.class.getName());
@@ -89,15 +91,12 @@ public class AuthorizeSecurityGroupEgressCmd extends BaseAsyncCmd {
@Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, description = "an optional project of the security group", entityType = ProjectResponse.class)
private Long projectId;
- @Parameter(name = ApiConstants.SECURITY_GROUP_ID,
- type = CommandType.UUID,
- description = "The ID of the security group. Mutually exclusive with securityGroupName parameter",
- entityType = SecurityGroupResponse.class)
+ @ACL(accessType = AccessType.OperateEntry)
+ @Parameter(name=ApiConstants.SECURITY_GROUP_ID, type=CommandType.UUID, description="The ID of the security group. Mutually exclusive with securityGroupName parameter", entityType=SecurityGroupResponse.class)
private Long securityGroupId;
- @Parameter(name = ApiConstants.SECURITY_GROUP_NAME,
- type = CommandType.STRING,
- description = "The name of the security group. Mutually exclusive with securityGroupName parameter")
+ @ACL(accessType = AccessType.OperateEntry)
+ @Parameter(name=ApiConstants.SECURITY_GROUP_NAME, type=CommandType.STRING, description="The name of the security group. Mutually exclusive with securityGroupName parameter")
private String securityGroupName;
/////////////////////////////////////////////////////
@@ -174,7 +173,7 @@ public class AuthorizeSecurityGroupEgressCmd extends BaseAsyncCmd {
@Override
public long getEntityOwnerId() {
- Long accountId = finalyzeAccountId(accountName, domainId, projectId, true);
+ Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true);
if (accountId == null) {
return CallContext.current().getCallingAccount().getId();
}
@@ -221,7 +220,7 @@ public class AuthorizeSecurityGroupEgressCmd extends BaseAsyncCmd {
List extends SecurityRule> egressRules = _securityGroupService.authorizeSecurityGroupEgress(this);
if (egressRules != null && !egressRules.isEmpty()) {
SecurityGroupResponse response = _responseGenerator.createSecurityGroupResponseFromSecurityGroupRule(egressRules);
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to authorize security group egress rule(s)");
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupIngressCmd.java b/api/src/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupIngressCmd.java
index be91959b3eb..188df6e1114 100644
--- a/api/src/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupIngressCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupIngressCmd.java
@@ -24,6 +24,8 @@ import java.util.Map;
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;
@@ -39,12 +41,13 @@ import org.apache.cloudstack.context.CallContext;
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.network.security.SecurityGroup;
import com.cloud.network.security.SecurityRule;
import com.cloud.utils.StringUtils;
-@APICommand(name = "authorizeSecurityGroupIngress",
- responseObject = SecurityGroupRuleResponse.class,
- description = "Authorizes a particular ingress rule for this security group")
+@APICommand(name = "authorizeSecurityGroupIngress", responseObject = SecurityGroupRuleResponse.class, description = "Authorizes a particular ingress rule for this security group", entityType = {SecurityGroup.class},
+ requestHasSensitiveInfo = false,
+ responseHasSensitiveInfo = false)
@SuppressWarnings("rawtypes")
public class AuthorizeSecurityGroupIngressCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(AuthorizeSecurityGroupIngressCmd.class.getName());
@@ -88,15 +91,12 @@ public class AuthorizeSecurityGroupIngressCmd extends BaseAsyncCmd {
@Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, description = "an optional project of the security group", entityType = ProjectResponse.class)
private Long projectId;
- @Parameter(name = ApiConstants.SECURITY_GROUP_ID,
- type = CommandType.UUID,
- description = "The ID of the security group. Mutually exclusive with securityGroupName parameter",
- entityType = SecurityGroupResponse.class)
+ @ACL(accessType = AccessType.OperateEntry)
+ @Parameter(name=ApiConstants.SECURITY_GROUP_ID, type=CommandType.UUID, description="The ID of the security group. Mutually exclusive with securityGroupName parameter", entityType=SecurityGroupResponse.class)
private Long securityGroupId;
- @Parameter(name = ApiConstants.SECURITY_GROUP_NAME,
- type = CommandType.STRING,
- description = "The name of the security group. Mutually exclusive with securityGroupName parameter")
+ @ACL(accessType = AccessType.OperateEntry)
+ @Parameter(name=ApiConstants.SECURITY_GROUP_NAME, type=CommandType.STRING, description="The name of the security group. Mutually exclusive with securityGroupName parameter")
private String securityGroupName;
/////////////////////////////////////////////////////
@@ -173,7 +173,7 @@ public class AuthorizeSecurityGroupIngressCmd extends BaseAsyncCmd {
@Override
public long getEntityOwnerId() {
- Long accountId = finalyzeAccountId(accountName, domainId, projectId, true);
+ Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true);
if (accountId == null) {
return CallContext.current().getCallingAccount().getId();
}
@@ -220,7 +220,7 @@ public class AuthorizeSecurityGroupIngressCmd extends BaseAsyncCmd {
List extends SecurityRule> ingressRules = _securityGroupService.authorizeSecurityGroupIngress(this);
if (ingressRules != null && !ingressRules.isEmpty()) {
SecurityGroupResponse response = _responseGenerator.createSecurityGroupResponseFromSecurityGroupRule(ingressRules);
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to authorize security group ingress rule(s)");
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/securitygroup/CreateSecurityGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/securitygroup/CreateSecurityGroupCmd.java
index 3b16821d46d..b5758ca282f 100644
--- a/api/src/org/apache/cloudstack/api/command/user/securitygroup/CreateSecurityGroupCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/securitygroup/CreateSecurityGroupCmd.java
@@ -32,7 +32,8 @@ import org.apache.cloudstack.context.CallContext;
import com.cloud.network.security.SecurityGroup;
import com.cloud.user.Account;
-@APICommand(name = "createSecurityGroup", responseObject = SecurityGroupResponse.class, description = "Creates a security group")
+@APICommand(name = "createSecurityGroup", responseObject = SecurityGroupResponse.class, description = "Creates a security group", entityType = {SecurityGroup.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class CreateSecurityGroupCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(CreateSecurityGroupCmd.class.getName());
@@ -96,7 +97,7 @@ public class CreateSecurityGroupCmd extends BaseCmd {
@Override
public long getEntityOwnerId() {
Account account = CallContext.current().getCallingAccount();
- if ((account == null) || isAdmin(account.getType())) {
+ if ((account == null) || _accountService.isAdmin(account.getType())) {
if ((domainId != null) && (accountName != null)) {
Account userAccount = _responseGenerator.findAccountByNameDomain(accountName, domainId);
if (userAccount != null) {
@@ -119,7 +120,7 @@ public class CreateSecurityGroupCmd extends BaseCmd {
if (group != null) {
SecurityGroupResponse response = _responseGenerator.createSecurityGroupResponse(group);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create security group");
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/securitygroup/DeleteSecurityGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/securitygroup/DeleteSecurityGroupCmd.java
index 0bcc144af4f..87e6df41b6b 100644
--- a/api/src/org/apache/cloudstack/api/command/user/securitygroup/DeleteSecurityGroupCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/securitygroup/DeleteSecurityGroupCmd.java
@@ -18,6 +18,8 @@ package org.apache.cloudstack.api.command.user.securitygroup;
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;
@@ -32,8 +34,10 @@ import org.apache.cloudstack.context.CallContext;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ResourceInUseException;
+import com.cloud.network.security.SecurityGroup;
-@APICommand(name = "deleteSecurityGroup", description = "Deletes security group", responseObject = SuccessResponse.class)
+@APICommand(name = "deleteSecurityGroup", description = "Deletes security group", responseObject = SuccessResponse.class, entityType = {SecurityGroup.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteSecurityGroupCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(DeleteSecurityGroupCmd.class.getName());
private static final String s_name = "deletesecuritygroupresponse";
@@ -54,10 +58,8 @@ public class DeleteSecurityGroupCmd extends BaseCmd {
@Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, description = "the project of the security group", entityType = ProjectResponse.class)
private Long projectId;
- @Parameter(name = ApiConstants.ID,
- type = CommandType.UUID,
- description = "The ID of the security group. Mutually exclusive with name parameter",
- entityType = SecurityGroupResponse.class)
+ @ACL(accessType = AccessType.OperateEntry)
+ @Parameter(name=ApiConstants.ID, type=CommandType.UUID, description="The ID of the security group. Mutually exclusive with name parameter", entityType=SecurityGroupResponse.class)
private Long id;
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "The ID of the security group. Mutually exclusive with id parameter")
@@ -109,7 +111,7 @@ public class DeleteSecurityGroupCmd extends BaseCmd {
@Override
public long getEntityOwnerId() {
- Long accountId = finalyzeAccountId(accountName, domainId, projectId, true);
+ Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true);
if (accountId == null) {
return CallContext.current().getCallingAccount().getId();
}
@@ -123,7 +125,7 @@ public class DeleteSecurityGroupCmd extends BaseCmd {
boolean result = _securityGroupService.deleteSecurityGroup(this);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete security group");
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/securitygroup/ListSecurityGroupsCmd.java b/api/src/org/apache/cloudstack/api/command/user/securitygroup/ListSecurityGroupsCmd.java
index ae745b30e57..4a8081a3507 100644
--- a/api/src/org/apache/cloudstack/api/command/user/securitygroup/ListSecurityGroupsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/securitygroup/ListSecurityGroupsCmd.java
@@ -27,7 +27,10 @@ import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.SecurityGroupResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
-@APICommand(name = "listSecurityGroups", description = "Lists security groups", responseObject = SecurityGroupResponse.class)
+import com.cloud.network.security.SecurityGroup;
+
+@APICommand(name = "listSecurityGroups", description = "Lists security groups", responseObject = SecurityGroupResponse.class, entityType = {SecurityGroup.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListSecurityGroupsCmd extends BaseListTaggedResourcesCmd {
public static final Logger s_logger = Logger.getLogger(ListSecurityGroupsCmd.class.getName());
@@ -77,7 +80,7 @@ public class ListSecurityGroupsCmd extends BaseListTaggedResourcesCmd {
public void execute() {
ListResponse response = _queryService.searchForSecurityGroups(this);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
}
@Override
diff --git a/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupEgressCmd.java b/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupEgressCmd.java
index 006aa7d7947..a28a220b534 100644
--- a/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupEgressCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupEgressCmd.java
@@ -33,10 +33,10 @@ import com.cloud.network.security.SecurityGroup;
import com.cloud.network.security.SecurityRule;
import com.cloud.user.Account;
-@APICommand(name = "revokeSecurityGroupEgress",
- responseObject = SuccessResponse.class,
- description = "Deletes a particular egress rule from this security group",
- since = "3.0.0")
+
+@APICommand(name = "revokeSecurityGroupEgress", responseObject = SuccessResponse.class, description = "Deletes a particular egress rule from this security group", since = "3.0.0", entityType = {SecurityGroup.class},
+ requestHasSensitiveInfo = false,
+ responseHasSensitiveInfo = false)
public class RevokeSecurityGroupEgressCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(RevokeSecurityGroupEgressCmd.class.getName());
@@ -46,7 +46,7 @@ public class RevokeSecurityGroupEgressCmd extends BaseAsyncCmd {
// ////////////// API parameters /////////////////////
// ///////////////////////////////////////////////////
- @Parameter(name = ApiConstants.ID, type = CommandType.UUID, required = true, description = "The ID of the egress rule", entityType = SecurityGroupRuleResponse.class)
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, required = true, description = "The ID of the egress rule", entityType=SecurityGroupRuleResponse.class)
private Long id;
// ///////////////////////////////////////////////////
@@ -98,7 +98,7 @@ public class RevokeSecurityGroupEgressCmd extends BaseAsyncCmd {
boolean result = _securityGroupService.revokeSecurityGroupEgress(this);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to revoke security group egress rule");
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupIngressCmd.java b/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupIngressCmd.java
index 08585784fff..9e81d0bc4ee 100644
--- a/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupIngressCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupIngressCmd.java
@@ -18,6 +18,8 @@ package org.apache.cloudstack.api.command.user.securitygroup;
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;
@@ -33,7 +35,8 @@ import com.cloud.network.security.SecurityGroup;
import com.cloud.network.security.SecurityRule;
import com.cloud.user.Account;
-@APICommand(name = "revokeSecurityGroupIngress", responseObject = SuccessResponse.class, description = "Deletes a particular ingress rule from this security group")
+@APICommand(name = "revokeSecurityGroupIngress", responseObject = SuccessResponse.class, description = "Deletes a particular ingress rule from this security group", entityType = {SecurityGroup.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class RevokeSecurityGroupIngressCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(RevokeSecurityGroupIngressCmd.class.getName());
@@ -43,7 +46,8 @@ public class RevokeSecurityGroupIngressCmd extends BaseAsyncCmd {
// ////////////// API parameters /////////////////////
// ///////////////////////////////////////////////////
- @Parameter(name = ApiConstants.ID, type = CommandType.UUID, required = true, description = "The ID of the ingress rule", entityType = SecurityGroupRuleResponse.class)
+ @ACL(accessType = AccessType.OperateEntry, pointerToEntity = "securityGroupId")
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, required = true, description = "The ID of the ingress rule", entityType=SecurityGroupRuleResponse.class)
private Long id;
// ///////////////////////////////////////////////////
@@ -95,7 +99,7 @@ public class RevokeSecurityGroupIngressCmd extends BaseAsyncCmd {
boolean result = _securityGroupService.revokeSecurityGroupIngress(this);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to revoke security group ingress rule");
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java b/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java
index a0f307ba07a..bd8662e1460 100644
--- a/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java
@@ -18,6 +18,7 @@ package org.apache.cloudstack.api.command.user.snapshot;
import org.apache.log4j.Logger;
+import org.apache.cloudstack.api.ACL;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants;
@@ -41,7 +42,8 @@ import com.cloud.storage.Snapshot;
import com.cloud.storage.Volume;
import com.cloud.user.Account;
-@APICommand(name = "createSnapshot", description = "Creates an instant snapshot of a volume.", responseObject = SnapshotResponse.class)
+@APICommand(name = "createSnapshot", description = "Creates an instant snapshot of a volume.", responseObject = SnapshotResponse.class, entityType = {Snapshot.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class CreateSnapshotCmd extends BaseAsyncCreateCmd {
public static final Logger s_logger = Logger.getLogger(CreateSnapshotCmd.class.getName());
private static final String s_name = "createsnapshotresponse";
@@ -58,16 +60,17 @@ public class CreateSnapshotCmd extends BaseAsyncCreateCmd {
@Parameter(name = ApiConstants.DOMAIN_ID,
type = CommandType.UUID,
entityType = DomainResponse.class,
- description = "The domain ID of the snapshot. If used with the account parameter, specifies a domain for the account associated with the disk volume.")
+ description = "The domain ID of the snapshot. If used with the account parameter, specifies a domain for the account associated with the disk volume.")
private Long domainId;
+ @ACL
@Parameter(name = ApiConstants.VOLUME_ID, type = CommandType.UUID, entityType = VolumeResponse.class, required = true, description = "The ID of the disk volume")
private Long volumeId;
@Parameter(name = ApiConstants.POLICY_ID,
type = CommandType.UUID,
entityType = SnapshotPolicyResponse.class,
- description = "policy id of the snapshot, if this is null, then use MANUAL_POLICY.")
+ description = "policy id of the snapshot, if this is null, then use MANUAL_POLICY.")
private Long policyId;
@Parameter(name = ApiConstants.SNAPSHOT_QUIESCEVM, type = CommandType.BOOLEAN, required = false, description = "quiesce vm if true")
@@ -168,10 +171,10 @@ public class CreateSnapshotCmd extends BaseAsyncCreateCmd {
@Override
public void create() throws ResourceAllocationException {
- Snapshot snapshot = this._volumeService.allocSnapshot(getVolumeId(), getPolicyId());
+ Snapshot snapshot = _volumeService.allocSnapshot(getVolumeId(), getPolicyId());
if (snapshot != null) {
- this.setEntityId(snapshot.getId());
- this.setEntityUuid(snapshot.getUuid());
+ setEntityId(snapshot.getId());
+ setEntityUuid(snapshot.getUuid());
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create snapshot");
}
@@ -184,11 +187,11 @@ public class CreateSnapshotCmd extends BaseAsyncCreateCmd {
Snapshot snapshot;
try {
snapshot =
- _volumeService.takeSnapshot(this.getVolumeId(), this.getPolicyId(), this.getEntityId(), _accountService.getAccount(getEntityOwnerId()), getQuiescevm());
+ _volumeService.takeSnapshot(getVolumeId(), getPolicyId(), getEntityId(), _accountService.getAccount(getEntityOwnerId()), getQuiescevm());
if (snapshot != null) {
SnapshotResponse response = _responseGenerator.createSnapshotResponse(snapshot);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create snapshot due to an internal error creating snapshot for volume " + volumeId);
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java
index 5ecbaaa2bc9..c1381c8d7cc 100644
--- a/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java
@@ -34,7 +34,8 @@ import com.cloud.storage.Volume;
import com.cloud.storage.snapshot.SnapshotPolicy;
import com.cloud.user.Account;
-@APICommand(name = "createSnapshotPolicy", description = "Creates a snapshot policy for the account.", responseObject = SnapshotPolicyResponse.class)
+@APICommand(name = "createSnapshotPolicy", description = "Creates a snapshot policy for the account.", responseObject = SnapshotPolicyResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class CreateSnapshotPolicyCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(CreateSnapshotPolicyCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotCmd.java b/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotCmd.java
index 35caaff8e10..64a432d0bcb 100644
--- a/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotCmd.java
@@ -18,6 +18,8 @@ package org.apache.cloudstack.api.command.user.snapshot;
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;
@@ -33,7 +35,8 @@ import com.cloud.event.EventTypes;
import com.cloud.storage.Snapshot;
import com.cloud.user.Account;
-@APICommand(name = "deleteSnapshot", description = "Deletes a snapshot of a disk volume.", responseObject = SuccessResponse.class)
+@APICommand(name = "deleteSnapshot", description = "Deletes a snapshot of a disk volume.", responseObject = SuccessResponse.class, entityType = {Snapshot.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteSnapshotCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DeleteSnapshotCmd.class.getName());
private static final String s_name = "deletesnapshotresponse";
@@ -42,7 +45,9 @@ public class DeleteSnapshotCmd extends BaseAsyncCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = SnapshotResponse.class, required = true, description = "The ID of the snapshot")
+ @ACL(accessType = AccessType.OperateEntry)
+ @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = SnapshotResponse.class,
+ required=true, description="The ID of the snapshot")
private Long id;
/////////////////////////////////////////////////////
@@ -79,7 +84,7 @@ public class DeleteSnapshotCmd extends BaseAsyncCmd {
@Override
public String getEventDescription() {
- return "deleting snapshot: " + getId();
+ return "deleting snapshot: " + getId();
}
@Override
@@ -98,7 +103,7 @@ public class DeleteSnapshotCmd extends BaseAsyncCmd {
boolean result = _snapshotService.deleteSnapshot(getId());
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete snapshot");
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotPoliciesCmd.java b/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotPoliciesCmd.java
index bcccf8b4f3e..2d97d3df261 100644
--- a/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotPoliciesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotPoliciesCmd.java
@@ -31,7 +31,8 @@ import org.apache.cloudstack.api.response.SuccessResponse;
import com.cloud.user.Account;
-@APICommand(name = "deleteSnapshotPolicies", description = "Deletes snapshot policies for the account.", responseObject = SuccessResponse.class)
+@APICommand(name = "deleteSnapshotPolicies", description = "Deletes snapshot policies for the account.", responseObject = SuccessResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteSnapshotPoliciesCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(DeleteSnapshotPoliciesCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotPoliciesCmd.java b/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotPoliciesCmd.java
index 7c2899fe67c..ffafe2df7b7 100644
--- a/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotPoliciesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotPoliciesCmd.java
@@ -32,7 +32,8 @@ import org.apache.cloudstack.api.response.VolumeResponse;
import com.cloud.storage.snapshot.SnapshotPolicy;
import com.cloud.utils.Pair;
-@APICommand(name = "listSnapshotPolicies", description = "Lists snapshot policies.", responseObject = SnapshotPolicyResponse.class)
+@APICommand(name = "listSnapshotPolicies", description = "Lists snapshot policies.", responseObject = SnapshotPolicyResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListSnapshotPoliciesCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListSnapshotPoliciesCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java b/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java
index e4d566a3c5a..47a6876d09f 100644
--- a/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java
@@ -34,7 +34,8 @@ import org.apache.cloudstack.api.response.ZoneResponse;
import com.cloud.storage.Snapshot;
import com.cloud.utils.Pair;
-@APICommand(name = "listSnapshots", description = "Lists all available snapshots for the account.", responseObject = SnapshotResponse.class)
+@APICommand(name = "listSnapshots", description = "Lists all available snapshots for the account.", responseObject = SnapshotResponse.class, entityType = {Snapshot.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListSnapshotsCmd extends BaseListTaggedResourcesCmd {
public static final Logger s_logger = Logger.getLogger(ListSnapshotsCmd.class.getName());
@@ -117,6 +118,6 @@ public class ListSnapshotsCmd extends BaseListTaggedResourcesCmd {
response.setResponses(snapshotResponses, result.second());
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/RevertSnapshotCmd.java b/api/src/org/apache/cloudstack/api/command/user/snapshot/RevertSnapshotCmd.java
index f11fa3f04aa..0c79f81564d 100644
--- a/api/src/org/apache/cloudstack/api/command/user/snapshot/RevertSnapshotCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/RevertSnapshotCmd.java
@@ -18,6 +18,8 @@
*/
package org.apache.cloudstack.api.command.user.snapshot;
+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;
@@ -34,10 +36,14 @@ import com.cloud.event.EventTypes;
import com.cloud.storage.Snapshot;
import com.cloud.user.Account;
-@APICommand(name = "revertSnapshot", description = "revert a volume snapshot.", responseObject = SnapshotResponse.class)
+@APICommand(name = "revertSnapshot", description = "revert a volume snapshot.", responseObject = SnapshotResponse.class, entityType = {Snapshot.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class RevertSnapshotCmd extends BaseAsyncCmd {
private static final String s_name = "revertsnapshotresponse";
- @Parameter(name = ApiConstants.ID, type = BaseCmd.CommandType.UUID, entityType = SnapshotResponse.class, required = true, description = "The ID of the snapshot")
+
+ @ACL(accessType = AccessType.OperateEntry)
+ @Parameter(name= ApiConstants.ID, type= BaseCmd.CommandType.UUID, entityType = SnapshotResponse.class,
+ required=true, description="The ID of the snapshot")
private Long id;
public Long getId() {
@@ -66,7 +72,7 @@ public class RevertSnapshotCmd extends BaseAsyncCmd {
@Override
public String getEventDescription() {
- return "revert snapshot: " + getId();
+ return "revert snapshot: " + getId();
}
@Override
@@ -86,7 +92,7 @@ public class RevertSnapshotCmd extends BaseAsyncCmd {
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to revert snapshot");
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/ssh/CreateSSHKeyPairCmd.java b/api/src/org/apache/cloudstack/api/command/user/ssh/CreateSSHKeyPairCmd.java
index 1fc9d13fde1..bd7f613f897 100644
--- a/api/src/org/apache/cloudstack/api/command/user/ssh/CreateSSHKeyPairCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/ssh/CreateSSHKeyPairCmd.java
@@ -29,7 +29,8 @@ import org.apache.cloudstack.context.CallContext;
import com.cloud.user.SSHKeyPair;
-@APICommand(name = "createSSHKeyPair", description = "Create a new keypair and returns the private key", responseObject = CreateSSHKeyPairResponse.class)
+@APICommand(name = "createSSHKeyPair", description = "Create a new keypair and returns the private key", responseObject = CreateSSHKeyPairResponse.class, entityType = {SSHKeyPair.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
public class CreateSSHKeyPairCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(CreateSSHKeyPairCmd.class.getName());
private static final String s_name = "createsshkeypairresponse";
@@ -79,7 +80,7 @@ public class CreateSSHKeyPairCmd extends BaseCmd {
/////////////////////////////////////////////////////
@Override
public long getEntityOwnerId() {
- Long accountId = finalyzeAccountId(accountName, domainId, projectId, true);
+ Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true);
if (accountId == null) {
return CallContext.current().getCallingAccount().getId();
}
@@ -93,7 +94,7 @@ public class CreateSSHKeyPairCmd extends BaseCmd {
CreateSSHKeyPairResponse response = new CreateSSHKeyPairResponse(r.getName(), r.getFingerprint(), r.getPrivateKey());
response.setResponseName(getCommandName());
response.setObjectName("keypair");
- this.setResponseObject(response);
+ setResponseObject(response);
}
@Override
diff --git a/api/src/org/apache/cloudstack/api/command/user/ssh/DeleteSSHKeyPairCmd.java b/api/src/org/apache/cloudstack/api/command/user/ssh/DeleteSSHKeyPairCmd.java
index a638eb9d771..0709686ebf4 100644
--- a/api/src/org/apache/cloudstack/api/command/user/ssh/DeleteSSHKeyPairCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/ssh/DeleteSSHKeyPairCmd.java
@@ -16,6 +16,7 @@
// under the License.
package org.apache.cloudstack.api.command.user.ssh;
+
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
@@ -28,8 +29,10 @@ import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.cloudstack.context.CallContext;
import com.cloud.user.Account;
+import com.cloud.user.SSHKeyPair;
-@APICommand(name = "deleteSSHKeyPair", description = "Deletes a keypair by name", responseObject = SuccessResponse.class)
+@APICommand(name = "deleteSSHKeyPair", description = "Deletes a keypair by name", responseObject = SuccessResponse.class, entityType = {SSHKeyPair.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteSSHKeyPairCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(CreateSSHKeyPairCmd.class.getName());
private static final String s_name = "deletesshkeypairresponse";
@@ -79,7 +82,7 @@ public class DeleteSSHKeyPairCmd extends BaseCmd {
boolean result = _mgr.deleteSSHKeyPair(this);
SuccessResponse response = new SuccessResponse(getCommandName());
response.setSuccess(result);
- this.setResponseObject(response);
+ setResponseObject(response);
}
@Override
@@ -90,7 +93,7 @@ public class DeleteSSHKeyPairCmd extends BaseCmd {
@Override
public long getEntityOwnerId() {
Account account = CallContext.current().getCallingAccount();
- if ((account == null) || isAdmin(account.getType())) {
+ if ((account == null) || _accountService.isAdmin(account.getType())) {
if ((domainId != null) && (accountName != null)) {
Account userAccount = _responseGenerator.findAccountByNameDomain(accountName, domainId);
if (userAccount != null) {
diff --git a/api/src/org/apache/cloudstack/api/command/user/ssh/ListSSHKeyPairsCmd.java b/api/src/org/apache/cloudstack/api/command/user/ssh/ListSSHKeyPairsCmd.java
index 52fca5f031b..022cbc5068f 100644
--- a/api/src/org/apache/cloudstack/api/command/user/ssh/ListSSHKeyPairsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/ssh/ListSSHKeyPairsCmd.java
@@ -31,7 +31,8 @@ import org.apache.cloudstack.api.response.SSHKeyPairResponse;
import com.cloud.user.SSHKeyPair;
import com.cloud.utils.Pair;
-@APICommand(name = "listSSHKeyPairs", description = "List registered keypairs", responseObject = SSHKeyPairResponse.class)
+@APICommand(name = "listSSHKeyPairs", description = "List registered keypairs", responseObject = SSHKeyPairResponse.class, entityType = {SSHKeyPair.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListSSHKeyPairsCmd extends BaseListProjectAndAccountResourcesCmd {
public static final Logger s_logger = Logger.getLogger(ListSSHKeyPairsCmd.class.getName());
private static final String s_name = "listsshkeypairsresponse";
@@ -75,7 +76,7 @@ public class ListSSHKeyPairsCmd extends BaseListProjectAndAccountResourcesCmd {
ListResponse response = new ListResponse();
response.setResponses(responses, resultList.second());
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
}
@Override
diff --git a/api/src/org/apache/cloudstack/api/command/user/ssh/RegisterSSHKeyPairCmd.java b/api/src/org/apache/cloudstack/api/command/user/ssh/RegisterSSHKeyPairCmd.java
index 8ed5cbd5605..c7cbc56ae65 100644
--- a/api/src/org/apache/cloudstack/api/command/user/ssh/RegisterSSHKeyPairCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/ssh/RegisterSSHKeyPairCmd.java
@@ -29,7 +29,8 @@ import org.apache.cloudstack.context.CallContext;
import com.cloud.user.SSHKeyPair;
-@APICommand(name = "registerSSHKeyPair", description = "Register a public key in a keypair under a certain name", responseObject = SSHKeyPairResponse.class)
+@APICommand(name = "registerSSHKeyPair", description = "Register a public key in a keypair under a certain name", responseObject = SSHKeyPairResponse.class, entityType = {SSHKeyPair.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class RegisterSSHKeyPairCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(RegisterSSHKeyPairCmd.class.getName());
private static final String s_name = "registersshkeypairresponse";
@@ -87,7 +88,7 @@ public class RegisterSSHKeyPairCmd extends BaseCmd {
@Override
public long getEntityOwnerId() {
- Long accountId = finalyzeAccountId(accountName, domainId, projectId, true);
+ Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true);
if (accountId == null) {
return CallContext.current().getCallingAccount().getId();
}
@@ -101,7 +102,7 @@ public class RegisterSSHKeyPairCmd extends BaseCmd {
SSHKeyPairResponse response = new SSHKeyPairResponse(result.getName(), result.getFingerprint());
response.setResponseName(getCommandName());
response.setObjectName("keypair");
- this.setResponseObject(response);
+ setResponseObject(response);
}
@Override
diff --git a/api/src/org/apache/cloudstack/api/command/user/tag/CreateTagsCmd.java b/api/src/org/apache/cloudstack/api/command/user/tag/CreateTagsCmd.java
index ee0add438a7..6aecc055480 100644
--- a/api/src/org/apache/cloudstack/api/command/user/tag/CreateTagsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/tag/CreateTagsCmd.java
@@ -37,7 +37,8 @@ import com.cloud.event.EventTypes;
import com.cloud.server.ResourceTag;
import com.cloud.server.ResourceTag.ResourceObjectType;
-@APICommand(name = "createTags", description = "Creates resource tag(s)", responseObject = SuccessResponse.class, since = "4.0.0")
+@APICommand(name = "createTags", description = "Creates resource tag(s)", responseObject = SuccessResponse.class, since = "4.0.0", entityType = {ResourceTag.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class CreateTagsCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(CreateTagsCmd.class.getName());
@@ -117,7 +118,7 @@ public class CreateTagsCmd extends BaseAsyncCmd {
if (tags != null && !tags.isEmpty()) {
SuccessResponse response = new SuccessResponse(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create tags");
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/tag/DeleteTagsCmd.java b/api/src/org/apache/cloudstack/api/command/user/tag/DeleteTagsCmd.java
index 3ee7c06469a..e42cfce4d91 100644
--- a/api/src/org/apache/cloudstack/api/command/user/tag/DeleteTagsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/tag/DeleteTagsCmd.java
@@ -34,9 +34,11 @@ import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.SuccessResponse;
import com.cloud.event.EventTypes;
+import com.cloud.server.ResourceTag;
import com.cloud.server.ResourceTag.ResourceObjectType;
-@APICommand(name = "deleteTags", description = "Deleting resource tag(s)", responseObject = SuccessResponse.class, since = "4.0.0")
+@APICommand(name = "deleteTags", description = "Deleting resource tag(s)", responseObject = SuccessResponse.class, since = "4.0.0", entityType = {ResourceTag.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteTagsCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DeleteTagsCmd.class.getName());
@@ -108,7 +110,7 @@ public class DeleteTagsCmd extends BaseAsyncCmd {
if (success) {
SuccessResponse response = new SuccessResponse(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete tags");
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/tag/ListTagsCmd.java b/api/src/org/apache/cloudstack/api/command/user/tag/ListTagsCmd.java
index 893f6dfcedb..e02b25c4468 100644
--- a/api/src/org/apache/cloudstack/api/command/user/tag/ListTagsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/tag/ListTagsCmd.java
@@ -24,7 +24,10 @@ import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.ResourceTagResponse;
-@APICommand(name = "listTags", description = "List resource tag(s)", responseObject = ResourceTagResponse.class, since = "4.0.0")
+import com.cloud.server.ResourceTag;
+
+@APICommand(name = "listTags", description = "List resource tag(s)", responseObject = ResourceTagResponse.class, since = "4.0.0", entityType = {ResourceTag.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListTagsCmd extends BaseListProjectAndAccountResourcesCmd {
private static final String s_name = "listtagsresponse";
@@ -52,7 +55,7 @@ public class ListTagsCmd extends BaseListProjectAndAccountResourcesCmd {
ListResponse response = _queryService.listTags(this);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
}
public String getResourceType() {
diff --git a/api/src/org/apache/cloudstack/api/command/user/template/CopyTemplateCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/CopyTemplateCmd.java
index 87f94f72aa1..fdbdafd1446 100644
--- a/api/src/org/apache/cloudstack/api/command/user/template/CopyTemplateCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/template/CopyTemplateCmd.java
@@ -26,6 +26,7 @@ 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.TemplateResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
@@ -37,7 +38,8 @@ import com.cloud.exception.StorageUnavailableException;
import com.cloud.template.VirtualMachineTemplate;
import com.cloud.user.Account;
-@APICommand(name = "copyTemplate", description = "Copies a template from one zone to another.", responseObject = TemplateResponse.class)
+@APICommand(name = "copyTemplate", description = "Copies a template from one zone to another.", responseObject = TemplateResponse.class, responseView = ResponseView.Restricted,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class CopyTemplateCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(CopyTemplateCmd.class.getName());
private static final String s_name = "copytemplateresponse";
@@ -109,7 +111,7 @@ public class CopyTemplateCmd extends BaseAsyncCmd {
@Override
public String getEventDescription() {
- return "copying template: " + getId() + " from zone: " + getSourceZoneId() + " to zone: " + getDestinationZoneId();
+ return "copying template: " + getId() + " from zone: " + getSourceZoneId() + " to zone: " + getDestinationZoneId();
}
@Override
@@ -128,8 +130,8 @@ public class CopyTemplateCmd extends BaseAsyncCmd {
CallContext.current().setEventDetails(getEventDescription());
VirtualMachineTemplate template = _templateService.copyTemplate(this);
- if (template != null) {
- List listResponse = _responseGenerator.createTemplateResponses(template, getDestinationZoneId(), false);
+ if (template != null){
+ List listResponse = _responseGenerator.createTemplateResponses(ResponseView.Restricted, template, getDestinationZoneId(), false);
TemplateResponse response = new TemplateResponse();
if (listResponse != null && !listResponse.isEmpty()) {
response = listResponse.get(0);
diff --git a/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java
index 0030a7e9ce8..10b150df01e 100644
--- a/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java
@@ -28,6 +28,7 @@ import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCreateCmd;
import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.GuestOSResponse;
import org.apache.cloudstack.api.response.SnapshotResponse;
@@ -46,9 +47,9 @@ import com.cloud.storage.Volume;
import com.cloud.template.VirtualMachineTemplate;
import com.cloud.user.Account;
-@APICommand(name = "createTemplate", responseObject = TemplateResponse.class, description = "Creates a template of a virtual machine. "
- + "The virtual machine must be in a STOPPED state. "
- + "A template created from this command is automatically designated as a private template visible to the account that created it.")
+@APICommand(name = "createTemplate", responseObject = TemplateResponse.class, description = "Creates a template of a virtual machine. " + "The virtual machine must be in a STOPPED state. "
+ + "A template created from this command is automatically designated as a private template visible to the account that created it.", responseView = ResponseView.Restricted,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class CreateTemplateCmd extends BaseAsyncCreateCmd {
public static final Logger s_logger = Logger.getLogger(CreateTemplateCmd.class.getName());
private static final String s_name = "createtemplateresponse";
@@ -94,20 +95,18 @@ public class CreateTemplateCmd extends BaseAsyncCreateCmd {
@Parameter(name = ApiConstants.SNAPSHOT_ID,
type = CommandType.UUID,
entityType = SnapshotResponse.class,
- description = "the ID of the snapshot the template is being created from. Either this parameter, or volumeId has to be passed in")
- private Long snapshotId;
+ description = "the ID of the snapshot the template is being created from. Either this parameter, or volumeId has to be passed in")
+ protected Long snapshotId;
@Parameter(name = ApiConstants.VOLUME_ID,
type = CommandType.UUID,
entityType = VolumeResponse.class,
- description = "the ID of the disk volume the template is being created from. Either this parameter, or snapshotId has to be passed in")
- private Long volumeId;
+ description = "the ID of the disk volume the template is being created from. Either this parameter, or snapshotId has to be passed in")
+ protected Long volumeId;
- @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID,
- type = CommandType.UUID,
- entityType = UserVmResponse.class,
- description = "Optional, VM ID. If this presents, it is going to create a baremetal template for VM this ID refers to. This is only for VM whose hypervisor type is BareMetal")
- private Long vmId;
+ @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType = UserVmResponse.class,
+ description="Optional, VM ID. If this presents, it is going to create a baremetal template for VM this ID refers to. This is only for VM whose hypervisor type is BareMetal")
+ protected Long vmId;
@Parameter(name = ApiConstants.URL,
type = CommandType.STRING,
@@ -260,17 +259,17 @@ public class CreateTemplateCmd extends BaseAsyncCreateCmd {
return ApiCommandJobType.Template;
}
- private boolean isBareMetal() {
- return (this.getVmId() != null && this.getUrl() != null);
+ protected boolean isBareMetal() {
+ return (getVmId() != null && getUrl() != null);
}
@Override
public void create() throws ResourceAllocationException {
VirtualMachineTemplate template = null;
- template = this._templateService.createPrivateTemplateRecord(this, _accountService.getAccount(getEntityOwnerId()));
+ template = _templateService.createPrivateTemplateRecord(this, _accountService.getAccount(getEntityOwnerId()));
if (template != null) {
- this.setEntityId(template.getId());
- this.setEntityUuid(template.getUuid());
+ setEntityId(template.getId());
+ setEntityUuid(template.getUuid());
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a template");
}
@@ -282,21 +281,21 @@ public class CreateTemplateCmd extends BaseAsyncCreateCmd {
CallContext.current().setEventDetails(
"Template Id: " + getEntityId() + ((getSnapshotId() == null) ? " from volume Id: " + getVolumeId() : " from snapshot Id: " + getSnapshotId()));
VirtualMachineTemplate template = null;
- template = this._templateService.createPrivateTemplate(this);
+ template = _templateService.createPrivateTemplate(this);
if (template != null) {
List templateResponses;
if (isBareMetal()) {
- templateResponses = _responseGenerator.createTemplateResponses(template.getId(), vmId);
+ templateResponses = _responseGenerator.createTemplateResponses(ResponseView.Restricted, template.getId(), vmId);
} else {
- templateResponses = _responseGenerator.createTemplateResponses(template.getId(), snapshotId, volumeId, false);
+ templateResponses = _responseGenerator.createTemplateResponses(ResponseView.Restricted, template.getId(), snapshotId, volumeId, false);
}
TemplateResponse response = new TemplateResponse();
if (templateResponses != null && !templateResponses.isEmpty()) {
response = templateResponses.get(0);
}
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create private template");
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/template/DeleteTemplateCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/DeleteTemplateCmd.java
index 890af70330f..98d53be836e 100644
--- a/api/src/org/apache/cloudstack/api/command/user/template/DeleteTemplateCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/template/DeleteTemplateCmd.java
@@ -36,7 +36,8 @@ import com.cloud.user.Account;
@APICommand(name = "deleteTemplate",
responseObject = SuccessResponse.class,
- description = "Deletes a template from the system. All virtual machines using the deleted template will not be affected.")
+ description = "Deletes a template from the system. All virtual machines using the deleted template will not be affected.",
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteTemplateCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DeleteTemplateCmd.class.getName());
private static final String s_name = "deletetemplateresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/user/template/ExtractTemplateCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/ExtractTemplateCmd.java
index 082f46a5abf..c88b5e334b6 100644
--- a/api/src/org/apache/cloudstack/api/command/user/template/ExtractTemplateCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/template/ExtractTemplateCmd.java
@@ -35,7 +35,8 @@ import com.cloud.exception.InternalErrorException;
import com.cloud.template.VirtualMachineTemplate;
import com.cloud.user.Account;
-@APICommand(name = "extractTemplate", description = "Extracts a template", responseObject = ExtractResponse.class)
+@APICommand(name = "extractTemplate", description = "Extracts a template", responseObject = ExtractResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ExtractTemplateCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(ExtractTemplateCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatePermissionsCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatePermissionsCmd.java
index 08acf632a4c..48f8ffff586 100644
--- a/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatePermissionsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatePermissionsCmd.java
@@ -20,14 +20,15 @@ import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.BaseListTemplateOrIsoPermissionsCmd;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
import org.apache.cloudstack.api.response.TemplatePermissionsResponse;
import com.cloud.storage.Storage.ImageFormat;
import com.cloud.template.VirtualMachineTemplate;
-@APICommand(name = "listTemplatePermissions",
- description = "List template visibility and all accounts that have permissions to view this template.",
- responseObject = TemplatePermissionsResponse.class)
+@APICommand(name = "listTemplatePermissions", description = "List template visibility and all accounts that have permissions to view this template.", responseObject = TemplatePermissionsResponse.class, responseView = ResponseView.Restricted,
+ requestHasSensitiveInfo = false,
+ responseHasSensitiveInfo = false)
public class ListTemplatePermissionsCmd extends BaseListTemplateOrIsoPermissionsCmd {
protected String getResponseName() {
return "listtemplatepermissionsresponse";
@@ -47,4 +48,10 @@ public class ListTemplatePermissionsCmd extends BaseListTemplateOrIsoPermissions
protected boolean templateIsCorrectType(VirtualMachineTemplate template) {
return !template.getFormat().equals(ImageFormat.ISO);
}
+
+ @Override
+ public void execute() {
+ executeWithView(ResponseView.Restricted);
+ }
+
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
index d393c6a5fdf..249aa0e9be0 100644
--- a/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
@@ -23,15 +23,18 @@ import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.TemplateResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.cloudstack.context.CallContext;
+import com.cloud.template.VirtualMachineTemplate;
import com.cloud.template.VirtualMachineTemplate.TemplateFilter;
import com.cloud.user.Account;
-@APICommand(name = "listTemplates", description = "List all public, private, and privileged templates.", responseObject = TemplateResponse.class)
+@APICommand(name = "listTemplates", description = "List all public, private, and privileged templates.", responseObject = TemplateResponse.class, entityType = {VirtualMachineTemplate.class}, responseView = ResponseView.Restricted,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ListTemplatesCmd extends BaseListTaggedResourcesCmd {
public static final Logger s_logger = Logger.getLogger(ListTemplatesCmd.class.getName());
@@ -100,7 +103,7 @@ public class ListTemplatesCmd extends BaseListTaggedResourcesCmd {
Account account = CallContext.current().getCallingAccount();
// It is account specific if account is admin type and domainId and accountName are not null
- boolean isAccountSpecific = (account == null || isAdmin(account.getType())) && (getAccountName() != null) && (getDomainId() != null);
+ boolean isAccountSpecific = (account == null || _accountService.isAdmin(account.getType())) && (getAccountName() != null) && (getDomainId() != null);
// Show only those that are downloaded.
TemplateFilter templateFilter = TemplateFilter.valueOf(getTemplateFilter());
boolean onlyReady =
@@ -127,6 +130,6 @@ public class ListTemplatesCmd extends BaseListTaggedResourcesCmd {
public void execute() {
ListResponse response = _queryService.listTemplates(this);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/template/RegisterTemplateCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/RegisterTemplateCmd.java
index 48ed6ea6aac..f478c9bc8ee 100644
--- a/api/src/org/apache/cloudstack/api/command/user/template/RegisterTemplateCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/template/RegisterTemplateCmd.java
@@ -21,14 +21,13 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
-import org.apache.log4j.Logger;
-
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.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.DomainResponse;
import org.apache.cloudstack.api.response.GuestOSResponse;
@@ -37,11 +36,13 @@ import org.apache.cloudstack.api.response.ProjectResponse;
import org.apache.cloudstack.api.response.TemplateResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.cloudstack.context.CallContext;
+import org.apache.log4j.Logger;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.template.VirtualMachineTemplate;
-@APICommand(name = "registerTemplate", description = "Registers an existing template into the CloudStack cloud. ", responseObject = TemplateResponse.class)
+@APICommand(name = "registerTemplate", description = "Registers an existing template into the CloudStack cloud. ", responseObject = TemplateResponse.class, responseView = ResponseView.Restricted,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class RegisterTemplateCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(RegisterTemplateCmd.class.getName());
@@ -106,12 +107,9 @@ public class RegisterTemplateCmd extends BaseCmd {
description = "the URL of where the template is hosted. Possible URL include http:// and https://")
private String url;
- @Parameter(name = ApiConstants.ZONE_ID,
- type = CommandType.UUID,
- entityType = ZoneResponse.class,
- required = true,
- description = "the ID of the zone the template is to be hosted on")
- private Long zoneId;
+ @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = ZoneResponse.class,
+ required=true, description="the ID of the zone the template is to be hosted on")
+ protected Long zoneId;
@Parameter(name = ApiConstants.DOMAIN_ID,
type = CommandType.UUID,
@@ -251,7 +249,7 @@ public class RegisterTemplateCmd extends BaseCmd {
@Override
public long getEntityOwnerId() {
- Long accountId = finalyzeAccountId(accountName, domainId, projectId, true);
+ Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true);
if (accountId == null) {
return CallContext.current().getCallingAccount().getId();
}
@@ -265,10 +263,10 @@ public class RegisterTemplateCmd extends BaseCmd {
VirtualMachineTemplate template = _templateService.registerTemplate(this);
if (template != null) {
ListResponse response = new ListResponse();
- List templateResponses = _responseGenerator.createTemplateResponses(template, zoneId, false);
+ List templateResponses = _responseGenerator.createTemplateResponses(ResponseView.Restricted, template, zoneId, false);
response.setResponses(templateResponses);
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to register template");
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/template/UpdateTemplateCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/UpdateTemplateCmd.java
index f80a4ee3062..81da7eea625 100644
--- a/api/src/org/apache/cloudstack/api/command/user/template/UpdateTemplateCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/template/UpdateTemplateCmd.java
@@ -21,13 +21,15 @@ import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseUpdateTemplateOrIsoCmd;
+import org.apache.cloudstack.api.ResponseObject.ResponseView;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.TemplateResponse;
import com.cloud.template.VirtualMachineTemplate;
import com.cloud.user.Account;
-@APICommand(name = "updateTemplate", description = "Updates attributes of a template.", responseObject = TemplateResponse.class)
+@APICommand(name = "updateTemplate", description = "Updates attributes of a template.", responseObject = TemplateResponse.class, responseView = ResponseView.Restricted,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class UpdateTemplateCmd extends BaseUpdateTemplateOrIsoCmd {
public static final Logger s_logger = Logger.getLogger(UpdateTemplateCmd.class.getName());
private static final String s_name = "updatetemplateresponse";
@@ -52,7 +54,7 @@ public class UpdateTemplateCmd extends BaseUpdateTemplateOrIsoCmd {
@SuppressWarnings("unchecked")
public TemplateResponse getResponse() {
- return null;
+ return null;
}
@Override
@@ -69,11 +71,11 @@ public class UpdateTemplateCmd extends BaseUpdateTemplateOrIsoCmd {
public void execute() {
VirtualMachineTemplate result = _templateService.updateTemplate(this);
if (result != null) {
- TemplateResponse response = _responseGenerator.createTemplateUpdateResponse(result);
+ TemplateResponse response = _responseGenerator.createTemplateUpdateResponse(ResponseView.Restricted, result);
response.setObjectName("template");
response.setTemplateType(result.getTemplateType().toString());//Template can be either USER or ROUTING type
response.setResponseName(getCommandName());
- this.setResponseObject(response);
+ setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update template");
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/template/UpdateTemplatePermissionsCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/UpdateTemplatePermissionsCmd.java
index 96d1f55751a..2029156837e 100644
--- a/api/src/org/apache/cloudstack/api/command/user/template/UpdateTemplatePermissionsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/template/UpdateTemplatePermissionsCmd.java
@@ -27,7 +27,8 @@ import com.cloud.user.Account;
@APICommand(name = "updateTemplatePermissions", responseObject = SuccessResponse.class, description = "Updates a template visibility permissions. "
+ "A public template is visible to all accounts within the same domain. " + "A private template is visible only to the owner of the template. "
- + "A priviledged template is a private template with account permissions added. " + "Only accounts specified under the template permissions are visible to them.")
+ + "A priviledged template is a private template with account permissions added. " + "Only accounts specified under the template permissions are visible to them.", entityType = {VirtualMachineTemplate.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class UpdateTemplatePermissionsCmd extends BaseUpdateTemplateOrIsoPermissionsCmd {
@Override
protected String getResponseName() {
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/AddIpToVmNicCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/AddIpToVmNicCmd.java
index 439879add9b..870bbbf01e9 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/AddIpToVmNicCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/AddIpToVmNicCmd.java
@@ -43,7 +43,8 @@ import com.cloud.vm.Nic;
import com.cloud.vm.NicSecondaryIp;
import com.cloud.vm.VirtualMachine;
-@APICommand(name = "addIpToNic", description = "Assigns secondary IP to NIC", responseObject = NicSecondaryIpResponse.class)
+@APICommand(name = "addIpToNic", description = "Assigns secondary IP to NIC", responseObject = NicSecondaryIpResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class AddIpToVmNicCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(AddIpToVmNicCmd.class.getName());
private static final String s_name = "addiptovmnicresponse";
@@ -91,6 +92,12 @@ public class AddIpToVmNicCmd extends BaseAsyncCmd {
return dc.getNetworkType();
}
+ private boolean isZoneSGEnabled() {
+ Network ntwk = _entityMgr.findById(Network.class, getNetworkId());
+ DataCenter dc = _entityMgr.findById(DataCenter.class, ntwk.getDataCenterId());
+ return dc.isSecurityGroupEnabled();
+ }
+
@Override
public String getEventType() {
return EventTypes.EVENT_NET_IP_ASSIGN;
@@ -135,7 +142,7 @@ public class AddIpToVmNicCmd extends BaseAsyncCmd {
if (result != null) {
secondaryIp = result.getIp4Address();
- if (getNetworkType() == NetworkType.Basic) {
+ if (isZoneSGEnabled()) {
// add security group rules for the secondary ip addresses
boolean success = false;
success = _securityGroupService.securityGroupRulesForVmSecIp(getNicId(), secondaryIp, true);
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/AddNicToVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/AddNicToVMCmd.java
index 43efe166895..fd30152ae08 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/AddNicToVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/AddNicToVMCmd.java
@@ -21,12 +21,15 @@ import java.util.EnumSet;
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.ApiConstants.VMDetails;
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.NetworkResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
@@ -35,8 +38,10 @@ import org.apache.cloudstack.context.CallContext;
import com.cloud.event.EventTypes;
import com.cloud.user.Account;
import com.cloud.uservm.UserVm;
+import com.cloud.vm.VirtualMachine;
-@APICommand(name = "addNicToVirtualMachine", description = "Adds VM to specified network by creating a NIC", responseObject = UserVmResponse.class)
+@APICommand(name = "addNicToVirtualMachine", description = "Adds VM to specified network by creating a NIC", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = {VirtualMachine.class},
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
public class AddNicToVMCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(AddNicToVMCmd.class);
private static final String s_name = "addnictovirtualmachineresponse";
@@ -44,10 +49,12 @@ public class AddNicToVMCmd extends BaseAsyncCmd {
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
-
- @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, entityType = UserVmResponse.class, required = true, description = "Virtual Machine ID")
+ @ACL(accessType = AccessType.OperateEntry)
+ @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType=UserVmResponse.class,
+ required=true, description="Virtual Machine ID")
private Long vmId;
+ @ACL
@Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, required = true, description = "Network ID")
private Long netId;
@@ -90,14 +97,14 @@ public class AddNicToVMCmd extends BaseAsyncCmd {
@Override
public String getEventDescription() {
- return "Adding network " + getNetworkId() + " to user vm: " + getVmId();
+ return "Adding network " + getNetworkId() + " to user vm: " + getVmId();
}
@Override
public long getEntityOwnerId() {
UserVm vm = _responseGenerator.findUserVmById(getVmId());
if (vm == null) {
- return Account.ACCOUNT_ID_SYSTEM; // bad id given, parent this command to SYSTEM so ERROR events are tracked
+ return Account.ACCOUNT_ID_SYSTEM; // bad id given, parent this command to SYSTEM so ERROR events are tracked
}
return vm.getAccountId();
}
@@ -109,10 +116,10 @@ public class AddNicToVMCmd extends BaseAsyncCmd {
ArrayList dc = new ArrayList