Example usage for com.amazonaws.services.ec2.model CreateRouteTableResult getRouteTable

List of usage examples for com.amazonaws.services.ec2.model CreateRouteTableResult getRouteTable

Introduction

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

Prototype


public RouteTable getRouteTable() 

Source Link

Document

Information about the route table.

Usage

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

License:Apache License

/**
 *
 * @param vpcId//w w  w  . ja  va2 s.  c om
 * @param ec2Client
 * @return
 */
public String createRouteTable(String vpcId, AmazonEC2 ec2Client) {
    String routeTableId = null;
    try {
        CreateRouteTableRequest request = new CreateRouteTableRequest().withVpcId(vpcId);
        CreateRouteTableResult result = ec2Client.createRouteTable(request);
        if (result != null && result.getRouteTable() != null) {
            routeTableId = result.getRouteTable().getRouteTableId();
        }
    } catch (AmazonServiceException e) {
        log.error("Failed to create Route Table in Vpc " + vpcId, e);
        if (!"InvalidVpcID.NotFound".equalsIgnoreCase(e.getErrorCode())) {
            throw e;
        }
    }
    return routeTableId;
}