Search in sources :

Example 1 with CreateRouteRequest

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

the class AWSNetworkClient method createInternetRoute.

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

Example 2 with CreateRouteRequest

use of com.amazonaws.services.ec2.model.CreateRouteRequest 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)2 CreateRouteResult (com.amazonaws.services.ec2.model.CreateRouteResult)1