com.amazonaws.services.ec2.model.DescribeRouteTablesRequest Java Examples

The following examples show how to use com.amazonaws.services.ec2.model.DescribeRouteTablesRequest. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RouteTableProviderTest.java    From aws-athena-query-federation with Apache License 2.0 6 votes vote down vote up
@Override
protected void setUpRead()
{
    when(mockEc2.describeRouteTables(any(DescribeRouteTablesRequest.class))).thenAnswer((InvocationOnMock invocation) -> {
        DescribeRouteTablesRequest request = (DescribeRouteTablesRequest) invocation.getArguments()[0];

        assertEquals(getIdValue(), request.getRouteTableIds().get(0));
        DescribeRouteTablesResult mockResult = mock(DescribeRouteTablesResult.class);
        List<RouteTable> values = new ArrayList<>();
        values.add(makeRouteTable(getIdValue()));
        values.add(makeRouteTable(getIdValue()));
        values.add(makeRouteTable("fake-id"));
        when(mockResult.getRouteTables()).thenReturn(values);
        return mockResult;
    });
}
 
Example #2
Source File: RouteTableProvider.java    From aws-athena-query-federation with Apache License 2.0 5 votes vote down vote up
/**
 * Calls DescribeRouteTables on the AWS EC2 Client returning all Routes that match the supplied predicate and attempting
 * to push down certain predicates (namely queries for specific RoutingTables) to EC2.
 *
 * @See TableProvider
 */
@Override
public void readWithConstraint(BlockSpiller spiller, ReadRecordsRequest recordsRequest, QueryStatusChecker queryStatusChecker)
{
    boolean done = false;
    DescribeRouteTablesRequest request = new DescribeRouteTablesRequest();

    ValueSet idConstraint = recordsRequest.getConstraints().getSummary().get("route_table_id");
    if (idConstraint != null && idConstraint.isSingleValue()) {
        request.setRouteTableIds(Collections.singletonList(idConstraint.getSingleValue().toString()));
    }

    while (!done) {
        DescribeRouteTablesResult response = ec2.describeRouteTables(request);

        for (RouteTable nextRouteTable : response.getRouteTables()) {
            for (Route route : nextRouteTable.getRoutes()) {
                instanceToRow(nextRouteTable, route, spiller);
            }
        }

        request.setNextToken(response.getNextToken());

        if (response.getNextToken() == null || !queryStatusChecker.isQueryRunning()) {
            done = true;
        }
    }
}
 
Example #3
Source File: RouteTableImpl.java    From aws-sdk-java-resources with Apache License 2.0 5 votes vote down vote up
@Override
public RouteTableAssociationCollection getAssociations(
        DescribeRouteTablesRequest request) {

    ResourceCollectionImpl result = resource.getCollection("Associations",
            request);

    if (result == null) return null;
    return new RouteTableAssociationCollectionImpl(result);
}
 
Example #4
Source File: VpcImpl.java    From aws-sdk-java-resources with Apache License 2.0 5 votes vote down vote up
@Override
public RouteTableCollection getRouteTables(DescribeRouteTablesRequest
        request) {

    ResourceCollectionImpl result = resource.getCollection("RouteTables",
            request);

    if (result == null) return null;
    return new RouteTableCollectionImpl(result);
}
 
Example #5
Source File: EC2Impl.java    From aws-sdk-java-resources with Apache License 2.0 5 votes vote down vote up
@Override
public RouteTableCollection getRouteTables(DescribeRouteTablesRequest
        request) {

    ResourceCollectionImpl result = service.getCollection("RouteTables",
            request);

    if (result == null) return null;
    return new RouteTableCollectionImpl(result);
}
 
Example #6
Source File: BaseTest.java    From aws-mock with MIT License 5 votes vote down vote up
/**
 * Describe route table.
 *
 * @return RouteTable
 */
protected final RouteTable getRouteTable() {
    RouteTable routeTable = null;

    DescribeRouteTablesRequest req = new DescribeRouteTablesRequest();
    DescribeRouteTablesResult result = amazonEC2Client.describeRouteTables(req);
    if (result != null && !result.getRouteTables().isEmpty()) {
        routeTable = result.getRouteTables().get(0);
    }

    return routeTable;
}
 
Example #7
Source File: RouteTableImpl.java    From aws-sdk-java-resources with Apache License 2.0 4 votes vote down vote up
@Override
public boolean load(DescribeRouteTablesRequest request) {
    return load(request, null);
}
 
Example #8
Source File: RouteTableImpl.java    From aws-sdk-java-resources with Apache License 2.0 4 votes vote down vote up
@Override
public boolean load(DescribeRouteTablesRequest request,
        ResultCapture<DescribeRouteTablesResult> extractor) {

    return resource.load(request, extractor);
}
 
Example #9
Source File: EC2Impl.java    From aws-sdk-java-resources with Apache License 2.0 4 votes vote down vote up
@Override
public RouteTableCollection getRouteTables() {
    return getRouteTables((DescribeRouteTablesRequest)null);
}
 
Example #10
Source File: Vpc.java    From aws-sdk-java-resources with Apache License 2.0 2 votes vote down vote up
/**
 * Retrieves the RouteTables collection referenced by this resource.
 */
RouteTableCollection getRouteTables(DescribeRouteTablesRequest request);
 
Example #11
Source File: EC2.java    From aws-sdk-java-resources with Apache License 2.0 2 votes vote down vote up
/**
 * Retrieves the RouteTables collection referenced by this resource.
 */
RouteTableCollection getRouteTables(DescribeRouteTablesRequest request);
 
Example #12
Source File: RouteTable.java    From aws-sdk-java-resources with Apache License 2.0 2 votes vote down vote up
/**
 * Makes a call to the service to load this resource's attributes if they
 * are not loaded yet.
 * The following request parameters will be populated from the data of this
 * <code>RouteTable</code> resource, and any conflicting parameter value set
 * in the request will be overridden:
 * <ul>
 *   <li>
 *     <b><code>RouteTableIds.0</code></b>
 *         - mapped from the <code>Id</code> identifier.
 *   </li>
 * </ul>
 *
 * <p>
 *
 * @return Returns {@code true} if the resource is not yet loaded when this
 *         method was invoked, which indicates that a service call has been
 *         made to retrieve the attributes.
 * @see DescribeRouteTablesRequest
 */
boolean load(DescribeRouteTablesRequest request);
 
Example #13
Source File: RouteTable.java    From aws-sdk-java-resources with Apache License 2.0 2 votes vote down vote up
/**
 * Makes a call to the service to load this resource's attributes if they
 * are not loaded yet, and use a ResultCapture to retrieve the low-level
 * client response
 * The following request parameters will be populated from the data of this
 * <code>RouteTable</code> resource, and any conflicting parameter value set
 * in the request will be overridden:
 * <ul>
 *   <li>
 *     <b><code>RouteTableIds.0</code></b>
 *         - mapped from the <code>Id</code> identifier.
 *   </li>
 * </ul>
 *
 * <p>
 *
 * @return Returns {@code true} if the resource is not yet loaded when this
 *         method was invoked, which indicates that a service call has been
 *         made to retrieve the attributes.
 * @see DescribeRouteTablesRequest
 */
boolean load(DescribeRouteTablesRequest request,
        ResultCapture<DescribeRouteTablesResult> extractor);
 
Example #14
Source File: RouteTable.java    From aws-sdk-java-resources with Apache License 2.0 2 votes vote down vote up
/**
 * Retrieves the Associations collection referenced by this resource.
 */
RouteTableAssociationCollection getAssociations(DescribeRouteTablesRequest
        request);