You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, SDK client config has a region property which is a non-defered static string. Internally, the SDK uses RegionProvider and DefaultRegionProviderChain to lazily infer the region when one is not explicitly provided by the caller. This complicates dynamic region selection for callers who use their own configuration lookup mechanisms or want to use custom provider chains.
Is your feature request related to a problem?
The lack of a regionProvider property complicates dynamic region selection for callers who use their own configuration lookup mechanisms or want to use custom provider chains. Users must manage their own chain independently and then call getRegion() to pass to the client's region property:
val myRegionProvider =RegionProviderChain(src1, src2, src3, ...)
val s3 =S3Client.fromEnvironment {
region = myRegionProvider.getRegion()
}
Proposed Solution
Expose a regionProvider client config property alongside region. When set, it should replace the default region provider chain used when a static region is not specified:
val myRegionProvider =RegionProviderChain(src1, src2, src3, ...)
val s3 =S3Client.fromEnvironment {
regionProvider = myRegionProvider
}
If a static regionis specified, the value of regionProvider will not be used:
val myRegionProvider =...
val s3 =S3Client.fromEnvironment {
regionProvider = myRegionProvider // Ignored since `region` is also set
region ="moon-east-1"
}
Describe alternative solutions or features you've considered
The existing region property presently allows using providers indirectly but it's not very ergonomic and differs from how credentials are resolved.
Acknowledge
I may be able to implement this feature request
AWS SDK for Kotlin version
1.3.93
Platform (JVM/JS/Native)
(any)
Operating system and version
(any)
The text was updated successfully, but these errors were encountered:
regionProvider = myRegionProvider // Ignored since `region` is also set
region = "moon-east-1"
Alternatively this could error out - but that may be surprising in more complicated cases where the configuration is composed (not always two lines of code together), and perhaps hard to resolve.
Also an option is to flip the resolution, on the premise that a RegionProvider may be more relevant than static configuration (but not always...).
Are there other *Providers in the SDK that have perhaps already addressed this?
I don't have a strong opinion or specific requirements here - whatever you decide will be fine, so long as the "conflict resolution" behaviour is clearly documented.
My instinct is to bias towards the most specific option (i.e., region) rather than a less specific option (i.e., regionProvider). This matches the current behavior of endpointUrl and endpointProvider—endpointUrl wins if both are set. We'll discuss internally in more depth to verify that's the best approach but if you have further thoughts about one approach vs the other we'd love to take those into account. 🙂 And of course whichever option we select, we'll need to update/clarify our documentation.
If we do stick with the proposed region > regionProvider approach, it might be sensible to log a warning when both are set. This would probably apply to endpointUrl > endpointProvider too.
Agree on the "most specific" approach; good to know that endpoint* already has that behaviour.
Like the idea of logging a warning - silently ignoring things is a 💣 that we'd all prefer to avoid!
Possibly over engineering - add a "configuration resolution mode" or some such settings, defaults to Warn, could also be Error. I'd expect this would get rarely used, though, perhaps not worth the effort.
Describe the feature
Currently, SDK client config has a
region
property which is a non-defered static string. Internally, the SDK usesRegionProvider
andDefaultRegionProviderChain
to lazily infer the region when one is not explicitly provided by the caller. This complicates dynamic region selection for callers who use their own configuration lookup mechanisms or want to use custom provider chains.Is your feature request related to a problem?
The lack of a
regionProvider
property complicates dynamic region selection for callers who use their own configuration lookup mechanisms or want to use custom provider chains. Users must manage their own chain independently and then callgetRegion()
to pass to the client'sregion
property:Proposed Solution
Expose a
regionProvider
client config property alongsideregion
. When set, it should replace the default region provider chain used when a staticregion
is not specified:If a static
region
is specified, the value ofregionProvider
will not be used:Describe alternative solutions or features you've considered
The existing
region
property presently allows using providers indirectly but it's not very ergonomic and differs from how credentials are resolved.Acknowledge
AWS SDK for Kotlin version
1.3.93
Platform (JVM/JS/Native)
(any)
Operating system and version
(any)
The text was updated successfully, but these errors were encountered: