software.amazon.awssdk.services.ec2.waiters.DefaultEc2AsyncWaiter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ec2 Show documentation
Show all versions of ec2 Show documentation
The AWS Java SDK for Amazon EC2 module holds the client classes that are used for communicating with
Amazon EC2 Service
The newest version!
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.ec2.waiters;
import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.function.Consumer;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.annotations.ThreadSafe;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.awscore.exception.AwsServiceException;
import software.amazon.awssdk.core.ApiName;
import software.amazon.awssdk.core.internal.waiters.WaiterAttribute;
import software.amazon.awssdk.core.waiters.AsyncWaiter;
import software.amazon.awssdk.core.waiters.WaiterAcceptor;
import software.amazon.awssdk.core.waiters.WaiterOverrideConfiguration;
import software.amazon.awssdk.core.waiters.WaiterResponse;
import software.amazon.awssdk.core.waiters.WaiterState;
import software.amazon.awssdk.retries.api.BackoffStrategy;
import software.amazon.awssdk.services.ec2.Ec2AsyncClient;
import software.amazon.awssdk.services.ec2.jmespath.internal.JmesPathRuntime;
import software.amazon.awssdk.services.ec2.model.DescribeBundleTasksRequest;
import software.amazon.awssdk.services.ec2.model.DescribeBundleTasksResponse;
import software.amazon.awssdk.services.ec2.model.DescribeConversionTasksRequest;
import software.amazon.awssdk.services.ec2.model.DescribeConversionTasksResponse;
import software.amazon.awssdk.services.ec2.model.DescribeCustomerGatewaysRequest;
import software.amazon.awssdk.services.ec2.model.DescribeCustomerGatewaysResponse;
import software.amazon.awssdk.services.ec2.model.DescribeExportTasksRequest;
import software.amazon.awssdk.services.ec2.model.DescribeExportTasksResponse;
import software.amazon.awssdk.services.ec2.model.DescribeImagesRequest;
import software.amazon.awssdk.services.ec2.model.DescribeImagesResponse;
import software.amazon.awssdk.services.ec2.model.DescribeImportSnapshotTasksRequest;
import software.amazon.awssdk.services.ec2.model.DescribeImportSnapshotTasksResponse;
import software.amazon.awssdk.services.ec2.model.DescribeInstanceStatusRequest;
import software.amazon.awssdk.services.ec2.model.DescribeInstanceStatusResponse;
import software.amazon.awssdk.services.ec2.model.DescribeInstancesRequest;
import software.amazon.awssdk.services.ec2.model.DescribeInstancesResponse;
import software.amazon.awssdk.services.ec2.model.DescribeInternetGatewaysRequest;
import software.amazon.awssdk.services.ec2.model.DescribeInternetGatewaysResponse;
import software.amazon.awssdk.services.ec2.model.DescribeKeyPairsRequest;
import software.amazon.awssdk.services.ec2.model.DescribeKeyPairsResponse;
import software.amazon.awssdk.services.ec2.model.DescribeNatGatewaysRequest;
import software.amazon.awssdk.services.ec2.model.DescribeNatGatewaysResponse;
import software.amazon.awssdk.services.ec2.model.DescribeNetworkInterfacesRequest;
import software.amazon.awssdk.services.ec2.model.DescribeNetworkInterfacesResponse;
import software.amazon.awssdk.services.ec2.model.DescribeSecurityGroupsRequest;
import software.amazon.awssdk.services.ec2.model.DescribeSecurityGroupsResponse;
import software.amazon.awssdk.services.ec2.model.DescribeSnapshotsRequest;
import software.amazon.awssdk.services.ec2.model.DescribeSnapshotsResponse;
import software.amazon.awssdk.services.ec2.model.DescribeSpotInstanceRequestsRequest;
import software.amazon.awssdk.services.ec2.model.DescribeSpotInstanceRequestsResponse;
import software.amazon.awssdk.services.ec2.model.DescribeStoreImageTasksRequest;
import software.amazon.awssdk.services.ec2.model.DescribeStoreImageTasksResponse;
import software.amazon.awssdk.services.ec2.model.DescribeSubnetsRequest;
import software.amazon.awssdk.services.ec2.model.DescribeSubnetsResponse;
import software.amazon.awssdk.services.ec2.model.DescribeVolumesRequest;
import software.amazon.awssdk.services.ec2.model.DescribeVolumesResponse;
import software.amazon.awssdk.services.ec2.model.DescribeVpcPeeringConnectionsRequest;
import software.amazon.awssdk.services.ec2.model.DescribeVpcPeeringConnectionsResponse;
import software.amazon.awssdk.services.ec2.model.DescribeVpcsRequest;
import software.amazon.awssdk.services.ec2.model.DescribeVpcsResponse;
import software.amazon.awssdk.services.ec2.model.DescribeVpnConnectionsRequest;
import software.amazon.awssdk.services.ec2.model.DescribeVpnConnectionsResponse;
import software.amazon.awssdk.services.ec2.model.Ec2Request;
import software.amazon.awssdk.services.ec2.model.GetPasswordDataRequest;
import software.amazon.awssdk.services.ec2.model.GetPasswordDataResponse;
import software.amazon.awssdk.services.ec2.waiters.internal.WaitersRuntime;
import software.amazon.awssdk.utils.AttributeMap;
import software.amazon.awssdk.utils.SdkAutoCloseable;
import software.amazon.awssdk.utils.ThreadFactoryBuilder;
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
@ThreadSafe
final class DefaultEc2AsyncWaiter implements Ec2AsyncWaiter {
private static final WaiterAttribute CLIENT_ATTRIBUTE = new WaiterAttribute<>(SdkAutoCloseable.class);
private static final WaiterAttribute SCHEDULED_EXECUTOR_SERVICE_ATTRIBUTE = new WaiterAttribute<>(
ScheduledExecutorService.class);
private final Ec2AsyncClient client;
private final AttributeMap managedResources;
private final AsyncWaiter instanceExistsWaiter;
private final AsyncWaiter bundleTaskCompleteWaiter;
private final AsyncWaiter conversionTaskCancelledWaiter;
private final AsyncWaiter conversionTaskCompletedWaiter;
private final AsyncWaiter conversionTaskDeletedWaiter;
private final AsyncWaiter customerGatewayAvailableWaiter;
private final AsyncWaiter exportTaskCancelledWaiter;
private final AsyncWaiter exportTaskCompletedWaiter;
private final AsyncWaiter imageExistsWaiter;
private final AsyncWaiter imageAvailableWaiter;
private final AsyncWaiter instanceRunningWaiter;
private final AsyncWaiter instanceStatusOkWaiter;
private final AsyncWaiter instanceStoppedWaiter;
private final AsyncWaiter instanceTerminatedWaiter;
private final AsyncWaiter internetGatewayExistsWaiter;
private final AsyncWaiter keyPairExistsWaiter;
private final AsyncWaiter natGatewayAvailableWaiter;
private final AsyncWaiter natGatewayDeletedWaiter;
private final AsyncWaiter networkInterfaceAvailableWaiter;
private final AsyncWaiter passwordDataAvailableWaiter;
private final AsyncWaiter snapshotCompletedWaiter;
private final AsyncWaiter snapshotImportedWaiter;
private final AsyncWaiter securityGroupExistsWaiter;
private final AsyncWaiter spotInstanceRequestFulfilledWaiter;
private final AsyncWaiter storeImageTaskCompleteWaiter;
private final AsyncWaiter subnetAvailableWaiter;
private final AsyncWaiter systemStatusOkWaiter;
private final AsyncWaiter volumeAvailableWaiter;
private final AsyncWaiter volumeDeletedWaiter;
private final AsyncWaiter volumeInUseWaiter;
private final AsyncWaiter vpcAvailableWaiter;
private final AsyncWaiter vpcExistsWaiter;
private final AsyncWaiter vpnConnectionAvailableWaiter;
private final AsyncWaiter vpnConnectionDeletedWaiter;
private final AsyncWaiter vpcPeeringConnectionExistsWaiter;
private final AsyncWaiter vpcPeeringConnectionDeletedWaiter;
private final ScheduledExecutorService executorService;
private DefaultEc2AsyncWaiter(DefaultBuilder builder) {
AttributeMap.Builder attributeMapBuilder = AttributeMap.builder();
if (builder.client == null) {
this.client = Ec2AsyncClient.builder().build();
attributeMapBuilder.put(CLIENT_ATTRIBUTE, this.client);
} else {
this.client = builder.client;
}
if (builder.executorService == null) {
this.executorService = Executors.newScheduledThreadPool(1,
new ThreadFactoryBuilder().threadNamePrefix("waiters-ScheduledExecutor").build());
attributeMapBuilder.put(SCHEDULED_EXECUTOR_SERVICE_ATTRIBUTE, this.executorService);
} else {
this.executorService = builder.executorService;
}
managedResources = attributeMapBuilder.build();
this.instanceExistsWaiter = AsyncWaiter.builder(DescribeInstancesResponse.class)
.acceptors(instanceExistsWaiterAcceptors())
.overrideConfiguration(instanceExistsWaiterConfig(builder.overrideConfiguration))
.scheduledExecutorService(executorService).build();
this.bundleTaskCompleteWaiter = AsyncWaiter.builder(DescribeBundleTasksResponse.class)
.acceptors(bundleTaskCompleteWaiterAcceptors())
.overrideConfiguration(bundleTaskCompleteWaiterConfig(builder.overrideConfiguration))
.scheduledExecutorService(executorService).build();
this.conversionTaskCancelledWaiter = AsyncWaiter.builder(DescribeConversionTasksResponse.class)
.acceptors(conversionTaskCancelledWaiterAcceptors())
.overrideConfiguration(conversionTaskCancelledWaiterConfig(builder.overrideConfiguration))
.scheduledExecutorService(executorService).build();
this.conversionTaskCompletedWaiter = AsyncWaiter.builder(DescribeConversionTasksResponse.class)
.acceptors(conversionTaskCompletedWaiterAcceptors())
.overrideConfiguration(conversionTaskCompletedWaiterConfig(builder.overrideConfiguration))
.scheduledExecutorService(executorService).build();
this.conversionTaskDeletedWaiter = AsyncWaiter.builder(DescribeConversionTasksResponse.class)
.acceptors(conversionTaskDeletedWaiterAcceptors())
.overrideConfiguration(conversionTaskDeletedWaiterConfig(builder.overrideConfiguration))
.scheduledExecutorService(executorService).build();
this.customerGatewayAvailableWaiter = AsyncWaiter.builder(DescribeCustomerGatewaysResponse.class)
.acceptors(customerGatewayAvailableWaiterAcceptors())
.overrideConfiguration(customerGatewayAvailableWaiterConfig(builder.overrideConfiguration))
.scheduledExecutorService(executorService).build();
this.exportTaskCancelledWaiter = AsyncWaiter.builder(DescribeExportTasksResponse.class)
.acceptors(exportTaskCancelledWaiterAcceptors())
.overrideConfiguration(exportTaskCancelledWaiterConfig(builder.overrideConfiguration))
.scheduledExecutorService(executorService).build();
this.exportTaskCompletedWaiter = AsyncWaiter.builder(DescribeExportTasksResponse.class)
.acceptors(exportTaskCompletedWaiterAcceptors())
.overrideConfiguration(exportTaskCompletedWaiterConfig(builder.overrideConfiguration))
.scheduledExecutorService(executorService).build();
this.imageExistsWaiter = AsyncWaiter.builder(DescribeImagesResponse.class).acceptors(imageExistsWaiterAcceptors())
.overrideConfiguration(imageExistsWaiterConfig(builder.overrideConfiguration))
.scheduledExecutorService(executorService).build();
this.imageAvailableWaiter = AsyncWaiter.builder(DescribeImagesResponse.class).acceptors(imageAvailableWaiterAcceptors())
.overrideConfiguration(imageAvailableWaiterConfig(builder.overrideConfiguration))
.scheduledExecutorService(executorService).build();
this.instanceRunningWaiter = AsyncWaiter.builder(DescribeInstancesResponse.class)
.acceptors(instanceRunningWaiterAcceptors())
.overrideConfiguration(instanceRunningWaiterConfig(builder.overrideConfiguration))
.scheduledExecutorService(executorService).build();
this.instanceStatusOkWaiter = AsyncWaiter.builder(DescribeInstanceStatusResponse.class)
.acceptors(instanceStatusOkWaiterAcceptors())
.overrideConfiguration(instanceStatusOkWaiterConfig(builder.overrideConfiguration))
.scheduledExecutorService(executorService).build();
this.instanceStoppedWaiter = AsyncWaiter.builder(DescribeInstancesResponse.class)
.acceptors(instanceStoppedWaiterAcceptors())
.overrideConfiguration(instanceStoppedWaiterConfig(builder.overrideConfiguration))
.scheduledExecutorService(executorService).build();
this.instanceTerminatedWaiter = AsyncWaiter.builder(DescribeInstancesResponse.class)
.acceptors(instanceTerminatedWaiterAcceptors())
.overrideConfiguration(instanceTerminatedWaiterConfig(builder.overrideConfiguration))
.scheduledExecutorService(executorService).build();
this.internetGatewayExistsWaiter = AsyncWaiter.builder(DescribeInternetGatewaysResponse.class)
.acceptors(internetGatewayExistsWaiterAcceptors())
.overrideConfiguration(internetGatewayExistsWaiterConfig(builder.overrideConfiguration))
.scheduledExecutorService(executorService).build();
this.keyPairExistsWaiter = AsyncWaiter.builder(DescribeKeyPairsResponse.class).acceptors(keyPairExistsWaiterAcceptors())
.overrideConfiguration(keyPairExistsWaiterConfig(builder.overrideConfiguration))
.scheduledExecutorService(executorService).build();
this.natGatewayAvailableWaiter = AsyncWaiter.builder(DescribeNatGatewaysResponse.class)
.acceptors(natGatewayAvailableWaiterAcceptors())
.overrideConfiguration(natGatewayAvailableWaiterConfig(builder.overrideConfiguration))
.scheduledExecutorService(executorService).build();
this.natGatewayDeletedWaiter = AsyncWaiter.builder(DescribeNatGatewaysResponse.class)
.acceptors(natGatewayDeletedWaiterAcceptors())
.overrideConfiguration(natGatewayDeletedWaiterConfig(builder.overrideConfiguration))
.scheduledExecutorService(executorService).build();
this.networkInterfaceAvailableWaiter = AsyncWaiter.builder(DescribeNetworkInterfacesResponse.class)
.acceptors(networkInterfaceAvailableWaiterAcceptors())
.overrideConfiguration(networkInterfaceAvailableWaiterConfig(builder.overrideConfiguration))
.scheduledExecutorService(executorService).build();
this.passwordDataAvailableWaiter = AsyncWaiter.builder(GetPasswordDataResponse.class)
.acceptors(passwordDataAvailableWaiterAcceptors())
.overrideConfiguration(passwordDataAvailableWaiterConfig(builder.overrideConfiguration))
.scheduledExecutorService(executorService).build();
this.snapshotCompletedWaiter = AsyncWaiter.builder(DescribeSnapshotsResponse.class)
.acceptors(snapshotCompletedWaiterAcceptors())
.overrideConfiguration(snapshotCompletedWaiterConfig(builder.overrideConfiguration))
.scheduledExecutorService(executorService).build();
this.snapshotImportedWaiter = AsyncWaiter.builder(DescribeImportSnapshotTasksResponse.class)
.acceptors(snapshotImportedWaiterAcceptors())
.overrideConfiguration(snapshotImportedWaiterConfig(builder.overrideConfiguration))
.scheduledExecutorService(executorService).build();
this.securityGroupExistsWaiter = AsyncWaiter.builder(DescribeSecurityGroupsResponse.class)
.acceptors(securityGroupExistsWaiterAcceptors())
.overrideConfiguration(securityGroupExistsWaiterConfig(builder.overrideConfiguration))
.scheduledExecutorService(executorService).build();
this.spotInstanceRequestFulfilledWaiter = AsyncWaiter.builder(DescribeSpotInstanceRequestsResponse.class)
.acceptors(spotInstanceRequestFulfilledWaiterAcceptors())
.overrideConfiguration(spotInstanceRequestFulfilledWaiterConfig(builder.overrideConfiguration))
.scheduledExecutorService(executorService).build();
this.storeImageTaskCompleteWaiter = AsyncWaiter.builder(DescribeStoreImageTasksResponse.class)
.acceptors(storeImageTaskCompleteWaiterAcceptors())
.overrideConfiguration(storeImageTaskCompleteWaiterConfig(builder.overrideConfiguration))
.scheduledExecutorService(executorService).build();
this.subnetAvailableWaiter = AsyncWaiter.builder(DescribeSubnetsResponse.class)
.acceptors(subnetAvailableWaiterAcceptors())
.overrideConfiguration(subnetAvailableWaiterConfig(builder.overrideConfiguration))
.scheduledExecutorService(executorService).build();
this.systemStatusOkWaiter = AsyncWaiter.builder(DescribeInstanceStatusResponse.class)
.acceptors(systemStatusOkWaiterAcceptors())
.overrideConfiguration(systemStatusOkWaiterConfig(builder.overrideConfiguration))
.scheduledExecutorService(executorService).build();
this.volumeAvailableWaiter = AsyncWaiter.builder(DescribeVolumesResponse.class)
.acceptors(volumeAvailableWaiterAcceptors())
.overrideConfiguration(volumeAvailableWaiterConfig(builder.overrideConfiguration))
.scheduledExecutorService(executorService).build();
this.volumeDeletedWaiter = AsyncWaiter.builder(DescribeVolumesResponse.class).acceptors(volumeDeletedWaiterAcceptors())
.overrideConfiguration(volumeDeletedWaiterConfig(builder.overrideConfiguration))
.scheduledExecutorService(executorService).build();
this.volumeInUseWaiter = AsyncWaiter.builder(DescribeVolumesResponse.class).acceptors(volumeInUseWaiterAcceptors())
.overrideConfiguration(volumeInUseWaiterConfig(builder.overrideConfiguration))
.scheduledExecutorService(executorService).build();
this.vpcAvailableWaiter = AsyncWaiter.builder(DescribeVpcsResponse.class).acceptors(vpcAvailableWaiterAcceptors())
.overrideConfiguration(vpcAvailableWaiterConfig(builder.overrideConfiguration))
.scheduledExecutorService(executorService).build();
this.vpcExistsWaiter = AsyncWaiter.builder(DescribeVpcsResponse.class).acceptors(vpcExistsWaiterAcceptors())
.overrideConfiguration(vpcExistsWaiterConfig(builder.overrideConfiguration))
.scheduledExecutorService(executorService).build();
this.vpnConnectionAvailableWaiter = AsyncWaiter.builder(DescribeVpnConnectionsResponse.class)
.acceptors(vpnConnectionAvailableWaiterAcceptors())
.overrideConfiguration(vpnConnectionAvailableWaiterConfig(builder.overrideConfiguration))
.scheduledExecutorService(executorService).build();
this.vpnConnectionDeletedWaiter = AsyncWaiter.builder(DescribeVpnConnectionsResponse.class)
.acceptors(vpnConnectionDeletedWaiterAcceptors())
.overrideConfiguration(vpnConnectionDeletedWaiterConfig(builder.overrideConfiguration))
.scheduledExecutorService(executorService).build();
this.vpcPeeringConnectionExistsWaiter = AsyncWaiter.builder(DescribeVpcPeeringConnectionsResponse.class)
.acceptors(vpcPeeringConnectionExistsWaiterAcceptors())
.overrideConfiguration(vpcPeeringConnectionExistsWaiterConfig(builder.overrideConfiguration))
.scheduledExecutorService(executorService).build();
this.vpcPeeringConnectionDeletedWaiter = AsyncWaiter.builder(DescribeVpcPeeringConnectionsResponse.class)
.acceptors(vpcPeeringConnectionDeletedWaiterAcceptors())
.overrideConfiguration(vpcPeeringConnectionDeletedWaiterConfig(builder.overrideConfiguration))
.scheduledExecutorService(executorService).build();
}
private static String errorCode(Throwable error) {
if (error instanceof AwsServiceException) {
return ((AwsServiceException) error).awsErrorDetails().errorCode();
}
return null;
}
@Override
public CompletableFuture> waitUntilBundleTaskComplete(
DescribeBundleTasksRequest describeBundleTasksRequest) {
return bundleTaskCompleteWaiter.runAsync(() -> client
.describeBundleTasks(applyWaitersUserAgent(describeBundleTasksRequest)));
}
@Override
public CompletableFuture> waitUntilBundleTaskComplete(
DescribeBundleTasksRequest describeBundleTasksRequest, WaiterOverrideConfiguration overrideConfig) {
return bundleTaskCompleteWaiter.runAsync(
() -> client.describeBundleTasks(applyWaitersUserAgent(describeBundleTasksRequest)),
bundleTaskCompleteWaiterConfig(overrideConfig));
}
@Override
public CompletableFuture> waitUntilConversionTaskCancelled(
DescribeConversionTasksRequest describeConversionTasksRequest) {
return conversionTaskCancelledWaiter.runAsync(() -> client
.describeConversionTasks(applyWaitersUserAgent(describeConversionTasksRequest)));
}
@Override
public CompletableFuture> waitUntilConversionTaskCancelled(
DescribeConversionTasksRequest describeConversionTasksRequest, WaiterOverrideConfiguration overrideConfig) {
return conversionTaskCancelledWaiter.runAsync(
() -> client.describeConversionTasks(applyWaitersUserAgent(describeConversionTasksRequest)),
conversionTaskCancelledWaiterConfig(overrideConfig));
}
@Override
public CompletableFuture> waitUntilConversionTaskCompleted(
DescribeConversionTasksRequest describeConversionTasksRequest) {
return conversionTaskCompletedWaiter.runAsync(() -> client
.describeConversionTasks(applyWaitersUserAgent(describeConversionTasksRequest)));
}
@Override
public CompletableFuture> waitUntilConversionTaskCompleted(
DescribeConversionTasksRequest describeConversionTasksRequest, WaiterOverrideConfiguration overrideConfig) {
return conversionTaskCompletedWaiter.runAsync(
() -> client.describeConversionTasks(applyWaitersUserAgent(describeConversionTasksRequest)),
conversionTaskCompletedWaiterConfig(overrideConfig));
}
@Override
public CompletableFuture> waitUntilConversionTaskDeleted(
DescribeConversionTasksRequest describeConversionTasksRequest) {
return conversionTaskDeletedWaiter.runAsync(() -> client
.describeConversionTasks(applyWaitersUserAgent(describeConversionTasksRequest)));
}
@Override
public CompletableFuture> waitUntilConversionTaskDeleted(
DescribeConversionTasksRequest describeConversionTasksRequest, WaiterOverrideConfiguration overrideConfig) {
return conversionTaskDeletedWaiter.runAsync(
() -> client.describeConversionTasks(applyWaitersUserAgent(describeConversionTasksRequest)),
conversionTaskDeletedWaiterConfig(overrideConfig));
}
@Override
public CompletableFuture> waitUntilCustomerGatewayAvailable(
DescribeCustomerGatewaysRequest describeCustomerGatewaysRequest) {
return customerGatewayAvailableWaiter.runAsync(() -> client
.describeCustomerGateways(applyWaitersUserAgent(describeCustomerGatewaysRequest)));
}
@Override
public CompletableFuture> waitUntilCustomerGatewayAvailable(
DescribeCustomerGatewaysRequest describeCustomerGatewaysRequest, WaiterOverrideConfiguration overrideConfig) {
return customerGatewayAvailableWaiter.runAsync(
() -> client.describeCustomerGateways(applyWaitersUserAgent(describeCustomerGatewaysRequest)),
customerGatewayAvailableWaiterConfig(overrideConfig));
}
@Override
public CompletableFuture> waitUntilExportTaskCancelled(
DescribeExportTasksRequest describeExportTasksRequest) {
return exportTaskCancelledWaiter.runAsync(() -> client
.describeExportTasks(applyWaitersUserAgent(describeExportTasksRequest)));
}
@Override
public CompletableFuture> waitUntilExportTaskCancelled(
DescribeExportTasksRequest describeExportTasksRequest, WaiterOverrideConfiguration overrideConfig) {
return exportTaskCancelledWaiter.runAsync(
() -> client.describeExportTasks(applyWaitersUserAgent(describeExportTasksRequest)),
exportTaskCancelledWaiterConfig(overrideConfig));
}
@Override
public CompletableFuture> waitUntilExportTaskCompleted(
DescribeExportTasksRequest describeExportTasksRequest) {
return exportTaskCompletedWaiter.runAsync(() -> client
.describeExportTasks(applyWaitersUserAgent(describeExportTasksRequest)));
}
@Override
public CompletableFuture> waitUntilExportTaskCompleted(
DescribeExportTasksRequest describeExportTasksRequest, WaiterOverrideConfiguration overrideConfig) {
return exportTaskCompletedWaiter.runAsync(
() -> client.describeExportTasks(applyWaitersUserAgent(describeExportTasksRequest)),
exportTaskCompletedWaiterConfig(overrideConfig));
}
@Override
public CompletableFuture> waitUntilImageAvailable(
DescribeImagesRequest describeImagesRequest) {
return imageAvailableWaiter.runAsync(() -> client.describeImages(applyWaitersUserAgent(describeImagesRequest)));
}
@Override
public CompletableFuture> waitUntilImageAvailable(
DescribeImagesRequest describeImagesRequest, WaiterOverrideConfiguration overrideConfig) {
return imageAvailableWaiter.runAsync(() -> client.describeImages(applyWaitersUserAgent(describeImagesRequest)),
imageAvailableWaiterConfig(overrideConfig));
}
@Override
public CompletableFuture> waitUntilImageExists(
DescribeImagesRequest describeImagesRequest) {
return imageExistsWaiter.runAsync(() -> client.describeImages(applyWaitersUserAgent(describeImagesRequest)));
}
@Override
public CompletableFuture> waitUntilImageExists(
DescribeImagesRequest describeImagesRequest, WaiterOverrideConfiguration overrideConfig) {
return imageExistsWaiter.runAsync(() -> client.describeImages(applyWaitersUserAgent(describeImagesRequest)),
imageExistsWaiterConfig(overrideConfig));
}
@Override
public CompletableFuture> waitUntilInstanceExists(
DescribeInstancesRequest describeInstancesRequest) {
return instanceExistsWaiter.runAsync(() -> client.describeInstances(applyWaitersUserAgent(describeInstancesRequest)));
}
@Override
public CompletableFuture> waitUntilInstanceExists(
DescribeInstancesRequest describeInstancesRequest, WaiterOverrideConfiguration overrideConfig) {
return instanceExistsWaiter.runAsync(() -> client.describeInstances(applyWaitersUserAgent(describeInstancesRequest)),
instanceExistsWaiterConfig(overrideConfig));
}
@Override
public CompletableFuture> waitUntilInstanceRunning(
DescribeInstancesRequest describeInstancesRequest) {
return instanceRunningWaiter.runAsync(() -> client.describeInstances(applyWaitersUserAgent(describeInstancesRequest)));
}
@Override
public CompletableFuture> waitUntilInstanceRunning(
DescribeInstancesRequest describeInstancesRequest, WaiterOverrideConfiguration overrideConfig) {
return instanceRunningWaiter.runAsync(() -> client.describeInstances(applyWaitersUserAgent(describeInstancesRequest)),
instanceRunningWaiterConfig(overrideConfig));
}
@Override
public CompletableFuture> waitUntilInstanceStatusOk(
DescribeInstanceStatusRequest describeInstanceStatusRequest) {
return instanceStatusOkWaiter.runAsync(() -> client
.describeInstanceStatus(applyWaitersUserAgent(describeInstanceStatusRequest)));
}
@Override
public CompletableFuture> waitUntilInstanceStatusOk(
DescribeInstanceStatusRequest describeInstanceStatusRequest, WaiterOverrideConfiguration overrideConfig) {
return instanceStatusOkWaiter.runAsync(
() -> client.describeInstanceStatus(applyWaitersUserAgent(describeInstanceStatusRequest)),
instanceStatusOkWaiterConfig(overrideConfig));
}
@Override
public CompletableFuture> waitUntilInstanceStopped(
DescribeInstancesRequest describeInstancesRequest) {
return instanceStoppedWaiter.runAsync(() -> client.describeInstances(applyWaitersUserAgent(describeInstancesRequest)));
}
@Override
public CompletableFuture> waitUntilInstanceStopped(
DescribeInstancesRequest describeInstancesRequest, WaiterOverrideConfiguration overrideConfig) {
return instanceStoppedWaiter.runAsync(() -> client.describeInstances(applyWaitersUserAgent(describeInstancesRequest)),
instanceStoppedWaiterConfig(overrideConfig));
}
@Override
public CompletableFuture> waitUntilInstanceTerminated(
DescribeInstancesRequest describeInstancesRequest) {
return instanceTerminatedWaiter.runAsync(() -> client.describeInstances(applyWaitersUserAgent(describeInstancesRequest)));
}
@Override
public CompletableFuture> waitUntilInstanceTerminated(
DescribeInstancesRequest describeInstancesRequest, WaiterOverrideConfiguration overrideConfig) {
return instanceTerminatedWaiter.runAsync(() -> client.describeInstances(applyWaitersUserAgent(describeInstancesRequest)),
instanceTerminatedWaiterConfig(overrideConfig));
}
@Override
public CompletableFuture> waitUntilInternetGatewayExists(
DescribeInternetGatewaysRequest describeInternetGatewaysRequest) {
return internetGatewayExistsWaiter.runAsync(() -> client
.describeInternetGateways(applyWaitersUserAgent(describeInternetGatewaysRequest)));
}
@Override
public CompletableFuture> waitUntilInternetGatewayExists(
DescribeInternetGatewaysRequest describeInternetGatewaysRequest, WaiterOverrideConfiguration overrideConfig) {
return internetGatewayExistsWaiter.runAsync(
() -> client.describeInternetGateways(applyWaitersUserAgent(describeInternetGatewaysRequest)),
internetGatewayExistsWaiterConfig(overrideConfig));
}
@Override
public CompletableFuture> waitUntilKeyPairExists(
DescribeKeyPairsRequest describeKeyPairsRequest) {
return keyPairExistsWaiter.runAsync(() -> client.describeKeyPairs(applyWaitersUserAgent(describeKeyPairsRequest)));
}
@Override
public CompletableFuture> waitUntilKeyPairExists(
DescribeKeyPairsRequest describeKeyPairsRequest, WaiterOverrideConfiguration overrideConfig) {
return keyPairExistsWaiter.runAsync(() -> client.describeKeyPairs(applyWaitersUserAgent(describeKeyPairsRequest)),
keyPairExistsWaiterConfig(overrideConfig));
}
@Override
public CompletableFuture> waitUntilNatGatewayAvailable(
DescribeNatGatewaysRequest describeNatGatewaysRequest) {
return natGatewayAvailableWaiter.runAsync(() -> client
.describeNatGateways(applyWaitersUserAgent(describeNatGatewaysRequest)));
}
@Override
public CompletableFuture> waitUntilNatGatewayAvailable(
DescribeNatGatewaysRequest describeNatGatewaysRequest, WaiterOverrideConfiguration overrideConfig) {
return natGatewayAvailableWaiter.runAsync(
() -> client.describeNatGateways(applyWaitersUserAgent(describeNatGatewaysRequest)),
natGatewayAvailableWaiterConfig(overrideConfig));
}
@Override
public CompletableFuture> waitUntilNatGatewayDeleted(
DescribeNatGatewaysRequest describeNatGatewaysRequest) {
return natGatewayDeletedWaiter.runAsync(() -> client
.describeNatGateways(applyWaitersUserAgent(describeNatGatewaysRequest)));
}
@Override
public CompletableFuture> waitUntilNatGatewayDeleted(
DescribeNatGatewaysRequest describeNatGatewaysRequest, WaiterOverrideConfiguration overrideConfig) {
return natGatewayDeletedWaiter.runAsync(
() -> client.describeNatGateways(applyWaitersUserAgent(describeNatGatewaysRequest)),
natGatewayDeletedWaiterConfig(overrideConfig));
}
@Override
public CompletableFuture> waitUntilNetworkInterfaceAvailable(
DescribeNetworkInterfacesRequest describeNetworkInterfacesRequest) {
return networkInterfaceAvailableWaiter.runAsync(() -> client
.describeNetworkInterfaces(applyWaitersUserAgent(describeNetworkInterfacesRequest)));
}
@Override
public CompletableFuture> waitUntilNetworkInterfaceAvailable(
DescribeNetworkInterfacesRequest describeNetworkInterfacesRequest, WaiterOverrideConfiguration overrideConfig) {
return networkInterfaceAvailableWaiter.runAsync(
() -> client.describeNetworkInterfaces(applyWaitersUserAgent(describeNetworkInterfacesRequest)),
networkInterfaceAvailableWaiterConfig(overrideConfig));
}
@Override
public CompletableFuture> waitUntilPasswordDataAvailable(
GetPasswordDataRequest getPasswordDataRequest) {
return passwordDataAvailableWaiter.runAsync(() -> client.getPasswordData(applyWaitersUserAgent(getPasswordDataRequest)));
}
@Override
public CompletableFuture> waitUntilPasswordDataAvailable(
GetPasswordDataRequest getPasswordDataRequest, WaiterOverrideConfiguration overrideConfig) {
return passwordDataAvailableWaiter.runAsync(() -> client.getPasswordData(applyWaitersUserAgent(getPasswordDataRequest)),
passwordDataAvailableWaiterConfig(overrideConfig));
}
@Override
public CompletableFuture> waitUntilSecurityGroupExists(
DescribeSecurityGroupsRequest describeSecurityGroupsRequest) {
return securityGroupExistsWaiter.runAsync(() -> client
.describeSecurityGroups(applyWaitersUserAgent(describeSecurityGroupsRequest)));
}
@Override
public CompletableFuture> waitUntilSecurityGroupExists(
DescribeSecurityGroupsRequest describeSecurityGroupsRequest, WaiterOverrideConfiguration overrideConfig) {
return securityGroupExistsWaiter.runAsync(
() -> client.describeSecurityGroups(applyWaitersUserAgent(describeSecurityGroupsRequest)),
securityGroupExistsWaiterConfig(overrideConfig));
}
@Override
public CompletableFuture> waitUntilSnapshotCompleted(
DescribeSnapshotsRequest describeSnapshotsRequest) {
return snapshotCompletedWaiter.runAsync(() -> client.describeSnapshots(applyWaitersUserAgent(describeSnapshotsRequest)));
}
@Override
public CompletableFuture> waitUntilSnapshotCompleted(
DescribeSnapshotsRequest describeSnapshotsRequest, WaiterOverrideConfiguration overrideConfig) {
return snapshotCompletedWaiter.runAsync(() -> client.describeSnapshots(applyWaitersUserAgent(describeSnapshotsRequest)),
snapshotCompletedWaiterConfig(overrideConfig));
}
@Override
public CompletableFuture> waitUntilSnapshotImported(
DescribeImportSnapshotTasksRequest describeImportSnapshotTasksRequest) {
return snapshotImportedWaiter.runAsync(() -> client
.describeImportSnapshotTasks(applyWaitersUserAgent(describeImportSnapshotTasksRequest)));
}
@Override
public CompletableFuture> waitUntilSnapshotImported(
DescribeImportSnapshotTasksRequest describeImportSnapshotTasksRequest, WaiterOverrideConfiguration overrideConfig) {
return snapshotImportedWaiter.runAsync(
() -> client.describeImportSnapshotTasks(applyWaitersUserAgent(describeImportSnapshotTasksRequest)),
snapshotImportedWaiterConfig(overrideConfig));
}
@Override
public CompletableFuture> waitUntilSpotInstanceRequestFulfilled(
DescribeSpotInstanceRequestsRequest describeSpotInstanceRequestsRequest) {
return spotInstanceRequestFulfilledWaiter.runAsync(() -> client
.describeSpotInstanceRequests(applyWaitersUserAgent(describeSpotInstanceRequestsRequest)));
}
@Override
public CompletableFuture> waitUntilSpotInstanceRequestFulfilled(
DescribeSpotInstanceRequestsRequest describeSpotInstanceRequestsRequest, WaiterOverrideConfiguration overrideConfig) {
return spotInstanceRequestFulfilledWaiter.runAsync(
() -> client.describeSpotInstanceRequests(applyWaitersUserAgent(describeSpotInstanceRequestsRequest)),
spotInstanceRequestFulfilledWaiterConfig(overrideConfig));
}
@Override
public CompletableFuture> waitUntilStoreImageTaskComplete(
DescribeStoreImageTasksRequest describeStoreImageTasksRequest) {
return storeImageTaskCompleteWaiter.runAsync(() -> client
.describeStoreImageTasks(applyWaitersUserAgent(describeStoreImageTasksRequest)));
}
@Override
public CompletableFuture> waitUntilStoreImageTaskComplete(
DescribeStoreImageTasksRequest describeStoreImageTasksRequest, WaiterOverrideConfiguration overrideConfig) {
return storeImageTaskCompleteWaiter.runAsync(
() -> client.describeStoreImageTasks(applyWaitersUserAgent(describeStoreImageTasksRequest)),
storeImageTaskCompleteWaiterConfig(overrideConfig));
}
@Override
public CompletableFuture> waitUntilSubnetAvailable(
DescribeSubnetsRequest describeSubnetsRequest) {
return subnetAvailableWaiter.runAsync(() -> client.describeSubnets(applyWaitersUserAgent(describeSubnetsRequest)));
}
@Override
public CompletableFuture> waitUntilSubnetAvailable(
DescribeSubnetsRequest describeSubnetsRequest, WaiterOverrideConfiguration overrideConfig) {
return subnetAvailableWaiter.runAsync(() -> client.describeSubnets(applyWaitersUserAgent(describeSubnetsRequest)),
subnetAvailableWaiterConfig(overrideConfig));
}
@Override
public CompletableFuture> waitUntilSystemStatusOk(
DescribeInstanceStatusRequest describeInstanceStatusRequest) {
return systemStatusOkWaiter.runAsync(() -> client
.describeInstanceStatus(applyWaitersUserAgent(describeInstanceStatusRequest)));
}
@Override
public CompletableFuture> waitUntilSystemStatusOk(
DescribeInstanceStatusRequest describeInstanceStatusRequest, WaiterOverrideConfiguration overrideConfig) {
return systemStatusOkWaiter.runAsync(
() -> client.describeInstanceStatus(applyWaitersUserAgent(describeInstanceStatusRequest)),
systemStatusOkWaiterConfig(overrideConfig));
}
@Override
public CompletableFuture> waitUntilVolumeAvailable(
DescribeVolumesRequest describeVolumesRequest) {
return volumeAvailableWaiter.runAsync(() -> client.describeVolumes(applyWaitersUserAgent(describeVolumesRequest)));
}
@Override
public CompletableFuture> waitUntilVolumeAvailable(
DescribeVolumesRequest describeVolumesRequest, WaiterOverrideConfiguration overrideConfig) {
return volumeAvailableWaiter.runAsync(() -> client.describeVolumes(applyWaitersUserAgent(describeVolumesRequest)),
volumeAvailableWaiterConfig(overrideConfig));
}
@Override
public CompletableFuture> waitUntilVolumeDeleted(
DescribeVolumesRequest describeVolumesRequest) {
return volumeDeletedWaiter.runAsync(() -> client.describeVolumes(applyWaitersUserAgent(describeVolumesRequest)));
}
@Override
public CompletableFuture> waitUntilVolumeDeleted(
DescribeVolumesRequest describeVolumesRequest, WaiterOverrideConfiguration overrideConfig) {
return volumeDeletedWaiter.runAsync(() -> client.describeVolumes(applyWaitersUserAgent(describeVolumesRequest)),
volumeDeletedWaiterConfig(overrideConfig));
}
@Override
public CompletableFuture> waitUntilVolumeInUse(
DescribeVolumesRequest describeVolumesRequest) {
return volumeInUseWaiter.runAsync(() -> client.describeVolumes(applyWaitersUserAgent(describeVolumesRequest)));
}
@Override
public CompletableFuture> waitUntilVolumeInUse(
DescribeVolumesRequest describeVolumesRequest, WaiterOverrideConfiguration overrideConfig) {
return volumeInUseWaiter.runAsync(() -> client.describeVolumes(applyWaitersUserAgent(describeVolumesRequest)),
volumeInUseWaiterConfig(overrideConfig));
}
@Override
public CompletableFuture> waitUntilVpcAvailable(DescribeVpcsRequest describeVpcsRequest) {
return vpcAvailableWaiter.runAsync(() -> client.describeVpcs(applyWaitersUserAgent(describeVpcsRequest)));
}
@Override
public CompletableFuture> waitUntilVpcAvailable(DescribeVpcsRequest describeVpcsRequest,
WaiterOverrideConfiguration overrideConfig) {
return vpcAvailableWaiter.runAsync(() -> client.describeVpcs(applyWaitersUserAgent(describeVpcsRequest)),
vpcAvailableWaiterConfig(overrideConfig));
}
@Override
public CompletableFuture> waitUntilVpcExists(DescribeVpcsRequest describeVpcsRequest) {
return vpcExistsWaiter.runAsync(() -> client.describeVpcs(applyWaitersUserAgent(describeVpcsRequest)));
}
@Override
public CompletableFuture> waitUntilVpcExists(DescribeVpcsRequest describeVpcsRequest,
WaiterOverrideConfiguration overrideConfig) {
return vpcExistsWaiter.runAsync(() -> client.describeVpcs(applyWaitersUserAgent(describeVpcsRequest)),
vpcExistsWaiterConfig(overrideConfig));
}
@Override
public CompletableFuture> waitUntilVpcPeeringConnectionDeleted(
DescribeVpcPeeringConnectionsRequest describeVpcPeeringConnectionsRequest) {
return vpcPeeringConnectionDeletedWaiter.runAsync(() -> client
.describeVpcPeeringConnections(applyWaitersUserAgent(describeVpcPeeringConnectionsRequest)));
}
@Override
public CompletableFuture> waitUntilVpcPeeringConnectionDeleted(
DescribeVpcPeeringConnectionsRequest describeVpcPeeringConnectionsRequest, WaiterOverrideConfiguration overrideConfig) {
return vpcPeeringConnectionDeletedWaiter.runAsync(
() -> client.describeVpcPeeringConnections(applyWaitersUserAgent(describeVpcPeeringConnectionsRequest)),
vpcPeeringConnectionDeletedWaiterConfig(overrideConfig));
}
@Override
public CompletableFuture> waitUntilVpcPeeringConnectionExists(
DescribeVpcPeeringConnectionsRequest describeVpcPeeringConnectionsRequest) {
return vpcPeeringConnectionExistsWaiter.runAsync(() -> client
.describeVpcPeeringConnections(applyWaitersUserAgent(describeVpcPeeringConnectionsRequest)));
}
@Override
public CompletableFuture> waitUntilVpcPeeringConnectionExists(
DescribeVpcPeeringConnectionsRequest describeVpcPeeringConnectionsRequest, WaiterOverrideConfiguration overrideConfig) {
return vpcPeeringConnectionExistsWaiter.runAsync(
() -> client.describeVpcPeeringConnections(applyWaitersUserAgent(describeVpcPeeringConnectionsRequest)),
vpcPeeringConnectionExistsWaiterConfig(overrideConfig));
}
@Override
public CompletableFuture> waitUntilVpnConnectionAvailable(
DescribeVpnConnectionsRequest describeVpnConnectionsRequest) {
return vpnConnectionAvailableWaiter.runAsync(() -> client
.describeVpnConnections(applyWaitersUserAgent(describeVpnConnectionsRequest)));
}
@Override
public CompletableFuture> waitUntilVpnConnectionAvailable(
DescribeVpnConnectionsRequest describeVpnConnectionsRequest, WaiterOverrideConfiguration overrideConfig) {
return vpnConnectionAvailableWaiter.runAsync(
() -> client.describeVpnConnections(applyWaitersUserAgent(describeVpnConnectionsRequest)),
vpnConnectionAvailableWaiterConfig(overrideConfig));
}
@Override
public CompletableFuture> waitUntilVpnConnectionDeleted(
DescribeVpnConnectionsRequest describeVpnConnectionsRequest) {
return vpnConnectionDeletedWaiter.runAsync(() -> client
.describeVpnConnections(applyWaitersUserAgent(describeVpnConnectionsRequest)));
}
@Override
public CompletableFuture> waitUntilVpnConnectionDeleted(
DescribeVpnConnectionsRequest describeVpnConnectionsRequest, WaiterOverrideConfiguration overrideConfig) {
return vpnConnectionDeletedWaiter.runAsync(
() -> client.describeVpnConnections(applyWaitersUserAgent(describeVpnConnectionsRequest)),
vpnConnectionDeletedWaiterConfig(overrideConfig));
}
private static List> instanceExistsWaiterAcceptors() {
List> result = new ArrayList<>();
result.add(WaiterAcceptor.successOnResponseAcceptor(response -> {
JmesPathRuntime.Value input = new JmesPathRuntime.Value(response);
return Objects.equals(input.field("Reservations").flatten().length().compare(">", input.constant(0)).value(), true);
}));
result.add(WaiterAcceptor.retryOnExceptionAcceptor(error -> Objects
.equals(errorCode(error), "InvalidInstanceID.NotFound")));
result.addAll(WaitersRuntime.DEFAULT_ACCEPTORS);
return result;
}
private static List> bundleTaskCompleteWaiterAcceptors() {
List> result = new ArrayList<>();
result.add(WaiterAcceptor.successOnResponseAcceptor(response -> {
JmesPathRuntime.Value input = new JmesPathRuntime.Value(response);
List