Example usage for com.amazonaws.services.ec2.model DescribeRouteTablesRequest withRouteTableIds

List of usage examples for com.amazonaws.services.ec2.model DescribeRouteTablesRequest withRouteTableIds

Introduction

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

Prototype


public DescribeRouteTablesRequest withRouteTableIds(java.util.Collection<String> routeTableIds) 

Source Link

Document

One or more route table IDs.

Usage

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

License:Apache License

/**
 * Gets a list of all RouteTables or all RouteTables listed in routeTableIds from Amazon.
 * You can leave the list of ids empty or null to get all route tables.
 *
 * @param routeTableIds - leave this null or empty to get all RouteTables
 * @param ec2Client/*  ww  w . j  a  v a  2 s  .  c  o m*/
 * @return RouteTables - a List of RouteTables found
 */
public List<RouteTable> getRouteTables(List<String> routeTableIds, AmazonEC2 ec2Client) {
    DescribeRouteTablesRequest request = new DescribeRouteTablesRequest();

    if (routeTableIds != null && !routeTableIds.isEmpty()) {
        request = request.withRouteTableIds(routeTableIds);
    }
    DescribeRouteTablesResult result = ec2Client.describeRouteTables(request);

    return result.getRouteTables();
}