awslabs / aws-sdk-kotlin

Multiplatform AWS SDK for Kotlin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ProfileCredentialsProvider isn't available without internal modules

LDVSOFT opened this issue · comments

Describe the feature

One cannot provide explicitly a provider of class ProfileCredentialsProvider, since some of its constructor parameters are explicitly marked with aws.sdk.kotlin.runtime.InternalSdkApi. So, compared to Java v2 SDK, one couldn't reliably use it:

  1. It raises warnings on unstable non-published API (correctly),
  2. It requires bringing in aws.smithy.kotlin:http-client dependency (that might pull something else), where aws.sdk.kotlin:aws-config would probably suffice.

Is your Feature Request related to a problem?

Please consider custom configuration of a client that would like to share a bit of code like this:

import aws.sdk.kotlin.runtime.auth.credentials.ProfileCredentialsProvider
import aws.sdk.kotlin.runtime.client.AwsSdkClientConfig
import aws.smithy.kotlin.runtime.auth.awscredentials.CachedCredentialsProvider
import aws.smithy.kotlin.runtime.auth.awscredentials.CredentialsProviderConfig

fun <T> T.localSetup()
    where
        T: AwsSdkClientConfig.Builder,
        T: CredentialsProviderConfig.Builder
    = apply {
        region = "eu-west-1"
        credentialsProvider = CachedCredentialsProvider(
            ProfileCredentialsProvider("my-awesome-profile")
        )
    }

While it looks innocent it actually compiles against internal API signatures.

Proposed Solution

Don't know any ideas, sorry. It's clearly implementable, but probably that artifact separation was intended. A lo of Jars out there! Without purely collapsing the whole hierarchy with a dependency or building a stable HttpClient / runtime API I can't think of a solution myself.

Describe alternative solutions or features you've considered

No response

Acknowledge

  • I may be able to implement this feature request

AWS Kotlin SDK version used

1.0.52

Platform (JVM/JS/Native)

JVM OpenJDK 17

Operating System and version

Ubuntu 22.04 amd64

I don't think this was intentional and you should indeed be able to construct a profile credential provider without having to opt-in to the internal annotations. Thanks for the report, we'll look into fixing this.

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@0marperez I see that there were several automatic releases without the fix, what is your process for incorporating manual changes into release?

My apologies, we have a process but it has to be run manually. I'll be running it today and the change should be released tomorrow.