Example usage for com.amazonaws.services.ec2.model DeleteInternetGatewayRequest DeleteInternetGatewayRequest

List of usage examples for com.amazonaws.services.ec2.model DeleteInternetGatewayRequest DeleteInternetGatewayRequest

Introduction

In this page you can find the example usage for com.amazonaws.services.ec2.model DeleteInternetGatewayRequest DeleteInternetGatewayRequest.

Prototype

DeleteInternetGatewayRequest

Source Link

Usage

From source file:com.urbancode.terraform.tasks.aws.helpers.AWSHelper.java

License:Apache License

/**
 * Deletes the given internetGateway. Does not detach the gateway if it is attached.
 *
 * @param gatewayId//from   w  w  w. java  2 s  .  c  o  m
 * @param ec2Client
 */
public void deleteInternetGateway(String gatewayId, AmazonEC2 ec2Client) {
    try {
        DeleteInternetGatewayRequest request = new DeleteInternetGatewayRequest()
                .withInternetGatewayId(gatewayId);
        ec2Client.deleteInternetGateway(request);
    } catch (AmazonServiceException e) {
        log.error("Failed to delete Internet Gateway", e);
        if (!"InvalidInternetGatewayID.NotFound".equalsIgnoreCase(e.getErrorCode())) {
            // swallow the exception only if the gateway id was not found
            throw e;
        }
    }
}

From source file:com.vmware.photon.controller.model.adapters.awsadapter.AWSNetworkService.java

License:Open Source License

public void deleteInternetGateway(String resourceID, AmazonEC2AsyncClient client) {
    DeleteInternetGatewayRequest req = new DeleteInternetGatewayRequest().withInternetGatewayId(resourceID);
    client.deleteInternetGateway(req);//from   w ww.j a  va2  s. c o  m
}