Search in sources :

Example 1 with DiskOfferingResponse

use of com.cloud.api.response.DiskOfferingResponse in project CloudStack-archive by CloudStack-extras.

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(BaseCmd.INTERNAL_ERROR, "Failed to update disk offering");
    }
}
Also used : DiskOffering(com.cloud.offering.DiskOffering) ServerApiException(com.cloud.api.ServerApiException) DiskOfferingResponse(com.cloud.api.response.DiskOfferingResponse)

Example 2 with DiskOfferingResponse

use of com.cloud.api.response.DiskOfferingResponse in project CloudStack-archive by CloudStack-extras.

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(BaseCmd.INTERNAL_ERROR, "Failed to create disk offering");
    }
}
Also used : DiskOffering(com.cloud.offering.DiskOffering) ServerApiException(com.cloud.api.ServerApiException) DiskOfferingResponse(com.cloud.api.response.DiskOfferingResponse)

Example 3 with DiskOfferingResponse

use of com.cloud.api.response.DiskOfferingResponse in project CloudStack-archive by CloudStack-extras.

the class ListDiskOfferingsCmd method execute.

@Override
public void execute() {
    List<? extends DiskOffering> result = _mgr.searchForDiskOfferings(this);
    ListResponse<DiskOfferingResponse> response = new ListResponse<DiskOfferingResponse>();
    List<DiskOfferingResponse> diskOfferingResponses = new ArrayList<DiskOfferingResponse>();
    for (DiskOffering offering : result) {
        DiskOfferingResponse diskOffResp = _responseGenerator.createDiskOfferingResponse(offering);
        diskOffResp.setObjectName("diskoffering");
        diskOfferingResponses.add(diskOffResp);
    }
    response.setResponses(diskOfferingResponses);
    response.setResponseName(getCommandName());
    this.setResponseObject(response);
}
Also used : DiskOffering(com.cloud.offering.DiskOffering) ListResponse(com.cloud.api.response.ListResponse) ArrayList(java.util.ArrayList) DiskOfferingResponse(com.cloud.api.response.DiskOfferingResponse)

Aggregations

DiskOfferingResponse (com.cloud.api.response.DiskOfferingResponse)3 DiskOffering (com.cloud.offering.DiskOffering)3 ServerApiException (com.cloud.api.ServerApiException)2 ListResponse (com.cloud.api.response.ListResponse)1 ArrayList (java.util.ArrayList)1