Search in sources :

Example 1 with CreateRouteResult

use of com.amazonaws.services.ec2.model.CreateRouteResult in project photon-model by vmware.

the class AWSNetworkClient method addRouteToNatGateway.

/**
 * 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 -> {
    });
}
Also used : CreateRouteResult(com.amazonaws.services.ec2.model.CreateRouteResult) CreateRouteRequest(com.amazonaws.services.ec2.model.CreateRouteRequest)

Aggregations

CreateRouteRequest (com.amazonaws.services.ec2.model.CreateRouteRequest)1 CreateRouteResult (com.amazonaws.services.ec2.model.CreateRouteResult)1