List of usage examples for com.amazonaws.services.ec2 AmazonEC2 deleteInternetGateway
DeleteInternetGatewayResult deleteInternetGateway(DeleteInternetGatewayRequest deleteInternetGatewayRequest);
Deletes the specified internet gateway.
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 ww w . j av a2s . c om * @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; } } }