use of org.apache.cloudstack.api.response.OvsProviderResponse in project cloudstack by apache.
the class ListOvsElementsCmd method execute.
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
List<? extends OvsProvider> providers = _service.get(0).searchForOvsElement(this);
ListResponse<OvsProviderResponse> response = new ListResponse<OvsProviderResponse>();
List<OvsProviderResponse> providerResponses = new ArrayList<OvsProviderResponse>();
for (OvsProvider provider : providers) {
OvsProviderResponse providerResponse = _responseGenerator.createOvsProviderResponse(provider);
providerResponses.add(providerResponse);
}
response.setResponses(providerResponses);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
use of org.apache.cloudstack.api.response.OvsProviderResponse in project cloudstack by apache.
the class ConfigureOvsElementCmd method execute.
@Override
public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
CallContext.current().setEventDetails("Ovs element: " + id);
OvsProvider result = _service.get(0).configure(this);
if (result != null) {
OvsProviderResponse ovsResponse = _responseGenerator.createOvsProviderResponse(result);
ovsResponse.setResponseName(getCommandName());
this.setResponseObject(ovsResponse);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to configure the ovs provider");
}
}
use of org.apache.cloudstack.api.response.OvsProviderResponse in project cloudstack by apache.
the class ApiResponseHelper method createOvsProviderResponse.
@Override
public OvsProviderResponse createOvsProviderResponse(OvsProvider result) {
OvsProviderResponse response = new OvsProviderResponse();
response.setId(result.getUuid());
PhysicalNetworkServiceProvider nsp = ApiDBUtils.findPhysicalNetworkServiceProviderById(result.getNspId());
if (nsp != null) {
response.setNspId(nsp.getUuid());
}
response.setEnabled(result.isEnabled());
response.setObjectName("ovselement");
return response;
}
Aggregations