use of software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration in project aws-sdk-java-v2 by aws.
the class ApplyUserAgentInterceptor method modifyRequest.
@Override
public SdkRequest modifyRequest(Context.ModifyRequest context, ExecutionAttributes executionAttributes) {
if (!(context.request() instanceof DynamoDbRequest)) {
// should never happen
return context.request();
}
DynamoDbRequest request = (DynamoDbRequest) context.request();
AwsRequestOverrideConfiguration overrideConfiguration = request.overrideConfiguration().map(c -> c.toBuilder().applyMutation(USER_AGENT_APPLIER).build()).orElse((AwsRequestOverrideConfiguration.builder().applyMutation(USER_AGENT_APPLIER).build()));
return request.toBuilder().overrideConfiguration(overrideConfiguration).build();
}
use of software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration in project aws-sdk-java-v2 by aws.
the class ApplyUserAgentInterceptor method modifyRequest.
@Override
public SdkRequest modifyRequest(Context.ModifyRequest context, ExecutionAttributes executionAttributes) {
assert context.request() instanceof S3Request;
S3Request request = (S3Request) context.request();
AwsRequestOverrideConfiguration overrideConfiguration = request.overrideConfiguration().map(c -> c.toBuilder().applyMutation(USER_AGENT_APPLIER).build()).orElseGet(() -> AwsRequestOverrideConfiguration.builder().applyMutation(USER_AGENT_APPLIER).build());
return request.toBuilder().overrideConfiguration(overrideConfiguration).build();
}
use of software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration in project aws-sdk-java-v2 by aws.
the class DefaultJsonAsyncClient method applyPaginatorUserAgent.
private <T extends JsonRequest> T applyPaginatorUserAgent(T request) {
Consumer<AwsRequestOverrideConfiguration.Builder> userAgentApplier = b -> b.addApiName(ApiName.builder().version(VersionInfo.SDK_VERSION).name("PAGINATED").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();
}
use of software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration in project aws-sdk-java-v2 by aws.
the class DefaultJsonAsyncClient method applySignerOverride.
private <T extends JsonRequest> 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();
}
use of software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration in project aws-sdk-java-v2 by aws.
the class DefaultJsonClient method applyPaginatorUserAgent.
private <T extends JsonRequest> T applyPaginatorUserAgent(T request) {
Consumer<AwsRequestOverrideConfiguration.Builder> userAgentApplier = b -> b.addApiName(ApiName.builder().version(VersionInfo.SDK_VERSION).name("PAGINATED").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();
}
Aggregations