Search in sources :

Example 1 with DeleteNatGatewayResult

use of com.amazonaws.services.ec2.model.DeleteNatGatewayResult in project photon-model by vmware.

the class AWSNetworkClient method deleteNATGateway.

/**
 * Delete a NAT Gateway
 * It waits for the NAT gateway to get into the Deleted state before returning.
 */
public DeferredResult<Void> deleteNATGateway(String natGatewayId, TaskManager taskManager, long taskExpirationMicros) {
    DeleteNatGatewayRequest req = new DeleteNatGatewayRequest().withNatGatewayId(natGatewayId);
    String message = "Delete AWS NAT Gateway with id [" + natGatewayId + "].";
    AWSDeferredResultAsyncHandler<DeleteNatGatewayRequest, DeleteNatGatewayResult> handler = new AWSDeferredResultAsyncHandler<>(this.service, message);
    this.client.deleteNatGatewayAsync(req, handler);
    return handler.toDeferredResult().thenCompose(ignore -> waitForNatGatewayState(natGatewayId, taskManager, taskExpirationMicros, AWSTaskStatusChecker.AWS_DELETED_NAME)).thenApply(ignore -> null);
}
Also used : AWSTaskStatusChecker(com.vmware.photon.controller.model.adapters.awsadapter.AWSTaskStatusChecker) DescribeSubnetsRequest(com.amazonaws.services.ec2.model.DescribeSubnetsRequest) DescribeVpcsRequest(com.amazonaws.services.ec2.model.DescribeVpcsRequest) ReleaseAddressRequest(com.amazonaws.services.ec2.model.ReleaseAddressRequest) AllocateAddressRequest(com.amazonaws.services.ec2.model.AllocateAddressRequest) AttachInternetGatewayRequest(com.amazonaws.services.ec2.model.AttachInternetGatewayRequest) AssociateRouteTableRequest(com.amazonaws.services.ec2.model.AssociateRouteTableRequest) DescribeSubnetsResult(com.amazonaws.services.ec2.model.DescribeSubnetsResult) NatGateway(com.amazonaws.services.ec2.model.NatGateway) CreateTagsRequest(com.amazonaws.services.ec2.model.CreateTagsRequest) CreateNatGatewayResult(com.amazonaws.services.ec2.model.CreateNatGatewayResult) DeleteSubnetResult(com.amazonaws.services.ec2.model.DeleteSubnetResult) DeleteSubnetRequest(com.amazonaws.services.ec2.model.DeleteSubnetRequest) DeleteVpcRequest(com.amazonaws.services.ec2.model.DeleteVpcRequest) AWS_MAIN_ROUTE_ASSOCIATION(com.vmware.photon.controller.model.adapters.awsadapter.AWSConstants.AWS_MAIN_ROUTE_ASSOCIATION) StatelessService(com.vmware.xenon.common.StatelessService) CreateRouteResult(com.amazonaws.services.ec2.model.CreateRouteResult) DescribeInternetGatewaysResult(com.amazonaws.services.ec2.model.DescribeInternetGatewaysResult) TaskManager(com.vmware.photon.controller.model.adapters.util.TaskManager) List(java.util.List) DescribeRouteTablesRequest(com.amazonaws.services.ec2.model.DescribeRouteTablesRequest) Tag(com.amazonaws.services.ec2.model.Tag) DeferredResult(com.vmware.xenon.common.DeferredResult) CreateNatGatewayRequest(com.amazonaws.services.ec2.model.CreateNatGatewayRequest) AssociateRouteTableResult(com.amazonaws.services.ec2.model.AssociateRouteTableResult) DeleteRouteTableRequest(com.amazonaws.services.ec2.model.DeleteRouteTableRequest) AllocateAddressResult(com.amazonaws.services.ec2.model.AllocateAddressResult) CreateSubnetRequest(com.amazonaws.services.ec2.model.CreateSubnetRequest) DescribeRouteTablesResult(com.amazonaws.services.ec2.model.DescribeRouteTablesResult) ROUTE_DEST_ALL(com.vmware.photon.controller.model.adapters.awsadapter.AWSNetworkService.ROUTE_DEST_ALL) DeleteInternetGatewayRequest(com.amazonaws.services.ec2.model.DeleteInternetGatewayRequest) DomainType(com.amazonaws.services.ec2.model.DomainType) DeleteNatGatewayResult(com.amazonaws.services.ec2.model.DeleteNatGatewayResult) CreateSubnetResult(com.amazonaws.services.ec2.model.CreateSubnetResult) CreateRouteTableResult(com.amazonaws.services.ec2.model.CreateRouteTableResult) ArrayList(java.util.ArrayList) CreateVpcResult(com.amazonaws.services.ec2.model.CreateVpcResult) DescribeVpcsResult(com.amazonaws.services.ec2.model.DescribeVpcsResult) Filter(com.amazonaws.services.ec2.model.Filter) RouteTable(com.amazonaws.services.ec2.model.RouteTable) Subnet(com.amazonaws.services.ec2.model.Subnet) CreateVpcRequest(com.amazonaws.services.ec2.model.CreateVpcRequest) AWS_TAG_NAME(com.vmware.photon.controller.model.adapters.awsadapter.AWSConstants.AWS_TAG_NAME) CreateTagsResult(com.amazonaws.services.ec2.model.CreateTagsResult) ReleaseAddressResult(com.amazonaws.services.ec2.model.ReleaseAddressResult) Vpc(com.amazonaws.services.ec2.model.Vpc) DeleteRouteTableResult(com.amazonaws.services.ec2.model.DeleteRouteTableResult) CreateInternetGatewayResult(com.amazonaws.services.ec2.model.CreateInternetGatewayResult) DetachInternetGatewayRequest(com.amazonaws.services.ec2.model.DetachInternetGatewayRequest) DeleteNatGatewayRequest(com.amazonaws.services.ec2.model.DeleteNatGatewayRequest) AWSUtils(com.vmware.photon.controller.model.adapters.awsadapter.AWSUtils) CreateRouteTableRequest(com.amazonaws.services.ec2.model.CreateRouteTableRequest) InternetGateway(com.amazonaws.services.ec2.model.InternetGateway) AmazonEC2Exception(com.amazonaws.services.ec2.model.AmazonEC2Exception) DescribeInternetGatewaysRequest(com.amazonaws.services.ec2.model.DescribeInternetGatewaysRequest) AmazonEC2AsyncClient(com.amazonaws.services.ec2.AmazonEC2AsyncClient) CreateRouteRequest(com.amazonaws.services.ec2.model.CreateRouteRequest) DeleteNatGatewayResult(com.amazonaws.services.ec2.model.DeleteNatGatewayResult) DeleteNatGatewayRequest(com.amazonaws.services.ec2.model.DeleteNatGatewayRequest)

