Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a StaticRegionProvider #1005

Open
1 task
cloudshiftchris opened this issue Jul 28, 2023 · 3 comments
Open
1 task

Create a StaticRegionProvider #1005

cloudshiftchris opened this issue Jul 28, 2023 · 3 comments
Labels
feature-request A feature should be added or improved.

Comments

@cloudshiftchris
Copy link

Describe the feature

Create a StaticRegionProvider class to explicitly set a region to use.

Is your Feature Request related to a problem?

Currently Kotlin SDK does not have a mechanism to explicitly set the region via a RegionProvider; this is useful for say development environments (outside of AWS) where the region can't be directly inferred and configuration is integrated with other application configuration (i.e. no using system properties or environment variables)

Proposed Solution

public class StaticRegionProvider(private val region: String) : RegionProvider {
    override suspend fun getRegion(): String = region
}

Describe alternative solutions or features you've considered

See proposed solution.

Acknowledge

  • I may be able to implement this feature request

AWS Kotlin SDK version used

029.0-beta

Platform (JVM/JS/Native)

JVM

Operating System and version

MacOS

@cloudshiftchris cloudshiftchris added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Jul 28, 2023
@aajtodd
Copy link
Collaborator

aajtodd commented Jul 31, 2023

Is this just a "nice to have" request or is this blocking something for you?

As far as I understand the request you can get this now by wrapping client creation in a way that you consult your own region provider and pass that to client construction.

e.g.

val resolvedRegion = regionProvider.getRegion()
val s3 = S3Client.fromEnvironment{
    region = resolvedRegion
}

@aajtodd aajtodd removed the needs-triage This issue or PR still needs to be triaged. label Jul 31, 2023
@cloudshiftchris
Copy link
Author

Not blocking anything atm, have done as noted above, creating our own StaticRegionProvider driven by configuration.

Q: what are RegionProviders used for in Kotlin SDK? They aren't symmetrical with CredentialsProvider behaviour (provider set at construction time, queried for each API call). Kotlin SDK clients look to use a stringly-typed region parameter at construction time.

@aajtodd
Copy link
Collaborator

aajtodd commented Jul 31, 2023

Q: what are RegionProviders used for in Kotlin SDK? They aren't symmetrical with CredentialsProvider behaviour (provider set at construction time, queried for each API call). Kotlin SDK clients look to use a stringly-typed region parameter at construction time.

They're used in fromEnvironment when we need to try and auto detect the region that the client should be configured for. Unlike credentials, region is static once set and doesn't change through the lifetime of a client (e.g. region doesn't expire, your EC2 instance isn't going to magically be in a different region, etc). If you need to talk to a different region you would create a new client or use the withConfig extension (see developer guide here).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved.
Projects
None yet
Development

No branches or pull requests

2 participants