@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))); }
/** * Create a route table */ public DeferredResult<String> createRouteTable(String vpcId) { CreateRouteTableRequest req = new CreateRouteTableRequest() .withVpcId(vpcId); String message = "Create AWS Route Table on VPC [" + vpcId + "]."; AWSDeferredResultAsyncHandler<CreateRouteTableRequest, CreateRouteTableResult> handler = new AWSDeferredResultAsyncHandler<>(this.service, message); this.client.createRouteTableAsync(req, handler); return handler.toDeferredResult() .thenApply(CreateRouteTableResult::getRouteTable) .thenApply(RouteTable::getRouteTableId); }
@Override public RouteTable createRouteTable(CreateRouteTableRequest request, ResultCapture<CreateRouteTableResult> extractor) { ActionResult result = resource.performAction("CreateRouteTable", request, extractor); if (result == null) return null; return new RouteTableImpl(result.getResource()); }
@Override public RouteTable createRouteTable(CreateRouteTableRequest request, ResultCapture<CreateRouteTableResult> extractor) { ActionResult result = service.performAction("CreateRouteTable", request, extractor); if (result == null) return null; return new RouteTableImpl(result.getResource()); }
/** * Create route table. * * @param vpcId the vpc id * @return RouteTable */ protected final RouteTable createRouteTable(final String vpcId) { RouteTable routeTable = null; CreateRouteTableRequest req = new CreateRouteTableRequest(); req.setVpcId(vpcId); CreateRouteTableResult result = amazonEC2Client.createRouteTable(req); if (result != null) { routeTable = result.getRouteTable(); } return routeTable; }
@Override public CreateRouteTableResult createRouteTable(CreateRouteTableRequest createRouteTableRequest) throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); }
@Override public RouteTable createRouteTable(CreateRouteTableRequest request) { return createRouteTable(request, null); }
/** * Performs the <code>CreateRouteTable</code> action. * * <p> * The following request parameters will be populated from the data of this * <code>Vpc</code> resource, and any conflicting parameter value set in the * request will be overridden: * <ul> * <li> * <b><code>VpcId</code></b> * - mapped from the <code>Id</code> identifier. * </li> * </ul> * * <p> * * @return The <code>RouteTable</code> resource object associated with the * result of this action. * @see CreateRouteTableRequest */ RouteTable createRouteTable(CreateRouteTableRequest request);
/** * Performs the <code>CreateRouteTable</code> action and use a ResultCapture * to retrieve the low-level client response. * * <p> * The following request parameters will be populated from the data of this * <code>Vpc</code> resource, and any conflicting parameter value set in the * request will be overridden: * <ul> * <li> * <b><code>VpcId</code></b> * - mapped from the <code>Id</code> identifier. * </li> * </ul> * * <p> * * @return The <code>RouteTable</code> resource object associated with the * result of this action. * @see CreateRouteTableRequest */ RouteTable createRouteTable(CreateRouteTableRequest request, ResultCapture<CreateRouteTableResult> extractor);
/** * Performs the <code>CreateRouteTable</code> action. * * <p> * * @return The <code>RouteTable</code> resource object associated with the * result of this action. * @see CreateRouteTableRequest */ com.amazonaws.resources.ec2.RouteTable createRouteTable( CreateRouteTableRequest request);
/** * Performs the <code>CreateRouteTable</code> action and use a ResultCapture * to retrieve the low-level client response. * * <p> * * @return The <code>RouteTable</code> resource object associated with the * result of this action. * @see CreateRouteTableRequest */ com.amazonaws.resources.ec2.RouteTable createRouteTable( CreateRouteTableRequest request, ResultCapture<CreateRouteTableResult> extractor);