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


Java CreateRouteRequest类代码示例

本文整理汇总了Java中com.amazonaws.services.ec2.model.CreateRouteRequest的典型用法代码示例。如果您正苦于以下问题:Java CreateRouteRequest类的具体用法?Java CreateRouteRequest怎么用?Java CreateRouteRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CreateRouteRequest类属于com.amazonaws.services.ec2.model包,在下文中一共展示了CreateRouteRequest类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addRouteToNatGateway

import com.amazonaws.services.ec2.model.CreateRouteRequest; //导入依赖的package包/类
/**
 * Add a 0.0.0.0/0 route to NAT gateway on an existing route table
 */
public DeferredResult<Void> addRouteToNatGateway(String routeTableId, String natGatewayId) {
    CreateRouteRequest req = new CreateRouteRequest()
            .withNatGatewayId(natGatewayId)
            .withDestinationCidrBlock(ROUTE_DEST_ALL)
            .withRouteTableId(routeTableId);

    String message = "Create AWS Route to NAT Gateway [" + natGatewayId + "] for Internet "
            + "traffic on route table [" + routeTableId + "].";

    AWSDeferredResultAsyncHandler<CreateRouteRequest, CreateRouteResult> handler = new
            AWSDeferredResultAsyncHandler<>(this.service, message);
    this.client.createRouteAsync(req, handler);
    return handler.toDeferredResult()
            .thenAccept(ignore -> { });
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:19,代码来源:AWSNetworkClient.java

示例2: execute

import com.amazonaws.services.ec2.model.CreateRouteRequest; //导入依赖的package包/类
@Override
public void execute(Context context) throws Exception {
    logger.info("create route table, routeTable={}", resource.id);
    resource.remoteRouteTable = AWS.vpc.ec2.createRouteTable(new CreateRouteTableRequest().withVpcId(resource.vpc.remoteVPC.getVpcId())).getRouteTable();

    if (resource.internetGateway != null) {
        AWS.vpc.ec2.createRoute(new CreateRouteRequest()
            .withRouteTableId(resource.remoteRouteTable.getRouteTableId())
            .withGatewayId(resource.internetGateway.remoteInternetGatewayId)
            .withDestinationCidrBlock("0.0.0.0/0"));
    } else {
        AWS.vpc.ec2.createRoute(new CreateRouteRequest()
            .withRouteTableId(resource.remoteRouteTable.getRouteTableId())
            .withNatGatewayId(resource.nat.remoteNATGateway.getNatGatewayId())
            .withDestinationCidrBlock("0.0.0.0/0"));
    }

    EC2TagHelper tagHelper = new EC2TagHelper(context.env);

    AWS.ec2.createTags(new CreateTagsRequest()
        .withResources(resource.remoteRouteTable.getRouteTableId())
        .withTags(tagHelper.env(), tagHelper.name(resource.id), tagHelper.resourceId(resource.id)));
}
 
开发者ID:neowu,项目名称:cmn-project,代码行数:24,代码来源:CreateRouteTableTask.java

示例3: createInternetRoute

import com.amazonaws.services.ec2.model.CreateRouteRequest; //导入依赖的package包/类
/**
 * Create a route from a specified CIDR Subnet to a specific GW / Route Table
 */
public void createInternetRoute(String gatewayId, String routeTableId, String subnetCidr) {
    CreateRouteRequest req = new CreateRouteRequest()
            .withGatewayId(gatewayId)
            .withRouteTableId(routeTableId)
            .withDestinationCidrBlock(subnetCidr);
    this.client.createRoute(req);
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:11,代码来源:AWSNetworkClient.java

示例4: createAndAssociateRoutes

import com.amazonaws.services.ec2.model.CreateRouteRequest; //导入依赖的package包/类
/**
 * Create routes
 *
 * @param vpnEndpoints
 */
private void createAndAssociateRoutes(List<VPNEndpoint> vpnEndpoints) {

  for (VPNEndpoint vpnEndpoint : vpnEndpoints) {
    ec2Client.setEndpoint(vpnEndpoint.getRegion().getEndpoint());

    for (VPNEndpoint extVpnEndpoint : vpnEndpoints) {
      if (!vpnEndpoint.equals(extVpnEndpoint)) {

        // Get route tables
        DescribeRouteTablesResult descRouteTablesResult = ec2Client.describeRouteTables();
        List<RouteTable> routeTables = descRouteTablesResult.getRouteTables();
        for (RouteTable routeTable : routeTables) {
          if (routeTable.getVpcId().equals(vpnEndpoint.getVpc().getVpcId())) {
            // Create the route
            CreateRouteRequest createRouteReq = new CreateRouteRequest();
            createRouteReq.setDestinationCidrBlock(extVpnEndpoint.getVpc().getCidrBlock());
            createRouteReq.setInstanceId(vpnEndpoint.getInstance().getInstanceId());
            createRouteReq.setRouteTableId(routeTable.getRouteTableId());
            LOG.debug("About to create a route in " + vpnEndpoint.getVpc().getVpcId() + " to " + extVpnEndpoint.getVpc().getVpcId() + " in route table: " + routeTable.getRouteTableId());
            ec2Client.createRoute(createRouteReq);
            LOG.debug("Created route in " + vpnEndpoint.getVpc().getVpcId() + " to " + extVpnEndpoint.getVpc().getVpcId() + " in route table: " + routeTable.getRouteTableId());
          }
        }
      }
    }

  }

}
 
开发者ID:vinayselvaraj,项目名称:vpc2vpc,代码行数:35,代码来源:CreateConnection.java

示例5: createRoute

import com.amazonaws.services.ec2.model.CreateRouteRequest; //导入依赖的package包/类
/**
 * Create route with gateway and route table.
 *
 * @param routeTableId the route table id
 * @param gatewayId the gateway id
 * @param destinationCidrBlock the destination cidr block
 * @return true if Created Route
 */
protected final boolean createRoute(final String routeTableId, final String gatewayId, final String destinationCidrBlock) {
  
    CreateRouteRequest req = new CreateRouteRequest();
    req.setDestinationCidrBlock(destinationCidrBlock);
    req.setGatewayId(gatewayId);
    req.setRouteTableId(routeTableId);
    CreateRouteResult result = amazonEC2Client.createRoute(req);
    
    if (result != null) {
        return true;
    }

    return false;
}
 
开发者ID:treelogic-swe,项目名称:aws-mock,代码行数:23,代码来源:BaseTest.java

示例6: createRoute

import com.amazonaws.services.ec2.model.CreateRouteRequest; //导入依赖的package包/类
@Override
public CreateRouteResult createRoute(CreateRouteRequest createRouteRequest) throws AmazonServiceException, AmazonClientException {
    throw new UnsupportedOperationException("Not supported in mock");
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:AmazonEC2Mock.java

示例7: createRoute

import com.amazonaws.services.ec2.model.CreateRouteRequest; //导入依赖的package包/类
@Override
public void createRoute(CreateRouteRequest request) {
    createRoute(request, null);
}
 
开发者ID:awslabs,项目名称:aws-sdk-java-resources,代码行数:5,代码来源:RouteTableImpl.java

示例8: createRoute

import com.amazonaws.services.ec2.model.CreateRouteRequest; //导入依赖的package包/类
/**
 * Performs the <code>CreateRoute</code> action.
 *
 * <p>
 * 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>RouteTableId</code></b>
 *         - mapped from the <code>Id</code> identifier.
 *   </li>
 * </ul>
 *
 * <p>
 *
 * @see CreateRouteRequest
 */
void createRoute(CreateRouteRequest request);
 
开发者ID:awslabs,项目名称:aws-sdk-java-resources,代码行数:20,代码来源:RouteTable.java


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