use of com.cloud.api.response.DedicatePodResponse in project cosmic by MissionCriticalCloud.
the class ListDedicatedPodsCmd method execute.
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() {
final Pair<List<? extends DedicatedResourceVO>, Integer> result = dedicatedService.listDedicatedPods(this);
final ListResponse<DedicatePodResponse> response = new ListResponse<>();
final List<DedicatePodResponse> Responses = new ArrayList<>();
if (result != null) {
for (final DedicatedResources resource : result.first()) {
final 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 com.cloud.api.response.DedicatePodResponse in project cosmic by MissionCriticalCloud.
the class DedicatedResourceManagerImpl method createDedicatePodResponse.
@Override
public DedicatePodResponse createDedicatePodResponse(final DedicatedResources resource) {
final DedicatePodResponse dedicatePodResponse = new DedicatePodResponse();
final HostPodVO pod = _podDao.findById(resource.getPodId());
final DomainVO domain = _domainDao.findById(resource.getDomainId());
final AccountVO account = _accountDao.findById(resource.getAccountId());
final AffinityGroup group = _affinityGroupDao.findById(resource.getAffinityGroupId());
dedicatePodResponse.setId(resource.getUuid());
dedicatePodResponse.setPodId(pod.getUuid());
dedicatePodResponse.setPodName(pod.getName());
dedicatePodResponse.setDomainId(domain.getUuid());
dedicatePodResponse.setDomainName(domain.getName());
dedicatePodResponse.setAffinityGroupId(group.getUuid());
if (account != null) {
dedicatePodResponse.setAccountId(account.getUuid());
dedicatePodResponse.setAccountName(account.getAccountName());
}
dedicatePodResponse.setObjectName("dedicatedpod");
return dedicatePodResponse;
}
use of com.cloud.api.response.DedicatePodResponse 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");
}
}
Aggregations