You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ts...@apache.org on 2013/06/03 12:52:01 UTC
[3/3] git commit: updated refs/heads/master to 2f51bcf
CLOUDSTACK-2815: org.apache.cloudstack.dedicated.* to org.apache.cloudstack
Moving the package one level up so API discovery can discovery APIs from
org.apache.cloudstack.api.* This also keeps the plugin uniform with the
other plugins which have their APIs in org.apache.cloudstack.api
namespace.
Signed-off-by: Prasanna Santhanam <ts...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/2f51bcf2
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/2f51bcf2
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/2f51bcf2
Branch: refs/heads/master
Commit: 2f51bcf2a89399f17fe73dc773100f7c1a8bfeb8
Parents: a9bfee1
Author: Prasanna Santhanam <ts...@apache.org>
Authored: Mon Jun 3 16:19:44 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Mon Jun 3 16:21:47 2013 +0530
----------------------------------------------------------------------
client/tomcatconf/componentContext.xml.in | 2 +-
.../api/commands/DedicateClusterCmd.java | 115 ++
.../cloudstack/api/commands/DedicateHostCmd.java | 118 +++
.../cloudstack/api/commands/DedicatePodCmd.java | 120 +++
.../cloudstack/api/commands/DedicateZoneCmd.java | 120 +++
.../api/commands/ListDedicatedClustersCmd.java | 105 ++
.../api/commands/ListDedicatedHostsCmd.java | 105 ++
.../api/commands/ListDedicatedPodsCmd.java | 105 ++
.../api/commands/ListDedicatedZonesCmd.java | 105 ++
.../api/commands/ReleaseDedicatedClusterCmd.java | 91 ++
.../api/commands/ReleaseDedicatedHostCmd.java | 91 ++
.../api/commands/ReleaseDedicatedPodCmd.java | 91 ++
.../api/commands/ReleaseDedicatedZoneCmd.java | 91 ++
.../api/response/DedicateClusterResponse.java | 79 ++
.../api/response/DedicateHostResponse.java | 79 ++
.../api/response/DedicatePodResponse.java | 82 ++
.../api/response/DedicateZoneResponse.java | 83 ++
.../dedicated/DedicatedResourceManagerImpl.java | 814 ++++++++++++++
.../cloudstack/dedicated/DedicatedService.java | 63 ++
.../dedicated/api/commands/DedicateClusterCmd.java | 115 --
.../dedicated/api/commands/DedicateHostCmd.java | 118 ---
.../dedicated/api/commands/DedicatePodCmd.java | 120 ---
.../dedicated/api/commands/DedicateZoneCmd.java | 120 ---
.../api/commands/ListDedicatedClustersCmd.java | 105 --
.../api/commands/ListDedicatedHostsCmd.java | 105 --
.../api/commands/ListDedicatedPodsCmd.java | 105 --
.../api/commands/ListDedicatedZonesCmd.java | 105 --
.../api/commands/ReleaseDedicatedClusterCmd.java | 91 --
.../api/commands/ReleaseDedicatedHostCmd.java | 91 --
.../api/commands/ReleaseDedicatedPodCmd.java | 91 --
.../api/commands/ReleaseDedicatedZoneCmd.java | 91 --
.../api/response/DedicateClusterResponse.java | 79 --
.../api/response/DedicateHostResponse.java | 79 --
.../api/response/DedicatePodResponse.java | 82 --
.../api/response/DedicateZoneResponse.java | 83 --
.../manager/DedicatedResourceManagerImpl.java | 816 ---------------
.../dedicated/services/DedicatedService.java | 63 --
.../dedicated/manager/DedicatedApiUnitTest.java | 9 +-
38 files changed, 2459 insertions(+), 2468 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2f51bcf2/client/tomcatconf/componentContext.xml.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/componentContext.xml.in b/client/tomcatconf/componentContext.xml.in
index fcbcc1b..03e931a 100644
--- a/client/tomcatconf/componentContext.xml.in
+++ b/client/tomcatconf/componentContext.xml.in
@@ -272,7 +272,7 @@
<!--
Dedicated Resources components
-->
- <bean id="DedicatedResourceManagerImpl" class="org.apache.cloudstack.dedicated.manager.DedicatedResourceManagerImpl"/>
+ <bean id="DedicatedResourceManagerImpl" class="org.apache.cloudstack.dedicated.DedicatedResourceManagerImpl"/>
<bean id="ExplicitDedicationProcessor" class="org.apache.cloudstack.affinity.ExplicitDedicationProcessor">
<property name="name" value="ExplicitDedicationProcessor"/>
<property name="type" value="ExplicitDedication"/>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2f51bcf2/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/DedicateClusterCmd.java
----------------------------------------------------------------------
diff --git a/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/DedicateClusterCmd.java b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/DedicateClusterCmd.java
new file mode 100644
index 0000000..91e4fce
--- /dev/null
+++ b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/DedicateClusterCmd.java
@@ -0,0 +1,115 @@
+// 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.commands;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.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.ClusterResponse;
+import org.apache.cloudstack.api.response.DomainResponse;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.DedicateClusterResponse;
+import org.apache.cloudstack.dedicated.DedicatedService;
+import org.apache.log4j.Logger;
+
+import com.cloud.dc.DedicatedResources;
+import com.cloud.event.EventTypes;
+import com.cloud.user.Account;
+
+@APICommand(name = "dedicateCluster", description= "Dedicate an existing cluster", responseObject = DedicateClusterResponse.class )
+public class DedicateClusterCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger.getLogger(DedicateClusterCmd.class.getName());
+
+ private static final String s_name = "dedicateclusterresponse";
+ @Inject DedicatedService dedicatedService;
+
+ @Parameter(name=ApiConstants.CLUSTER_ID, type=CommandType.UUID, entityType=ClusterResponse.class,
+ required=true, description="the ID of the Cluster")
+ private Long clusterId;
+
+ @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType=DomainResponse.class, required=true, description="the ID of the containing domain")
+ private Long domainId;
+
+ @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "the name of the account which needs dedication. Must be used with domainId.")
+ private String accountName;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getClusterId() {
+ return clusterId;
+ }
+
+ public Long getDomainId() {
+ return domainId;
+ }
+
+ public String getAccountName() {
+ return accountName;
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_DEDICATE_RESOURCE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "dedicating a cluster";
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute(){
+ List<? extends DedicatedResources> result = dedicatedService.dedicateCluster(getClusterId(), getDomainId(), getAccountName());
+ ListResponse<DedicateClusterResponse> response = new ListResponse<DedicateClusterResponse>();
+ List<DedicateClusterResponse> clusterResponseList = new ArrayList<DedicateClusterResponse>();
+ if (result != null) {
+ for (DedicatedResources resource : result) {
+ DedicateClusterResponse clusterResponse = dedicatedService.createDedicateClusterResponse(resource);
+ clusterResponseList.add(clusterResponse);
+ }
+ response.setResponses(clusterResponseList);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to dedicate cluster");
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2f51bcf2/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/DedicateHostCmd.java
----------------------------------------------------------------------
diff --git a/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/DedicateHostCmd.java b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/DedicateHostCmd.java
new file mode 100644
index 0000000..cb8eb45
--- /dev/null
+++ b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/DedicateHostCmd.java
@@ -0,0 +1,118 @@
+// 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.commands;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.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.DomainResponse;
+import org.apache.cloudstack.api.response.HostResponse;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.DedicateHostResponse;
+import org.apache.cloudstack.dedicated.DedicatedService;
+import org.apache.log4j.Logger;
+
+import com.cloud.dc.DedicatedResources;
+import com.cloud.event.EventTypes;
+import com.cloud.user.Account;
+
+@APICommand(name = "dedicateHost", description = "Dedicates a host.", responseObject = DedicateHostResponse.class)
+public class DedicateHostCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger.getLogger(DedicateHostCmd.class.getName());
+ private static final String s_name = "dedicatehostresponse";
+ @Inject DedicatedService dedicatedService;
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name=ApiConstants.HOST_ID, type=CommandType.UUID, entityType = HostResponse.class,
+ required=true, description="the ID of the host to update")
+ private Long hostId;
+
+ @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType=DomainResponse.class, required=true, description="the ID of the containing domain")
+ private Long domainId;
+
+ @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "the name of the account which needs dedication. Must be used with domainId.")
+ private String accountName;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getHostId() {
+ return hostId;
+ }
+
+ public Long getDomainId() {
+ return domainId;
+ }
+
+ public String getAccountName() {
+ return accountName;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute(){
+ List<? extends DedicatedResources> result = dedicatedService.dedicateHost(getHostId(), getDomainId(), getAccountName());
+ ListResponse<DedicateHostResponse> response = new ListResponse<DedicateHostResponse>();
+ List<DedicateHostResponse> hostResponseList = new ArrayList<DedicateHostResponse>();
+ if (result != null) {
+ for (DedicatedResources resource : result) {
+ DedicateHostResponse hostResponse = dedicatedService.createDedicateHostResponse(resource);
+ hostResponseList.add(hostResponse);
+ }
+ response.setResponses(hostResponseList);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to dedicate host");
+ }
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_DEDICATE_RESOURCE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "dedicating a host";
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2f51bcf2/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/DedicatePodCmd.java
----------------------------------------------------------------------
diff --git a/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/DedicatePodCmd.java b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/DedicatePodCmd.java
new file mode 100644
index 0000000..ed3c227
--- /dev/null
+++ b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/DedicatePodCmd.java
@@ -0,0 +1,120 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.commands;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.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.DomainResponse;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.PodResponse;
+import org.apache.cloudstack.api.response.DedicatePodResponse;
+import org.apache.cloudstack.dedicated.DedicatedService;
+import org.apache.log4j.Logger;
+
+import com.cloud.dc.DedicatedResources;
+import com.cloud.event.EventTypes;
+import com.cloud.user.Account;
+
+@APICommand(name = "dedicatePod", description ="Dedicates a Pod.", responseObject = DedicatePodResponse.class)
+public class DedicatePodCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger.getLogger(DedicatePodCmd.class.getName());
+
+ private static final String s_name = "dedicatepodresponse";
+ @Inject public DedicatedService dedicatedService;
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name=ApiConstants.POD_ID, type=CommandType.UUID, entityType=PodResponse.class,
+ required=true, description="the ID of the Pod")
+ private Long podId;
+
+ @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType=DomainResponse.class, required=true, description="the ID of the containing domain")
+ private Long domainId;
+
+ @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "the name of the account which needs dedication. Must be used with domainId.")
+ private String accountName;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+
+ public Long getPodId() {
+ return podId;
+ }
+
+ public Long getDomainId() {
+ return domainId;
+ }
+
+ public String getAccountName() {
+ return accountName;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute(){
+ List<? extends DedicatedResources> result = dedicatedService.dedicatePod(getPodId(), getDomainId(), getAccountName());
+ ListResponse<DedicatePodResponse> response = new ListResponse<DedicatePodResponse>();
+ List<DedicatePodResponse> podResponseList = new ArrayList<DedicatePodResponse>();
+ if (result != null) {
+ for (DedicatedResources resource : result) {
+ DedicatePodResponse podresponse = dedicatedService.createDedicatePodResponse(resource);
+ podResponseList.add(podresponse);
+ }
+ response.setResponses(podResponseList);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to dedicate pod");
+ }
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_DEDICATE_RESOURCE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "dedicating a pod";
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2f51bcf2/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/DedicateZoneCmd.java
----------------------------------------------------------------------
diff --git a/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/DedicateZoneCmd.java b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/DedicateZoneCmd.java
new file mode 100644
index 0000000..31c6025
--- /dev/null
+++ b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/DedicateZoneCmd.java
@@ -0,0 +1,120 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.commands;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.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.DomainResponse;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.cloudstack.api.response.DedicateZoneResponse;
+import org.apache.cloudstack.dedicated.DedicatedService;
+import org.apache.log4j.Logger;
+
+import com.cloud.dc.DedicatedResources;
+import com.cloud.event.EventTypes;
+import com.cloud.user.Account;
+
+@APICommand(name = "dedicateZone", description ="Dedicates a zones.", responseObject = DedicateZoneResponse.class)
+public class DedicateZoneCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger.getLogger(DedicateZoneCmd.class.getName());
+
+ private static final String s_name = "dedicatezoneresponse";
+ @Inject public DedicatedService dedicatedService;
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType=ZoneResponse.class,
+ required=true, description="the ID of the zone")
+ private Long zoneId;
+
+ @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType=DomainResponse.class, required=true, description="the ID of the containing domain")
+ private Long domainId;
+
+ @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "the name of the account which needs dedication. Must be used with domainId.")
+ private String accountName;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+
+ public Long getZoneId() {
+ return zoneId;
+ }
+
+ public Long getDomainId() {
+ return domainId;
+ }
+
+ public String getAccountName() {
+ return accountName;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute(){
+ List<? extends DedicatedResources> result = dedicatedService.dedicateZone(getZoneId(), getDomainId(), getAccountName());
+ ListResponse<DedicateZoneResponse> response = new ListResponse<DedicateZoneResponse>();
+ List<DedicateZoneResponse> zoneResponseList = new ArrayList<DedicateZoneResponse>();
+ if (result != null) {
+ for (DedicatedResources resource : result) {
+ DedicateZoneResponse zoneresponse = dedicatedService.createDedicateZoneResponse(resource);
+ zoneResponseList.add(zoneresponse);
+ }
+ response.setResponses(zoneResponseList);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to dedicate zone");
+ }
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_DEDICATE_RESOURCE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "dedicating a zone";
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2f51bcf2/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ListDedicatedClustersCmd.java
----------------------------------------------------------------------
diff --git a/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ListDedicatedClustersCmd.java b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ListDedicatedClustersCmd.java
new file mode 100644
index 0000000..f394787
--- /dev/null
+++ b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ListDedicatedClustersCmd.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.commands;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseListCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.ClusterResponse;
+import org.apache.cloudstack.api.response.DomainResponse;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.DedicateClusterResponse;
+import org.apache.cloudstack.dedicated.DedicatedService;
+import org.apache.log4j.Logger;
+
+import com.cloud.dc.DedicatedResourceVO;
+import com.cloud.dc.DedicatedResources;
+import com.cloud.utils.Pair;
+
+@APICommand(name = "listDedicatedClusters", description = "Lists dedicated clusters.", responseObject = DedicateClusterResponse.class)
+public class ListDedicatedClustersCmd extends BaseListCmd {
+ public static final Logger s_logger = Logger.getLogger(ListDedicatedClustersCmd.class.getName());
+
+ private static final String s_name = "listdedicatedclustersresponse";
+ @Inject DedicatedService dedicatedService;
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+ @Parameter(name=ApiConstants.CLUSTER_ID, type=CommandType.UUID, entityType=ClusterResponse.class,
+ description="the ID of the cluster")
+ private Long clusterId;
+
+ @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType=DomainResponse.class,
+ description="the ID of the domain associated with the cluster")
+ private Long domainId;
+
+ @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING,
+ description = "the name of the account associated with the cluster. Must be used with domainId.")
+ private String accountName;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getClusterId() {
+ return clusterId;
+ }
+
+ public Long getDomainId(){
+ return domainId;
+ }
+
+ public String getAccountName(){
+ return accountName;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public void execute(){
+ Pair<List<? extends DedicatedResourceVO>, Integer> result = dedicatedService.listDedicatedClusters(this);
+ ListResponse<DedicateClusterResponse> response = new ListResponse<DedicateClusterResponse>();
+ List<DedicateClusterResponse> Responses = new ArrayList<DedicateClusterResponse>();
+ if (result != null) {
+ for (DedicatedResources resource : result.first()) {
+ DedicateClusterResponse clusterResponse = dedicatedService.createDedicateClusterResponse(resource);
+ Responses.add(clusterResponse);
+ }
+ response.setResponses(Responses, result.second());
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to list dedicated clusters");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2f51bcf2/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ListDedicatedHostsCmd.java
----------------------------------------------------------------------
diff --git a/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ListDedicatedHostsCmd.java b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ListDedicatedHostsCmd.java
new file mode 100644
index 0000000..736251b
--- /dev/null
+++ b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ListDedicatedHostsCmd.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.commands;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseListCmd;
+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.HostResponse;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.DedicateHostResponse;
+import org.apache.cloudstack.dedicated.DedicatedService;
+import org.apache.log4j.Logger;
+
+import com.cloud.dc.DedicatedResourceVO;
+import com.cloud.dc.DedicatedResources;
+import com.cloud.utils.Pair;
+
+@APICommand(name = "listDedicatedHosts", description = "Lists dedicated hosts.", responseObject = DedicateHostResponse.class)
+public class ListDedicatedHostsCmd extends BaseListCmd {
+ public static final Logger s_logger = Logger.getLogger(ListDedicatedHostsCmd.class.getName());
+
+ private static final String s_name = "listdedicatedhostsresponse";
+ @Inject DedicatedService dedicatedService;
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+ @Parameter(name=ApiConstants.HOST_ID, type=CommandType.UUID, entityType=HostResponse.class,
+ description="the ID of the host")
+ private Long hostId;
+
+ @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType=DomainResponse.class,
+ description="the ID of the domain associated with the host")
+ private Long domainId;
+
+ @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING,
+ description = "the name of the account associated with the host. Must be used with domainId.")
+ private String accountName;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getHostId() {
+ return hostId;
+ }
+
+ public Long getDomainId(){
+ return domainId;
+ }
+
+ public String getAccountName(){
+ return accountName;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////l
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public void execute(){
+ Pair<List<? extends DedicatedResourceVO>, Integer> result = dedicatedService.listDedicatedHosts(this);
+ ListResponse<DedicateHostResponse> response = new ListResponse<DedicateHostResponse>();
+ List<DedicateHostResponse> Responses = new ArrayList<DedicateHostResponse>();
+ if (result != null) {
+ for (DedicatedResources resource : result.first()) {
+ DedicateHostResponse hostResponse = dedicatedService.createDedicateHostResponse(resource);
+ Responses.add(hostResponse);
+ }
+ response.setResponses(Responses, result.second());
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to list dedicated hosts");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2f51bcf2/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ListDedicatedPodsCmd.java
----------------------------------------------------------------------
diff --git a/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ListDedicatedPodsCmd.java b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ListDedicatedPodsCmd.java
new file mode 100644
index 0000000..da59eda
--- /dev/null
+++ b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ListDedicatedPodsCmd.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.commands;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseListCmd;
+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.ListResponse;
+import org.apache.cloudstack.api.response.PodResponse;
+import org.apache.cloudstack.api.response.DedicatePodResponse;
+import org.apache.cloudstack.dedicated.DedicatedService;
+import org.apache.log4j.Logger;
+
+import com.cloud.dc.DedicatedResourceVO;
+import com.cloud.dc.DedicatedResources;
+import com.cloud.utils.Pair;
+
+@APICommand(name = "listDedicatedPods", description = "Lists dedicated pods.", responseObject = DedicatePodResponse.class)
+public class ListDedicatedPodsCmd extends BaseListCmd {
+ public static final Logger s_logger = Logger.getLogger(ListDedicatedPodsCmd.class.getName());
+
+ private static final String s_name = "listdedicatedpodsresponse";
+ @Inject DedicatedService dedicatedService;
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+ @Parameter(name=ApiConstants.POD_ID, type=CommandType.UUID, entityType=PodResponse.class,
+ description="the ID of the pod")
+ private Long podId;
+
+ @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType=DomainResponse.class,
+ description="the ID of the domain associated with the pod")
+ private Long domainId;
+
+ @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING,
+ description = "the name of the account associated with the pod. Must be used with domainId.")
+ private String accountName;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getPodId() {
+ return podId;
+ }
+
+ public Long getDomainId(){
+ return domainId;
+ }
+
+ public String getAccountName(){
+ return accountName;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public void execute(){
+ Pair<List<? extends DedicatedResourceVO>, Integer> result = dedicatedService.listDedicatedPods(this);
+ ListResponse<DedicatePodResponse> response = new ListResponse<DedicatePodResponse>();
+ List<DedicatePodResponse> Responses = new ArrayList<DedicatePodResponse>();
+ if (result != null) {
+ for (DedicatedResources resource : result.first()) {
+ DedicatePodResponse podresponse = dedicatedService.createDedicatePodResponse(resource);
+ Responses.add(podresponse);
+ }
+ response.setResponses(Responses, result.second());
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to list dedicated pods");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2f51bcf2/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ListDedicatedZonesCmd.java
----------------------------------------------------------------------
diff --git a/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ListDedicatedZonesCmd.java b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ListDedicatedZonesCmd.java
new file mode 100644
index 0000000..a21f129
--- /dev/null
+++ b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ListDedicatedZonesCmd.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.commands;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseListCmd;
+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.ListResponse;
+import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.cloudstack.api.response.DedicateZoneResponse;
+import org.apache.cloudstack.dedicated.DedicatedService;
+import org.apache.log4j.Logger;
+
+import com.cloud.dc.DedicatedResourceVO;
+import com.cloud.dc.DedicatedResources;
+import com.cloud.utils.Pair;
+
+@APICommand(name = "listDedicatedZones", description = "List dedicated zones.", responseObject = DedicateZoneResponse.class)
+public class ListDedicatedZonesCmd extends BaseListCmd {
+ public static final Logger s_logger = Logger.getLogger(ListDedicatedZonesCmd.class.getName());
+
+ private static final String s_name = "listdedicatedzonesresponse";
+ @Inject DedicatedService _dedicatedservice;
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+ @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType=ZoneResponse.class,
+ description="the ID of the Zone")
+ private Long zoneId;
+
+ @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType=DomainResponse.class,
+ description="the ID of the domain associated with the zone")
+ private Long domainId;
+
+ @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING,
+ description = "the name of the account associated with the zone. Must be used with domainId.")
+ private String accountName;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getZoneId() {
+ return zoneId;
+ }
+
+ public Long getDomainId(){
+ return domainId;
+ }
+
+ public String getAccountName(){
+ return accountName;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public void execute(){
+ Pair<List<? extends DedicatedResourceVO>, Integer> result = _dedicatedservice.listDedicatedZones(this);
+ ListResponse<DedicateZoneResponse> response = new ListResponse<DedicateZoneResponse>();
+ List<DedicateZoneResponse> Responses = new ArrayList<DedicateZoneResponse>();
+ if (result != null) {
+ for (DedicatedResources resource : result.first()) {
+ DedicateZoneResponse zoneResponse = _dedicatedservice.createDedicateZoneResponse(resource);
+ Responses.add(zoneResponse);
+ }
+ response.setResponses(Responses, result.second());
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to list dedicated zones");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2f51bcf2/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ReleaseDedicatedClusterCmd.java
----------------------------------------------------------------------
diff --git a/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ReleaseDedicatedClusterCmd.java b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ReleaseDedicatedClusterCmd.java
new file mode 100644
index 0000000..ba1c6aa
--- /dev/null
+++ b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ReleaseDedicatedClusterCmd.java
@@ -0,0 +1,91 @@
+// 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.commands;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.ClusterResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.cloudstack.dedicated.DedicatedService;
+import org.apache.log4j.Logger;
+
+import com.cloud.event.EventTypes;
+import com.cloud.user.Account;
+
+@APICommand(name = "releaseDedicatedCluster", description = "Release the dedication for cluster", responseObject = SuccessResponse.class)
+public class ReleaseDedicatedClusterCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger.getLogger(ReleaseDedicatedClusterCmd.class.getName());
+
+ private static final String s_name = "releasededicatedclusterresponse";
+ @Inject DedicatedService dedicatedService;
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name=ApiConstants.CLUSTER_ID, type=CommandType.UUID, entityType=ClusterResponse.class,
+ required=true, description="the ID of the Cluster")
+ private Long clusterId;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getClusterId() {
+ return clusterId;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute(){
+ boolean result = dedicatedService.releaseDedicatedResource(null, null, getClusterId(), null);
+ if (result) {
+ SuccessResponse response = new SuccessResponse(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to release dedicated cluster");
+ }
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_DEDICATE_RESOURCE_RELEASE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "releasing dedicated cluster";
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2f51bcf2/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ReleaseDedicatedHostCmd.java
----------------------------------------------------------------------
diff --git a/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ReleaseDedicatedHostCmd.java b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ReleaseDedicatedHostCmd.java
new file mode 100644
index 0000000..a79c965
--- /dev/null
+++ b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ReleaseDedicatedHostCmd.java
@@ -0,0 +1,91 @@
+// 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.commands;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.HostResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.cloudstack.dedicated.DedicatedService;
+import org.apache.log4j.Logger;
+
+import com.cloud.event.EventTypes;
+import com.cloud.user.Account;
+
+@APICommand(name = "releaseDedicatedHost", description = "Release the dedication for host", responseObject = SuccessResponse.class)
+public class ReleaseDedicatedHostCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger.getLogger(ReleaseDedicatedHostCmd.class.getName());
+
+ private static final String s_name = "releasededicatedhostresponse";
+ @Inject DedicatedService dedicatedService;
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name=ApiConstants.HOST_ID, type=CommandType.UUID, entityType=HostResponse.class,
+ required=true, description="the ID of the host")
+ private Long hostId;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getHostId() {
+ return hostId;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute(){
+ boolean result = dedicatedService.releaseDedicatedResource(null, null, null, getHostId());
+ if (result) {
+ SuccessResponse response = new SuccessResponse(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to release dedicated Host");
+ }
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_DEDICATE_RESOURCE_RELEASE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "releasing dedicated host";
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2f51bcf2/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ReleaseDedicatedPodCmd.java
----------------------------------------------------------------------
diff --git a/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ReleaseDedicatedPodCmd.java b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ReleaseDedicatedPodCmd.java
new file mode 100644
index 0000000..d84ef66
--- /dev/null
+++ b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ReleaseDedicatedPodCmd.java
@@ -0,0 +1,91 @@
+// 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.commands;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.PodResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.cloudstack.dedicated.DedicatedService;
+import org.apache.log4j.Logger;
+
+import com.cloud.event.EventTypes;
+import com.cloud.user.Account;
+
+@APICommand(name = "releaseDedicatedPod", description = "Release the dedication for the pod", responseObject = SuccessResponse.class)
+public class ReleaseDedicatedPodCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger.getLogger(ReleaseDedicatedPodCmd.class.getName());
+
+ private static final String s_name = "releasededicatedpodresponse";
+ @Inject DedicatedService dedicatedService;
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name=ApiConstants.POD_ID, type=CommandType.UUID, entityType=PodResponse.class,
+ required=true, description="the ID of the Pod")
+ private Long podId;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getPodId() {
+ return podId;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute(){
+ boolean result = dedicatedService.releaseDedicatedResource(null, getPodId(), null, null);
+ if (result) {
+ SuccessResponse response = new SuccessResponse(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to release dedicated pod");
+ }
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_DEDICATE_RESOURCE_RELEASE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "releasing dedicated pod";
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2f51bcf2/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ReleaseDedicatedZoneCmd.java
----------------------------------------------------------------------
diff --git a/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ReleaseDedicatedZoneCmd.java b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ReleaseDedicatedZoneCmd.java
new file mode 100644
index 0000000..c78a496
--- /dev/null
+++ b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ReleaseDedicatedZoneCmd.java
@@ -0,0 +1,91 @@
+// 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.commands;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.cloudstack.dedicated.DedicatedService;
+import org.apache.log4j.Logger;
+
+import com.cloud.event.EventTypes;
+import com.cloud.user.Account;
+
+@APICommand(name = "releaseDedicatedZone", description = "Release dedication of zone", responseObject = SuccessResponse.class)
+public class ReleaseDedicatedZoneCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger.getLogger(ReleaseDedicatedZoneCmd.class.getName());
+
+ private static final String s_name = "releasededicatedzoneresponse";
+ @Inject DedicatedService dedicatedService;
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType= ZoneResponse.class,
+ required=true, description="the ID of the Zone")
+ private Long zoneId;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getZoneId() {
+ return zoneId;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute(){
+ boolean result = dedicatedService.releaseDedicatedResource(getZoneId(), null, null, null);
+ if (result) {
+ SuccessResponse response = new SuccessResponse(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to release dedicated zone");
+ }
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_DEDICATE_RESOURCE_RELEASE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "releasing dedicated zone";
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2f51bcf2/plugins/dedicated-resources/src/org/apache/cloudstack/api/response/DedicateClusterResponse.java
----------------------------------------------------------------------
diff --git a/plugins/dedicated-resources/src/org/apache/cloudstack/api/response/DedicateClusterResponse.java b/plugins/dedicated-resources/src/org/apache/cloudstack/api/response/DedicateClusterResponse.java
new file mode 100644
index 0000000..3c8dde3
--- /dev/null
+++ b/plugins/dedicated-resources/src/org/apache/cloudstack/api/response/DedicateClusterResponse.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.response;
+
+import org.apache.cloudstack.api.BaseResponse;
+
+import com.cloud.serializer.Param;
+import com.google.gson.annotations.SerializedName;
+
+public class DedicateClusterResponse extends BaseResponse {
+ @SerializedName("id") @Param(description="the ID of the dedicated resource")
+ private String id;
+
+ @SerializedName("clusterid") @Param(description="the ID of the cluster")
+ private String clusterId;
+
+ @SerializedName("clustername") @Param(description="the name of the cluster")
+ private String clusterName;
+
+ @SerializedName("domainid") @Param(description="the domain ID of the cluster")
+ private String domainId;
+
+ @SerializedName("accountid") @Param(description="the Account ID of the cluster")
+ private String accountId;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getClusterId() {
+ return clusterId;
+ }
+
+ public void setClusterId(String clusterId) {
+ this.clusterId = clusterId;
+ }
+
+ public String getClusterName() {
+ return clusterName;
+ }
+
+ public void setClusterName(String clusterName) {
+ this.clusterName = clusterName;
+ }
+
+ public String getDomainId() {
+ return domainId;
+ }
+
+ public void setDomainId(String domainId) {
+ this.domainId = domainId;
+ }
+
+ public String getAccountId() {
+ return accountId;
+ }
+
+ public void setAccountId(String accountId) {
+ this.accountId = accountId;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2f51bcf2/plugins/dedicated-resources/src/org/apache/cloudstack/api/response/DedicateHostResponse.java
----------------------------------------------------------------------
diff --git a/plugins/dedicated-resources/src/org/apache/cloudstack/api/response/DedicateHostResponse.java b/plugins/dedicated-resources/src/org/apache/cloudstack/api/response/DedicateHostResponse.java
new file mode 100644
index 0000000..cea31fe
--- /dev/null
+++ b/plugins/dedicated-resources/src/org/apache/cloudstack/api/response/DedicateHostResponse.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.response;
+
+import org.apache.cloudstack.api.BaseResponse;
+
+import com.cloud.serializer.Param;
+import com.google.gson.annotations.SerializedName;
+
+public class DedicateHostResponse extends BaseResponse {
+ @SerializedName("id") @Param(description="the ID of the dedicated resource")
+ private String id;
+
+ @SerializedName("hostid") @Param(description="the ID of the host")
+ private String hostId;
+
+ @SerializedName("hostname") @Param(description="the name of the host")
+ private String hostName;
+
+ @SerializedName("domainid") @Param(description="the domain ID of the host")
+ private String domainId;
+
+ @SerializedName("accountid") @Param(description="the Account ID of the host")
+ private String accountId;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getHostId() {
+ return hostId;
+ }
+
+ public void setHostId(String hostId) {
+ this.hostId = hostId;
+ }
+
+ public String getHostName() {
+ return hostName;
+ }
+
+ public void setHostName(String hostName) {
+ this.hostName = hostName;
+ }
+
+ public String getDomainId() {
+ return domainId;
+ }
+
+ public void setDomainId(String domainId) {
+ this.domainId = domainId;
+ }
+
+ public String getAccountId() {
+ return accountId;
+ }
+
+ public void setAccountId(String accountId) {
+ this.accountId = accountId;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2f51bcf2/plugins/dedicated-resources/src/org/apache/cloudstack/api/response/DedicatePodResponse.java
----------------------------------------------------------------------
diff --git a/plugins/dedicated-resources/src/org/apache/cloudstack/api/response/DedicatePodResponse.java b/plugins/dedicated-resources/src/org/apache/cloudstack/api/response/DedicatePodResponse.java
new file mode 100644
index 0000000..4bcaa61
--- /dev/null
+++ b/plugins/dedicated-resources/src/org/apache/cloudstack/api/response/DedicatePodResponse.java
@@ -0,0 +1,82 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.response;
+
+import org.apache.cloudstack.api.BaseResponse;
+import org.apache.cloudstack.api.EntityReference;
+
+import com.cloud.dc.DedicatedResources;
+import com.cloud.serializer.Param;
+import com.google.gson.annotations.SerializedName;
+
+@EntityReference(value = DedicatedResources.class)
+public class DedicatePodResponse extends BaseResponse {
+ @SerializedName("id") @Param(description="the ID of the dedicated resource")
+ private String id;
+
+ @SerializedName("podid") @Param(description="the ID of the Pod")
+ private String podId;
+
+ @SerializedName("podname") @Param(description="the Name of the Pod")
+ private String podName;
+
+ @SerializedName("domainid") @Param(description="the domain ID to which the Pod is dedicated")
+ private String domainId;
+
+ @SerializedName("accountid") @Param(description="the Account Id to which the Pod is dedicated")
+ private String accountId;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getPodId() {
+ return podId;
+ }
+
+ public void setPodId(String podId) {
+ this.podId = podId;
+ }
+
+ public String getPodName() {
+ return podName;
+ }
+
+ public void setPodName(String podName) {
+ this.podName = podName;
+ }
+
+ public String getDomainId() {
+ return domainId;
+ }
+
+ public void setDomainId(String domainId) {
+ this.domainId = domainId;
+ }
+
+ public String getAccountId() {
+ return accountId;
+ }
+
+ public void setAccountId(String accountId) {
+ this.accountId = accountId;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2f51bcf2/plugins/dedicated-resources/src/org/apache/cloudstack/api/response/DedicateZoneResponse.java
----------------------------------------------------------------------
diff --git a/plugins/dedicated-resources/src/org/apache/cloudstack/api/response/DedicateZoneResponse.java b/plugins/dedicated-resources/src/org/apache/cloudstack/api/response/DedicateZoneResponse.java
new file mode 100644
index 0000000..57497cd
--- /dev/null
+++ b/plugins/dedicated-resources/src/org/apache/cloudstack/api/response/DedicateZoneResponse.java
@@ -0,0 +1,83 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.response;
+
+import org.apache.cloudstack.api.BaseResponse;
+import org.apache.cloudstack.api.EntityReference;
+
+import com.cloud.dc.DedicatedResources;
+import com.cloud.serializer.Param;
+import com.google.gson.annotations.SerializedName;
+
+@EntityReference(value = DedicatedResources.class)
+public class DedicateZoneResponse extends BaseResponse {
+ @SerializedName("id") @Param(description="the ID of the dedicated resource")
+ private String id;
+
+ @SerializedName("zoneid") @Param(description="the ID of the Zone")
+ private String zoneId;
+
+ @SerializedName("zonename") @Param(description="the Name of the Zone")
+ private String zoneName;
+
+ @SerializedName("domainid") @Param(description="the domain ID to which the Zone is dedicated")
+ private String domainId;
+
+ @SerializedName("accountid") @Param(description="the Account Id to which the Zone is dedicated")
+ private String accountId;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getZoneId() {
+ return zoneId;
+ }
+
+ public void setZoneId(String zoneId) {
+ this.zoneId = zoneId;
+ }
+
+ public String getZoneName() {
+ return zoneName;
+ }
+
+ public void setZoneName(String zoneName) {
+ this.zoneName = zoneName;
+ }
+
+ public String getDomainId() {
+ return domainId;
+ }
+
+ public void setDomainId(String domainId) {
+ this.domainId = domainId;
+ }
+
+ public String getAccountId() {
+ return accountId;
+ }
+
+ public void setAccountId(String accountId) {
+ this.accountId = accountId;
+ }
+
+}