Skip to content

Commit e416285

Browse files
committed
Add CredentialsProvider.simpleClassName and override CachedCredentialsProvider toString()
1 parent a414d6e commit e416285

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

runtime/auth/aws-credentials/api/aws-credentials.api

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ public final class aws/smithy/kotlin/runtime/auth/awscredentials/CachedCredentia
33
public synthetic fun <init> (Laws/smithy/kotlin/runtime/auth/awscredentials/CredentialsProvider;JJLaws/smithy/kotlin/runtime/time/Clock;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
44
public fun close ()V
55
public fun resolve (Laws/smithy/kotlin/runtime/collections/Attributes;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
6+
public fun toString ()Ljava/lang/String;
67
}
78

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

66+
public final class aws/smithy/kotlin/runtime/auth/awscredentials/CredentialsProviderKt {
67+
public static final fun getSimpleClassName (Laws/smithy/kotlin/runtime/auth/awscredentials/CredentialsProvider;)Ljava/lang/String;
68+
}
69+
6570
public abstract interface class aws/smithy/kotlin/runtime/auth/awscredentials/SigV4aClientConfig {
6671
public abstract fun getSigV4aSigningRegionSet ()Ljava/util/Set;
6772
}

runtime/auth/aws-credentials/common/src/aws/smithy/kotlin/runtime/auth/awscredentials/CachedCredentialsProvider.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ public class CachedCredentialsProvider(
7373
cachedCredentials.close()
7474
source.closeIfCloseable()
7575
}
76+
77+
override fun toString(): String = this.simpleClassName + ": " + this.source.simpleClassName
7678
}
7779

7880
/**

runtime/auth/aws-credentials/common/src/aws/smithy/kotlin/runtime/auth/awscredentials/CredentialsProvider.kt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,14 @@ public interface CredentialsProvider : IdentityProvider {
2727
public interface CloseableCredentialsProvider :
2828
CredentialsProvider,
2929
Closeable
30+
31+
/**
32+
* Retrieves the simple name of the class implementing [CredentialsProvider].
33+
*
34+
* This property uses Kotlin reflection to obtain the simple class name of
35+
* the current instance of [CredentialsProvider]. The simple class name is
36+
* the name of the class without the package qualification (e.g., "MyCredentialsProvider"
37+
* instead of "com.example.MyCredentialsProvider").
38+
*/
39+
public val CredentialsProvider.simpleClassName: String
40+
get() = this::class.simpleName ?: "AnonymousCredentialsProvider"

0 commit comments

Comments
 (0)