use of com.cloud.dc.DedicatedResources in project cosmic by MissionCriticalCloud.
the class DedicatePodCmd method execute.
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() {
final List<? extends DedicatedResources> result = dedicatedService.dedicatePod(getPodId(), getDomainId(), getAccountName());
final ListResponse<DedicatePodResponse> response = new ListResponse<>();
final List<DedicatePodResponse> podResponseList = new ArrayList<>();
if (result != null) {
for (final DedicatedResources resource : result) {
final 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");
}
}
use of com.cloud.dc.DedicatedResources in project cosmic by MissionCriticalCloud.
the class ListDedicatedClustersCmd method execute.
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() {
final Pair<List<? extends DedicatedResourceVO>, Integer> result = dedicatedService.listDedicatedClusters(this);
final ListResponse<DedicateClusterResponse> response = new ListResponse<>();
final List<DedicateClusterResponse> Responses = new ArrayList<>();
if (result != null) {
for (final DedicatedResources resource : result.first()) {
final 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");
}
}
use of com.cloud.dc.DedicatedResources in project cosmic by MissionCriticalCloud.
the class ListDedicatedZonesCmd method execute.
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() {
final Pair<List<? extends DedicatedResourceVO>, Integer> result = _dedicatedservice.listDedicatedZones(this);
final ListResponse<DedicateZoneResponse> response = new ListResponse<>();
final List<DedicateZoneResponse> Responses = new ArrayList<>();
if (result != null) {
for (final DedicatedResources resource : result.first()) {
final 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");
}
}
use of com.cloud.dc.DedicatedResources in project cloudstack by apache.
the class DedicateHostCmd method execute.
@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");
}
}
use of com.cloud.dc.DedicatedResources in project cloudstack by apache.
the class DedicatePodCmd method execute.
@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");
}
}
Aggregations