File tree Expand file tree Collapse file tree 5 files changed +6
-6
lines changed
src/main/kotlin/com/kotlin/sts Expand file tree Collapse file tree 5 files changed +6
-6
lines changed Original file line number Diff line number Diff line change 11import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
22
33plugins {
4- kotlin(" jvm" ) version " 1.9 .0"
4+ kotlin(" jvm" ) version " 2.1 .0"
55 application
66}
77
@@ -27,7 +27,7 @@ repositories {
2727}
2828apply (plugin = " org.jlleitschuh.gradle.ktlint" )
2929dependencies {
30- implementation(platform(" aws.sdk.kotlin:bom:1.3.112 " ))
30+ implementation(platform(" aws.sdk.kotlin:bom:1.4.119 " ))
3131 implementation(" aws.sdk.kotlin:sts" )
3232 implementation(" aws.sdk.kotlin:secretsmanager" )
3333 implementation(" aws.smithy.kotlin:http-client-engine-okhttp" )
Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ suspend fun assumeGivenRole(
6464 roleSessionName = roleSessionNameVal
6565 }
6666
67- StsClient { region = " us-east-1" }.use { stsClient ->
67+ StsClient .fromEnvironment { region = " us-east-1" }.use { stsClient ->
6868 val roleResponse = stsClient.assumeRole(roleRequest)
6969 val myCreds = roleResponse.credentials
7070 val exTime = myCreds?.expiration
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ suspend fun getKeyInfo(accessKeyIdVal: String?) {
4141 accessKeyId = accessKeyIdVal
4242 }
4343
44- StsClient { region = " us-east-1" }.use { stsClient ->
44+ StsClient .fromEnvironment { region = " us-east-1" }.use { stsClient ->
4545 val accessResponse = stsClient.getAccessKeyInfo(accessRequest)
4646 println (" The account associated with the access key is ${accessResponse.account} " )
4747 }
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ suspend fun main() {
2121
2222// snippet-start:[sts.kotlin.get_call_id.main]
2323suspend fun getCallerId () {
24- StsClient { region = " us-east-1" }.use { stsClient ->
24+ StsClient .fromEnvironment { region = " us-east-1" }.use { stsClient ->
2525 val response = stsClient.getCallerIdentity(GetCallerIdentityRequest {})
2626 println (" The user id is ${response.userId} " )
2727 println (" The ARN value is ${response.arn} " )
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ suspend fun getToken() {
2626 durationSeconds = 1500
2727 }
2828
29- StsClient { region = " us-east-1" }.use { stsClient ->
29+ StsClient .fromEnvironment { region = " us-east-1" }.use { stsClient ->
3030 val tokenResponse = stsClient.getSessionToken(request)
3131 println (" The token value is ${tokenResponse.credentials?.sessionToken} " )
3232 }
You can’t perform that action at this time.
0 commit comments