Search in sources :

Example 11 with ListResponse

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

the class ListTrafficTypesCmd method execute.

@Override
public void execute() {
    List<? extends PhysicalNetworkTrafficType> trafficTypes = _networkService.listTrafficTypes(getPhysicalNetworkId());
    ListResponse<TrafficTypeResponse> response = new ListResponse<TrafficTypeResponse>();
    List<TrafficTypeResponse> trafficTypesResponses = new ArrayList<TrafficTypeResponse>();
    for (PhysicalNetworkTrafficType trafficType : trafficTypes) {
        TrafficTypeResponse trafficTypeResponse = _responseGenerator.createTrafficTypeResponse(trafficType);
        trafficTypesResponses.add(trafficTypeResponse);
    }
    response.setResponses(trafficTypesResponses);
    response.setResponseName(getCommandName());
    this.setResponseObject(response);
}
Also used : ListResponse(com.cloud.api.response.ListResponse) TrafficTypeResponse(com.cloud.api.response.TrafficTypeResponse) ArrayList(java.util.ArrayList) PhysicalNetworkTrafficType(com.cloud.network.PhysicalNetworkTrafficType)

Example 12 with ListResponse

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

the class ListUsersCmd method execute.

@Override
public void execute() {
    List<? extends UserAccount> result = _accountService.searchForUsers(this);
    ListResponse<UserResponse> response = new ListResponse<UserResponse>();
    List<UserResponse> userResponses = new ArrayList<UserResponse>();
    for (UserAccount user : result) {
        UserResponse userResponse = _responseGenerator.createUserResponse(user);
        userResponses.add(userResponse);
    }
    response.setResponses(userResponses);
    response.setResponseName(getCommandName());
    this.setResponseObject(response);
}
Also used : UserResponse(com.cloud.api.response.UserResponse) ListResponse(com.cloud.api.response.ListResponse) ArrayList(java.util.ArrayList) UserAccount(com.cloud.user.UserAccount)

Example 13 with ListResponse

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

the class ListVMGroupsCmd method execute.

@Override
public void execute() {
    List<? extends InstanceGroup> groups = _mgr.searchForVmGroups(this);
    ListResponse<InstanceGroupResponse> response = new ListResponse<InstanceGroupResponse>();
    List<InstanceGroupResponse> responses = new ArrayList<InstanceGroupResponse>();
    for (InstanceGroup group : groups) {
        InstanceGroupResponse groupResponse = _responseGenerator.createInstanceGroupResponse(group);
        groupResponse.setObjectName("instancegroup");
        responses.add(groupResponse);
    }
    response.setResponses(responses);
    response.setResponseName(getCommandName());
    this.setResponseObject(response);
}
Also used : ListResponse(com.cloud.api.response.ListResponse) ArrayList(java.util.ArrayList) InstanceGroupResponse(com.cloud.api.response.InstanceGroupResponse) InstanceGroup(com.cloud.vm.InstanceGroup)

Example 14 with ListResponse

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

the class ListLoadBalancerRulesCmd method execute.

@Override
public void execute() {
    List<? extends LoadBalancer> loadBalancers = _lbService.searchForLoadBalancers(this);
    ListResponse<LoadBalancerResponse> response = new ListResponse<LoadBalancerResponse>();
    List<LoadBalancerResponse> lbResponses = new ArrayList<LoadBalancerResponse>();
    if (loadBalancers != null) {
        for (LoadBalancer loadBalancer : loadBalancers) {
            LoadBalancerResponse lbResponse = _responseGenerator.createLoadBalancerResponse(loadBalancer);
            lbResponse.setObjectName("loadbalancerrule");
            lbResponses.add(lbResponse);
        }
    }
    response.setResponses(lbResponses);
    response.setResponseName(getCommandName());
    this.setResponseObject(response);
}
Also used : LoadBalancerResponse(com.cloud.api.response.LoadBalancerResponse) ListResponse(com.cloud.api.response.ListResponse) ArrayList(java.util.ArrayList) LoadBalancer(com.cloud.network.rules.LoadBalancer)

Example 15 with ListResponse

use of com.cloud.api.response.ListResponse 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);
}
Also used : ProviderResponse(com.cloud.api.response.ProviderResponse) ListResponse(com.cloud.api.response.ListResponse) ArrayList(java.util.ArrayList) PhysicalNetworkServiceProvider(com.cloud.network.PhysicalNetworkServiceProvider)

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