本文整理汇总了Java中com.amazonaws.services.ec2.model.DeleteNatGatewayRequest类的典型用法代码示例。如果您正苦于以下问题:Java DeleteNatGatewayRequest类的具体用法?Java DeleteNatGatewayRequest怎么用?Java DeleteNatGatewayRequest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DeleteNatGatewayRequest类属于com.amazonaws.services.ec2.model包,在下文中一共展示了DeleteNatGatewayRequest类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deleteNATGateway
import com.amazonaws.services.ec2.model.DeleteNatGatewayRequest; //导入依赖的package包/类
/**
* 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);
}
示例2: deleteNATGateway
import com.amazonaws.services.ec2.model.DeleteNatGatewayRequest; //导入依赖的package包/类
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);
}
}
}
示例3: deleteNatGateway
import com.amazonaws.services.ec2.model.DeleteNatGatewayRequest; //导入依赖的package包/类
@Override
public DeleteNatGatewayResult deleteNatGateway(DeleteNatGatewayRequest deleteNatGatewayRequest) {
throw new UnsupportedOperationException("Not supported in mock");
}