Search in sources :

Example 26 with ListResponse

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

the class ListResourceLimitsCmd method execute.

@Override
public void execute() {
    List<? extends ResourceLimit> result = _resourceLimitService.searchForLimits(id, finalyzeAccountId(this.getAccountName(), this.getDomainId(), this.getProjectId(), false), this.getDomainId(), resourceType, this.getStartIndex(), this.getPageSizeVal());
    ListResponse<ResourceLimitResponse> response = new ListResponse<ResourceLimitResponse>();
    List<ResourceLimitResponse> limitResponses = new ArrayList<ResourceLimitResponse>();
    for (ResourceLimit limit : result) {
        ResourceLimitResponse resourceLimitResponse = _responseGenerator.createResourceLimitResponse(limit);
        resourceLimitResponse.setObjectName("resourcelimit");
        limitResponses.add(resourceLimitResponse);
    }
    response.setResponses(limitResponses);
    response.setResponseName(getCommandName());
    this.setResponseObject(response);
}
Also used : ListResponse(com.cloud.api.response.ListResponse) ResourceLimitResponse(com.cloud.api.response.ResourceLimitResponse) ArrayList(java.util.ArrayList) ResourceLimit(com.cloud.configuration.ResourceLimit)

Example 27 with ListResponse

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

the class ListProjectsCmd method execute.

/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public void execute() {
    List<? extends Project> projects = _projectService.listProjects(id, name, displayText, state, this.getAccountName(), this.getDomainId(), this.getKeyword(), this.getStartIndex(), this.getPageSizeVal(), this.listAll(), this.isRecursive());
    ListResponse<ProjectResponse> response = new ListResponse<ProjectResponse>();
    List<ProjectResponse> projectResponses = new ArrayList<ProjectResponse>();
    for (Project project : projects) {
        ProjectResponse projectResponse = _responseGenerator.createProjectResponse(project);
        projectResponses.add(projectResponse);
    }
    response.setResponses(projectResponses);
    response.setResponseName(getCommandName());
    this.setResponseObject(response);
}
Also used : Project(com.cloud.projects.Project) ProjectResponse(com.cloud.api.response.ProjectResponse) ListResponse(com.cloud.api.response.ListResponse) ArrayList(java.util.ArrayList)

Example 28 with ListResponse

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

the class ListPublicIpAddressesCmd method execute.

@Override
public void execute() {
    List<? extends IpAddress> result = _mgr.searchForIPAddresses(this);
    ListResponse<IPAddressResponse> response = new ListResponse<IPAddressResponse>();
    List<IPAddressResponse> ipAddrResponses = new ArrayList<IPAddressResponse>();
    for (IpAddress ipAddress : result) {
        IPAddressResponse ipResponse = _responseGenerator.createIPAddressResponse(ipAddress);
        ipResponse.setObjectName("publicipaddress");
        ipAddrResponses.add(ipResponse);
    }
    response.setResponses(ipAddrResponses);
    response.setResponseName(getCommandName());
    this.setResponseObject(response);
}
Also used : ListResponse(com.cloud.api.response.ListResponse) ArrayList(java.util.ArrayList) IpAddress(com.cloud.network.IpAddress) IPAddressResponse(com.cloud.api.response.IPAddressResponse)

Example 29 with ListResponse

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

the class ListRoutersCmd method execute.

@Override
public void execute() {
    List<? extends VirtualRouter> result = _mgr.searchForRouters(this);
    ListResponse<DomainRouterResponse> response = new ListResponse<DomainRouterResponse>();
    List<DomainRouterResponse> routerResponses = new ArrayList<DomainRouterResponse>();
    for (VirtualRouter router : result) {
        DomainRouterResponse routerResponse = _responseGenerator.createDomainRouterResponse(router);
        routerResponse.setObjectName("router");
        routerResponses.add(routerResponse);
    }
    response.setResponses(routerResponses);
    response.setResponseName(getCommandName());
    this.setResponseObject(response);
}
Also used : ListResponse(com.cloud.api.response.ListResponse) ArrayList(java.util.ArrayList) DomainRouterResponse(com.cloud.api.response.DomainRouterResponse) VirtualRouter(com.cloud.network.router.VirtualRouter)

Example 30 with ListResponse

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

the class ListSSHKeyPairsCmd method execute.

/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public void execute() {
    List<? extends SSHKeyPair> resultList = _mgr.listSSHKeyPairs(this);
    List<SSHKeyPairResponse> responses = new ArrayList<SSHKeyPairResponse>();
    for (SSHKeyPair result : resultList) {
        SSHKeyPairResponse r = new SSHKeyPairResponse(result.getName(), result.getFingerprint());
        r.setObjectName("sshkeypair");
        responses.add(r);
    }
    ListResponse<SSHKeyPairResponse> response = new ListResponse<SSHKeyPairResponse>();
    response.setResponses(responses);
    response.setResponseName(getCommandName());
    this.setResponseObject(response);
}
Also used : SSHKeyPairResponse(com.cloud.api.response.SSHKeyPairResponse) SSHKeyPair(com.cloud.user.SSHKeyPair) ListResponse(com.cloud.api.response.ListResponse) ArrayList(java.util.ArrayList)

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