use of org.apache.cloudstack.api.response.VirtualRouterProviderResponse in project cloudstack by apache.
the class CreateVirtualRouterElementCmd method execute.
@Override
public void execute() {
CallContext.current().setEventDetails("Virtual router element Id: " + getEntityUuid());
VirtualRouterProvider result = _service.get(0).getCreatedElement(getEntityId());
if (result != null) {
VirtualRouterProviderResponse response = _responseGenerator.createVirtualRouterProviderResponse(result);
if (response != null) {
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add Virtual Router entity to physical network");
}
}
use of org.apache.cloudstack.api.response.VirtualRouterProviderResponse in project cloudstack by apache.
the class ConfigureVirtualRouterElementCmd method execute.
@Override
public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
CallContext.current().setEventDetails("Virtual router element: " + id);
VirtualRouterProvider result = _service.get(0).configure(this);
if (result != null) {
VirtualRouterProviderResponse routerResponse = _responseGenerator.createVirtualRouterProviderResponse(result);
if (routerResponse != null) {
routerResponse.setResponseName(getCommandName());
this.setResponseObject(routerResponse);
}
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to configure the virtual router provider");
}
}
use of org.apache.cloudstack.api.response.VirtualRouterProviderResponse in project cloudstack by apache.
the class ListVirtualRouterElementsCmd method execute.
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
List<? extends VirtualRouterProvider> providers = _service.get(0).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);
}
use of org.apache.cloudstack.api.response.VirtualRouterProviderResponse in project cloudstack by apache.
the class ApiResponseHelper method createVirtualRouterProviderResponse.
@Override
public VirtualRouterProviderResponse createVirtualRouterProviderResponse(VirtualRouterProvider result) {
// generate only response of the VR/VPCVR provider type
if (!(result.getType() == VirtualRouterProvider.Type.VirtualRouter || result.getType() == VirtualRouterProvider.Type.VPCVirtualRouter)) {
return null;
}
VirtualRouterProviderResponse response = new VirtualRouterProviderResponse();
response.setId(result.getUuid());
PhysicalNetworkServiceProvider nsp = ApiDBUtils.findPhysicalNetworkServiceProviderById(result.getNspId());
if (nsp != null) {
response.setNspId(nsp.getUuid());
}
response.setEnabled(result.isEnabled());
response.setObjectName("virtualrouterelement");
return response;
}
Aggregations