Search in sources :

Example 11 with NetworkResponse

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

the class CreateNetworkCmdByAdmin method execute.

// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public // an exception thrown by createNetwork() will be caught by the dispatcher.
void execute() throws InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException {
    final Network result = _networkService.createGuestNetwork(this);
    if (result != null) {
        final NetworkResponse response = _responseGenerator.createNetworkResponse(ResponseView.Full, result);
        response.setResponseName(getCommandName());
        setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create network");
    }
}
Also used : ServerApiException(com.cloud.api.ServerApiException) Network(com.cloud.network.Network) NetworkResponse(com.cloud.api.response.NetworkResponse)

Example 12 with NetworkResponse

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

the class CreateNetworkCmd method execute.

@Override
public // an exception thrown by createNetwork() will be caught by the dispatcher.
void execute() throws InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException {
    final Network result = _networkService.createGuestNetwork(this);
    if (result != null) {
        final NetworkResponse response = _responseGenerator.createNetworkResponse(ResponseView.Restricted, result);
        response.setResponseName(getCommandName());
        setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create network");
    }
}
Also used : ServerApiException(com.cloud.api.ServerApiException) Network(com.cloud.network.Network) NetworkResponse(com.cloud.api.response.NetworkResponse) PhysicalNetworkResponse(com.cloud.api.response.PhysicalNetworkResponse)

Aggregations

NetworkResponse (com.cloud.api.response.NetworkResponse)12 Network (com.cloud.network.Network)11 ServerApiException (com.cloud.api.ServerApiException)7 ArrayList (java.util.ArrayList)6 ListResponse (com.cloud.api.response.ListResponse)4 PhysicalNetworkResponse (com.cloud.api.response.PhysicalNetworkResponse)4 Account (com.cloud.user.Account)3 User (com.cloud.user.User)3 InvalidParameterValueException (com.cloud.utils.exception.InvalidParameterValueException)3 ResourceTagResponse (com.cloud.api.response.ResourceTagResponse)2 ServiceResponse (com.cloud.api.response.ServiceResponse)2 DataCenter (com.cloud.dc.DataCenter)2 Service (com.cloud.network.Network.Service)2 ResourceTag (com.cloud.server.ResourceTag)2 HashSet (java.util.HashSet)2 List (java.util.List)2 CapabilityResponse (com.cloud.api.response.CapabilityResponse)1 VpcResponse (com.cloud.api.response.VpcResponse)1 Domain (com.cloud.domain.Domain)1 Capability (com.cloud.network.Network.Capability)1