[ https://issues.apache.org/jira/browse/BEAM-13563?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Moritz Mack updated BEAM-13563: ------------------------------- Description: Currently each AWS IO uses its own client provider, in some cases also separate ones for sync and async clients. Besides adding lots of boilerplate code across these IOs, this makes it impossible to switch to an async implementation without breaking APIs. The approach below would require only one common client provider to build all kinds of clients: {code:java} public <BuilderT extends AwsClientBuilder<BuilderT, ClientT>, ClientT> ClientT buildClient(BuilderT builder) { if (endpoint != null) { builder.endpointOverride(URI.create(endpoint)); } return builder .credentialsProvider(credentialsProvider) .region(Region.of(region)) .build(); } buildClient(DynamoDbClient.builder()); buildClient(DynamoDbAsyncClient.builder()); buildClient(S3Client.builder()); buildClient(S3AsyncClient.builder()); ...{code} > Generalize AWS client provider to be independent of client type > --------------------------------------------------------------- > > Key: BEAM-13563 > URL: https://issues.apache.org/jira/browse/BEAM-13563 > Project: Beam > Issue Type: Improvement > Components: io-java-aws > Reporter: Moritz Mack > Priority: P3 > Labels: aws-sdk-v2 > > Currently each AWS IO uses its own client provider, in some cases also > separate ones for sync and async clients. > Besides adding lots of boilerplate code across these IOs, this makes it > impossible to switch to an async implementation without breaking APIs. > The approach below would require only one common client provider to build all > kinds of clients: > {code:java} > public <BuilderT extends AwsClientBuilder<BuilderT, ClientT>, ClientT> > ClientT buildClient(BuilderT builder) { > if (endpoint != null) { > builder.endpointOverride(URI.create(endpoint)); > } > return builder > .credentialsProvider(credentialsProvider) > .region(Region.of(region)) > .build(); > } > buildClient(DynamoDbClient.builder()); > buildClient(DynamoDbAsyncClient.builder()); > buildClient(S3Client.builder()); > buildClient(S3AsyncClient.builder()); > ...{code} -- This message was sent by Atlassian Jira (v8.20.1#820001)