use of com.cloud.configuration.ResourceCount in project CloudStack-archive by CloudStack-extras.
the class UpdateResourceCountCmd method execute.
@Override
public void execute() {
List<? extends ResourceCount> result = _resourceLimitService.recalculateResourceCount(finalyzeAccountId(accountName, domainId, projectId, true), getDomainId(), getResourceType());
if ((result != null) && (result.size() > 0)) {
ListResponse<ResourceCountResponse> response = new ListResponse<ResourceCountResponse>();
List<ResourceCountResponse> countResponses = new ArrayList<ResourceCountResponse>();
for (ResourceCount count : result) {
ResourceCountResponse resourceCountResponse = _responseGenerator.createResourceCountResponse(count);
resourceCountResponse.setObjectName("resourcecount");
countResponses.add(resourceCountResponse);
}
response.setResponses(countResponses);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to recalculate resource counts");
}
}
use of com.cloud.configuration.ResourceCount in project cloudstack by apache.
the class UpdateResourceCountCmd method execute.
@Override
public void execute() {
List<? extends ResourceCount> result = _resourceLimitService.recalculateResourceCount(_accountService.finalyzeAccountId(accountName, domainId, projectId, true), getDomainId(), getResourceType());
if ((result != null) && (result.size() > 0)) {
ListResponse<ResourceCountResponse> response = new ListResponse<ResourceCountResponse>();
List<ResourceCountResponse> countResponses = new ArrayList<ResourceCountResponse>();
for (ResourceCount count : result) {
ResourceCountResponse resourceCountResponse = _responseGenerator.createResourceCountResponse(count);
resourceCountResponse.setObjectName("resourcecount");
countResponses.add(resourceCountResponse);
}
response.setResponses(countResponses);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to recalculate resource counts");
}
}
Aggregations