Skip to content

Add a mechanism to identify a service from its Builder (without reflection) #6184

Open
@abatkin

Description

@abatkin

Describe the feature

There should be a way to uniquely identify a service from its Builder. Direct reflection on the Builder's class or interfaces is heavy handed and cumbersome. In the interim, we have been successfully using reflection to make accessible and call the protected method AwsDefaultClientBuilder.serviceName(). The serviceEndpointPrefix() method would work equally well.

Use Case

We have service-specific configuration settings that we apply in a generic way using SdkBuilder.applyMutation(). For example, under certain circumstances, some services need to use one of two different proxy clusters or no proxy server at all. But part of this determination requires that we know what service it is.

Proposed Solution

Hoist serviceEndpointPrefix() and/or serviceName() from AwsDefaultClientBuilder into an interface like AwsClientBuilder.

Other Information

I haven't really thought through all the implications of moving those methods to AwsClientBuilder (or to another interface, or just making the abstract class's methods public). Or whether there's a better way altogether. But I can say that we have been successfully using serviceName() for many years, and it would be nice to make this (or something equivalent) better/officially supported.

So let's start the discussion here.

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

AWS Java SDK version used

All

JDK version used

All

Operating System and version

All

Metadata

Metadata

Assignees

Labels

feature-requestA feature should be added or improved.needs-reviewThis issue or PR needs review from the team.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions