-
Notifications
You must be signed in to change notification settings - Fork 718
Description
Describe the feature
Allow for aws.Config
to hold "options" to be applied only when constructing the client for a particular service.
Use Case
In a monorepo, it is useful to have a single framework for configuring the SDK. Today, while we can configure the "base" aws.Config
itself, it is not feasible to for example apply a consistent configuration to all DynamoDB service clients.
While we can somewhat achieve this today by writing our own wrapper functions around every service client constructor, this requires all developers to remember to do this.
Proposed Solution
Add a field to aws.Config
that maps from a service ID (e.g., dynamodb.ServiceID
) to a list of callback functions ([]func(any)
).
When calling for example dynamodb.NewFromConfig
, it will check if the aws.Config
contains an entry for the service ID in question. If it does, it will pass the service-specific options struct (e.g., dynamodb.Options
) to each callback.
Alternatively, add a field like func(string) []func(any)
to aws.Config
, which is a function that will accept the service ID and return the list of options callback, if any. The advantage of this approach is that the set of options can be determined more dynamically (e.g., mapping the service ID to an environment variable).
Other Information
No response
Acknowledgements
- I may be able to implement this feature request
- This feature might incur a breaking change
AWS Go SDK V2 Module Versions Used
n/a
Go version used
n/a