Search in sources :

Example 1 with DeleteLoadBalancerRequest

use of com.amazonaws.services.elasticloadbalancing.model.DeleteLoadBalancerRequest in project photon-model by vmware.

the class AWSLoadBalancerServiceTest method deleteAwsLoadBalancer.

private void deleteAwsLoadBalancer(String name) {
    if (this.isMock) {
        return;
    }
    try {
        DeleteLoadBalancerRequest deleteRequest = new DeleteLoadBalancerRequest(name);
        this.client.deleteLoadBalancer(deleteRequest);
    } catch (Exception e) {
        this.host.log("Exception deleting a load balancer '%s': %s", name, e.toString());
    }
}
Also used : DeleteLoadBalancerRequest(com.amazonaws.services.elasticloadbalancing.model.DeleteLoadBalancerRequest) CompletionException(java.util.concurrent.CompletionException)

Example 2 with DeleteLoadBalancerRequest

use of com.amazonaws.services.elasticloadbalancing.model.DeleteLoadBalancerRequest in project photon-model by vmware.

the class AWSLoadBalancerService method deleteLoadBalancer.

private DeferredResult<AWSLoadBalancerContext> deleteLoadBalancer(AWSLoadBalancerContext context) {
    DeleteLoadBalancerRequest request = new DeleteLoadBalancerRequest().withLoadBalancerName(context.loadBalancerStateExpanded.name);
    String message = "Delete AWS Load Balancer with name [" + context.loadBalancerStateExpanded.name + "]";
    AWSDeferredResultAsyncHandler<DeleteLoadBalancerRequest, DeleteLoadBalancerResult> handler = new AWSDeferredResultAsyncHandler<>(this, message);
    context.client.deleteLoadBalancerAsync(request, handler);
    return handler.toDeferredResult().thenApply(ignore -> context);
}
Also used : AWSDeferredResultAsyncHandler(com.vmware.photon.controller.model.adapters.awsadapter.util.AWSDeferredResultAsyncHandler) DeleteLoadBalancerRequest(com.amazonaws.services.elasticloadbalancing.model.DeleteLoadBalancerRequest) DeleteLoadBalancerResult(com.amazonaws.services.elasticloadbalancing.model.DeleteLoadBalancerResult)

Aggregations

DeleteLoadBalancerRequest (com.amazonaws.services.elasticloadbalancing.model.DeleteLoadBalancerRequest)2 DeleteLoadBalancerResult (com.amazonaws.services.elasticloadbalancing.model.DeleteLoadBalancerResult)1 AWSDeferredResultAsyncHandler (com.vmware.photon.controller.model.adapters.awsadapter.util.AWSDeferredResultAsyncHandler)1 CompletionException (java.util.concurrent.CompletionException)1