Example usage for com.amazonaws.services.ec2.model RouteTable getVpcId

List of usage examples for com.amazonaws.services.ec2.model RouteTable getVpcId

Introduction

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

Prototype


public String getVpcId() 

Source Link

Document

The ID of the VPC.

Usage

From source file:com.infinitechaos.vpcviewer.web.rest.dto.RouteTableDTO.java

License:Open Source License

public RouteTableDTO(final RouteTable routeTable) {
    this.routeTableId = routeTable.getRouteTableId();
    this.vpcId = routeTable.getVpcId();
    this.routes.addAll(routeTable.getRoutes().stream().map(RouteDTO::new).collect(Collectors.toList()));
    this.tags.addAll(routeTable.getTags().stream().map(TagDTO::new).collect(Collectors.toList()));
    this.associations.addAll(routeTable.getAssociations().stream().map(RouteTableAssociationDTO::new)
            .collect(Collectors.toList()));
    this.propagatingVgws.addAll(
            routeTable.getPropagatingVgws().stream().map(PropagatingVgwDTO::new).collect(Collectors.toList()));
}

From source file:com.urbancode.terraform.tasks.aws.RouteTableTask.java

License:Apache License

/**
 *
 *
 * @param defaultRoute//  ww  w .  j  av a 2 s . c o m
 * @return
 */
private String setupMainTable(boolean defaultRoute) {
    String result = null;

    // grab id of first (only) route table in vpc
    List<RouteTable> tables = helper.getRouteTables(null, ec2Client);

    log.debug("tables found: " + tables.size());
    for (RouteTable table : tables) {
        log.debug("Table: " + table.getRouteTableId());
        log.debug("VPC: " + table.getVpcId());
        if (table.getVpcId().equals(vpcId)) {
            routeTableId = table.getRouteTableId();
            log.info("Found main route table " + routeTableId);
            break;
        }
    }

    if (defaultRoute) {
        // set default route
        RouteTask dRoute = new RouteTask(context);
        dRoute.setRouteTableId(routeTableId);
        dRoute.setTarget(target);
        dRoute.setDest("0.0.0.0/0");
        dRoute.create();
    }

    return result;
}