Search in sources :

Example 1 with NetworkOfferingResponse

use of com.cloud.api.response.NetworkOfferingResponse in project CloudStack-archive by CloudStack-extras.

the class UpdateNetworkOfferingCmd method execute.

@Override
public void execute() {
    NetworkOffering result = _configService.updateNetworkOffering(this);
    if (result != null) {
        NetworkOfferingResponse response = _responseGenerator.createNetworkOfferingResponse(result);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update network offering");
    }
}
Also used : NetworkOfferingResponse(com.cloud.api.response.NetworkOfferingResponse) ServerApiException(com.cloud.api.ServerApiException) NetworkOffering(com.cloud.offering.NetworkOffering)

Example 2 with NetworkOfferingResponse

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

the class UpdateNetworkOfferingCmd method execute.

@Override
public void execute() {
    final NetworkOffering result = _configService.updateNetworkOffering(this);
    if (result != null) {
        final NetworkOfferingResponse response = _responseGenerator.createNetworkOfferingResponse(result);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update network offering");
    }
}
Also used : NetworkOfferingResponse(com.cloud.api.response.NetworkOfferingResponse) ServerApiException(com.cloud.api.ServerApiException) NetworkOffering(com.cloud.offering.NetworkOffering)

Example 3 with NetworkOfferingResponse

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

the class ListNetworkOfferingsCmd method execute.

@Override
public void execute() {
    final Pair<List<? extends NetworkOffering>, Integer> offerings = _configService.searchForNetworkOfferings(this);
    final ListResponse<NetworkOfferingResponse> response = new ListResponse<>();
    final List<NetworkOfferingResponse> offeringResponses = new ArrayList<>();
    for (final NetworkOffering offering : offerings.first()) {
        final NetworkOfferingResponse offeringResponse = _responseGenerator.createNetworkOfferingResponse(offering);
        offeringResponses.add(offeringResponse);
    }
    response.setResponses(offeringResponses, offerings.second());
    response.setResponseName(getCommandName());
    this.setResponseObject(response);
}
Also used : NetworkOfferingResponse(com.cloud.api.response.NetworkOfferingResponse) ListResponse(com.cloud.api.response.ListResponse) NetworkOffering(com.cloud.offering.NetworkOffering) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List)

Example 4 with NetworkOfferingResponse

use of com.cloud.api.response.NetworkOfferingResponse in project CloudStack-archive by CloudStack-extras.

the class ListNetworkOfferingsCmd method execute.

@Override
public void execute() {
    List<? extends NetworkOffering> offerings = _configService.searchForNetworkOfferings(this);
    ListResponse<NetworkOfferingResponse> response = new ListResponse<NetworkOfferingResponse>();
    List<NetworkOfferingResponse> offeringResponses = new ArrayList<NetworkOfferingResponse>();
    for (NetworkOffering offering : offerings) {
        NetworkOfferingResponse offeringResponse = _responseGenerator.createNetworkOfferingResponse(offering);
        offeringResponses.add(offeringResponse);
    }
    response.setResponses(offeringResponses);
    response.setResponseName(getCommandName());
    this.setResponseObject(response);
}
Also used : ListResponse(com.cloud.api.response.ListResponse) NetworkOfferingResponse(com.cloud.api.response.NetworkOfferingResponse) NetworkOffering(com.cloud.offering.NetworkOffering) ArrayList(java.util.ArrayList)

Example 5 with NetworkOfferingResponse

use of com.cloud.api.response.NetworkOfferingResponse in project CloudStack-archive by CloudStack-extras.

the class CreateNetworkOfferingCmd method execute.

@Override
public void execute() {
    NetworkOffering result = _configService.createNetworkOffering(this);
    if (result != null) {
        NetworkOfferingResponse response = _responseGenerator.createNetworkOfferingResponse(result);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create network offering");
    }
}
Also used : NetworkOfferingResponse(com.cloud.api.response.NetworkOfferingResponse) ServerApiException(com.cloud.api.ServerApiException) NetworkOffering(com.cloud.offering.NetworkOffering)

Aggregations

NetworkOfferingResponse (com.cloud.api.response.NetworkOfferingResponse)7 NetworkOffering (com.cloud.offering.NetworkOffering)6 ServerApiException (com.cloud.api.ServerApiException)4 ArrayList (java.util.ArrayList)3 ListResponse (com.cloud.api.response.ListResponse)2 List (java.util.List)2 CapabilityResponse (com.cloud.api.response.CapabilityResponse)1 ProviderResponse (com.cloud.api.response.ProviderResponse)1 ServiceResponse (com.cloud.api.response.ServiceResponse)1 VirtualRouterProviderResponse (com.cloud.api.response.VirtualRouterProviderResponse)1 Provider (com.cloud.network.Network.Provider)1 Service (com.cloud.network.Network.Service)1 PhysicalNetworkServiceProvider (com.cloud.network.PhysicalNetworkServiceProvider)1 VirtualRouterProvider (com.cloud.network.VirtualRouterProvider)1 Detail (com.cloud.offering.NetworkOffering.Detail)1 ServiceOffering (com.cloud.offering.ServiceOffering)1 EnumSet (java.util.EnumSet)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1