use of com.cloud.configuration.ResourceLimit in project cosmic by MissionCriticalCloud.
the class UpdateResourceLimitCmd method execute.
@Override
public void execute() {
final ResourceLimit result = _resourceLimitService.updateResourceLimit(_accountService.finalyzeAccountId(accountName, domainId, projectId, true), getDomainId(), resourceType, max);
if (result != null || (result == null && max != null && max.longValue() == -1L)) {
final ResourceLimitResponse response = _responseGenerator.createResourceLimitResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update resource limit");
}
}
use of com.cloud.configuration.ResourceLimit in project cosmic by MissionCriticalCloud.
the class ListResourceLimitsCmd method execute.
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() {
final List<? extends ResourceLimit> result = _resourceLimitService.searchForLimits(id, _accountService.finalyzeAccountId(this.getAccountName(), this.getDomainId(), this.getProjectId(), false), this.getDomainId(), resourceType, this.getStartIndex(), this.getPageSizeVal());
final ListResponse<ResourceLimitResponse> response = new ListResponse<>();
final List<ResourceLimitResponse> limitResponses = new ArrayList<>();
for (final ResourceLimit limit : result) {
final ResourceLimitResponse resourceLimitResponse = _responseGenerator.createResourceLimitResponse(limit);
resourceLimitResponse.setObjectName("resourcelimit");
limitResponses.add(resourceLimitResponse);
}
response.setResponses(limitResponses);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
use of com.cloud.configuration.ResourceLimit in project cloudstack by apache.
the class ListResourceLimitsCmd method execute.
@Override
public void execute() {
List<? extends ResourceLimit> result = _resourceLimitService.searchForLimits(id, _accountService.finalyzeAccountId(this.getAccountName(), this.getDomainId(), this.getProjectId(), false), this.getDomainId(), getResourceTypeEnum(), this.getStartIndex(), this.getPageSizeVal());
ListResponse<ResourceLimitResponse> response = new ListResponse<ResourceLimitResponse>();
List<ResourceLimitResponse> limitResponses = new ArrayList<ResourceLimitResponse>();
for (ResourceLimit limit : result) {
ResourceLimitResponse resourceLimitResponse = _responseGenerator.createResourceLimitResponse(limit);
resourceLimitResponse.setObjectName("resourcelimit");
limitResponses.add(resourceLimitResponse);
}
response.setResponses(limitResponses);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
Aggregations