@Override public void execute(Context context) throws Exception { logger.info("delete route table, routeTableId={}", resource.id); for (RouteTableAssociation association : resource.remoteRouteTable.getAssociations()) { AWS.vpc.ec2.disassociateRouteTable(new DisassociateRouteTableRequest().withAssociationId(association.getRouteTableAssociationId())); } AWS.vpc.ec2.deleteRouteTable(new DeleteRouteTableRequest().withRouteTableId(resource.remoteRouteTable.getRouteTableId())); }
private void visitRouteTable(VPCDiagramBuilder vpcDiagram, RouteTable routeTable) throws CfnAssistException { logger.debug("visit routetable " + routeTable.getRouteTableId()); List<Route> routes = routeTable.getRoutes(); List<RouteTableAssociation> usersOfTable = routeTable.getAssociations(); for (RouteTableAssociation usedBy : usersOfTable) { String subnetId = usedBy.getSubnetId(); // can subnet ever be null in an association? if (subnetId!=null) { vpcDiagram.addAsssociatedRouteTable(routeTable, subnetId); // possible duplication if route table reused? for (Route route : routes) { vpcDiagram.addRoute(routeTable.getRouteTableId(), subnetId, route); } } } }
public RouteTableAssociationDTO(final RouteTableAssociation rta) { this.routeTableAssociationId = rta.getRouteTableAssociationId(); this.routeTableId = rta.getRouteTableId(); this.subnetId = rta.getSubnetId(); this.main = rta.getMain(); }