Example usage for com.amazonaws.services.ec2 AmazonEC2 deleteRoute

List of usage examples for com.amazonaws.services.ec2 AmazonEC2 deleteRoute

Introduction

In this page you can find the example usage for com.amazonaws.services.ec2 AmazonEC2 deleteRoute.

Prototype

DeleteRouteResult deleteRoute(DeleteRouteRequest deleteRouteRequest);

Source Link

Document

Deletes the specified route from the specified route table.

Usage

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

License:Apache License

/**
 * Deletes the route corresponding to the given info
 *
 * @param routeTableId//from  w ww .  j  a v  a2  s .  c  o m
 * @param destCidr
 * @param ec2Client
 */
public void deleteRoute(String routeTableId, String destCidr, AmazonEC2 ec2Client) {
    try {
        DeleteRouteRequest request = new DeleteRouteRequest().withDestinationCidrBlock(destCidr)
                .withRouteTableId(routeTableId);
        ec2Client.deleteRoute(request);
    } catch (AmazonServiceException e) {
        log.error("Failed to delete Route: " + "\n\tRouteTableId: " + routeTableId + "\n\tDestination CIDR: "
                + destCidr, e);
        if (!"InvalidRouteTableID.NotFound".equals(e.getErrorCode())) {
            throw e;
        }
    }
}