cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mlsoren...@apache.org
Subject [20/52] [partial] Summary: Fixes for api_refactoring
Date Thu, 10 Jan 2013 00:48:37 GMT
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/org/apache/cloudstack/api/ApiConstants.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/ApiConstants.java b/api/src/org/apache/cloudstack/api/ApiConstants.java
new file mode 100644
index 0000000..81dd289
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/ApiConstants.java
@@ -0,0 +1,448 @@
+// 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;
+
+import org.omg.CORBA.PUBLIC_MEMBER;
+
+public class ApiConstants {
+    public static final String ACCOUNT = "account";
+    public static final String ACCOUNTS = "accounts";
+    public static final String ACCOUNT_TYPE = "accounttype";
+    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 APPLIED = "applied";
+    public static final String AVAILABLE = "available";
+    public static final String BITS = "bits";
+    public static final String BOOTABLE = "bootable";
+    public static final String BIND_DN = "binddn";
+    public static final String BIND_PASSWORD = "bindpass";
+    public static final String CATEGORY = "category";
+    public static final String CERTIFICATE = "certificate";
+    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 CIDR = "cidr";
+    public static final String CIDR_LIST = "cidrlist";
+    public static final String CLEANUP = "cleanup";
+    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 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 CUSTOMIZED = "customized";
+    public static final String DESCRIPTION = "description";
+    public static final String DESTINATION_ZONE_ID = "destzoneid";
+    public static final String DETAILS = "details";
+    public static final String DEVICE_ID = "deviceid";
+    public static final String DISK_OFFERING_ID = "diskofferingid";
+    public static final String DISK_SIZE = "disksize";
+    public static final String DISPLAY_NAME = "displayname";
+    public static final String DISPLAY_TEXT = "displaytext";
+    public static final String DNS1 = "dns1";
+    public static final String DNS2 = "dns2";
+    public static final String DOMAIN = "domain";
+    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";
+    public static final String END_IP = "endip";
+    public static final String END_PORT = "endport";
+    public static final String ENTRY_TIME = "entrytime";
+    public static final String FETCH_LATEST = "fetchlatest";
+    public static final String FIRSTNAME = "firstname";
+    public static final String FORCED = "forced";
+    public static final String FORCED_DESTROY_LOCAL_STORAGE = "forcedestroylocalstorage";
+    public static final String FORMAT = "format";
+    public static final String FOR_VIRTUAL_NETWORK = "forvirtualnetwork";
+    public static final String GATEWAY = "gateway";
+    public static final String GROUP = "group";
+    public static final String GROUP_ID = "groupid";
+    public static final String GUEST_CIDR_ADDRESS = "guestcidraddress";
+    public static final String HA_ENABLE = "haenable";
+    public static final String HOST_ID = "hostid";
+    public static final String HOST_NAME = "hostname";
+    public static final String HYPERVISOR = "hypervisor";
+    public static final String INLINE = "inline";
+    public static final String INSTANCE = "instance";
+    public static final String ICMP_CODE = "icmpcode";
+    public static final String ICMP_TYPE = "icmptype";
+    public static final String ID = "id";
+    public static final String IDS = "ids";
+    public static final String INTERNAL_DNS1 = "internaldns1";
+    public static final String INTERNAL_DNS2 = "internaldns2";
+    public static final String INTERVAL_TYPE = "intervaltype";
+    public static final String IP_ADDRESS = "ipaddress";
+    public static final String IP_ADDRESS_ID = "ipaddressid";
+    public static final String IS_ASYNC = "isasync";
+    public static final String IP_AVAILABLE = "ipavailable";
+    public static final String IP_LIMIT = "iplimit";
+    public static final String IP_TOTAL = "iptotal";
+    public static final String IS_CLEANUP_REQUIRED = "iscleanuprequired";
+    public static final String IS_EXTRACTABLE = "isextractable";
+    public static final String IS_FEATURED = "isfeatured";
+    public static final String IS_PUBLIC = "ispublic";
+    public static final String IS_READY = "isready";
+    public static final String IS_RECURSIVE = "isrecursive";
+    public static final String ISO_FILTER = "isofilter";
+    public static final String ISO_GUEST_OS_NONE = "None";
+    public static final String JOB_ID = "jobid";
+    public static final String JOB_STATUS = "jobstatus";
+    public static final String LASTNAME = "lastname";
+    public static final String LEVEL = "level";
+    public static final String LENGTH = "length";
+    public static final String LIMIT_CPU_USE = "limitcpuuse";
+    public static final String LOCK = "lock";
+    public static final String LUN = "lun";
+    public static final String LBID = "lbruleid";
+    public static final String MAX = "max";
+    public static final String MAX_SNAPS = "maxsnaps";
+    public static final String MEMORY = "memory";
+    public static final String MODE = "mode";
+    public static final String NAME = "name";
+    public static final String METHOD_NAME = "methodname";
+    public static final String NETWORK_DOMAIN = "networkdomain";
+    public static final String NETMASK = "netmask";
+    public static final String NEW_NAME = "newname";
+    public static final String NUM_RETRIES = "numretries";
+    public static final String OFFER_HA = "offerha";
+    public static final String IS_SYSTEM_OFFERING = "issystem";
+    public static final String IS_DEFAULT_USE = "defaultuse";
+    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 PARAMS = "params";
+    public static final String PARENT_DOMAIN_ID = "parentdomainid";
+    public static final String PASSWORD = "password";
+    public static final String NEW_PASSWORD = "new_password";
+    public static final String PASSWORD_ENABLED = "passwordenabled";
+    public static final String SSHKEY_ENABLED = "sshkeyenabled";
+    public static final String PATH = "path";
+    public static final String POD_ID = "podid";
+    public static final String POD_IDS = "podids";
+    public static final String POLICY_ID = "policyid";
+    public static final String PORT = "port";
+    public static final String PORTAL = "portal";
+    public static final String PORT_FORWARDING_SERVICE_ID = "portforwardingserviceid";
+    public static final String PRIVATE_INTERFACE = "privateinterface";
+    public static final String PRIVATE_IP = "privateip";
+    public static final String PRIVATE_PORT = "privateport";
+    public static final String PRIVATE_START_PORT = "privateport";
+    public static final String PRIVATE_END_PORT = "privateendport";
+    public static final String PRIVATE_ZONE = "privatezone";
+    public static final String PROTOCOL = "protocol";
+    public static final String PUBLIC_INTERFACE = "publicinterface";
+    public static final String PUBLIC_IP_ID = "publicipid";
+    public static final String PUBLIC_IP = "publicip";
+    public static final String PUBLIC_PORT = "publicport";
+    public static final String PUBLIC_START_PORT = "publicport";
+    public static final String PUBLIC_END_PORT = "publicendport";
+    public static final String PUBLIC_ZONE = "publiczone";
+    public static final String RECEIVED_BYTES = "receivedbytes";
+    public static final String REQUIRES_HVM = "requireshvm";
+    public static final String RESOURCE_TYPE = "resourcetype";
+    public static final String QUERY_FILTER = "queryfilter";
+    public static final String SCHEDULE = "schedule";
+    public static final String SCOPE = "scope";
+    public static final String SECRET_KEY = "usersecretkey";
+    public static final String SINCE = "since";
+    public static final String KEY = "key";
+    public static final String SEARCH_BASE = "searchbase";
+    public static final String SECURITY_GROUP_IDS = "securitygroupids";
+    public static final String SECURITY_GROUP_NAMES = "securitygroupnames";
+    public static final String SECURITY_GROUP_NAME = "securitygroupname";
+    public static final String SECURITY_GROUP_ID = "securitygroupid";
+    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 SHOW_CAPACITIES = "showcapacities";
+    public static final String SIZE = "size";
+    public static final String SNAPSHOT_ID = "snapshotid";
+    public static final String SNAPSHOT_POLICY_ID = "snapshotpolicyid";
+    public static final String SNAPSHOT_TYPE = "snapshottype";
+    public static final String SOURCE_ZONE_ID = "sourcezoneid";
+    public static final String START_DATE = "startdate";
+    public static final String START_IP = "startip";
+    public static final String START_PORT = "startport";
+    public static final String STATE = "state";
+    public static final String STATUS = "status";
+    public static final String STORAGE_TYPE = "storagetype";
+    public static final String SYSTEM_VM_TYPE = "systemvmtype";
+    public static final String TAGS = "tags";
+    public static final String TARGET_IQN = "targetiqn";
+    public static final String TEMPLATE_FILTER = "templatefilter";
+    public static final String TEMPLATE_ID = "templateid";
+    public static final String ISO_ID = "isoid";
+    public static final String TIMEOUT = "timeout";
+    public static final String TIMEZONE = "timezone";
+    public static final String TYPE = "type";
+    public static final String TRUST_STORE = "truststore";
+    public static final String TRUST_STORE_PASSWORD = "truststorepass";
+    public static final String URL = "url";
+    public static final String USAGE_INTERFACE = "usageinterface";
+    public static final String USER_DATA = "userdata";
+    public static final String USER_ID = "userid";
+    public static final String USE_SSL = "ssl";
+    public static final String USERNAME = "username";
+    public static final String USER_SECURITY_GROUP_LIST = "usersecuritygrouplist";
+    public static final String USE_VIRTUAL_NETWORK = "usevirtualnetwork";
+    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 VLAN = "vlan";
+    public static final String VLAN_ID = "vlanid";
+    public static final String VM_AVAILABLE = "vmavailable";
+    public static final String VM_LIMIT = "vmlimit";
+    public static final String VM_TOTAL = "vmtotal";
+    public static final String VNET = "vnet";
+    public static final String VOLUME_ID = "volumeid";
+    public static final String ZONE_ID = "zoneid";
+    public static final String ZONE_NAME = "zonename";
+    public static final String NETWORK_TYPE = "networktype";
+    public static final String PAGE = "page";
+    public static final String PAGE_SIZE = "pagesize";
+    public static final String COUNT = "count";
+    public static final String TRAFFIC_TYPE = "traffictype";
+    public static final String NETWORK_OFFERING_ID = "networkofferingid";
+    public static final String NETWORK_IDS = "networkids";
+    public static final String NETWORK_ID = "networkid";
+    public static final String SPECIFY_VLAN = "specifyvlan";
+    public static final String IS_DEFAULT = "isdefault";
+    public static final String IS_SYSTEM = "issystem";
+    public static final String AVAILABILITY = "availability";
+    public static final String NETWORKRATE = "networkrate";
+    public static final String HOST_TAGS = "hosttags";
+    public static final String SSH_KEYPAIR = "keypair";
+    public static final String HOST_CPU_CAPACITY = "hostcpucapacity";
+    public static final String HOST_CPU_NUM = "hostcpunum";
+    public static final String HOST_MEM_CAPACITY = "hostmemcapacity";
+    public static final String HOST_MAC = "hostmac";
+    public static final String HOST_TAG = "hosttag";
+    public static final String PXE_SERVER_TYPE = "pxeservertype";
+    public static final String LINMIN_USERNAME = "linminusername";
+    public static final String LINMIN_PASSWORD = "linminpassword";
+    public static final String LINMIN_APID = "linminapid";
+    public static final String DHCP_SERVER_TYPE = "dhcpservertype";
+    public static final String LINK_LOCAL_IP = "linklocalip";
+    public static final String LINK_LOCAL_MAC_ADDRESS = "linklocalmacaddress";
+    public static final String LINK_LOCAL_MAC_NETMASK = "linklocalnetmask";
+    public static final String LINK_LOCAL_NETWORK_ID = "linklocalnetworkid";
+    public static final String PRIVATE_MAC_ADDRESS = "privatemacaddress";
+    public static final String PRIVATE_NETMASK = "privatenetmask";
+    public static final String PRIVATE_NETWORK_ID = "privatenetworkid";
+    public static final String ALLOCATION_STATE = "allocationstate";
+    public static final String MANAGED_STATE = "managedstate";
+    public static final String STORAGE_ID = "storageid";
+    public static final String PING_STORAGE_SERVER_IP = "pingstorageserverip";
+    public static final String PING_DIR = "pingdir";
+    public static final String TFTP_DIR = "tftpdir";
+    public static final String PING_CIFS_USERNAME = "pingcifsusername";
+    public static final String PING_CIFS_PASSWORD = "pingcifspassword";
+    public static final String CHECKSUM = "checksum";
+    public static final String NETWORK_DEVICE_TYPE = "networkdevicetype";
+    public static final String NETWORK_DEVICE_PARAMETER_LIST = "networkdeviceparameterlist";
+    public static final String ZONE_TOKEN = "zonetoken";
+    public static final String DHCP_PROVIDER = "dhcpprovider";
+    public static final String RESULT = "success";
+    public static final String LUN_ID = "lunId";
+    public static final String IQN = "iqn";
+    public static final String AGGREGATE_NAME = "aggregatename";
+    public static final String POOL_NAME = "poolname";
+    public static final String VOLUME_NAME = "volumename";
+    public static final String SNAPSHOT_POLICY = "snapshotpolicy";
+    public static final String SNAPSHOT_RESERVATION = "snapshotreservation";
+    public static final String IP_NETWORK_LIST = "iptonetworklist";
+    public static final String PARAM_LIST = "param";
+    public static final String FOR_LOAD_BALANCING = "forloadbalancing";
+    public static final String KEYBOARD = "keyboard";
+    public static final String OPEN_FIREWALL = "openfirewall";
+    public static final String TEMPLATE_TAG = "templatetag";
+    public static final String HYPERVISOR_VERSION = "hypervisorversion";
+    public static final String MAX_GUESTS_LIMIT = "maxguestslimit";
+    public static final String PROJECT_ID = "projectid";
+    public static final String PROJECT_IDS = "projectids";
+    public static final String PROJECT = "project";
+    public static final String ROLE = "role";
+    public static final String USER = "user";
+    public static final String ACTIVE_ONLY = "activeonly";
+    public static final String TOKEN = "token";
+    public static final String ACCEPT = "accept";
+    public static final String SORT_KEY = "sortkey";
+    public static final String ACCOUNT_DETAILS = "accountdetails";
+    public static final String SERVICE_PROVIDER_LIST = "serviceproviderlist";
+    public static final String SERVICE_CAPABILITY_LIST = "servicecapabilitylist";
+    public static final String CAN_CHOOSE_SERVICE_CAPABILITY = "canchooseservicecapability";
+    public static final String PROVIDER = "provider";
+    public static final String NETWORK_SPEED = "networkspeed";
+    public static final String BROADCAST_DOMAIN_RANGE = "broadcastdomainrange";
+    public static final String ISOLATION_METHODS = "isolationmethods";
+    public static final String PHYSICAL_NETWORK_ID = "physicalnetworkid";
+    public static final String DEST_PHYSICAL_NETWORK_ID = "destinationphysicalnetworkid";
+    public static final String ENABLED = "enabled";
+    public static final String SERVICE_NAME = "servicename";
+    public static final String DHCP_RANGE = "dhcprange";
+    public static final String UUID = "uuid";
+    public static final String SECURITY_GROUP_EANBLED = "securitygroupenabled";
+    public static final String LOCAL_STORAGE_ENABLED = "localstorageenabled";
+    public static final String GUEST_IP_TYPE = "guestiptype";
+    public static final String XEN_NETWORK_LABEL = "xennetworklabel";
+    public static final String KVM_NETWORK_LABEL = "kvmnetworklabel";
+    public static final String VMWARE_NETWORK_LABEL = "vmwarenetworklabel";
+    public static final String NETWORK_SERVICE_PROVIDER_ID = "nspid";
+    public static final String SERVICE_LIST = "servicelist";
+    public static final String CAN_ENABLE_INDIVIDUAL_SERVICE = "canenableindividualservice";
+    public static final String SUPPORTED_SERVICES = "supportedservices";
+    public static final String NSP_ID = "nspid";
+    public static final String ACL_TYPE = "acltype";
+    public static final String SUBDOMAIN_ACCESS = "subdomainaccess";
+    public static final String LOAD_BALANCER_DEVICE_ID = "lbdeviceid";
+    public static final String LOAD_BALANCER_DEVICE_NAME = "lbdevicename";
+    public static final String LOAD_BALANCER_DEVICE_STATE = "lbdevicestate";
+    public static final String LOAD_BALANCER_DEVICE_CAPACITY = "lbdevicecapacity";
+    public static final String LOAD_BALANCER_DEVICE_DEDICATED = "lbdevicededicated";
+    public static final String FIREWALL_DEVICE_ID = "fwdeviceid";
+    public static final String FIREWALL_DEVICE_NAME = "fwdevicename";
+    public static final String FIREWALL_DEVICE_STATE = "fwdevicestate";
+    public static final String FIREWALL_DEVICE_CAPACITY = "fwdevicecapacity";
+    public static final String FIREWALL_DEVICE_DEDICATED = "fwdevicededicated";
+    public static final String SERVICE = "service";
+    public static final String ASSOCIATED_NETWORK_ID = "associatednetworkid";
+    public static final String ASSOCIATED_NETWORK_NAME = "associatednetworkname";
+    public static final String SOURCE_NAT_SUPPORTED = "sourcenatsupported";
+    public static final String RESOURCE_STATE = "resourcestate";
+    public static final String PROJECT_INVITE_REQUIRED = "projectinviterequired";
+    public static final String REQUIRED = "required";
+    public static final String RESTART_REQUIRED = "restartrequired";
+    public static final String ALLOW_USER_CREATE_PROJECTS = "allowusercreateprojects";
+    public static final String CONSERVE_MODE = "conservemode";
+    public static final String TRAFFIC_TYPE_IMPLEMENTOR = "traffictypeimplementor";
+    public static final String KEYWORD = "keyword";
+    public static final String LIST_ALL = "listall";
+    public static final String SPECIFY_IP_RANGES = "specifyipranges";
+    public static final String IS_SOURCE_NAT = "issourcenat";
+    public static final String IS_STATIC_NAT = "isstaticnat";
+    public static final String SORT_BY = "sortby";
+    public static final String CHANGE_CIDR = "changecidr";
+    public static final String PURPOSE = "purpose";
+    public static final String IS_TAGGED = "istagged";
+    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_MAX_SIZE = "customdiskofferingmaxsize";
+    public static final String DEFAULT_ZONE_ID = "defaultzoneid";
+    public static final String GUID = "guid";
+
+    public static final String EXTERNAL_SWITCH_MGMT_DEVICE_ID = "vsmdeviceid";
+    public static final String EXTERNAL_SWITCH_MGMT_DEVICE_NAME = "vsmdevicename";
+    public static final String EXTERNAL_SWITCH_MGMT_DEVICE_STATE = "vsmdevicestate";
+    // Would we need to have a capacity field for Cisco N1KV VSM? Max hosts managed by it perhaps? May remove this later.
+    public static final String EXTERNAL_SWITCH_MGMT_DEVICE_CAPACITY = "vsmdevicecapacity";
+    public static final String CISCO_NEXUS_VSM_NAME = "vsmname";
+    public static final String VSM_USERNAME = "vsmusername";
+    public static final String VSM_PASSWORD = "vsmpassword";
+    public static final String VSM_IPADDRESS = "vsmipaddress";
+    public static final String VSM_MGMT_VLAN_ID = "vsmmgmtvlanid";
+    public static final String VSM_PKT_VLAN_ID = "vsmpktvlanid";
+    public static final String VSM_CTRL_VLAN_ID = "vsmctrlvlanid";
+    public static final String VSM_STORAGE_VLAN_ID = "vsmstoragevlanid";
+    public static final String VSM_DOMAIN_ID = "vsmdomainid";
+    public static final String VSM_CONFIG_MODE = "vsmconfigmode";
+    public static final String VSM_CONFIG_STATE = "vsmconfigstate";
+    public static final String VSM_DEVICE_STATE = "vsmdevicestate";
+    public static final String ADD_VSM_FLAG = "addvsmflag";
+    public static final String VPC_OFF_ID = "vpcofferingid";
+    public static final String NETWORK = "network";
+    public static final String VPC_ID = "vpcid";
+    public static final String GATEWAY_ID = "gatewayid";
+    public static final String CAN_USE_FOR_DEPLOY = "canusefordeploy";
+    public static final String RESOURCE_IDS = "resourceids";
+    public static final String RESOURCE_ID = "resourceid";
+    public static final String CUSTOMER = "customer";
+    public static final String S2S_VPN_GATEWAY_ID = "s2svpngatewayid";
+    public static final String S2S_CUSTOMER_GATEWAY_ID = "s2scustomergatewayid";
+    public static final String IPSEC_PSK = "ipsecpsk";
+    public static final String GUEST_IP = "guestip";
+    public static final String REMOVED = "removed";
+    public static final String IKE_POLICY = "ikepolicy";
+    public static final String ESP_POLICY = "esppolicy";
+    public static final String IKE_LIFETIME = "ikelifetime";
+    public static final String ESP_LIFETIME = "esplifetime";
+    public static final String DPD = "dpd";
+    public static final String FOR_VPC = "forvpc";
+    public static final String SHRINK_OK = "shrinkok";
+    public static final String NICIRA_NVP_DEVICE_ID = "nvpdeviceid";
+    public static final String NICIRA_NVP_TRANSPORT_ZONE_UUID = "transportzoneuuid";
+    public static final String NICIRA_NVP_DEVICE_NAME = "niciradevicename";
+    public static final String NICIRA_NVP_GATEWAYSERVICE_UUID = "l3gatewayserviceuuid";
+    public static final String S3_ACCESS_KEY = "accesskey";
+    public static final String S3_SECRET_KEY = "secretkey";
+    public static final String S3_END_POINT = "endpoint";
+    public static final String S3_BUCKET_NAME = "bucket";
+    public static final String S3_HTTPS_FLAG = "usehttps";
+    public static final String S3_CONNECTION_TIMEOUT = "connectiontimeout";
+    public static final String S3_MAX_ERROR_RETRY = "maxerrorretry";
+    public static final String S3_SOCKET_TIMEOUT = "sockettimeout";
+    public static final String INCL_ZONES = "includezones";
+    public static final String EXCL_ZONES = "excludezones";
+    public static final String SOURCE = "source";
+    public static final String COUNTER_ID = "counterid";
+    public static final String AGGR_OPERATOR = "aggroperator";
+    public static final String AGGR_FUNCTION = "aggrfunction";
+    public static final String AGGR_VALUE = "aggrvalue";
+    public static final String THRESHOLD = "threshold";
+    public static final String RELATIONAL_OPERATOR = "relationaloperator";
+    public static final String OTHER_DEPLOY_PARAMS = "otherdeployparams";
+    public static final String MIN_MEMBERS = "minmembers";
+    public static final String MAX_MEMBERS = "maxmembers";
+    public static final String AUTOSCALE_VM_DESTROY_TIME = "destroyvmgraceperiod";
+    public static final String VMPROFILE_ID = "vmprofileid";
+    public static final String VMGROUP_ID = "vmgroupid";
+    public static final String CS_URL = "csurl";
+    public static final String SCALEUP_POLICY_IDS = "scaleuppolicyids";
+    public static final String SCALEDOWN_POLICY_IDS = "scaledownpolicyids";
+    public static final String SCALEUP_POLICIES = "scaleuppolicies";
+    public static final String SCALEDOWN_POLICIES = "scaledownpolicies";
+    public static final String INTERVAL = "interval";
+    public static final String QUIETTIME = "quiettime";
+    public static final String ACTION = "action";
+    public static final String CONDITION_ID = "conditionid";
+    public static final String CONDITION_IDS = "conditionids";
+    public static final String COUNTERPARAM_LIST = "counterparam";
+    public static final String AUTOSCALE_USER_ID = "autoscaleuserid";
+
+    public enum HostDetails {
+        all, capacity, events, stats, min;
+    }
+
+    public enum VMDetails {
+        all, group, nics, stats, secgrp, tmpl, servoff, iso, volume, min;
+    }
+
+    public enum LDAPParams {
+        hostname, port, usessl, queryfilter, searchbase, dn, passwd, truststore, truststorepass;
+
+        @Override
+        public String toString() {
+            return "ldap." + name();
+        }
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/org/apache/cloudstack/api/BaseAsyncCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/BaseAsyncCmd.java b/api/src/org/apache/cloudstack/api/BaseAsyncCmd.java
new file mode 100644
index 0000000..fd67ed8
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/BaseAsyncCmd.java
@@ -0,0 +1,135 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api;
+
+import org.apache.cloudstack.api.response.AsyncJobResponse;
+import com.cloud.async.AsyncJob;
+import com.cloud.user.User;
+import com.cloud.user.UserContext;
+
+/**
+ * queryAsyncJobResult API command.
+ */
+public abstract class BaseAsyncCmd extends BaseCmd {
+
+    public static final String ipAddressSyncObject = "ipaddress";
+    public static final String networkSyncObject = "network";
+    public static final String vpcSyncObject = "vpc";
+    public static final String snapshotHostSyncObject = "snapshothost";
+
+    private AsyncJob job;
+
+    @Parameter(name = "starteventid", type = CommandType.LONG)
+    private Long startEventId;
+
+    /**
+     * For proper tracking of async commands through the system, events must be generated when the command is
+     * scheduled, started, and completed. Commands should specify the type of event so that when the scheduled,
+     * started, and completed events are saved to the events table, they have the proper type information.
+     *
+     * @return a string representing the type of event, e.g. VM.START, VOLUME.CREATE.
+     */
+    public abstract String getEventType();
+
+    /**
+     * For proper tracking of async commands through the system, events must be generated when the command is
+     * scheduled, started, and completed. Commands should specify a description for these events so that when
+     * the scheduled, started, and completed events are saved to the events table, they have a meaningful description.
+     *
+     * @return a string representing a description of the event
+     */
+    public abstract String getEventDescription();
+
+    public ResponseObject getResponse(long jobId) {
+        AsyncJobResponse response = new AsyncJobResponse();
+
+        AsyncJob job = _entityMgr.findById(AsyncJob.class, jobId);
+        response.setJobId(job.getUuid());
+        response.setResponseName(getCommandName());
+        return response;
+    }
+
+    public void setJob(AsyncJob job) {
+        this.job = job;
+    }
+
+    public Long getStartEventId() {
+        return startEventId;
+    }
+
+    public void setStartEventId(Long startEventId) {
+        this.startEventId = startEventId;
+    }
+
+    /**
+     * Async commands that want to be tracked as part of the listXXX commands need to
+     * provide implementations of the two following methods, getInstanceId() and getInstanceType()
+     *
+     * getObjectId() should return the id of the object the async command is executing on
+     * getObjectType() should return a type from the AsyncJob.Type enumeration
+     */
+    public Long getInstanceId() {
+        return null;
+    }
+
+    public AsyncJob.Type getInstanceType() {
+        return AsyncJob.Type.None;
+    }
+
+    public String getSyncObjType() {
+        return null;
+    }
+
+    public Long getSyncObjId() {
+        return null;
+    }
+
+    public AsyncJob getJob() {
+        return job;
+    }
+
+    protected long saveStartedEvent() {
+        return saveStartedEvent(getEventType(), "Executing job for " + getEventDescription(), getStartEventId());
+    }
+
+    protected long saveStartedEvent(String eventType, String description, Long startEventId) {
+        UserContext ctx = UserContext.current();
+        Long userId = ctx.getCallerUserId();
+        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) {
+        UserContext ctx = UserContext.current();
+        Long userId = ctx.getCallerUserId();
+        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);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/org/apache/cloudstack/api/BaseAsyncCreateCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/BaseAsyncCreateCmd.java b/api/src/org/apache/cloudstack/api/BaseAsyncCreateCmd.java
new file mode 100644
index 0000000..ad9f4c6
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/BaseAsyncCreateCmd.java
@@ -0,0 +1,58 @@
+// 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;
+
+import org.apache.cloudstack.api.response.CreateCmdResponse;
+
+import com.cloud.async.AsyncJob;
+import com.cloud.exception.ResourceAllocationException;
+
+public abstract class BaseAsyncCreateCmd extends BaseAsyncCmd {
+    @Parameter(name = "id", type = CommandType.LONG)
+    private Long id;
+
+    public abstract void create() throws ResourceAllocationException;
+
+    public Long getEntityId() {
+        return id;
+    }
+
+    public void setEntityId(Long id) {
+        this.id = id;
+    }
+
+    public abstract String getEntityTable();
+
+    public String getResponse(long jobId, long objectId, String objectEntityTable) {
+        CreateCmdResponse response = new CreateCmdResponse();
+        AsyncJob job = _entityMgr.findById(AsyncJob.class, jobId);
+        response.setJobId(job.getUuid());
+        response.setId(objectId);
+        response.setIdEntityTable(objectEntityTable);
+        response.setResponseName(getCommandName());
+        return _responseGenerator.toSerializedString(response, getResponseType());
+    }
+
+    public String getCreateEventType() {
+        return null;
+    }
+
+    public String getCreateEventDescription() {
+        return null;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/org/apache/cloudstack/api/BaseCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/BaseCmd.java b/api/src/org/apache/cloudstack/api/BaseCmd.java
new file mode 100644
index 0000000..d964e70
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/BaseCmd.java
@@ -0,0 +1,538 @@
+// 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;
+
+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;
+
+import org.apache.cloudstack.query.QueryService;
+import org.apache.log4j.Logger;
+
+import com.cloud.configuration.ConfigurationService;
+import com.cloud.consoleproxy.ConsoleProxyService;
+import com.cloud.dao.EntityManager;
+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.NetworkService;
+import com.cloud.network.StorageNetworkService;
+import com.cloud.network.VpcVirtualNetworkApplianceService;
+import com.cloud.network.as.AutoScaleService;
+import com.cloud.network.firewall.FirewallService;
+import com.cloud.network.firewall.NetworkACLService;
+import com.cloud.network.lb.LoadBalancingRulesService;
+import com.cloud.network.rules.RulesService;
+import com.cloud.network.security.SecurityGroupService;
+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;
+import com.cloud.server.TaggedResourceService;
+import com.cloud.storage.StorageService;
+import com.cloud.storage.snapshot.SnapshotService;
+import com.cloud.template.TemplateService;
+import com.cloud.user.Account;
+import com.cloud.user.AccountService;
+import com.cloud.user.DomainService;
+import com.cloud.user.ResourceLimitService;
+import com.cloud.utils.IdentityProxy;
+import com.cloud.utils.Pair;
+import com.cloud.utils.component.ComponentLocator;
+import com.cloud.vm.BareMetalVmService;
+import com.cloud.vm.UserVmService;
+
+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 {
+        BOOLEAN, DATE, FLOAT, INTEGER, SHORT, LIST, LONG, OBJECT, MAP, STRING, TZDATE, UUID
+    }
+
+    // FIXME: Extract these out into a separate file
+    // Client error codes
+    public static final int MALFORMED_PARAMETER_ERROR = 430;
+    public static final int PARAM_ERROR = 431;
+    public static final int UNSUPPORTED_ACTION_ERROR = 432;
+    public static final int PAGE_LIMIT_EXCEED = 433;
+
+    // Server error codes
+    public static final int INTERNAL_ERROR = 530;
+    public static final int ACCOUNT_ERROR = 531;
+    public static final int ACCOUNT_RESOURCE_LIMIT_ERROR = 532;
+    public static final int INSUFFICIENT_CAPACITY_ERROR = 533;
+    public static final int RESOURCE_UNAVAILABLE_ERROR = 534;
+    public static final int RESOURCE_ALLOCATION_ERROR = 534;
+    public static final int RESOURCE_IN_USE_ERROR = 536;
+    public static final int NETWORK_RULE_CONFLICT_ERROR = 537;
+
+    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 _outputFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
+
+    private Object _responseObject = null;
+    private Map<String, String> fullUrlParams;
+
+    @Parameter(name = "response", type = CommandType.STRING)
+    private String responseType;
+
+    public static ComponentLocator s_locator;
+    public static ConfigurationService _configService;
+    public static AccountService _accountService;
+    public static UserVmService _userVmService;
+    public static ManagementService _mgr;
+    public static StorageService _storageService;
+    public static ResourceService _resourceService;
+    public static NetworkService _networkService;
+    public static TemplateService _templateService;
+    public static SecurityGroupService _securityGroupService;
+    public static SnapshotService _snapshotService;
+    public static ConsoleProxyService _consoleProxyService;
+    public static VpcVirtualNetworkApplianceService _routerService;
+    public static ResponseGenerator _responseGenerator;
+    public static EntityManager _entityMgr;
+    public static RulesService _rulesService;
+    public static AutoScaleService _autoScaleService;
+    public static LoadBalancingRulesService _lbService;
+    public static RemoteAccessVpnService _ravService;
+    public static BareMetalVmService _bareMetalVmService;
+    public static ProjectService _projectService;
+    public static FirewallService _firewallService;
+    public static DomainService _domainService;
+    public static ResourceLimitService _resourceLimitService;
+    public static IdentityService _identityService;
+    public static StorageNetworkService _storageNetworkService;
+    public static TaggedResourceService _taggedResourceService;
+    public static VpcService _vpcService;
+    public static NetworkACLService _networkACLService;
+    public static Site2SiteVpnService _s2sVpnService;
+
+    public static QueryService _queryService;
+
+    public static void setComponents(ResponseGenerator generator) {
+        ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
+        _mgr = (ManagementService) ComponentLocator.getComponent(ManagementService.Name);
+        _accountService = locator.getManager(AccountService.class);
+        _configService = locator.getManager(ConfigurationService.class);
+        _userVmService = locator.getManager(UserVmService.class);
+        _storageService = locator.getManager(StorageService.class);
+        _resourceService = locator.getManager(ResourceService.class);
+        _networkService = locator.getManager(NetworkService.class);
+        _templateService = locator.getManager(TemplateService.class);
+        _securityGroupService = locator.getManager(SecurityGroupService.class);
+        _snapshotService = locator.getManager(SnapshotService.class);
+        _consoleProxyService = locator.getManager(ConsoleProxyService.class);
+        _routerService = locator.getManager(VpcVirtualNetworkApplianceService.class);
+        _entityMgr = locator.getManager(EntityManager.class);
+        _rulesService = locator.getManager(RulesService.class);
+        _lbService = locator.getManager(LoadBalancingRulesService.class);
+        _autoScaleService = locator.getManager(AutoScaleService.class);
+        _ravService = locator.getManager(RemoteAccessVpnService.class);
+        _responseGenerator = generator;
+        _bareMetalVmService = locator.getManager(BareMetalVmService.class);
+        _projectService = locator.getManager(ProjectService.class);
+        _firewallService = locator.getManager(FirewallService.class);
+        _domainService = locator.getManager(DomainService.class);
+        _resourceLimitService = locator.getManager(ResourceLimitService.class);
+        _identityService = locator.getManager(IdentityService.class);
+        _storageNetworkService = locator.getManager(StorageNetworkService.class);
+        _taggedResourceService = locator.getManager(TaggedResourceService.class);
+        _vpcService = locator.getManager(VpcService.class);
+        _networkACLService = locator.getManager(NetworkACLService.class);
+        _s2sVpnService = locator.getManager(Site2SiteVpnService.class);
+        _queryService = locator.getManager(QueryService.class);
+    }
+
+    public abstract void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException;
+
+    public String getResponseType() {
+        if (responseType == null) {
+            return RESPONSE_TYPE_XML;
+        }
+        return responseType;
+    }
+
+    public void setResponseType(String responseType) {
+        this.responseType = responseType;
+    }
+
+    public abstract String getCommandName();
+
+    /**
+     * For commands the API framework needs to know the owner of the object being acted upon. This method is
+     * used to determine that information.
+     *
+     * @return the id of the account that owns the object being acted upon
+     */
+    public abstract long getEntityOwnerId();
+
+    public Object getResponseObject() {
+        return _responseObject;
+    }
+
+    public void setResponseObject(Object responseObject) {
+        _responseObject = responseObject;
+    }
+
+    public ManagementService getMgmtServiceRef() {
+        return _mgr;
+    }
+
+    public static String getDateString(Date date) {
+        if (date == null) {
+            return "";
+        }
+        String formattedString = null;
+        synchronized (_outputFormat) {
+            formattedString = _outputFormat.format(date);
+        }
+        return formattedString;
+    }
+
+    // FIXME: move this to a utils method so that maps can be unpacked and integer/long values can be appropriately cast
+    @SuppressWarnings({ "unchecked", "rawtypes" })
+    public Map<String, Object> unpackParams(Map<String, String> params) {
+        Map<String, Object> lowercaseParams = new HashMap<String, Object>();
+        for (String key : params.keySet()) {
+            int arrayStartIndex = key.indexOf('[');
+            int arrayStartLastIndex = key.lastIndexOf('[');
+            if (arrayStartIndex != arrayStartLastIndex) {
+                throw new ServerApiException(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");
+            }
+
+            if (arrayStartIndex > 0) {
+                int arrayEndIndex = key.indexOf(']');
+                int arrayEndLastIndex = key.lastIndexOf(']');
+                if ((arrayEndIndex < arrayStartIndex) || (arrayEndIndex != arrayEndLastIndex)) {
+                    // malformed parameter
+                    throw new ServerApiException(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(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key
+                            + "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
+                } else {
+                    fieldName = key.substring(fieldIndex + 1);
+                }
+
+                // parse the parameter name as the text before the first '[' character
+                String paramName = key.substring(0, arrayStartIndex);
+                paramName = paramName.toLowerCase();
+
+                Map<Integer, Map> mapArray = null;
+                Map<String, Object> mapValue = null;
+                String indexStr = key.substring(arrayStartIndex + 1, arrayEndIndex);
+                int index = 0;
+                boolean parsedIndex = false;
+                try {
+                    if (indexStr != null) {
+                        index = Integer.parseInt(indexStr);
+                        parsedIndex = true;
+                    }
+                } catch (NumberFormatException nfe) {
+                    s_logger.warn("Invalid parameter " + key + " received, unable to parse object array, returning an error.");
+                }
+
+                if (!parsedIndex) {
+                    throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key
+                            + "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
+                }
+
+                Object value = lowercaseParams.get(paramName);
+                if (value == null) {
+                    // for now, assume object array with sub fields
+                    mapArray = new HashMap<Integer, Map>();
+                    mapValue = new HashMap<String, Object>();
+                    mapArray.put(Integer.valueOf(index), mapValue);
+                } else if (value instanceof Map) {
+                    mapArray = (HashMap) value;
+                    mapValue = mapArray.get(Integer.valueOf(index));
+                    if (mapValue == null) {
+                        mapValue = new HashMap<String, Object>();
+                        mapArray.put(Integer.valueOf(index), mapValue);
+                    }
+                }
+
+                // we are ready to store the value for a particular field into the map for this object
+                mapValue.put(fieldName, params.get(key));
+
+                lowercaseParams.put(paramName, mapArray);
+            } else {
+                lowercaseParams.put(key.toLowerCase(), params.get(key));
+            }
+        }
+        return lowercaseParams;
+    }
+
+    public String buildResponse(ServerApiException apiException, String responseType) {
+        StringBuffer sb = new StringBuffer();
+        if (RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) {
+            // JSON response
+            sb.append("{ \"" + getCommandName() + "\" : { " + "\"@attributes\":{\"cloudstack-version\":\"" + _mgr.getVersion() + "\"},");
+            sb.append("\"errorcode\" : \"" + apiException.getErrorCode() + "\", \"description\" : \"" + apiException.getDescription() + "\" } }");
+        } else {
+            sb.append("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>");
+            sb.append("<" + getCommandName() + ">");
+            sb.append("<errorcode>" + apiException.getErrorCode() + "</errorcode>");
+            sb.append("<description>" + escapeXml(apiException.getDescription()) + "</description>");
+            sb.append("</" + getCommandName() + " cloudstack-version=\"" + _mgr.getVersion() + "\">");
+        }
+        return sb.toString();
+    }
+
+    public String buildResponse(List<Pair<String, Object>> tagList, String responseType) {
+        StringBuffer prefixSb = new StringBuffer();
+        StringBuffer suffixSb = new StringBuffer();
+
+        // set up the return value with the name of the response
+        if (RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) {
+            prefixSb.append("{ \"" + getCommandName() + "\" : { \"@attributes\":{\"cloudstack-version\":\"" + _mgr.getVersion() + "\"},");
+        } else {
+            prefixSb.append("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>");
+            prefixSb.append("<" + getCommandName() + " cloudstack-version=\"" + _mgr.getVersion() + "\">");
+        }
+
+        int i = 0;
+        for (Pair<String, Object> tagData : tagList) {
+            String tagName = tagData.first();
+            Object tagValue = tagData.second();
+            if (tagValue instanceof Object[]) {
+                Object[] subObjects = (Object[]) tagValue;
+                if (subObjects.length < 1) {
+                    continue;
+                }
+                writeObjectArray(responseType, suffixSb, i++, tagName, subObjects);
+            } else {
+                writeNameValuePair(suffixSb, tagName, tagValue, responseType, i++);
+            }
+        }
+
+        if (suffixSb.length() > 0) {
+            if (RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) { // append comma only if we have some suffix else
+                // not as per strict Json syntax.
+                prefixSb.append(",");
+            }
+            prefixSb.append(suffixSb);
+        }
+        // close the response
+        if (RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) {
+            prefixSb.append("} }");
+        } else {
+            prefixSb.append("</" + getCommandName() + ">");
+        }
+        return prefixSb.toString();
+    }
+
+    private void writeNameValuePair(StringBuffer sb, String tagName, Object tagValue, String responseType, int propertyCount) {
+        if (tagValue == null) {
+            return;
+        }
+
+        if (tagValue instanceof Object[]) {
+            Object[] subObjects = (Object[]) tagValue;
+            if (subObjects.length < 1) {
+                return;
+            }
+            writeObjectArray(responseType, sb, propertyCount, tagName, subObjects);
+        } else {
+            if (RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) {
+                String seperator = ((propertyCount > 0) ? ", " : "");
+                sb.append(seperator + "\"" + tagName + "\" : \"" + escapeJSON(tagValue.toString()) + "\"");
+            } else {
+                sb.append("<" + tagName + ">" + escapeXml(tagValue.toString()) + "</" + tagName + ">");
+            }
+        }
+    }
+
+    @SuppressWarnings("rawtypes")
+    private void writeObjectArray(String responseType, StringBuffer sb, int propertyCount, String tagName, Object[] subObjects) {
+        if (RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) {
+            String separator = ((propertyCount > 0) ? ", " : "");
+            sb.append(separator);
+        }
+        int j = 0;
+        for (Object subObject : subObjects) {
+            if (subObject instanceof List) {
+                List subObjList = (List) subObject;
+                writeSubObject(sb, tagName, subObjList, responseType, j++);
+            }
+        }
+
+        if (RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) {
+            sb.append("]");
+        }
+    }
+
+    @SuppressWarnings("rawtypes")
+    private void writeSubObject(StringBuffer sb, String tagName, List tagList, String responseType, int objectCount) {
+        if (RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) {
+            sb.append(((objectCount == 0) ? "\"" + tagName + "\" : [  { " : ", { "));
+        } else {
+            sb.append("<" + tagName + ">");
+        }
+
+        int i = 0;
+        for (Object tag : tagList) {
+            if (tag instanceof Pair) {
+                Pair nameValuePair = (Pair) tag;
+                writeNameValuePair(sb, (String) nameValuePair.first(), nameValuePair.second(), responseType, i++);
+            }
+        }
+
+        if (RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) {
+            sb.append("}");
+        } else {
+            sb.append("</" + tagName + ">");
+        }
+    }
+
+    /**
+     * Escape xml response set to false by default. API commands to override this method to allow escaping
+     */
+    public boolean requireXmlEscape() {
+        return true;
+    }
+
+    private String escapeXml(String xml) {
+        if (!requireXmlEscape()) {
+            return xml;
+        }
+        int iLen = xml.length();
+        if (iLen == 0) {
+            return xml;
+        }
+        StringBuffer sOUT = new StringBuffer(iLen + 256);
+        int i = 0;
+        for (; i < iLen; i++) {
+            char c = xml.charAt(i);
+            if (c == '<') {
+                sOUT.append("&lt;");
+            } else if (c == '>') {
+                sOUT.append("&gt;");
+            } else if (c == '&') {
+                sOUT.append("&amp;");
+            } else if (c == '"') {
+                sOUT.append("&quot;");
+            } else if (c == '\'') {
+                sOUT.append("&apos;");
+            } else {
+                sOUT.append(c);
+            }
+        }
+        return sOUT.toString();
+    }
+
+    private static String escapeJSON(String str) {
+        if (str == null) {
+            return str;
+        }
+
+        return str.replace("\"", "\\\"");
+    }
+
+    protected long getInstanceIdFromJobSuccessResult(String result) {
+        s_logger.debug("getInstanceIdFromJobSuccessResult not overridden in subclass " + this.getClass().getName());
+        return 0;
+    }
+
+    public static boolean isAdmin(short accountType) {
+        return ((accountType == Account.ACCOUNT_TYPE_ADMIN) ||
+                (accountType == Account.ACCOUNT_TYPE_RESOURCE_DOMAIN_ADMIN) ||
+                (accountType == Account.ACCOUNT_TYPE_DOMAIN_ADMIN) || (accountType == Account.ACCOUNT_TYPE_READ_ONLY_ADMIN));
+    }
+
+    public static boolean isRootAdmin(short accountType) {
+        return ((accountType == Account.ACCOUNT_TYPE_ADMIN));
+    }
+
+    public void setFullUrlParams(Map<String, String> map) {
+        this.fullUrlParams = map;
+    }
+
+    public Map<String, String> getFullUrlParams() {
+        return this.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");
+            }
+
+            Domain domain = _domainService.getDomain(domainId);
+            if (domain == null) {
+                throw new InvalidParameterValueException("Unable to find domain by id");
+            }
+
+            Account account = _accountService.getActiveAccountByName(accountName, domainId);
+            if (account != null && account.getType() != Account.ACCOUNT_TYPE_PROJECT) {
+                if (!enabledOnly || account.getState() == Account.State.enabled) {
+                    return account.getId();
+                } else {
+                    throw new PermissionDeniedException("Can't add resources to the account id=" + account.getId() + " in state=" + account.getState() + " as it's no longer active");
+                }
+            } else {
+                // idList is not used anywhere, so removed it now
+                //List<IdentityProxy> idList = new ArrayList<IdentityProxy>();
+                //idList.add(new IdentityProxy("domain", domainId, "domainId"));
+                throw new InvalidParameterValueException("Unable to find account by name " + accountName + " in domain with specified id");
+            }
+        }
+
+        if (projectId != null) {
+            Project project = _projectService.getProject(projectId);
+            if (project != null) {
+                if (!enabledOnly || project.getState() == Project.State.Active) {
+                    return project.getProjectAccountId();
+                } else {
+                    PermissionDeniedException ex = new PermissionDeniedException("Can't add resources to the project with specified projectId in state=" + project.getState() + " as it's no longer active");
+                    ex.addProxyObject(project, projectId, "projectId");
+                    throw ex;
+                }
+            } else {
+                throw new InvalidParameterValueException("Unable to find project by id");
+            }
+        }
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/org/apache/cloudstack/api/BaseListAccountResourcesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/BaseListAccountResourcesCmd.java b/api/src/org/apache/cloudstack/api/BaseListAccountResourcesCmd.java
new file mode 100644
index 0000000..038da63
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/BaseListAccountResourcesCmd.java
@@ -0,0 +1,27 @@
+// 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;
+
+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.")
+    private String accountName;
+
+    public String getAccountName() {
+        return accountName;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/org/apache/cloudstack/api/BaseListCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/BaseListCmd.java b/api/src/org/apache/cloudstack/api/BaseListCmd.java
new file mode 100644
index 0000000..58e83f7
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/BaseListCmd.java
@@ -0,0 +1,108 @@
+// 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;
+
+import com.cloud.async.AsyncJob;
+import com.cloud.exception.InvalidParameterValueException;
+
+public abstract class BaseListCmd extends BaseCmd {
+
+    private static Long MAX_PAGESIZE = null;
+    public static Long PAGESIZE_UNLIMITED = -1L;
+
+    // ///////////////////////////////////////////////////
+    // ///////// BaseList API parameters /////////////////
+    // ///////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.KEYWORD, type = CommandType.STRING, description = "List by keyword")
+    private String keyword;
+
+    // FIXME: Need to be able to specify next/prev/first/last, so Integer might not be right
+    @Parameter(name = ApiConstants.PAGE, type = CommandType.INTEGER)
+    private Integer page;
+
+    @Parameter(name = ApiConstants.PAGE_SIZE, type = CommandType.INTEGER)
+    private Integer pageSize;
+
+    // ///////////////////////////////////////////////////
+    // ///////////////// Accessors ///////////////////////
+    // ///////////////////////////////////////////////////
+
+    public String getKeyword() {
+        return keyword;
+    }
+
+    public Integer getPage() {
+        return page;
+    }
+
+    public Integer getPageSize() {
+        if (pageSize != null && MAX_PAGESIZE != null && pageSize.longValue() > MAX_PAGESIZE.longValue()) {
+            throw new InvalidParameterValueException("Page size can't exceed max allowed page size value: " + MAX_PAGESIZE.longValue());
+        }
+
+        if (pageSize != null && pageSize.longValue() == PAGESIZE_UNLIMITED && page != null) {
+            throw new InvalidParameterValueException("Can't specify page parameter when pagesize is -1 (Unlimited)");
+        }
+
+        return pageSize;
+    }
+
+    public static void configure() {
+        if (_configService.getDefaultPageSize().longValue() != PAGESIZE_UNLIMITED) {
+            MAX_PAGESIZE = _configService.getDefaultPageSize();
+        }
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        // no owner is needed for list command
+        return 0;
+    }
+
+    public Long getPageSizeVal() {
+        Long defaultPageSize = MAX_PAGESIZE;
+        Integer pageSizeInt = getPageSize();
+        if (pageSizeInt != null) {
+            if (pageSizeInt.longValue() == PAGESIZE_UNLIMITED) {
+                defaultPageSize = null;
+            } else {
+                defaultPageSize = pageSizeInt.longValue();
+            }
+        }
+        return defaultPageSize;
+    }
+
+    public Long getStartIndex() {
+        Long startIndex = Long.valueOf(0);
+        Long pageSizeVal = getPageSizeVal();
+
+        if (pageSizeVal == null) {
+            startIndex = null;
+        } else if (page != null) {
+            int pageNum = page.intValue();
+            if (pageNum > 0) {
+                startIndex = Long.valueOf(pageSizeVal * (pageNum - 1));
+            }
+        }
+        return startIndex;
+    }
+
+    public AsyncJob.Type getInstanceType() {
+        return AsyncJob.Type.None;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/org/apache/cloudstack/api/BaseListDomainResourcesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/BaseListDomainResourcesCmd.java b/api/src/org/apache/cloudstack/api/BaseListDomainResourcesCmd.java
new file mode 100644
index 0000000..6e50a15
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/BaseListDomainResourcesCmd.java
@@ -0,0 +1,46 @@
+// 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;
+
+import org.apache.cloudstack.api.response.DomainResponse;
+
+public abstract class BaseListDomainResourcesCmd extends BaseListCmd {
+
+    @Parameter(name = ApiConstants.LIST_ALL, type = CommandType.BOOLEAN, description = "If set to false, " +
+            "list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false")
+    private Boolean listAll;
+
+    @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType=DomainResponse.class,
+            description="list only resources belonging to the domain specified")
+    private Long domainId;
+
+    @Parameter(name = ApiConstants.IS_RECURSIVE, type = CommandType.BOOLEAN, description = "defaults to false," +
+            " but if true, lists all resources from the parent specified by the domainId till leaves.")
+    private Boolean recursive;
+
+    public boolean listAll() {
+        return listAll == null ? false : listAll;
+    }
+
+    public boolean isRecursive() {
+        return recursive == null ? false : recursive;
+    }
+
+    public Long getDomainId() {
+        return domainId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/org/apache/cloudstack/api/BaseListProjectAndAccountResourcesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/BaseListProjectAndAccountResourcesCmd.java b/api/src/org/apache/cloudstack/api/BaseListProjectAndAccountResourcesCmd.java
new file mode 100644
index 0000000..836527f
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/BaseListProjectAndAccountResourcesCmd.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;
+
+import org.apache.cloudstack.api.response.ProjectResponse;
+
+public abstract class BaseListProjectAndAccountResourcesCmd extends BaseListAccountResourcesCmd {
+
+    @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.UUID, entityType=ProjectResponse.class,
+            description="list objects by project")
+    private Long projectId;
+
+    public Long getProjectId() {
+        return projectId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/org/apache/cloudstack/api/BaseListTaggedResourcesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/BaseListTaggedResourcesCmd.java b/api/src/org/apache/cloudstack/api/BaseListTaggedResourcesCmd.java
new file mode 100644
index 0000000..88176a5
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/BaseListTaggedResourcesCmd.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;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import com.cloud.exception.InvalidParameterValueException;
+
+public abstract class BaseListTaggedResourcesCmd extends BaseListProjectAndAccountResourcesCmd{
+    @Parameter(name = ApiConstants.TAGS, type = CommandType.MAP, description = "List resources by tags (key/value pairs)")
+    private Map tags;
+
+    public Map<String, String> getTags() {
+        Map<String, String> tagsMap = null;
+        if (tags != null && !tags.isEmpty()) {
+            tagsMap = new HashMap<String, String>();
+            Collection<?> servicesCollection = tags.values();
+            Iterator<?> iter = servicesCollection.iterator();
+            while (iter.hasNext()) {
+                HashMap<String, String> services = (HashMap<String, String>) iter.next();
+                String key = services.get("key");
+                String value = services.get("value");
+                if (value == null) {
+                    throw new InvalidParameterValueException("No value is passed in for key " + key);
+                }
+                tagsMap.put(key, value);
+            }
+        }
+        return tagsMap;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/org/apache/cloudstack/api/BaseListTemplateOrIsoPermissionsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/BaseListTemplateOrIsoPermissionsCmd.java b/api/src/org/apache/cloudstack/api/BaseListTemplateOrIsoPermissionsCmd.java
new file mode 100644
index 0000000..cde2d94
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/BaseListTemplateOrIsoPermissionsCmd.java
@@ -0,0 +1,89 @@
+// 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;
+
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.response.TemplatePermissionsResponse;
+import com.cloud.template.VirtualMachineTemplate;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+
+public class BaseListTemplateOrIsoPermissionsCmd extends BaseCmd {
+    public Logger s_logger = getLogger();
+    protected String s_name = "listtemplatepermissionsresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = TemplatePermissionsResponse.class,
+            required=true, description="the template ID")
+    private Long id;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+    @Override
+    public long getEntityOwnerId() {
+        VirtualMachineTemplate template = _entityMgr.findById(VirtualMachineTemplate.class, getId());
+        if (template != null) {
+            return template.getAccountId();
+        }
+
+        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
+    }
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    protected boolean templateIsCorrectType(VirtualMachineTemplate template) {
+        return true;
+    }
+
+    public String getMediaType() {
+        return "templateOrIso";
+    }
+
+    protected Logger getLogger() {
+        return Logger.getLogger(BaseUpdateTemplateOrIsoPermissionsCmd.class.getName());
+    }
+
+    @Override
+    public void execute(){
+        List<String> accountNames = _templateService.listTemplatePermissions(this);
+
+        Account account = UserContext.current().getCaller();
+        boolean isAdmin = (isAdmin(account.getType()));
+
+        TemplatePermissionsResponse response = _responseGenerator.createTemplatePermissionsResponse(accountNames, id, isAdmin);
+        response.setResponseName(getCommandName());
+        this.setResponseObject(response);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/org/apache/cloudstack/api/BaseResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/BaseResponse.java b/api/src/org/apache/cloudstack/api/BaseResponse.java
new file mode 100644
index 0000000..28ca6b8
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/BaseResponse.java
@@ -0,0 +1,74 @@
+// 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;
+
+import org.apache.cloudstack.api.ApiConstants;
+import com.cloud.utils.IdentityProxy;
+import org.apache.cloudstack.api.ResponseObject;
+import com.cloud.serializer.Param;
+import com.google.gson.annotations.SerializedName;
+
+public abstract class BaseResponse implements ResponseObject {
+    private transient String responseName;
+    private transient String objectName;
+
+    @Override
+    public String getResponseName() {
+        return responseName;
+    }
+
+    @Override
+    public void setResponseName(String responseName) {
+        this.responseName = responseName;
+    }
+
+    @Override
+    public String getObjectName() {
+        return objectName;
+    }
+
+    @Override
+    public void setObjectName(String objectName) {
+        this.objectName = objectName;
+    }
+
+    public String getObjectId() {
+        return null;
+    }
+
+    @SerializedName(ApiConstants.JOB_ID) @Param(description="the UUID of the latest async job acting on this object")
+    protected String jobId;
+
+    @SerializedName(ApiConstants.JOB_STATUS) @Param(description="the current status of the latest async job acting on this object")
+    private Integer jobStatus;
+
+    public String getJobId() {
+        return jobId;
+    }
+
+    public void setJobId(String jobId) {
+        this.jobId = jobId;
+    }
+
+    public Integer getJobStatus() {
+        return jobStatus;
+    }
+
+    public void setJobStatus(Integer jobStatus) {
+        this.jobStatus = jobStatus;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java b/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java
new file mode 100644
index 0000000..dd6ae00
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java
@@ -0,0 +1,96 @@
+// 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;
+
+import org.apache.cloudstack.api.command.user.iso.UpdateIsoCmd;
+import org.apache.cloudstack.api.response.GuestOSResponse;
+import org.apache.cloudstack.api.response.TemplateResponse;
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+
+public abstract class BaseUpdateTemplateOrIsoCmd extends BaseCmd {
+    public static final Logger s_logger = Logger.getLogger(UpdateIsoCmd.class.getName());
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name=ApiConstants.BOOTABLE, type=CommandType.BOOLEAN, description="true if image is bootable, false otherwise")
+    private Boolean bootable;
+
+    @Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, description="the display text of the image", length=4096)
+    private String displayText;
+
+    @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = TemplateResponse.class,
+            required=true, description="the ID of the image file")
+    private Long id;
+
+    @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the image file")
+    private String templateName;
+
+    @Parameter(name=ApiConstants.OS_TYPE_ID, type=CommandType.UUID, entityType = GuestOSResponse.class,
+            description="the ID of the OS type that best represents the OS of this image.")
+    private Long osTypeId;
+
+    @Parameter(name=ApiConstants.FORMAT, type=CommandType.STRING, description="the format for the image")
+    private String format;
+
+    @Parameter(name=ApiConstants.PASSWORD_ENABLED, type=CommandType.BOOLEAN, description="true if the image supports the password reset feature; default is false")
+    private Boolean passwordEnabled;
+
+    @Parameter(name=ApiConstants.SORT_KEY, type=CommandType.INTEGER, description="sort key of the template, integer")
+    private Integer sortKey;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Boolean isBootable() {
+        return bootable;
+    }
+
+    public String getDisplayText() {
+        return displayText;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public String getTemplateName() {
+        return templateName;
+    }
+
+    public Long getOsTypeId() {
+        return osTypeId;
+    }
+
+    public Boolean isPasswordEnabled() {
+        return passwordEnabled;
+    }
+
+    public String getFormat() {
+        return format;
+    }
+
+    public Integer getSortKey() {
+        return sortKey;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoPermissionsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoPermissionsCmd.java b/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoPermissionsCmd.java
new file mode 100644
index 0000000..aacc6ef
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoPermissionsCmd.java
@@ -0,0 +1,125 @@
+// 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;
+
+import java.util.List;
+
+import org.apache.cloudstack.api.response.ProjectResponse;
+import org.apache.cloudstack.api.response.TemplateResponse;
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.response.SuccessResponse;
+import com.cloud.exception.InvalidParameterValueException;
+
+public abstract class BaseUpdateTemplateOrIsoPermissionsCmd extends BaseCmd {
+    public Logger s_logger = getLogger();
+    protected String s_name = getResponseName();
+
+    // ///////////////////////////////////////////////////
+    // ////////////// API parameters /////////////////////
+    // ///////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.ACCOUNTS, type = CommandType.LIST, collectionType = CommandType.STRING, description = "a comma delimited list of accounts. If specified, \"op\" parameter has to be passed in.")
+    private List<String> accountNames;
+
+    @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TemplateResponse.class,
+            required = true, description = "the template ID")
+    private Long id;
+
+    @Parameter(name = ApiConstants.IS_FEATURED, type = CommandType.BOOLEAN, description = "true for featured template/iso, false otherwise")
+    private Boolean featured;
+
+    @Parameter(name = ApiConstants.IS_PUBLIC, type = CommandType.BOOLEAN, description = "true for public template/iso, false for private templates/isos")
+    private Boolean isPublic;
+
+    @Parameter(name = ApiConstants.IS_EXTRACTABLE, type = CommandType.BOOLEAN, description = "true if the template/iso is extractable, false other wise. Can be set only by root admin")
+    private Boolean isExtractable;
+
+    @Parameter(name = ApiConstants.OP, type = CommandType.STRING, description = "permission operator (add, remove, reset)")
+    private String operation;
+
+    @Parameter(name = ApiConstants.PROJECT_IDS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = ProjectResponse.class,
+            description = "a comma delimited list of projects. If specified, \"op\" parameter has to be passed in.")
+    private List<Long> projectIds;
+
+    // ///////////////////////////////////////////////////
+    // ///////////////// Accessors ///////////////////////
+    // ///////////////////////////////////////////////////
+
+    public List<String> getAccountNames() {
+        if (accountNames != null && projectIds != null) {
+            throw new InvalidParameterValueException("Accounts and projectIds can't be specified together");
+        }
+
+        return accountNames;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public Boolean isFeatured() {
+        return featured;
+    }
+
+    public Boolean isPublic() {
+        return isPublic;
+    }
+
+    public Boolean isExtractable() {
+        return isExtractable;
+    }
+
+    public String getOperation() {
+        return operation;
+    }
+
+    public List<Long> getProjectIds() {
+        if (accountNames != null && projectIds != null) {
+            throw new InvalidParameterValueException("Accounts and projectIds can't be specified together");
+        }
+        return projectIds;
+    }
+
+    // ///////////////////////////////////////////////////
+    // ///////////// API Implementation///////////////////
+    // ///////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    protected String getResponseName() {
+        return "updatetemplateorisopermissionsresponse";
+    }
+
+    protected Logger getLogger() {
+        return Logger.getLogger(BaseUpdateTemplateOrIsoPermissionsCmd.class.getName());
+    }
+
+    @Override
+    public void execute(){
+        boolean result = _templateService.updateTemplateOrIsoPermissions(this);
+        if (result) {
+            SuccessResponse response = new SuccessResponse(getCommandName());
+            this.setResponseObject(response);
+        } else {
+            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update template/iso permissions");
+        }
+    }
+}


Mime
View raw message