Search in sources :

Example 1 with DescribeRouteTablesResult

use of com.amazonaws.services.ec2.model.DescribeRouteTablesResult in project photon-model by vmware.

the class AWSNetworkClient method getMainRouteTable.

/**
 * Get the main route table for a given VPC
 */
public RouteTable getMainRouteTable(String vpcId) {
    // build filter list
    List<Filter> filters = new ArrayList<>();
    filters.add(AWSUtils.getFilter(AWSUtils.AWS_FILTER_VPC_ID, vpcId));
    filters.add(AWSUtils.getFilter(AWS_MAIN_ROUTE_ASSOCIATION, "true"));
    DescribeRouteTablesRequest req = new DescribeRouteTablesRequest().withFilters(filters);
    DescribeRouteTablesResult res = this.client.describeRouteTables(req);
    List<RouteTable> routeTables = res.getRouteTables();
    return routeTables.isEmpty() ? null : routeTables.get(0);
}
Also used : RouteTable(com.amazonaws.services.ec2.model.RouteTable) DescribeRouteTablesRequest(com.amazonaws.services.ec2.model.DescribeRouteTablesRequest) Filter(com.amazonaws.services.ec2.model.Filter) ArrayList(java.util.ArrayList) DescribeRouteTablesResult(com.amazonaws.services.ec2.model.DescribeRouteTablesResult)

Aggregations

DescribeRouteTablesRequest (com.amazonaws.services.ec2.model.DescribeRouteTablesRequest)1 DescribeRouteTablesResult (com.amazonaws.services.ec2.model.DescribeRouteTablesResult)1 Filter (com.amazonaws.services.ec2.model.Filter)1 RouteTable (com.amazonaws.services.ec2.model.RouteTable)1 ArrayList (java.util.ArrayList)1