use of com.cloud.api.response.ServiceResponse in project CloudStack-archive by CloudStack-extras.
the class ListSupportedNetworkServicesCmd method execute.
@Override
public void execute() {
List<? extends Network.Service> services;
if (getServiceName() != null) {
Network.Service service = null;
if (serviceName != null) {
service = Network.Service.getService(serviceName);
if (service == null) {
throw new InvalidParameterValueException("Invalid Network Service=" + serviceName);
}
}
List<Network.Service> serviceList = new ArrayList<Network.Service>();
serviceList.add(service);
services = serviceList;
} else {
services = _networkService.listNetworkServices(getProviderName());
}
ListResponse<ServiceResponse> response = new ListResponse<ServiceResponse>();
List<ServiceResponse> servicesResponses = new ArrayList<ServiceResponse>();
for (Network.Service service : services) {
//skip gateway service
if (service == Service.Gateway) {
continue;
}
ServiceResponse serviceResponse = _responseGenerator.createNetworkServiceResponse(service);
servicesResponses.add(serviceResponse);
}
response.setResponses(servicesResponses);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
Aggregations