当前位置: 首页>>代码示例>>Java>>正文


Java Route类代码示例

本文整理汇总了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));
            }
        }
    }
}
 
开发者ID:neowu,项目名称:cmn-project,代码行数:20,代码来源:RouteTableTaskPlanner.java

示例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();
}
 
开发者ID:kylesm,项目名称:vpcviewer,代码行数:10,代码来源:RouteDTO.java

示例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;
}
 
开发者ID:vinayselvaraj,项目名称:vpc2vpc,代码行数:36,代码来源:CreateConnection.java

示例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);
		}
	} 
}
}
 
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:16,代码来源:VPCVisitor.java

示例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));
	}
}
 
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:15,代码来源:VPCDiagramBuilder.java

示例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));
	}
}
 
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:13,代码来源:VPCDiagramBuilder.java

示例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;
}
 
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:8,代码来源:VPCDiagramBuilder.java

示例8: getRoutes

import com.amazonaws.services.ec2.model.Route; //导入依赖的package包/类
@Override
public List<Route> getRoutes() {
    return (List<Route>) resource.getAttribute("Routes");
}
 
开发者ID:awslabs,项目名称:aws-sdk-java-resources,代码行数:5,代码来源:RouteTableImpl.java

示例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();
 
开发者ID:awslabs,项目名称:aws-sdk-java-resources,代码行数:7,代码来源:RouteTable.java


注:本文中的com.amazonaws.services.ec2.model.Route类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。