use of com.cloud.api.response.ProviderResponse in project CloudStack-archive by CloudStack-extras.
the class UpdateNetworkServiceProviderCmd method execute.
@Override
public void execute() {
PhysicalNetworkServiceProvider result = _networkService.updateNetworkServiceProvider(getId(), getState(), getEnabledServices());
if (result != null) {
ProviderResponse response = _responseGenerator.createNetworkServiceProviderResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update service provider");
}
}
use of com.cloud.api.response.ProviderResponse in project CloudStack-archive by CloudStack-extras.
the class ListNetworkServiceProvidersCmd method execute.
@Override
public void execute() {
List<? extends PhysicalNetworkServiceProvider> serviceProviders = _networkService.listNetworkServiceProviders(getPhysicalNetworkId(), getName(), getState(), this.getStartIndex(), this.getPageSizeVal());
ListResponse<ProviderResponse> response = new ListResponse<ProviderResponse>();
List<ProviderResponse> serviceProvidersResponses = new ArrayList<ProviderResponse>();
for (PhysicalNetworkServiceProvider serviceProvider : serviceProviders) {
ProviderResponse serviceProviderResponse = _responseGenerator.createNetworkServiceProviderResponse(serviceProvider);
serviceProvidersResponses.add(serviceProviderResponse);
}
response.setResponses(serviceProvidersResponses);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
use of com.cloud.api.response.ProviderResponse in project cosmic by MissionCriticalCloud.
the class AddNetworkServiceProviderCmd method execute.
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() {
CallContext.current().setEventDetails("Network ServiceProvider Id: " + getEntityId());
final PhysicalNetworkServiceProvider result = _networkService.getCreatedPhysicalNetworkServiceProvider(getEntityId());
if (result != null) {
final ProviderResponse response = _responseGenerator.createNetworkServiceProviderResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add service provider to physical network");
}
}
use of com.cloud.api.response.ProviderResponse in project cosmic by MissionCriticalCloud.
the class ListNetworkServiceProvidersCmd method execute.
@Override
public void execute() {
final Pair<List<? extends PhysicalNetworkServiceProvider>, Integer> serviceProviders = _networkService.listNetworkServiceProviders(getPhysicalNetworkId(), getName(), getState(), this.getStartIndex(), this.getPageSizeVal());
final ListResponse<ProviderResponse> response = new ListResponse<>();
final List<ProviderResponse> serviceProvidersResponses = new ArrayList<>();
for (final PhysicalNetworkServiceProvider serviceProvider : serviceProviders.first()) {
final ProviderResponse serviceProviderResponse = _responseGenerator.createNetworkServiceProviderResponse(serviceProvider);
serviceProvidersResponses.add(serviceProviderResponse);
}
response.setResponses(serviceProvidersResponses, serviceProviders.second());
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
use of com.cloud.api.response.ProviderResponse in project cosmic by MissionCriticalCloud.
the class ApiResponseHelper method getProviderResponses.
private List<ProviderResponse> getProviderResponses(final Set<Provider> srvc_providers) {
final List<ProviderResponse> providers = new ArrayList<>();
for (final Provider provider : srvc_providers) {
if (provider != null) {
final ProviderResponse providerRsp = new ProviderResponse();
providerRsp.setName(provider.getName());
providers.add(providerRsp);
}
}
return providers;
}
Aggregations