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

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

Introduction

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

Prototype

DeleteRouteRequest

Source Link

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  .  jav a 2s  .  c  om*/
 * @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;
        }
    }
}