Search in sources :

Example 1 with PodResponse

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

the class CreatePodCmd method execute.

@Override
public void execute() {
    Pod result = _configService.createPod(getZoneId(), getPodName(), getStartIp(), getEndIp(), getGateway(), getNetmask(), getAllocationState());
    if (result != null) {
        PodResponse response = _responseGenerator.createPodResponse(result, false);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create pod");
    }
}
Also used : Pod(com.cloud.dc.Pod) ServerApiException(com.cloud.api.ServerApiException) PodResponse(com.cloud.api.response.PodResponse)

Example 2 with PodResponse

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

the class ListPodsByCmd method execute.

@Override
public void execute() {
    List<? extends Pod> result = _mgr.searchForPods(this);
    ListResponse<PodResponse> response = new ListResponse<PodResponse>();
    List<PodResponse> podResponses = new ArrayList<PodResponse>();
    for (Pod pod : result) {
        PodResponse podResponse = _responseGenerator.createPodResponse(pod, showCapacities);
        podResponse.setObjectName("pod");
        podResponses.add(podResponse);
    }
    response.setResponses(podResponses);
    response.setResponseName(getCommandName());
    this.setResponseObject(response);
}
Also used : ListResponse(com.cloud.api.response.ListResponse) Pod(com.cloud.dc.Pod) ArrayList(java.util.ArrayList) PodResponse(com.cloud.api.response.PodResponse)

Example 3 with PodResponse

use of com.cloud.api.response.PodResponse in project cosmic by MissionCriticalCloud.

the class CreatePodCmd method execute.

// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() {
    final Pod result = _configService.createPod(getZoneId(), getPodName(), getStartIp(), getEndIp(), getGateway(), getNetmask(), getAllocationState());
    if (result != null) {
        final PodResponse response = _responseGenerator.createPodResponse(result, false);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create pod");
    }
}
Also used : Pod(com.cloud.dc.Pod) ServerApiException(com.cloud.api.ServerApiException) PodResponse(com.cloud.api.response.PodResponse)

Example 4 with PodResponse

use of com.cloud.api.response.PodResponse in project cosmic by MissionCriticalCloud.

the class ListPodsByCmd method execute.

// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() {
    final Pair<List<? extends Pod>, Integer> result = _mgr.searchForPods(this);
    final ListResponse<PodResponse> response = new ListResponse<>();
    final List<PodResponse> podResponses = new ArrayList<>();
    for (final Pod pod : result.first()) {
        final PodResponse podResponse = _responseGenerator.createPodResponse(pod, showCapacities);
        podResponse.setObjectName("pod");
        podResponses.add(podResponse);
    }
    response.setResponses(podResponses, result.second());
    response.setResponseName(getCommandName());
    this.setResponseObject(response);
}
Also used : Pod(com.cloud.dc.Pod) ListResponse(com.cloud.api.response.ListResponse) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) PodResponse(com.cloud.api.response.PodResponse)

Example 5 with PodResponse

use of com.cloud.api.response.PodResponse in project cosmic by MissionCriticalCloud.

the class UpdatePodCmd method execute.

// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() {
    final Pod result = _configService.editPod(this);
    if (result != null) {
        final PodResponse response = _responseGenerator.createPodResponse(result, false);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update pod");
    }
}
Also used : Pod(com.cloud.dc.Pod) ServerApiException(com.cloud.api.ServerApiException) PodResponse(com.cloud.api.response.PodResponse)

Aggregations

PodResponse (com.cloud.api.response.PodResponse)7 Pod (com.cloud.dc.Pod)6 ServerApiException (com.cloud.api.ServerApiException)4 ListResponse (com.cloud.api.response.ListResponse)2 ArrayList (java.util.ArrayList)2 CapacityResponse (com.cloud.api.response.CapacityResponse)1 SummedCapacity (com.cloud.capacity.dao.CapacityDaoImpl.SummedCapacity)1 DataCenter (com.cloud.dc.DataCenter)1 HashSet (java.util.HashSet)1 List (java.util.List)1