use of org.apache.cloudstack.api.response.ServiceResponse in project cloudstack by apache.
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);
}
use of org.apache.cloudstack.api.response.ServiceResponse in project cloudstack by apache.
the class LoadBalancingRulesManagerImpl method getLBCapability.
// Will return a string. For LB Stickiness this will be a json, for
// autoscale this will be "," separated values
@Override
public String getLBCapability(long networkid, String capabilityName) {
Map<Service, Map<Capability, String>> serviceCapabilitiesMap = _networkModel.getNetworkCapabilities(networkid);
if (serviceCapabilitiesMap != null) {
for (Service service : serviceCapabilitiesMap.keySet()) {
ServiceResponse serviceResponse = new ServiceResponse();
serviceResponse.setName(service.getName());
if ("Lb".equalsIgnoreCase(service.getName())) {
Map<Capability, String> serviceCapabilities = serviceCapabilitiesMap.get(service);
if (serviceCapabilities != null) {
for (Capability capability : serviceCapabilities.keySet()) {
if (capabilityName.equals(capability.getName())) {
return serviceCapabilities.get(capability);
}
}
}
}
}
}
return null;
}
Aggregations