Search in sources :

Example 1 with NetworkACLResponse

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

the class ListNetworkACLListsCmd method execute.

@Override
public void execute() {
    Pair<List<? extends NetworkACL>, Integer> result = _networkACLService.listNetworkACLs(this);
    ListResponse<NetworkACLResponse> response = new ListResponse<NetworkACLResponse>();
    List<NetworkACLResponse> aclResponses = new ArrayList<NetworkACLResponse>();
    for (NetworkACL acl : result.first()) {
        NetworkACLResponse aclResponse = _responseGenerator.createNetworkACLResponse(acl);
        aclResponses.add(aclResponse);
    }
    response.setResponses(aclResponses, result.second());
    response.setResponseName(getCommandName());
    setResponseObject(response);
}
Also used : NetworkACLResponse(org.apache.cloudstack.api.response.NetworkACLResponse) ListResponse(org.apache.cloudstack.api.response.ListResponse) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) NetworkACL(com.cloud.network.vpc.NetworkACL)

Example 2 with NetworkACLResponse

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

the class CreateNetworkACLListCmd method execute.

@Override
public void execute() throws ResourceUnavailableException {
    NetworkACL acl = _networkACLService.getNetworkACL(getEntityId());
    if (acl != null) {
        NetworkACLResponse aclResponse = _responseGenerator.createNetworkACLResponse(acl);
        setResponseObject(aclResponse);
        aclResponse.setResponseName(getCommandName());
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create network ACL");
    }
}
Also used : NetworkACLResponse(org.apache.cloudstack.api.response.NetworkACLResponse) ServerApiException(org.apache.cloudstack.api.ServerApiException) NetworkACL(com.cloud.network.vpc.NetworkACL)

Example 3 with NetworkACLResponse

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

the class UpdateNetworkACLListCmd method execute.

@Override
public void execute() throws ResourceUnavailableException {
    NetworkACL acl = _networkACLService.updateNetworkACL(this);
    NetworkACLResponse aclResponse = _responseGenerator.createNetworkACLResponse(acl);
    setResponseObject(aclResponse);
    aclResponse.setResponseName(getCommandName());
}
Also used : NetworkACLResponse(org.apache.cloudstack.api.response.NetworkACLResponse) NetworkACL(com.cloud.network.vpc.NetworkACL)

Example 4 with NetworkACLResponse

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

the class ApiResponseHelper method createNetworkACLResponse.

@Override
public NetworkACLResponse createNetworkACLResponse(NetworkACL networkACL) {
    NetworkACLResponse response = new NetworkACLResponse();
    response.setId(networkACL.getUuid());
    response.setName(networkACL.getName());
    response.setDescription(networkACL.getDescription());
    response.setForDisplay(networkACL.isDisplay());
    Vpc vpc = ApiDBUtils.findVpcById(networkACL.getVpcId());
    if (vpc != null) {
        response.setVpcId(vpc.getUuid());
    }
    response.setObjectName("networkacllist");
    return response;
}
Also used : NetworkACLResponse(org.apache.cloudstack.api.response.NetworkACLResponse) Vpc(com.cloud.network.vpc.Vpc)

Aggregations

NetworkACLResponse (org.apache.cloudstack.api.response.NetworkACLResponse)4 NetworkACL (com.cloud.network.vpc.NetworkACL)3 Vpc (com.cloud.network.vpc.Vpc)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 ServerApiException (org.apache.cloudstack.api.ServerApiException)1 ListResponse (org.apache.cloudstack.api.response.ListResponse)1