Aggregations

AmazonEC2AsyncClient (com.amazonaws.services.ec2.AmazonEC2AsyncClient)1 AllocateAddressRequest (com.amazonaws.services.ec2.model.AllocateAddressRequest)1 AllocateAddressResult (com.amazonaws.services.ec2.model.AllocateAddressResult)1 AmazonEC2Exception (com.amazonaws.services.ec2.model.AmazonEC2Exception)1 AssociateRouteTableRequest (com.amazonaws.services.ec2.model.AssociateRouteTableRequest)1 AssociateRouteTableResult (com.amazonaws.services.ec2.model.AssociateRouteTableResult)1 AttachInternetGatewayRequest (com.amazonaws.services.ec2.model.AttachInternetGatewayRequest)1 CreateInternetGatewayResult (com.amazonaws.services.ec2.model.CreateInternetGatewayResult)1 CreateNatGatewayRequest (com.amazonaws.services.ec2.model.CreateNatGatewayRequest)1 CreateNatGatewayResult (com.amazonaws.services.ec2.model.CreateNatGatewayResult)1 CreateRouteRequest (com.amazonaws.services.ec2.model.CreateRouteRequest)1 CreateRouteResult (com.amazonaws.services.ec2.model.CreateRouteResult)1 CreateRouteTableRequest (com.amazonaws.services.ec2.model.CreateRouteTableRequest)1 CreateRouteTableResult (com.amazonaws.services.ec2.model.CreateRouteTableResult)1 CreateSubnetRequest (com.amazonaws.services.ec2.model.CreateSubnetRequest)1 CreateSubnetResult (com.amazonaws.services.ec2.model.CreateSubnetResult)1 CreateTagsRequest (com.amazonaws.services.ec2.model.CreateTagsRequest)1 CreateTagsResult (com.amazonaws.services.ec2.model.CreateTagsResult)1 CreateVpcRequest (com.amazonaws.services.ec2.model.CreateVpcRequest)1 CreateVpcResult (com.amazonaws.services.ec2.model.CreateVpcResult)1