Search in sources :

Example 6 with IPAddressResponse

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

the class ListPublicIpAddressesCmd method execute.

@Override
public void execute() {
    Pair<List<? extends IpAddress>, Integer> result = _mgr.searchForIPAddresses(this);
    ListResponse<IPAddressResponse> response = new ListResponse<IPAddressResponse>();
    List<IPAddressResponse> ipAddrResponses = new ArrayList<IPAddressResponse>();
    for (IpAddress ipAddress : result.first()) {
        IPAddressResponse ipResponse = _responseGenerator.createIPAddressResponse(ResponseView.Restricted, ipAddress);
        ipResponse.setObjectName("publicipaddress");
        ipAddrResponses.add(ipResponse);
    }
    response.setResponses(ipAddrResponses, result.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) IpAddress(com.cloud.network.IpAddress) IPAddressResponse(org.apache.cloudstack.api.response.IPAddressResponse)

Aggregations

IPAddressResponse (org.apache.cloudstack.api.response.IPAddressResponse)6 IpAddress (com.cloud.network.IpAddress)5 ArrayList (java.util.ArrayList)3 List (java.util.List)2 ServerApiException (org.apache.cloudstack.api.ServerApiException)2 ListResponse (org.apache.cloudstack.api.response.ListResponse)2 DataCenter (com.cloud.dc.DataCenter)1 VlanVO (com.cloud.dc.VlanVO)1 Network (com.cloud.network.Network)1 PhysicalNetwork (com.cloud.network.PhysicalNetwork)1 NetworkVO (com.cloud.network.dao.NetworkVO)1 PhysicalNetworkVO (com.cloud.network.dao.PhysicalNetworkVO)1 Vpc (com.cloud.network.vpc.Vpc)1 ResourceTag (com.cloud.server.ResourceTag)1 UserVm (com.cloud.uservm.UserVm)1 ResourceTagResponse (org.apache.cloudstack.api.response.ResourceTagResponse)1