use of org.apache.cloudstack.api.response.ListResponse in project cloudstack by apache.
the class ListVlanIpRangesCmd method execute.
@Override
public void execute() {
Pair<List<? extends Vlan>, Integer> vlans = _mgr.searchForVlans(this);
ListResponse<VlanIpRangeResponse> response = new ListResponse<VlanIpRangeResponse>();
List<VlanIpRangeResponse> vlanResponses = new ArrayList<VlanIpRangeResponse>();
for (Vlan vlan : vlans.first()) {
VlanIpRangeResponse vlanResponse = _responseGenerator.createVlanIpRangeResponse(vlan);
vlanResponse.setObjectName("vlaniprange");
vlanResponses.add(vlanResponse);
}
response.setResponses(vlanResponses, vlans.second());
response.setResponseName(getCommandName());
setResponseObject(response);
}
use of org.apache.cloudstack.api.response.ListResponse in project cloudstack by apache.
the class ListStorageProvidersCmd method execute.
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException {
if (getType() == null) {
throw new ServerApiException(ApiErrorCode.MALFORMED_PARAMETER_ERROR, "need to specify type: either primary or image");
}
List<StorageProviderResponse> providers = this.dataStoreProviderApiService.getDataStoreProviders(getType());
ListResponse<StorageProviderResponse> responses = new ListResponse<StorageProviderResponse>();
for (StorageProviderResponse provider : providers) {
provider.setObjectName("dataStoreProvider");
}
responses.setResponses(providers);
responses.setResponseName(this.getCommandName());
this.setResponseObject(responses);
}
use of org.apache.cloudstack.api.response.ListResponse in project cloudstack by apache.
the class ListSystemVMsCmd method execute.
@Override
public void execute() {
Pair<List<? extends VirtualMachine>, Integer> systemVMs = _mgr.searchForSystemVm(this);
ListResponse<SystemVmResponse> response = new ListResponse<SystemVmResponse>();
List<SystemVmResponse> vmResponses = new ArrayList<SystemVmResponse>();
for (VirtualMachine systemVM : systemVMs.first()) {
SystemVmResponse vmResponse = _responseGenerator.createSystemVmResponse(systemVM);
vmResponse.setObjectName("systemvm");
vmResponses.add(vmResponse);
}
response.setResponses(vmResponses, systemVMs.second());
response.setResponseName(getCommandName());
setResponseObject(response);
}
use of org.apache.cloudstack.api.response.ListResponse in project cloudstack by apache.
the class ListAutoScalePoliciesCmd method execute.
@Override
public void execute() {
List<? extends AutoScalePolicy> autoScalePolicies = _autoScaleService.listAutoScalePolicies(this);
ListResponse<AutoScalePolicyResponse> response = new ListResponse<AutoScalePolicyResponse>();
List<AutoScalePolicyResponse> responses = new ArrayList<AutoScalePolicyResponse>();
if (autoScalePolicies != null) {
for (AutoScalePolicy autoScalePolicy : autoScalePolicies) {
AutoScalePolicyResponse autoScalePolicyResponse = _responseGenerator.createAutoScalePolicyResponse(autoScalePolicy);
autoScalePolicyResponse.setObjectName("autoscalepolicy");
responses.add(autoScalePolicyResponse);
}
}
response.setResponses(responses);
response.setResponseName(getCommandName());
setResponseObject(response);
}
use of org.apache.cloudstack.api.response.ListResponse in project cloudstack by apache.
the class ListCountersCmd method execute.
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() {
List<? extends Counter> counters = null;
counters = _autoScaleService.listCounters(this);
ListResponse<CounterResponse> response = new ListResponse<CounterResponse>();
List<CounterResponse> ctrResponses = new ArrayList<CounterResponse>();
for (Counter ctr : counters) {
CounterResponse ctrResponse = _responseGenerator.createCounterResponse(ctr);
ctrResponses.add(ctrResponse);
}
response.setResponses(ctrResponses);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
Aggregations