Search in sources :

Example 1 with QueryRequest

use of software.amazon.awssdk.services.query.model.QueryRequest in project aws-sdk-java-v2 by aws.

the class DefaultQueryWaiter method applyWaitersUserAgent.

private <T extends QueryRequest> T applyWaitersUserAgent(T request) {
    Consumer<AwsRequestOverrideConfiguration.Builder> 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();
}
Also used : SdkAutoCloseable(software.amazon.awssdk.utils.SdkAutoCloseable) ThreadSafe(software.amazon.awssdk.annotations.ThreadSafe) AttributeMap(software.amazon.awssdk.utils.AttributeMap) ArrayList(java.util.ArrayList) ApiName(software.amazon.awssdk.core.ApiName) BackoffStrategy(software.amazon.awssdk.core.retry.backoff.BackoffStrategy) Duration(java.time.Duration) QueryClient(software.amazon.awssdk.services.query.QueryClient) APostOperationResponse(software.amazon.awssdk.services.query.model.APostOperationResponse) WaiterResponse(software.amazon.awssdk.core.waiters.WaiterResponse) WaiterOverrideConfiguration(software.amazon.awssdk.core.waiters.WaiterOverrideConfiguration) WaiterAcceptor(software.amazon.awssdk.core.waiters.WaiterAcceptor) WaiterAttribute(software.amazon.awssdk.core.internal.waiters.WaiterAttribute) AwsServiceException(software.amazon.awssdk.awscore.exception.AwsServiceException) WaitersRuntime(software.amazon.awssdk.services.query.waiters.internal.WaitersRuntime) FixedDelayBackoffStrategy(software.amazon.awssdk.core.retry.backoff.FixedDelayBackoffStrategy) QueryRequest(software.amazon.awssdk.services.query.model.QueryRequest) Objects(java.util.Objects) Consumer(java.util.function.Consumer) Waiter(software.amazon.awssdk.core.waiters.Waiter) List(java.util.List) WaiterState(software.amazon.awssdk.core.waiters.WaiterState) APostOperationRequest(software.amazon.awssdk.services.query.model.APostOperationRequest) Optional(java.util.Optional) SdkInternalApi(software.amazon.awssdk.annotations.SdkInternalApi) Generated(software.amazon.awssdk.annotations.Generated) AwsRequestOverrideConfiguration(software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration) AwsRequestOverrideConfiguration(software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration)

Example 2 with QueryRequest

use of software.amazon.awssdk.services.query.model.QueryRequest in project aws-sdk-java-v2 by aws.

the class DefaultQueryAsyncWaiter method applyWaitersUserAgent.

private <T extends QueryRequest> T applyWaitersUserAgent(T request) {
    Consumer<AwsRequestOverrideConfiguration.Builder> 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();
}
Also used : SdkAutoCloseable(software.amazon.awssdk.utils.SdkAutoCloseable) CompletableFuture(java.util.concurrent.CompletableFuture) ThreadSafe(software.amazon.awssdk.annotations.ThreadSafe) AttributeMap(software.amazon.awssdk.utils.AttributeMap) AsyncWaiter(software.amazon.awssdk.core.waiters.AsyncWaiter) ArrayList(java.util.ArrayList) ApiName(software.amazon.awssdk.core.ApiName) BackoffStrategy(software.amazon.awssdk.core.retry.backoff.BackoffStrategy) Duration(java.time.Duration) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) APostOperationResponse(software.amazon.awssdk.services.query.model.APostOperationResponse) WaiterResponse(software.amazon.awssdk.core.waiters.WaiterResponse) WaiterOverrideConfiguration(software.amazon.awssdk.core.waiters.WaiterOverrideConfiguration) WaiterAcceptor(software.amazon.awssdk.core.waiters.WaiterAcceptor) WaiterAttribute(software.amazon.awssdk.core.internal.waiters.WaiterAttribute) AwsServiceException(software.amazon.awssdk.awscore.exception.AwsServiceException) ThreadFactoryBuilder(software.amazon.awssdk.utils.ThreadFactoryBuilder) WaitersRuntime(software.amazon.awssdk.services.query.waiters.internal.WaitersRuntime) Executors(java.util.concurrent.Executors) FixedDelayBackoffStrategy(software.amazon.awssdk.core.retry.backoff.FixedDelayBackoffStrategy) QueryRequest(software.amazon.awssdk.services.query.model.QueryRequest) Objects(java.util.Objects) Consumer(java.util.function.Consumer) QueryAsyncClient(software.amazon.awssdk.services.query.QueryAsyncClient) List(java.util.List) WaiterState(software.amazon.awssdk.core.waiters.WaiterState) APostOperationRequest(software.amazon.awssdk.services.query.model.APostOperationRequest) Optional(java.util.Optional) SdkInternalApi(software.amazon.awssdk.annotations.SdkInternalApi) Generated(software.amazon.awssdk.annotations.Generated) AwsRequestOverrideConfiguration(software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration) AwsRequestOverrideConfiguration(software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration) ThreadFactoryBuilder(software.amazon.awssdk.utils.ThreadFactoryBuilder)

