Search in sources :

Example 6 with ListResponse

use of com.cloud.api.response.ListResponse in project CloudStack-archive by CloudStack-extras.

the class ListVolumesCmd method execute.

@Override
public void execute() {
    List<? extends Volume> volumes = _storageService.searchForVolumes(this);
    ListResponse<VolumeResponse> response = new ListResponse<VolumeResponse>();
    List<VolumeResponse> volResponses = new ArrayList<VolumeResponse>();
    for (Volume volume : volumes) {
        VolumeResponse volResponse = _responseGenerator.createVolumeResponse(volume);
        volResponse.setObjectName("volume");
        volResponses.add(volResponse);
    }
    response.setResponses(volResponses);
    response.setResponseName(getCommandName());
    this.setResponseObject(response);
}
Also used : ListResponse(com.cloud.api.response.ListResponse) VolumeResponse(com.cloud.api.response.VolumeResponse) Volume(com.cloud.storage.Volume) ArrayList(java.util.ArrayList)

Example 7 with ListResponse

use of com.cloud.api.response.ListResponse in project CloudStack-archive by CloudStack-extras.

the class ListZonesByCmd method execute.

@Override
public void execute() {
    List<? extends DataCenter> dataCenters = _mgr.listDataCenters(this);
    ListResponse<ZoneResponse> response = new ListResponse<ZoneResponse>();
    List<ZoneResponse> zoneResponses = new ArrayList<ZoneResponse>();
    for (DataCenter dataCenter : dataCenters) {
        ZoneResponse zoneResponse = _responseGenerator.createZoneResponse(dataCenter, showCapacities);
        zoneResponse.setObjectName("zone");
        zoneResponses.add(zoneResponse);
    }
    response.setResponses(zoneResponses);
    response.setResponseName(getCommandName());
    this.setResponseObject(response);
}
Also used : ZoneResponse(com.cloud.api.response.ZoneResponse) DataCenter(com.cloud.dc.DataCenter) ListResponse(com.cloud.api.response.ListResponse) ArrayList(java.util.ArrayList)

Example 8 with ListResponse

use of com.cloud.api.response.ListResponse in project CloudStack-archive by CloudStack-extras.

the class ListStoragePoolsCmd method execute.

@Override
public void execute() {
    List<? extends StoragePool> pools = _mgr.searchForStoragePools(this);
    ListResponse<StoragePoolResponse> response = new ListResponse<StoragePoolResponse>();
    List<StoragePoolResponse> poolResponses = new ArrayList<StoragePoolResponse>();
    for (StoragePool pool : pools) {
        StoragePoolResponse poolResponse = _responseGenerator.createStoragePoolResponse(pool);
        poolResponse.setObjectName("storagepool");
        poolResponses.add(poolResponse);
    }
    response.setResponses(poolResponses);
    response.setResponseName(getCommandName());
    this.setResponseObject(response);
}
Also used : StoragePoolResponse(com.cloud.api.response.StoragePoolResponse) StoragePool(com.cloud.storage.StoragePool) ListResponse(com.cloud.api.response.ListResponse) ArrayList(java.util.ArrayList)

Example 9 with ListResponse

use of com.cloud.api.response.ListResponse in project CloudStack-archive by CloudStack-extras.

the class ListSystemVMsCmd method execute.

@Override
public void execute() {
    List<? extends VirtualMachine> systemVMs = _mgr.searchForSystemVm(this);
    ListResponse<SystemVmResponse> response = new ListResponse<SystemVmResponse>();
    List<SystemVmResponse> vmResponses = new ArrayList<SystemVmResponse>();
    for (VirtualMachine systemVM : systemVMs) {
        SystemVmResponse vmResponse = _responseGenerator.createSystemVmResponse(systemVM);
        vmResponse.setObjectName("systemvm");
        vmResponses.add(vmResponse);
    }
    response.setResponses(vmResponses);
    response.setResponseName(getCommandName());
    this.setResponseObject(response);
}
Also used : SystemVmResponse(com.cloud.api.response.SystemVmResponse) ListResponse(com.cloud.api.response.ListResponse) ArrayList(java.util.ArrayList) VirtualMachine(com.cloud.vm.VirtualMachine)

Example 10 with ListResponse

use of com.cloud.api.response.ListResponse in project CloudStack-archive by CloudStack-extras.

the class ListTrafficTypeImplementorsCmd method execute.

@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
    List<Pair<TrafficType, String>> results = _networkService.listTrafficTypeImplementor(this);
    ListResponse<TrafficTypeImplementorResponse> response = new ListResponse<TrafficTypeImplementorResponse>();
    List<TrafficTypeImplementorResponse> responses = new ArrayList<TrafficTypeImplementorResponse>();
    for (Pair<TrafficType, String> r : results) {
        TrafficTypeImplementorResponse p = new TrafficTypeImplementorResponse();
        p.setTrafficType(r.first().toString());
        p.setImplementor(r.second());
        p.setObjectName("traffictypeimplementorresponse");
        responses.add(p);
    }
    response.setResponses(responses);
    response.setResponseName(getCommandName());
    this.setResponseObject(response);
}
Also used : ListResponse(com.cloud.api.response.ListResponse) TrafficTypeImplementorResponse(com.cloud.api.response.TrafficTypeImplementorResponse) ArrayList(java.util.ArrayList) Pair(com.cloud.utils.Pair) TrafficType(com.cloud.network.Networks.TrafficType)

Aggregations

ListResponse (com.cloud.api.response.ListResponse)57 ArrayList (java.util.ArrayList)54 ServerApiException (com.cloud.api.ServerApiException)7 TemplateResponse (com.cloud.api.response.TemplateResponse)3 ClusterResponse (com.cloud.api.response.ClusterResponse)2 DomainResponse (com.cloud.api.response.DomainResponse)2 HostResponse (com.cloud.api.response.HostResponse)2 Domain (com.cloud.domain.Domain)2 DiscoveryException (com.cloud.exception.DiscoveryException)2 Host (com.cloud.host.Host)2 Cluster (com.cloud.org.Cluster)2 VirtualMachineTemplate (com.cloud.template.VirtualMachineTemplate)2 Alert (com.cloud.alert.Alert)1 AccountResponse (com.cloud.api.response.AccountResponse)1 AlertResponse (com.cloud.api.response.AlertResponse)1 AsyncJobResponse (com.cloud.api.response.AsyncJobResponse)1 ConfigurationResponse (com.cloud.api.response.ConfigurationResponse)1 DiskOfferingResponse (com.cloud.api.response.DiskOfferingResponse)1 DomainRouterResponse (com.cloud.api.response.DomainRouterResponse)1 EventResponse (com.cloud.api.response.EventResponse)1