Search in sources :

Example 1 with DeleteTargetGroupResult

use of com.amazonaws.services.elasticloadbalancingv2.model.DeleteTargetGroupResult in project cloudbreak by hortonworks.

the class AwsNativeLoadBalancerTargetGroupResourceBuilder method delete.

@Override
public CloudResource delete(AwsContext context, com.sequenceiq.cloudbreak.cloud.context.AuthenticatedContext auth, CloudResource resource) throws Exception {
    LOGGER.info("Deleting load balancer's ('{}') target group with arn '{}'", resource.getReference(), resource.getInstanceId());
    AmazonElasticLoadBalancingClient loadBalancingClient = context.getLoadBalancingClient();
    DeleteTargetGroupRequest deleteTargetGroupRequest = new DeleteTargetGroupRequest().withTargetGroupArn(resource.getReference());
    DeleteTargetGroupResult deleteResult = awsMethodExecutor.execute(() -> loadBalancingClient.deleteTargetGroup(deleteTargetGroupRequest), null);
    return deleteResult != null ? resource : null;
}
Also used : AmazonElasticLoadBalancingClient(com.sequenceiq.cloudbreak.cloud.aws.common.client.AmazonElasticLoadBalancingClient) DeleteTargetGroupRequest(com.amazonaws.services.elasticloadbalancingv2.model.DeleteTargetGroupRequest) DeleteTargetGroupResult(com.amazonaws.services.elasticloadbalancingv2.model.DeleteTargetGroupResult)

Aggregations

DeleteTargetGroupRequest (com.amazonaws.services.elasticloadbalancingv2.model.DeleteTargetGroupRequest)1 DeleteTargetGroupResult (com.amazonaws.services.elasticloadbalancingv2.model.DeleteTargetGroupResult)1 AmazonElasticLoadBalancingClient (com.sequenceiq.cloudbreak.cloud.aws.common.client.AmazonElasticLoadBalancingClient)1