Skip to content

Commit

Permalink
Add CredentialsProvider.simpleClassName and override CachedCredential…
Browse files Browse the repository at this point in the history
…sProvider toString()
  • Loading branch information
0marperez committed Oct 11, 2024
1 parent a414d6e commit e416285
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions runtime/auth/aws-credentials/api/aws-credentials.api
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ public final class aws/smithy/kotlin/runtime/auth/awscredentials/CachedCredentia
public synthetic fun <init> (Laws/smithy/kotlin/runtime/auth/awscredentials/CredentialsProvider;JJLaws/smithy/kotlin/runtime/time/Clock;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun close ()V
public fun resolve (Laws/smithy/kotlin/runtime/collections/Attributes;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public fun toString ()Ljava/lang/String;
}

public final class aws/smithy/kotlin/runtime/auth/awscredentials/CachedCredentialsProviderKt {
Expand Down Expand Up @@ -62,6 +63,10 @@ public final class aws/smithy/kotlin/runtime/auth/awscredentials/CredentialsProv
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/Throwable;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
}

public final class aws/smithy/kotlin/runtime/auth/awscredentials/CredentialsProviderKt {
public static final fun getSimpleClassName (Laws/smithy/kotlin/runtime/auth/awscredentials/CredentialsProvider;)Ljava/lang/String;
}

public abstract interface class aws/smithy/kotlin/runtime/auth/awscredentials/SigV4aClientConfig {
public abstract fun getSigV4aSigningRegionSet ()Ljava/util/Set;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ public class CachedCredentialsProvider(
cachedCredentials.close()
source.closeIfCloseable()
}

override fun toString(): String = this.simpleClassName + ": " + this.source.simpleClassName
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,14 @@ public interface CredentialsProvider : IdentityProvider {
public interface CloseableCredentialsProvider :
CredentialsProvider,
Closeable

/**
* Retrieves the simple name of the class implementing [CredentialsProvider].
*
* This property uses Kotlin reflection to obtain the simple class name of
* the current instance of [CredentialsProvider]. The simple class name is
* the name of the class without the package qualification (e.g., "MyCredentialsProvider"
* instead of "com.example.MyCredentialsProvider").
*/
public val CredentialsProvider.simpleClassName: String
get() = this::class.simpleName ?: "AnonymousCredentialsProvider"

0 comments on commit e416285

Please sign in to comment.