use of com.amazonaws.services.ec2.model.NatGateway in project photon-model by vmware.
the class AWSRemoteCleanup method deleteNATGateway.
private void deleteNATGateway(String vpcId, AmazonEC2 usEastEc2Client) {
DescribeNatGatewaysRequest natGatewaysRequest = new DescribeNatGatewaysRequest().withFilter(new Filter(VPC_KEY, Collections.singletonList(vpcId)));
DescribeNatGatewaysResult natGatewaysResult = usEastEc2Client.describeNatGateways(natGatewaysRequest);
natGatewaysResult.getNatGateways().forEach(natGateway -> {
DeleteNatGatewayRequest deleteNatGatewayRequest = new DeleteNatGatewayRequest().withNatGatewayId(natGateway.getNatGatewayId());
this.host.log("Terminating stale NAT gateway: %s", natGateway.getNatGatewayId());
usEastEc2Client.deleteNatGateway(deleteNatGatewayRequest);
});
}
use of com.amazonaws.services.ec2.model.NatGateway in project photon-model by vmware.
the class AWSNetworkClient method waitForNatGatewayState.
/**
* Wait for NAT Gateway to go into the desired state
*/
private DeferredResult<String> waitForNatGatewayState(String natGatewayId, TaskManager taskManager, long taskExpirationMicros, String desiredState) {
DeferredResult<String> waitCompleted = new DeferredResult<>();
AWSTaskStatusChecker.create(this.client, natGatewayId, desiredState, (ignore) -> waitCompleted.complete(natGatewayId), taskManager, this.service, taskExpirationMicros).start(new NatGateway());
return waitCompleted;
}
Aggregations