Search in sources :

Example 1 with NetworkACLResponse

use of com.cloud.api.response.NetworkACLResponse in project cosmic by MissionCriticalCloud.

the class CreateNetworkACLListCmd method execute.

// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() throws ResourceUnavailableException {
    final NetworkACL acl = _networkACLService.getNetworkACL(getEntityId());
    if (acl != null) {
        final 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(com.cloud.api.response.NetworkACLResponse) ServerApiException(com.cloud.api.ServerApiException) NetworkACL(com.cloud.network.vpc.NetworkACL)

Example 2 with NetworkACLResponse

use of com.cloud.api.response.NetworkACLResponse in project cosmic by MissionCriticalCloud.

the class UpdateNetworkACLListCmd method execute.

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

Example 3 with NetworkACLResponse

use of com.cloud.api.response.NetworkACLResponse in project cosmic by MissionCriticalCloud.

the class ApiResponseHelper method createNetworkACLResponse.

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

Example 4 with NetworkACLResponse

use of com.cloud.api.response.NetworkACLResponse in project cosmic by MissionCriticalCloud.

the class ListNetworkACLListsCmd method execute.

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

Aggregations

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