本文整理汇总了Java中com.amazonaws.services.ec2.model.Route类的典型用法代码示例。如果您正苦于以下问题:Java Route类的具体用法?Java Route怎么用?Java Route使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Route类属于com.amazonaws.services.ec2.model包,在下文中一共展示了Route类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: linkDeleteTasks
import com.amazonaws.services.ec2.model.Route; //导入依赖的package包/类
private void linkDeleteTasks() {
for (DeleteRouteTableTask routeTableTask : all(DeleteRouteTableTask.class)) {
RouteTable routeTable = routeTableTask.resource;
find(DeleteVPCTask.class)
.ifPresent(task -> task.dependsOn(routeTableTask));
for (final Route route : routeTable.remoteRouteTable.getRoutes()) {
if (route.getGatewayId() != null) {
all(DeleteInternetGatewayTask.class).stream()
.filter(task -> task.resource.remoteInternetGatewayId.equals(route.getGatewayId()))
.findAny().ifPresent(task -> task.dependsOn(routeTableTask));
} else if (route.getNatGatewayId() != null) {
all(DeleteNATGatewayTask.class).stream()
.filter(task -> task.resource.remoteNATGateway.getNatGatewayId().equals(route.getNatGatewayId()))
.findAny().ifPresent(task -> task.dependsOn(routeTableTask));
}
}
}
}
示例2: RouteDTO
import com.amazonaws.services.ec2.model.Route; //导入依赖的package包/类
public RouteDTO(final Route route) {
this.origin = route.getOrigin();
this.destinationCidrBlock = route.getDestinationCidrBlock();
this.instanceId = route.getInstanceId();
this.gatewayId = route.getGatewayId();
this.vpcPeeringConnectionId = route.getVpcPeeringConnectionId();
this.state = route.getState();
this.networkInterfaceId = route.getNetworkInterfaceId();
}
示例3: checkIfRoutesExist
import com.amazonaws.services.ec2.model.Route; //导入依赖的package包/类
/**
* Checks if routes between the selected VPCs already exist
*
* @param vpnEndpoints
* @return
*/
private boolean checkIfRoutesExist(List<VPNEndpoint> vpnEndpoints) {
boolean routesExist = false;
for (VPNEndpoint vpnEndpoint : vpnEndpoints) {
ec2Client.setEndpoint(vpnEndpoint.getRegion().getEndpoint());
DescribeRouteTablesResult descRouteTableResult = ec2Client.describeRouteTables();
List<RouteTable> routeTables = descRouteTableResult.getRouteTables();
for (RouteTable routeTable : routeTables) {
if (routeTable.getVpcId().equals(vpnEndpoint.getVpc().getVpcId())) {
List<Route> routes = routeTable.getRoutes();
for (Route route : routes) {
for (VPNEndpoint extVpnEndpoint : vpnEndpoints) {
if (!vpnEndpoint.equals(extVpnEndpoint)) {
LOG.debug("Checking if route allows requested traffic: " + route);
if (route.getDestinationCidrBlock().endsWith(extVpnEndpoint.getVpc().getCidrBlock())) {
routesExist = true;
LOG.error("A route already exists between " + vpnEndpoint.getVpc().getCidrBlock() + " and " + extVpnEndpoint.getVpc().getCidrBlock());
}
}
}
}
}
}
}
return routesExist;
}
示例4: visitRouteTable
import com.amazonaws.services.ec2.model.Route; //导入依赖的package包/类
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);
}
}
}
}
示例5: addRoute
import com.amazonaws.services.ec2.model.Route; //导入依赖的package包/类
public void addRoute(String routeTableId, String subnetId, Route route) throws CfnAssistException {
String string = route.getDestinationCidrBlock();
Cidr subnet = parseCidr(string);
String state = route.getState();
if (ROUTE_ACTIVE.equals(state)) {
addActiveRoute(routeTableId, subnetId, route, subnet);
} else if (ROUTE_BLACKHOLE.equals(state)){
logger.warn("Route state is not active, cidr block is " + route.getDestinationCidrBlock());
networkDiagram.addConnectionFromSubDiagram(ROUTE_BLACKHOLE, subnetId, subnetDiagramBuilders.get(subnetId), string);
} else {
throw new CfnAssistException(String.format("Unexpected state for route with cidr %s, state was %s", string, state));
}
}
示例6: addActiveRoute
import com.amazonaws.services.ec2.model.Route; //导入依赖的package包/类
private void addActiveRoute(String routeTableId, String subnetId, Route route, Cidr subnet) throws CfnAssistException {
String destination = getDestination(route);
String cidr = subnetAsCidrString(subnet);
if (!destination.equals("local")) {
String diagramId = formRouteTableIdForDiagram(subnetId, routeTableId);
networkDiagram.addRouteToInstance(destination, diagramId, subnetDiagramBuilders.get(subnetId), cidr);
} else {
// this associates the cidr block with the current subnet
networkDiagram.associateWithSubDiagram(cidr, subnetId, subnetDiagramBuilders.get(subnetId));
}
}
示例7: getDestination
import com.amazonaws.services.ec2.model.Route; //导入依赖的package包/类
private String getDestination(Route route) {
String dest = route.getGatewayId();
if (dest==null) {
dest = route.getInstanceId(); // api docs say this is a NAT instance, but could it be any instance?
}
return dest;
}
示例8: getRoutes
import com.amazonaws.services.ec2.model.Route; //导入依赖的package包/类
@Override
public List<Route> getRoutes() {
return (List<Route>) resource.getAttribute("Routes");
}
示例9: getRoutes
import com.amazonaws.services.ec2.model.Route; //导入依赖的package包/类
/**
* Gets the value of the Routes attribute. If this resource is not yet
* loaded, a call to {@code load()} is made to retrieve the value of the
* attribute.
*/
List<Route> getRoutes();