use of software.amazon.awssdk.core.client.config.ClientOverrideConfiguration in project flink by apache.
the class AWSAsyncSinkUtil method createAwsAsyncClient.
/**
* @param configProps configuration properties
* @param clientConfiguration the AWS SDK v2 config to instantiate the client
* @param httpClient the underlying HTTP client used to talk to AWS
* @return a new AWS Client
*/
public static <S extends SdkClient, T extends AwsAsyncClientBuilder<? extends T, S> & AwsClientBuilder<? extends T, S>> S createAwsAsyncClient(final Properties configProps, final SdkClientConfiguration clientConfiguration, final SdkAsyncHttpClient httpClient, final T clientBuilder, final String awsUserAgentPrefixFormat, final String awsClientUserAgentPrefix) {
String flinkUserAgentPrefix = Optional.ofNullable(configProps.getProperty(awsClientUserAgentPrefix)).orElse(formatFlinkUserAgentPrefix(awsUserAgentPrefixFormat + V2_USER_AGENT_SUFFIX));
final ClientOverrideConfiguration overrideConfiguration = createClientOverrideConfiguration(clientConfiguration, ClientOverrideConfiguration.builder(), flinkUserAgentPrefix);
return createAwsAsyncClient(configProps, clientBuilder, httpClient, overrideConfiguration);
}
use of software.amazon.awssdk.core.client.config.ClientOverrideConfiguration in project data-transfer-project by google.
the class BaseBackblazeS3ClientFactory method createS3Client.
public S3Client createS3Client(String accessKey, String secretKey, String region) {
AwsSessionCredentials awsCreds = AwsSessionCredentials.create(accessKey, secretKey, "");
ClientOverrideConfiguration clientOverrideConfiguration = ClientOverrideConfiguration.builder().putHeader("User-Agent", "Facebook-DTP").build();
// Use any AWS region for the client, the Backblaze API does not care about it
Region awsRegion = Region.US_EAST_1;
return S3Client.builder().credentialsProvider(StaticCredentialsProvider.create(awsCreds)).overrideConfiguration(clientOverrideConfiguration).endpointOverride(URI.create(String.format(S3_ENDPOINT_FORMAT_STRING, region))).region(awsRegion).build();
}
Aggregations