Search in sources :

Example 1 with VirtualRouterProviderResponse

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

the class ListVirtualRouterElementsCmd method execute.

@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
    List<? extends VirtualRouterProvider> providers = _service.searchForVirtualRouterElement(this);
    ListResponse<VirtualRouterProviderResponse> response = new ListResponse<VirtualRouterProviderResponse>();
    List<VirtualRouterProviderResponse> providerResponses = new ArrayList<VirtualRouterProviderResponse>();
    for (VirtualRouterProvider provider : providers) {
        VirtualRouterProviderResponse providerResponse = _responseGenerator.createVirtualRouterProviderResponse(provider);
        providerResponses.add(providerResponse);
    }
    response.setResponses(providerResponses);
    response.setResponseName(getCommandName());
    this.setResponseObject(response);
}
Also used : VirtualRouterProviderResponse(com.cloud.api.response.VirtualRouterProviderResponse) ListResponse(com.cloud.api.response.ListResponse) VirtualRouterProvider(com.cloud.network.VirtualRouterProvider) ArrayList(java.util.ArrayList)

Example 2 with VirtualRouterProviderResponse

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

the class ConfigureVirtualRouterElementCmd method execute.

@Override
public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
    UserContext.current().setEventDetails("Virtual router element: " + id);
    VirtualRouterProvider result = _service.configure(this);
    if (result != null) {
        VirtualRouterProviderResponse routerResponse = _responseGenerator.createVirtualRouterProviderResponse(result);
        routerResponse.setResponseName(getCommandName());
        this.setResponseObject(routerResponse);
    } else {
        throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to configure the virtual router provider");
    }
}
Also used : VirtualRouterProviderResponse(com.cloud.api.response.VirtualRouterProviderResponse) ServerApiException(com.cloud.api.ServerApiException) VirtualRouterProvider(com.cloud.network.VirtualRouterProvider)

Example 3 with VirtualRouterProviderResponse

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

the class CreateVirtualRouterElementCmd method execute.

@Override
public void execute() {
    UserContext.current().setEventDetails("Virtual router element Id: " + getEntityId());
    VirtualRouterProvider result = _service.getCreatedElement(getEntityId());
    if (result != null) {
        VirtualRouterProviderResponse response = _responseGenerator.createVirtualRouterProviderResponse(result);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add Virtual Router entity to physical network");
    }
}
Also used : VirtualRouterProviderResponse(com.cloud.api.response.VirtualRouterProviderResponse) ServerApiException(com.cloud.api.ServerApiException) VirtualRouterProvider(com.cloud.network.VirtualRouterProvider)

Aggregations

VirtualRouterProviderResponse (com.cloud.api.response.VirtualRouterProviderResponse)3 VirtualRouterProvider (com.cloud.network.VirtualRouterProvider)3 ServerApiException (com.cloud.api.ServerApiException)2 ListResponse (com.cloud.api.response.ListResponse)1 ArrayList (java.util.ArrayList)1