software.amazon.awssdk.services.neptunegraph.waiters.DefaultNeptuneGraphWaiter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of neptunegraph Show documentation
Show all versions of neptunegraph Show documentation
The AWS Java SDK for Neptune Graph module holds the client classes that are used for
communicating with Neptune Graph.
/*
* 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.neptunegraph.waiters;
import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
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.Waiter;
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.retries.api.BackoffStrategy;
import software.amazon.awssdk.services.neptunegraph.NeptuneGraphClient;
import software.amazon.awssdk.services.neptunegraph.jmespath.internal.JmesPathRuntime;
import software.amazon.awssdk.services.neptunegraph.model.GetGraphRequest;
import software.amazon.awssdk.services.neptunegraph.model.GetGraphResponse;
import software.amazon.awssdk.services.neptunegraph.model.GetGraphSnapshotRequest;
import software.amazon.awssdk.services.neptunegraph.model.GetGraphSnapshotResponse;
import software.amazon.awssdk.services.neptunegraph.model.GetImportTaskRequest;
import software.amazon.awssdk.services.neptunegraph.model.GetImportTaskResponse;
import software.amazon.awssdk.services.neptunegraph.model.GetPrivateGraphEndpointRequest;
import software.amazon.awssdk.services.neptunegraph.model.GetPrivateGraphEndpointResponse;
import software.amazon.awssdk.services.neptunegraph.model.NeptuneGraphRequest;
import software.amazon.awssdk.services.neptunegraph.waiters.internal.WaitersRuntime;
import software.amazon.awssdk.utils.AttributeMap;
import software.amazon.awssdk.utils.SdkAutoCloseable;
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
@ThreadSafe
final class DefaultNeptuneGraphWaiter implements NeptuneGraphWaiter {
private static final WaiterAttribute CLIENT_ATTRIBUTE = new WaiterAttribute<>(SdkAutoCloseable.class);
private final NeptuneGraphClient client;
private final AttributeMap managedResources;
private final Waiter graphAvailableWaiter;
private final Waiter graphDeletedWaiter;
private final Waiter graphSnapshotAvailableWaiter;
private final Waiter graphSnapshotDeletedWaiter;
private final Waiter importTaskCancelledWaiter;
private final Waiter importTaskSuccessfulWaiter;
private final Waiter privateGraphEndpointAvailableWaiter;
private final Waiter privateGraphEndpointDeletedWaiter;
private DefaultNeptuneGraphWaiter(DefaultBuilder builder) {
AttributeMap.Builder attributeMapBuilder = AttributeMap.builder();
if (builder.client == null) {
this.client = NeptuneGraphClient.builder().build();
attributeMapBuilder.put(CLIENT_ATTRIBUTE, this.client);
} else {
this.client = builder.client;
}
managedResources = attributeMapBuilder.build();
this.graphAvailableWaiter = Waiter.builder(GetGraphResponse.class).acceptors(graphAvailableWaiterAcceptors())
.overrideConfiguration(graphAvailableWaiterConfig(builder.overrideConfiguration)).build();
this.graphDeletedWaiter = Waiter.builder(GetGraphResponse.class).acceptors(graphDeletedWaiterAcceptors())
.overrideConfiguration(graphDeletedWaiterConfig(builder.overrideConfiguration)).build();
this.graphSnapshotAvailableWaiter = Waiter.builder(GetGraphSnapshotResponse.class)
.acceptors(graphSnapshotAvailableWaiterAcceptors())
.overrideConfiguration(graphSnapshotAvailableWaiterConfig(builder.overrideConfiguration)).build();
this.graphSnapshotDeletedWaiter = Waiter.builder(GetGraphSnapshotResponse.class)
.acceptors(graphSnapshotDeletedWaiterAcceptors())
.overrideConfiguration(graphSnapshotDeletedWaiterConfig(builder.overrideConfiguration)).build();
this.importTaskCancelledWaiter = Waiter.builder(GetImportTaskResponse.class)
.acceptors(importTaskCancelledWaiterAcceptors())
.overrideConfiguration(importTaskCancelledWaiterConfig(builder.overrideConfiguration)).build();
this.importTaskSuccessfulWaiter = Waiter.builder(GetImportTaskResponse.class)
.acceptors(importTaskSuccessfulWaiterAcceptors())
.overrideConfiguration(importTaskSuccessfulWaiterConfig(builder.overrideConfiguration)).build();
this.privateGraphEndpointAvailableWaiter = Waiter.builder(GetPrivateGraphEndpointResponse.class)
.acceptors(privateGraphEndpointAvailableWaiterAcceptors())
.overrideConfiguration(privateGraphEndpointAvailableWaiterConfig(builder.overrideConfiguration)).build();
this.privateGraphEndpointDeletedWaiter = Waiter.builder(GetPrivateGraphEndpointResponse.class)
.acceptors(privateGraphEndpointDeletedWaiterAcceptors())
.overrideConfiguration(privateGraphEndpointDeletedWaiterConfig(builder.overrideConfiguration)).build();
}
private static String errorCode(Throwable error) {
if (error instanceof AwsServiceException) {
return ((AwsServiceException) error).awsErrorDetails().errorCode();
}
return null;
}
@Override
public WaiterResponse waitUntilGraphAvailable(GetGraphRequest getGraphRequest) {
return graphAvailableWaiter.run(() -> client.getGraph(applyWaitersUserAgent(getGraphRequest)));
}
@Override
public WaiterResponse waitUntilGraphAvailable(GetGraphRequest getGraphRequest,
WaiterOverrideConfiguration overrideConfig) {
return graphAvailableWaiter.run(() -> client.getGraph(applyWaitersUserAgent(getGraphRequest)),
graphAvailableWaiterConfig(overrideConfig));
}
@Override
public WaiterResponse waitUntilGraphDeleted(GetGraphRequest getGraphRequest) {
return graphDeletedWaiter.run(() -> client.getGraph(applyWaitersUserAgent(getGraphRequest)));
}
@Override
public WaiterResponse waitUntilGraphDeleted(GetGraphRequest getGraphRequest,
WaiterOverrideConfiguration overrideConfig) {
return graphDeletedWaiter.run(() -> client.getGraph(applyWaitersUserAgent(getGraphRequest)),
graphDeletedWaiterConfig(overrideConfig));
}
@Override
public WaiterResponse waitUntilGraphSnapshotAvailable(
GetGraphSnapshotRequest getGraphSnapshotRequest) {
return graphSnapshotAvailableWaiter.run(() -> client.getGraphSnapshot(applyWaitersUserAgent(getGraphSnapshotRequest)));
}
@Override
public WaiterResponse waitUntilGraphSnapshotAvailable(
GetGraphSnapshotRequest getGraphSnapshotRequest, WaiterOverrideConfiguration overrideConfig) {
return graphSnapshotAvailableWaiter.run(() -> client.getGraphSnapshot(applyWaitersUserAgent(getGraphSnapshotRequest)),
graphSnapshotAvailableWaiterConfig(overrideConfig));
}
@Override
public WaiterResponse waitUntilGraphSnapshotDeleted(GetGraphSnapshotRequest getGraphSnapshotRequest) {
return graphSnapshotDeletedWaiter.run(() -> client.getGraphSnapshot(applyWaitersUserAgent(getGraphSnapshotRequest)));
}
@Override
public WaiterResponse waitUntilGraphSnapshotDeleted(
GetGraphSnapshotRequest getGraphSnapshotRequest, WaiterOverrideConfiguration overrideConfig) {
return graphSnapshotDeletedWaiter.run(() -> client.getGraphSnapshot(applyWaitersUserAgent(getGraphSnapshotRequest)),
graphSnapshotDeletedWaiterConfig(overrideConfig));
}
@Override
public WaiterResponse waitUntilImportTaskCancelled(GetImportTaskRequest getImportTaskRequest) {
return importTaskCancelledWaiter.run(() -> client.getImportTask(applyWaitersUserAgent(getImportTaskRequest)));
}
@Override
public WaiterResponse waitUntilImportTaskCancelled(GetImportTaskRequest getImportTaskRequest,
WaiterOverrideConfiguration overrideConfig) {
return importTaskCancelledWaiter.run(() -> client.getImportTask(applyWaitersUserAgent(getImportTaskRequest)),
importTaskCancelledWaiterConfig(overrideConfig));
}
@Override
public WaiterResponse waitUntilImportTaskSuccessful(GetImportTaskRequest getImportTaskRequest) {
return importTaskSuccessfulWaiter.run(() -> client.getImportTask(applyWaitersUserAgent(getImportTaskRequest)));
}
@Override
public WaiterResponse waitUntilImportTaskSuccessful(GetImportTaskRequest getImportTaskRequest,
WaiterOverrideConfiguration overrideConfig) {
return importTaskSuccessfulWaiter.run(() -> client.getImportTask(applyWaitersUserAgent(getImportTaskRequest)),
importTaskSuccessfulWaiterConfig(overrideConfig));
}
@Override
public WaiterResponse waitUntilPrivateGraphEndpointAvailable(
GetPrivateGraphEndpointRequest getPrivateGraphEndpointRequest) {
return privateGraphEndpointAvailableWaiter.run(() -> client
.getPrivateGraphEndpoint(applyWaitersUserAgent(getPrivateGraphEndpointRequest)));
}
@Override
public WaiterResponse waitUntilPrivateGraphEndpointAvailable(
GetPrivateGraphEndpointRequest getPrivateGraphEndpointRequest, WaiterOverrideConfiguration overrideConfig) {
return privateGraphEndpointAvailableWaiter.run(
() -> client.getPrivateGraphEndpoint(applyWaitersUserAgent(getPrivateGraphEndpointRequest)),
privateGraphEndpointAvailableWaiterConfig(overrideConfig));
}
@Override
public WaiterResponse waitUntilPrivateGraphEndpointDeleted(
GetPrivateGraphEndpointRequest getPrivateGraphEndpointRequest) {
return privateGraphEndpointDeletedWaiter.run(() -> client
.getPrivateGraphEndpoint(applyWaitersUserAgent(getPrivateGraphEndpointRequest)));
}
@Override
public WaiterResponse waitUntilPrivateGraphEndpointDeleted(
GetPrivateGraphEndpointRequest getPrivateGraphEndpointRequest, WaiterOverrideConfiguration overrideConfig) {
return privateGraphEndpointDeletedWaiter.run(
() -> client.getPrivateGraphEndpoint(applyWaitersUserAgent(getPrivateGraphEndpointRequest)),
privateGraphEndpointDeletedWaiterConfig(overrideConfig));
}
private static List> graphAvailableWaiterAcceptors() {
List> result = new ArrayList<>();
result.add(WaiterAcceptor.errorOnResponseAcceptor(
response -> {
JmesPathRuntime.Value input = new JmesPathRuntime.Value(response);
return Objects.equals(input.field("status").value(), "DELETING");
},
"A waiter acceptor with the matcher (path) was matched on parameter (status=DELETING) and transitioned the waiter to failure state"));
result.add(WaiterAcceptor.errorOnResponseAcceptor(response -> {
JmesPathRuntime.Value input = new JmesPathRuntime.Value(response);
return Objects.equals(input.field("status").value(), "FAILED");
},
"A waiter acceptor with the matcher (path) was matched on parameter (status=FAILED) and transitioned the waiter to failure state"));
result.add(WaiterAcceptor.successOnResponseAcceptor(response -> {
JmesPathRuntime.Value input = new JmesPathRuntime.Value(response);
return Objects.equals(input.field("status").value(), "AVAILABLE");
}));
result.addAll(WaitersRuntime.DEFAULT_ACCEPTORS);
return result;
}
private static List> graphDeletedWaiterAcceptors() {
List> result = new ArrayList<>();
result.add(WaiterAcceptor.errorOnResponseAcceptor(
response -> {
JmesPathRuntime.Value input = new JmesPathRuntime.Value(response);
return Objects.equals(input.field("status").compare("!=", input.constant("DELETING")).value(), true);
},
"A waiter acceptor with the matcher (path) was matched on parameter (status != 'DELETING'=true) and transitioned the waiter to failure state"));
result.add(WaiterAcceptor.successOnExceptionAcceptor(error -> Objects.equals(errorCode(error),
"ResourceNotFoundException")));
result.addAll(WaitersRuntime.DEFAULT_ACCEPTORS);
return result;
}
private static List> graphSnapshotAvailableWaiterAcceptors() {
List> result = new ArrayList<>();
result.add(WaiterAcceptor.errorOnResponseAcceptor(
response -> {
JmesPathRuntime.Value input = new JmesPathRuntime.Value(response);
return Objects.equals(input.field("status").value(), "DELETING");
},
"A waiter acceptor with the matcher (path) was matched on parameter (status=DELETING) and transitioned the waiter to failure state"));
result.add(WaiterAcceptor.errorOnResponseAcceptor(response -> {
JmesPathRuntime.Value input = new JmesPathRuntime.Value(response);
return Objects.equals(input.field("status").value(), "FAILED");
},
"A waiter acceptor with the matcher (path) was matched on parameter (status=FAILED) and transitioned the waiter to failure state"));
result.add(WaiterAcceptor.successOnResponseAcceptor(response -> {
JmesPathRuntime.Value input = new JmesPathRuntime.Value(response);
return Objects.equals(input.field("status").value(), "AVAILABLE");
}));
result.addAll(WaitersRuntime.DEFAULT_ACCEPTORS);
return result;
}
private static List> graphSnapshotDeletedWaiterAcceptors() {
List> result = new ArrayList<>();
result.add(WaiterAcceptor.errorOnResponseAcceptor(
response -> {
JmesPathRuntime.Value input = new JmesPathRuntime.Value(response);
return Objects.equals(input.field("status").compare("!=", input.constant("DELETING")).value(), true);
},
"A waiter acceptor with the matcher (path) was matched on parameter (status != 'DELETING'=true) and transitioned the waiter to failure state"));
result.add(WaiterAcceptor.successOnExceptionAcceptor(error -> Objects.equals(errorCode(error),
"ResourceNotFoundException")));
result.addAll(WaitersRuntime.DEFAULT_ACCEPTORS);
return result;
}
private static List> importTaskCancelledWaiterAcceptors() {
List> result = new ArrayList<>();
result.add(WaiterAcceptor.errorOnResponseAcceptor(
response -> {
JmesPathRuntime.Value input = new JmesPathRuntime.Value(response);
return Objects.equals(
input.field("status").compare("!=", input.constant("CANCELLING"))
.and(input.field("status").compare("!=", input.constant("CANCELLED"))).value(), true);
},
"A waiter acceptor with the matcher (path) was matched on parameter (status != 'CANCELLING' && status != 'CANCELLED'=true) and transitioned the waiter to failure state"));
result.add(WaiterAcceptor.successOnResponseAcceptor(response -> {
JmesPathRuntime.Value input = new JmesPathRuntime.Value(response);
return Objects.equals(input.field("status").value(), "CANCELLED");
}));
result.addAll(WaitersRuntime.DEFAULT_ACCEPTORS);
return result;
}
private static List> importTaskSuccessfulWaiterAcceptors() {
List> result = new ArrayList<>();
result.add(WaiterAcceptor.errorOnResponseAcceptor(
response -> {
JmesPathRuntime.Value input = new JmesPathRuntime.Value(response);
return Objects.equals(input.field("status").value(), "CANCELLING");
},
"A waiter acceptor with the matcher (path) was matched on parameter (status=CANCELLING) and transitioned the waiter to failure state"));
result.add(WaiterAcceptor.errorOnResponseAcceptor(
response -> {
JmesPathRuntime.Value input = new JmesPathRuntime.Value(response);
return Objects.equals(input.field("status").value(), "CANCELLED");
},
"A waiter acceptor with the matcher (path) was matched on parameter (status=CANCELLED) and transitioned the waiter to failure state"));
result.add(WaiterAcceptor.errorOnResponseAcceptor(
response -> {
JmesPathRuntime.Value input = new JmesPathRuntime.Value(response);
return Objects.equals(input.field("status").value(), "ROLLING_BACK");
},
"A waiter acceptor with the matcher (path) was matched on parameter (status=ROLLING_BACK) and transitioned the waiter to failure state"));
result.add(WaiterAcceptor.errorOnResponseAcceptor(response -> {
JmesPathRuntime.Value input = new JmesPathRuntime.Value(response);
return Objects.equals(input.field("status").value(), "FAILED");
},
"A waiter acceptor with the matcher (path) was matched on parameter (status=FAILED) and transitioned the waiter to failure state"));
result.add(WaiterAcceptor.successOnResponseAcceptor(response -> {
JmesPathRuntime.Value input = new JmesPathRuntime.Value(response);
return Objects.equals(input.field("status").value(), "SUCCEEDED");
}));
result.addAll(WaitersRuntime.DEFAULT_ACCEPTORS);
return result;
}
private static List> privateGraphEndpointAvailableWaiterAcceptors() {
List> result = new ArrayList<>();
result.add(WaiterAcceptor.errorOnResponseAcceptor(
response -> {
JmesPathRuntime.Value input = new JmesPathRuntime.Value(response);
return Objects.equals(input.field("status").value(), "DELETING");
},
"A waiter acceptor with the matcher (path) was matched on parameter (status=DELETING) and transitioned the waiter to failure state"));
result.add(WaiterAcceptor.errorOnResponseAcceptor(response -> {
JmesPathRuntime.Value input = new JmesPathRuntime.Value(response);
return Objects.equals(input.field("status").value(), "FAILED");
},
"A waiter acceptor with the matcher (path) was matched on parameter (status=FAILED) and transitioned the waiter to failure state"));
result.add(WaiterAcceptor.successOnResponseAcceptor(response -> {
JmesPathRuntime.Value input = new JmesPathRuntime.Value(response);
return Objects.equals(input.field("status").value(), "AVAILABLE");
}));
result.addAll(WaitersRuntime.DEFAULT_ACCEPTORS);
return result;
}
private static List> privateGraphEndpointDeletedWaiterAcceptors() {
List> result = new ArrayList<>();
result.add(WaiterAcceptor.errorOnResponseAcceptor(
response -> {
JmesPathRuntime.Value input = new JmesPathRuntime.Value(response);
return Objects.equals(input.field("status").compare("!=", input.constant("DELETING")).value(), true);
},
"A waiter acceptor with the matcher (path) was matched on parameter (status != 'DELETING'=true) and transitioned the waiter to failure state"));
result.add(WaiterAcceptor.successOnExceptionAcceptor(error -> Objects.equals(errorCode(error),
"ResourceNotFoundException")));
result.addAll(WaitersRuntime.DEFAULT_ACCEPTORS);
return result;
}
private static WaiterOverrideConfiguration graphAvailableWaiterConfig(WaiterOverrideConfiguration overrideConfig) {
Optional optionalOverrideConfig = Optional.ofNullable(overrideConfig);
int maxAttempts = optionalOverrideConfig.flatMap(WaiterOverrideConfiguration::maxAttempts).orElse(480);
BackoffStrategy backoffStrategy = optionalOverrideConfig.flatMap(WaiterOverrideConfiguration::backoffStrategyV2).orElse(
BackoffStrategy.fixedDelayWithoutJitter(Duration.ofSeconds(60)));
Duration waitTimeout = optionalOverrideConfig.flatMap(WaiterOverrideConfiguration::waitTimeout).orElse(null);
return WaiterOverrideConfiguration.builder().maxAttempts(maxAttempts).backoffStrategyV2(backoffStrategy)
.waitTimeout(waitTimeout).build();
}
private static WaiterOverrideConfiguration graphDeletedWaiterConfig(WaiterOverrideConfiguration overrideConfig) {
Optional optionalOverrideConfig = Optional.ofNullable(overrideConfig);
int maxAttempts = optionalOverrideConfig.flatMap(WaiterOverrideConfiguration::maxAttempts).orElse(60);
BackoffStrategy backoffStrategy = optionalOverrideConfig.flatMap(WaiterOverrideConfiguration::backoffStrategyV2).orElse(
BackoffStrategy.fixedDelayWithoutJitter(Duration.ofSeconds(60)));
Duration waitTimeout = optionalOverrideConfig.flatMap(WaiterOverrideConfiguration::waitTimeout).orElse(null);
return WaiterOverrideConfiguration.builder().maxAttempts(maxAttempts).backoffStrategyV2(backoffStrategy)
.waitTimeout(waitTimeout).build();
}
private static WaiterOverrideConfiguration graphSnapshotAvailableWaiterConfig(WaiterOverrideConfiguration overrideConfig) {
Optional optionalOverrideConfig = Optional.ofNullable(overrideConfig);
int maxAttempts = optionalOverrideConfig.flatMap(WaiterOverrideConfiguration::maxAttempts).orElse(120);
BackoffStrategy backoffStrategy = optionalOverrideConfig.flatMap(WaiterOverrideConfiguration::backoffStrategyV2).orElse(
BackoffStrategy.fixedDelayWithoutJitter(Duration.ofSeconds(60)));
Duration waitTimeout = optionalOverrideConfig.flatMap(WaiterOverrideConfiguration::waitTimeout).orElse(null);
return WaiterOverrideConfiguration.builder().maxAttempts(maxAttempts).backoffStrategyV2(backoffStrategy)
.waitTimeout(waitTimeout).build();
}
private static WaiterOverrideConfiguration graphSnapshotDeletedWaiterConfig(WaiterOverrideConfiguration overrideConfig) {
Optional optionalOverrideConfig = Optional.ofNullable(overrideConfig);
int maxAttempts = optionalOverrideConfig.flatMap(WaiterOverrideConfiguration::maxAttempts).orElse(60);
BackoffStrategy backoffStrategy = optionalOverrideConfig.flatMap(WaiterOverrideConfiguration::backoffStrategyV2).orElse(
BackoffStrategy.fixedDelayWithoutJitter(Duration.ofSeconds(60)));
Duration waitTimeout = optionalOverrideConfig.flatMap(WaiterOverrideConfiguration::waitTimeout).orElse(null);
return WaiterOverrideConfiguration.builder().maxAttempts(maxAttempts).backoffStrategyV2(backoffStrategy)
.waitTimeout(waitTimeout).build();
}
private static WaiterOverrideConfiguration importTaskCancelledWaiterConfig(WaiterOverrideConfiguration overrideConfig) {
Optional optionalOverrideConfig = Optional.ofNullable(overrideConfig);
int maxAttempts = optionalOverrideConfig.flatMap(WaiterOverrideConfiguration::maxAttempts).orElse(60);
BackoffStrategy backoffStrategy = optionalOverrideConfig.flatMap(WaiterOverrideConfiguration::backoffStrategyV2).orElse(
BackoffStrategy.fixedDelayWithoutJitter(Duration.ofSeconds(60)));
Duration waitTimeout = optionalOverrideConfig.flatMap(WaiterOverrideConfiguration::waitTimeout).orElse(null);
return WaiterOverrideConfiguration.builder().maxAttempts(maxAttempts).backoffStrategyV2(backoffStrategy)
.waitTimeout(waitTimeout).build();
}
private static WaiterOverrideConfiguration importTaskSuccessfulWaiterConfig(WaiterOverrideConfiguration overrideConfig) {
Optional optionalOverrideConfig = Optional.ofNullable(overrideConfig);
int maxAttempts = optionalOverrideConfig.flatMap(WaiterOverrideConfiguration::maxAttempts).orElse(480);
BackoffStrategy backoffStrategy = optionalOverrideConfig.flatMap(WaiterOverrideConfiguration::backoffStrategyV2).orElse(
BackoffStrategy.fixedDelayWithoutJitter(Duration.ofSeconds(60)));
Duration waitTimeout = optionalOverrideConfig.flatMap(WaiterOverrideConfiguration::waitTimeout).orElse(null);
return WaiterOverrideConfiguration.builder().maxAttempts(maxAttempts).backoffStrategyV2(backoffStrategy)
.waitTimeout(waitTimeout).build();
}
private static WaiterOverrideConfiguration privateGraphEndpointAvailableWaiterConfig(
WaiterOverrideConfiguration overrideConfig) {
Optional optionalOverrideConfig = Optional.ofNullable(overrideConfig);
int maxAttempts = optionalOverrideConfig.flatMap(WaiterOverrideConfiguration::maxAttempts).orElse(180);
BackoffStrategy backoffStrategy = optionalOverrideConfig.flatMap(WaiterOverrideConfiguration::backoffStrategyV2).orElse(
BackoffStrategy.fixedDelayWithoutJitter(Duration.ofSeconds(10)));
Duration waitTimeout = optionalOverrideConfig.flatMap(WaiterOverrideConfiguration::waitTimeout).orElse(null);
return WaiterOverrideConfiguration.builder().maxAttempts(maxAttempts).backoffStrategyV2(backoffStrategy)
.waitTimeout(waitTimeout).build();
}
private static WaiterOverrideConfiguration privateGraphEndpointDeletedWaiterConfig(WaiterOverrideConfiguration overrideConfig) {
Optional optionalOverrideConfig = Optional.ofNullable(overrideConfig);
int maxAttempts = optionalOverrideConfig.flatMap(WaiterOverrideConfiguration::maxAttempts).orElse(180);
BackoffStrategy backoffStrategy = optionalOverrideConfig.flatMap(WaiterOverrideConfiguration::backoffStrategyV2).orElse(
BackoffStrategy.fixedDelayWithoutJitter(Duration.ofSeconds(10)));
Duration waitTimeout = optionalOverrideConfig.flatMap(WaiterOverrideConfiguration::waitTimeout).orElse(null);
return WaiterOverrideConfiguration.builder().maxAttempts(maxAttempts).backoffStrategyV2(backoffStrategy)
.waitTimeout(waitTimeout).build();
}
@Override
public void close() {
managedResources.close();
}
public static NeptuneGraphWaiter.Builder builder() {
return new DefaultBuilder();
}
private T applyWaitersUserAgent(T request) {
Consumer userAgentApplier = b -> b.addApiName(ApiName.builder()
.version("waiter").name("hll").build());
AwsRequestOverrideConfiguration overrideConfiguration = request.overrideConfiguration()
.map(c -> c.toBuilder().applyMutation(userAgentApplier).build())
.orElse((AwsRequestOverrideConfiguration.builder().applyMutation(userAgentApplier).build()));
return (T) request.toBuilder().overrideConfiguration(overrideConfiguration).build();
}
public static final class DefaultBuilder implements NeptuneGraphWaiter.Builder {
private NeptuneGraphClient client;
private WaiterOverrideConfiguration overrideConfiguration;
private DefaultBuilder() {
}
@Override
public NeptuneGraphWaiter.Builder overrideConfiguration(WaiterOverrideConfiguration overrideConfiguration) {
this.overrideConfiguration = overrideConfiguration;
return this;
}
@Override
public NeptuneGraphWaiter.Builder client(NeptuneGraphClient client) {
this.client = client;
return this;
}
public NeptuneGraphWaiter build() {
return new DefaultNeptuneGraphWaiter(this);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy