Search in sources :

Example 86 with ListResponse

use of org.apache.cloudstack.api.response.ListResponse in project cloudstack by apache.

the class ListConditionsCmd method execute.

// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() {
    List<? extends Condition> conditions = null;
    conditions = _autoScaleService.listConditions(this);
    ListResponse<ConditionResponse> response = new ListResponse<ConditionResponse>();
    List<ConditionResponse> cndnResponses = new ArrayList<ConditionResponse>();
    for (Condition cndn : conditions) {
        ConditionResponse cndnResponse = _responseGenerator.createConditionResponse(cndn);
        cndnResponses.add(cndnResponse);
    }
    response.setResponses(cndnResponses);
    response.setResponseName(getCommandName());
    this.setResponseObject(response);
}
Also used : Condition(com.cloud.network.as.Condition) ListResponse(org.apache.cloudstack.api.response.ListResponse) ConditionResponse(org.apache.cloudstack.api.response.ConditionResponse) ArrayList(java.util.ArrayList)

Example 87 with ListResponse

use of org.apache.cloudstack.api.response.ListResponse in project cloudstack by apache.

the class ListVpnGatewaysCmd method execute.

@Override
public void execute() {
    Pair<List<? extends Site2SiteVpnGateway>, Integer> gws = _s2sVpnService.searchForVpnGateways(this);
    ListResponse<Site2SiteVpnGatewayResponse> response = new ListResponse<Site2SiteVpnGatewayResponse>();
    List<Site2SiteVpnGatewayResponse> gwResponses = new ArrayList<Site2SiteVpnGatewayResponse>();
    for (Site2SiteVpnGateway gw : gws.first()) {
        if (gw == null) {
            continue;
        }
        Site2SiteVpnGatewayResponse site2SiteVpnGatewayRes = _responseGenerator.createSite2SiteVpnGatewayResponse(gw);
        site2SiteVpnGatewayRes.setObjectName("vpngateway");
        gwResponses.add(site2SiteVpnGatewayRes);
    }
    response.setResponses(gwResponses, gws.second());
    response.setResponseName(getCommandName());
    setResponseObject(response);
}
Also used : Site2SiteVpnGateway(com.cloud.network.Site2SiteVpnGateway) Site2SiteVpnGatewayResponse(org.apache.cloudstack.api.response.Site2SiteVpnGatewayResponse) ListResponse(org.apache.cloudstack.api.response.ListResponse) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List)

Example 88 with ListResponse

use of org.apache.cloudstack.api.response.ListResponse in project cloudstack by apache.

the class ListRemoteAccessVpnsCmd method execute.

@Override
public void execute() {
    Pair<List<? extends RemoteAccessVpn>, Integer> vpns = _ravService.searchForRemoteAccessVpns(this);
    ListResponse<RemoteAccessVpnResponse> response = new ListResponse<RemoteAccessVpnResponse>();
    List<RemoteAccessVpnResponse> vpnResponses = new ArrayList<RemoteAccessVpnResponse>();
    if (vpns.first() != null && !vpns.first().isEmpty()) {
        for (RemoteAccessVpn vpn : vpns.first()) {
            vpnResponses.add(_responseGenerator.createRemoteAccessVpnResponse(vpn));
        }
    }
    response.setResponses(vpnResponses, vpns.second());
    response.setResponseName(getCommandName());
    setResponseObject(response);
}
Also used : ListResponse(org.apache.cloudstack.api.response.ListResponse) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) RemoteAccessVpnResponse(org.apache.cloudstack.api.response.RemoteAccessVpnResponse) RemoteAccessVpn(com.cloud.network.RemoteAccessVpn)

Example 89 with ListResponse

use of org.apache.cloudstack.api.response.ListResponse in project cloudstack by apache.

the class ListStaticRoutesCmd method execute.

@Override
public void execute() {
    Pair<List<? extends StaticRoute>, Integer> result = _vpcService.listStaticRoutes(this);
    ListResponse<StaticRouteResponse> response = new ListResponse<StaticRouteResponse>();
    List<StaticRouteResponse> routeResponses = new ArrayList<StaticRouteResponse>();
    for (StaticRoute route : result.first()) {
        StaticRouteResponse ruleData = _responseGenerator.createStaticRouteResponse(route);
        routeResponses.add(ruleData);
    }
    response.setResponses(routeResponses, result.second());
    response.setResponseName(getCommandName());
    setResponseObject(response);
}
Also used : StaticRoute(com.cloud.network.vpc.StaticRoute) StaticRouteResponse(org.apache.cloudstack.api.response.StaticRouteResponse) ListResponse(org.apache.cloudstack.api.response.ListResponse) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList)

Example 90 with ListResponse

use of org.apache.cloudstack.api.response.ListResponse in project cloudstack by apache.

the class ListPrivateGatewaysCmd method execute.

@Override
public void execute() {
    Pair<List<PrivateGateway>, Integer> gateways = _vpcService.listPrivateGateway(this);
    ListResponse<PrivateGatewayResponse> response = new ListResponse<PrivateGatewayResponse>();
    List<PrivateGatewayResponse> projectResponses = new ArrayList<PrivateGatewayResponse>();
    for (PrivateGateway gateway : gateways.first()) {
        PrivateGatewayResponse gatewayResponse = _responseGenerator.createPrivateGatewayResponse(gateway);
        projectResponses.add(gatewayResponse);
    }
    response.setResponses(projectResponses, gateways.second());
    response.setResponseName(getCommandName());
    setResponseObject(response);
}
Also used : PrivateGatewayResponse(org.apache.cloudstack.api.response.PrivateGatewayResponse) ListResponse(org.apache.cloudstack.api.response.ListResponse) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) PrivateGateway(com.cloud.network.vpc.PrivateGateway)

Aggregations

ListResponse (org.apache.cloudstack.api.response.ListResponse)177 ArrayList (java.util.ArrayList)160 List (java.util.List)70 ServerApiException (org.apache.cloudstack.api.ServerApiException)49 InvalidParameterValueException (com.cloud.exception.InvalidParameterValueException)32 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)23 Account (com.cloud.user.Account)10 Network (com.cloud.network.Network)9 Host (com.cloud.host.Host)8 NetworkResponse (org.apache.cloudstack.api.response.NetworkResponse)8 Test (org.junit.Test)8 DedicatedResources (com.cloud.dc.DedicatedResources)7 ResponseView (org.apache.cloudstack.api.ResponseObject.ResponseView)7 TemplateResponse (org.apache.cloudstack.api.response.TemplateResponse)7 Domain (com.cloud.domain.Domain)6 VirtualMachineTemplate (com.cloud.template.VirtualMachineTemplate)5 ApiDiscoveryResponse (org.apache.cloudstack.api.response.ApiDiscoveryResponse)5 DedicatedResourceVO (com.cloud.dc.DedicatedResourceVO)4 ConcurrentOperationException (com.cloud.exception.ConcurrentOperationException)4 InsufficientCapacityException (com.cloud.exception.InsufficientCapacityException)4