Search in sources :

Example 1 with CiscoNexusVSMDevice

use of com.cloud.network.CiscoNexusVSMDevice in project cloudstack by apache.

the class EnableCiscoNexusVSMCmd method execute.

/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
    CiscoNexusVSMDevice result = _ciscoNexusVSMService.enableCiscoNexusVSM(this);
    if (result != null) {
        CiscoNexusVSMResponse response = _ciscoNexusVSMService.createCiscoNexusVSMDetailedResponse(result);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to enable Cisco Nexus VSM device");
    }
}
Also used : CiscoNexusVSMDevice(com.cloud.network.CiscoNexusVSMDevice) ServerApiException(org.apache.cloudstack.api.ServerApiException) CiscoNexusVSMResponse(com.cloud.api.response.CiscoNexusVSMResponse)

Example 2 with CiscoNexusVSMDevice

use of com.cloud.network.CiscoNexusVSMDevice in project cloudstack by apache.

the class ListCiscoNexusVSMsCmd method execute.

/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
// NOTE- The uuid that is sent in during the invocation of the API AddCiscoNexusVSM()
// automagically gets translated to the corresponding db id before this execute() method
// is invoked. That's the reason why we don't have any uuid-dbid translation code here.
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
    List<? extends CiscoNexusVSMDevice> vsmDeviceList = _ciscoNexusVSMService.getCiscoNexusVSMs(this);
    if (vsmDeviceList.size() > 0) {
        ListResponse<CiscoNexusVSMResponse> response = new ListResponse<CiscoNexusVSMResponse>();
        List<CiscoNexusVSMResponse> vsmResponses = new ArrayList<CiscoNexusVSMResponse>();
        for (CiscoNexusVSMDevice vsmDevice : vsmDeviceList) {
            CiscoNexusVSMResponse vsmresponse = _ciscoNexusVSMService.createCiscoNexusVSMDetailedResponse(vsmDevice);
            vsmresponse.setObjectName("cisconexusvsm");
            response.setResponseName(getCommandName());
            vsmResponses.add(vsmresponse);
        }
        response.setResponses(vsmResponses);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "No VSM found.");
    }
}
Also used : ListResponse(org.apache.cloudstack.api.response.ListResponse) CiscoNexusVSMDevice(com.cloud.network.CiscoNexusVSMDevice) ServerApiException(org.apache.cloudstack.api.ServerApiException) ArrayList(java.util.ArrayList) CiscoNexusVSMResponse(com.cloud.api.response.CiscoNexusVSMResponse)

Example 3 with CiscoNexusVSMDevice

use of com.cloud.network.CiscoNexusVSMDevice in project cloudstack by apache.

the class DisableCiscoNexusVSMCmd method execute.

/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
    CiscoNexusVSMDevice result = _ciscoNexusVSMService.disableCiscoNexusVSM(this);
    if (result != null) {
        CiscoNexusVSMResponse response = _ciscoNexusVSMService.createCiscoNexusVSMDetailedResponse(result);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to disable Cisco Nexus VSM device");
    }
}
Also used : CiscoNexusVSMDevice(com.cloud.network.CiscoNexusVSMDevice) ServerApiException(org.apache.cloudstack.api.ServerApiException) CiscoNexusVSMResponse(com.cloud.api.response.CiscoNexusVSMResponse)

Aggregations

CiscoNexusVSMResponse (com.cloud.api.response.CiscoNexusVSMResponse)3 CiscoNexusVSMDevice (com.cloud.network.CiscoNexusVSMDevice)3 ServerApiException (org.apache.cloudstack.api.ServerApiException)3 ArrayList (java.util.ArrayList)1 ListResponse (org.apache.cloudstack.api.response.ListResponse)1