Java 类com.amazonaws.services.ec2.model.DeleteNatGatewayRequest 实例源码

项目:photon-model    文件:AWSNetworkClient.java   
/**
 * Delete a NAT Gateway
 * It waits for the NAT gateway to get into the Deleted state before returning.
 */
public DeferredResult<Void> deleteNATGateway(String natGatewayId, TaskManager taskManager,
        long taskExpirationMicros) {
    DeleteNatGatewayRequest req = new DeleteNatGatewayRequest()
            .withNatGatewayId(natGatewayId);

    String message = "Delete AWS NAT Gateway with id [" + natGatewayId + "].";

    AWSDeferredResultAsyncHandler<DeleteNatGatewayRequest, DeleteNatGatewayResult> handler = new
            AWSDeferredResultAsyncHandler<>(this.service, message);
    this.client.deleteNatGatewayAsync(req, handler);
    return handler.toDeferredResult()
            .thenCompose(ignore -> waitForNatGatewayState(natGatewayId,
                    taskManager, taskExpirationMicros, AWSTaskStatusChecker.AWS_DELETED_NAME))
            .thenApply(ignore -> null);

}
项目:cmn-project    文件:EC2VPC.java   
public void deleteNATGateway(String gatewayId) {
    logger.info("delete nat gateway, natGatewayId={}", gatewayId);
    AWS.vpc.ec2.deleteNatGateway(new DeleteNatGatewayRequest().withNatGatewayId(gatewayId));

    while (true) {
        Threads.sleepRoughly(Duration.ofSeconds(30));
        NatGateway gateway = AWS.vpc.describeNATGateway(gatewayId);
        String state = gateway.getState();
        if ("deleting".equals(state)) continue;
        if ("deleted".equals(state)) {
            break;
        } else {
            throw new Error("failed to delete nat gateway, gatewayId=" + gatewayId + ", state=" + state);
        }
    }
}
项目:elasticsearch_my    文件:AmazonEC2Mock.java   
@Override
public DeleteNatGatewayResult deleteNatGateway(DeleteNatGatewayRequest deleteNatGatewayRequest) {
    throw new UnsupportedOperationException("Not supported in mock");
}