Example 3 with QueryRequest

use of software.amazon.awssdk.services.query.model.QueryRequest in project aws-sdk-java-v2 by aws.

the class DefaultQueryAsyncClient method applySignerOverride.

private <T extends QueryRequest> T applySignerOverride(T request, Signer signer) {
    if (request.overrideConfiguration().flatMap(c -> c.signer()).isPresent()) {
        return request;
    }
    Consumer<AwsRequestOverrideConfiguration.Builder> signerOverride = b -> b.signer(signer).build();
    AwsRequestOverrideConfiguration overrideConfiguration = request.overrideConfiguration().map(c -> c.toBuilder().applyMutation(signerOverride).build()).orElse((AwsRequestOverrideConfiguration.builder().applyMutation(signerOverride).build()));
    return (T) request.toBuilder().overrideConfiguration(overrideConfiguration).build();
}
Also used : ExceptionMetadata(software.amazon.awssdk.protocols.core.ExceptionMetadata) StreamingInputOperationRequestMarshaller(software.amazon.awssdk.services.query.transform.StreamingInputOperationRequestMarshaller) AwsAsyncClientHandler(software.amazon.awssdk.awscore.client.handler.AwsAsyncClientHandler) LoggerFactory(org.slf4j.LoggerFactory) MetricPublisher(software.amazon.awssdk.metrics.MetricPublisher) QueryException(software.amazon.awssdk.services.query.model.QueryException) AsyncStreamingRequestMarshaller(software.amazon.awssdk.core.runtime.transform.AsyncStreamingRequestMarshaller) AsyncResponseTransformer(software.amazon.awssdk.core.async.AsyncResponseTransformer) SdkClientOption(software.amazon.awssdk.core.client.config.SdkClientOption) OperationWithChecksumRequiredResponse(software.amazon.awssdk.services.query.model.OperationWithChecksumRequiredResponse) AsyncClientHandler(software.amazon.awssdk.core.client.handler.AsyncClientHandler) APostOperationRequestMarshaller(software.amazon.awssdk.services.query.transform.APostOperationRequestMarshaller) AwsServiceException(software.amazon.awssdk.awscore.exception.AwsServiceException) StreamingOutputOperationResponse(software.amazon.awssdk.services.query.model.StreamingOutputOperationResponse) StreamingOutputOperationRequest(software.amazon.awssdk.services.query.model.StreamingOutputOperationRequest) List(java.util.List) AsyncRequestBody(software.amazon.awssdk.core.async.AsyncRequestBody) OperationWithChecksumRequiredRequest(software.amazon.awssdk.services.query.model.OperationWithChecksumRequiredRequest) AsyncAws4Signer(software.amazon.awssdk.auth.signer.AsyncAws4Signer) HttpResponseHandler(software.amazon.awssdk.core.http.HttpResponseHandler) PutOperationWithChecksumResponse(software.amazon.awssdk.services.query.model.PutOperationWithChecksumResponse) Generated(software.amazon.awssdk.annotations.Generated) AsyncResponseTransformerUtils(software.amazon.awssdk.core.async.AsyncResponseTransformerUtils) GetOperationWithChecksumRequest(software.amazon.awssdk.services.query.model.GetOperationWithChecksumRequest) AwsRequestOverrideConfiguration(software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration) Signer(software.amazon.awssdk.core.signer.Signer) PutOperationWithChecksumRequestMarshaller(software.amazon.awssdk.services.query.transform.PutOperationWithChecksumRequestMarshaller) OperationWithChecksumRequiredRequestMarshaller(software.amazon.awssdk.services.query.transform.OperationWithChecksumRequiredRequestMarshaller) CompletableFutureUtils(software.amazon.awssdk.utils.CompletableFutureUtils) CompletableFuture(java.util.concurrent.CompletableFuture) SdkClientConfiguration(software.amazon.awssdk.core.client.config.SdkClientConfiguration) StreamingOutputOperationRequestMarshaller(software.amazon.awssdk.services.query.transform.StreamingOutputOperationRequestMarshaller) StreamingInputOperationRequest(software.amazon.awssdk.services.query.model.StreamingInputOperationRequest) HttpChecksumRequired(software.amazon.awssdk.core.interceptor.trait.HttpChecksumRequired) CoreMetric(software.amazon.awssdk.core.metrics.CoreMetric) AwsQueryProtocolFactory(software.amazon.awssdk.protocols.query.AwsQueryProtocolFactory) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) RequestOverrideConfiguration(software.amazon.awssdk.core.RequestOverrideConfiguration) InvalidInputException(software.amazon.awssdk.services.query.model.InvalidInputException) APostOperationResponse(software.amazon.awssdk.services.query.model.APostOperationResponse) NoOpMetricCollector(software.amazon.awssdk.metrics.NoOpMetricCollector) GetOperationWithChecksumResponse(software.amazon.awssdk.services.query.model.GetOperationWithChecksumResponse) APostOperationWithOutputResponse(software.amazon.awssdk.services.query.model.APostOperationWithOutputResponse) APostOperationWithOutputRequestMarshaller(software.amazon.awssdk.services.query.transform.APostOperationWithOutputRequestMarshaller) Logger(org.slf4j.Logger) SdkInternalExecutionAttribute(software.amazon.awssdk.core.interceptor.SdkInternalExecutionAttribute) MetricCollector(software.amazon.awssdk.metrics.MetricCollector) QueryAsyncWaiter(software.amazon.awssdk.services.query.waiters.QueryAsyncWaiter) StreamingInputOperationResponse(software.amazon.awssdk.services.query.model.StreamingInputOperationResponse) Pair(software.amazon.awssdk.utils.Pair) PutOperationWithChecksumRequest(software.amazon.awssdk.services.query.model.PutOperationWithChecksumRequest) QueryRequest(software.amazon.awssdk.services.query.model.QueryRequest) Consumer(java.util.function.Consumer) HttpChecksum(software.amazon.awssdk.core.interceptor.trait.HttpChecksum) ClientExecutionParams(software.amazon.awssdk.core.client.handler.ClientExecutionParams) APostOperationWithOutputRequest(software.amazon.awssdk.services.query.model.APostOperationWithOutputRequest) APostOperationRequest(software.amazon.awssdk.services.query.model.APostOperationRequest) GetOperationWithChecksumRequestMarshaller(software.amazon.awssdk.services.query.transform.GetOperationWithChecksumRequestMarshaller) SdkInternalApi(software.amazon.awssdk.annotations.SdkInternalApi) FunctionalUtils.runAndLogError(software.amazon.awssdk.utils.FunctionalUtils.runAndLogError) Collections(java.util.Collections) AwsRequestOverrideConfiguration(software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration)

