Search in sources :

Example 1 with DiskOfferingResponse

use of org.apache.cloudstack.api.response.DiskOfferingResponse in project cloudstack by apache.

the class UpdateDiskOfferingCmd method execute.

@Override
public void execute() {
    DiskOffering result = _configService.updateDiskOffering(this);
    if (result != null) {
        DiskOfferingResponse response = _responseGenerator.createDiskOfferingResponse(result);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update disk offering");
    }
}
Also used : DiskOffering(com.cloud.offering.DiskOffering) ServerApiException(org.apache.cloudstack.api.ServerApiException) DiskOfferingResponse(org.apache.cloudstack.api.response.DiskOfferingResponse)

Example 2 with DiskOfferingResponse

use of org.apache.cloudstack.api.response.DiskOfferingResponse in project cloudstack by apache.

the class CreateDiskOfferingCmd method execute.

@Override
public void execute() {
    DiskOffering offering = _configService.createDiskOffering(this);
    if (offering != null) {
        DiskOfferingResponse response = _responseGenerator.createDiskOfferingResponse(offering);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create disk offering");
    }
}
Also used : DiskOffering(com.cloud.offering.DiskOffering) ServerApiException(org.apache.cloudstack.api.ServerApiException) DiskOfferingResponse(org.apache.cloudstack.api.response.DiskOfferingResponse)

Example 3 with DiskOfferingResponse

use of org.apache.cloudstack.api.response.DiskOfferingResponse in project cloudstack by apache.

the class DiskOfferingJoinDaoImpl method newDiskOfferingResponse.

@Override
public DiskOfferingResponse newDiskOfferingResponse(DiskOfferingJoinVO offering) {
    DiskOfferingResponse diskOfferingResponse = new DiskOfferingResponse();
    diskOfferingResponse.setId(offering.getUuid());
    diskOfferingResponse.setName(offering.getName());
    diskOfferingResponse.setDisplayText(offering.getDisplayText());
    diskOfferingResponse.setProvisioningType(offering.getProvisioningType().toString());
    diskOfferingResponse.setCreated(offering.getCreated());
    diskOfferingResponse.setDiskSize(offering.getDiskSize() / (1024 * 1024 * 1024));
    diskOfferingResponse.setMinIops(offering.getMinIops());
    diskOfferingResponse.setMaxIops(offering.getMaxIops());
    diskOfferingResponse.setDomain(offering.getDomainName());
    diskOfferingResponse.setDomainId(offering.getDomainUuid());
    diskOfferingResponse.setDisplayOffering(offering.isDisplayOffering());
    diskOfferingResponse.setTags(offering.getTags());
    diskOfferingResponse.setCustomized(offering.isCustomized());
    diskOfferingResponse.setCustomizedIops(offering.isCustomizedIops());
    diskOfferingResponse.setHypervisorSnapshotReserve(offering.getHypervisorSnapshotReserve());
    diskOfferingResponse.setStorageType(offering.isUseLocalStorage() ? ServiceOffering.StorageType.local.toString() : ServiceOffering.StorageType.shared.toString());
    diskOfferingResponse.setBytesReadRate(offering.getBytesReadRate());
    diskOfferingResponse.setBytesWriteRate(offering.getBytesWriteRate());
    diskOfferingResponse.setIopsReadRate(offering.getIopsReadRate());
    diskOfferingResponse.setIopsWriteRate(offering.getIopsWriteRate());
    diskOfferingResponse.setCacheMode(offering.getCacheMode());
    diskOfferingResponse.setObjectName("diskoffering");
    return diskOfferingResponse;
}
Also used : DiskOfferingResponse(org.apache.cloudstack.api.response.DiskOfferingResponse)

Aggregations

DiskOfferingResponse (org.apache.cloudstack.api.response.DiskOfferingResponse)3 DiskOffering (com.cloud.offering.DiskOffering)2 ServerApiException (org.apache.cloudstack.api.ServerApiException)2