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

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

Introduction

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

Prototype

DisassociateRouteTableResult disassociateRouteTable(
        DisassociateRouteTableRequest disassociateRouteTableRequest);

Source Link

Document

Disassociates a subnet from a route table.

Usage

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

License:Apache License

/**
 *
 * @param associationId/*from   w w  w. j a  v a2s. co  m*/
 * @param ec2Client
 */
public void disassociateRouteTableFromSubnet(String associationId, AmazonEC2 ec2Client) {
    try {
        DisassociateRouteTableRequest request = new DisassociateRouteTableRequest()
                .withAssociationId(associationId);
        ec2Client.disassociateRouteTable(request);
    } catch (AmazonServiceException e) {
        log.error("Failed to disassociate Route Table from Subnet", e);
        if (!"InvalidAssociationID.NotFound".equalsIgnoreCase(e.getErrorCode())) {
            throw e;
        }
    }
}