Aggregations

List (java.util.List)3 Consumer (java.util.function.Consumer)3 Generated (software.amazon.awssdk.annotations.Generated)3 SdkInternalApi (software.amazon.awssdk.annotations.SdkInternalApi)3 AwsRequestOverrideConfiguration (software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration)3 AwsServiceException (software.amazon.awssdk.awscore.exception.AwsServiceException)3 APostOperationRequest (software.amazon.awssdk.services.query.model.APostOperationRequest)3 APostOperationResponse (software.amazon.awssdk.services.query.model.APostOperationResponse)3 QueryRequest (software.amazon.awssdk.services.query.model.QueryRequest)3 Duration (java.time.Duration)2 ArrayList (java.util.ArrayList)2 Objects (java.util.Objects)2 Optional (java.util.Optional)2 CompletableFuture (java.util.concurrent.CompletableFuture)2 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)2 ThreadSafe (software.amazon.awssdk.annotations.ThreadSafe)2 ApiName (software.amazon.awssdk.core.ApiName)2 WaiterAttribute (software.amazon.awssdk.core.internal.waiters.WaiterAttribute)2 BackoffStrategy (software.amazon.awssdk.core.retry.backoff.BackoffStrategy)2 FixedDelayBackoffStrategy (software.amazon.awssdk.core.retry.backoff.FixedDelayBackoffStrategy)2