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);
}
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 -> {
});
}
Aggregations