use of org.apache.cloudstack.api.response.DedicatePodResponse in project cloudstack by apache.
the class DedicatedResourceManagerImpl method createDedicatePodResponse.
@Override
public DedicatePodResponse createDedicatePodResponse(DedicatedResources resource) {
DedicatePodResponse dedicatePodResponse = new DedicatePodResponse();
HostPodVO pod = _podDao.findById(resource.getPodId());
DomainVO domain = _domainDao.findById(resource.getDomainId());
AccountVO account = _accountDao.findById(resource.getAccountId());
AffinityGroup group = _affinityGroupDao.findById(resource.getAffinityGroupId());
dedicatePodResponse.setId(resource.getUuid());
dedicatePodResponse.setPodId(pod.getUuid());
dedicatePodResponse.setPodName(pod.getName());
dedicatePodResponse.setDomainId(domain.getUuid());
dedicatePodResponse.setAffinityGroupId(group.getUuid());
if (account != null) {
dedicatePodResponse.setAccountId(account.getUuid());
}
dedicatePodResponse.setObjectName("dedicatedpod");
return dedicatePodResponse;
}
use of org.apache.cloudstack.api.response.DedicatePodResponse in project cloudstack by apache.
the class ListDedicatedPodsCmd method execute.
@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");
}
}
use of org.apache.cloudstack.api.response.DedicatePodResponse 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