Skip to content

Commit

Permalink
ktlint
Browse files Browse the repository at this point in the history
  • Loading branch information
lauzadis committed Jan 8, 2025
1 parent adb9d72 commit 2631b3a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
*/
package aws.sdk.kotlin.services.dsql

import aws.sdk.kotlin.runtime.auth.AuthTokenGenerator
import aws.sdk.kotlin.runtime.auth.credentials.DefaultChainCredentialsProvider
import aws.smithy.kotlin.runtime.auth.awscredentials.Credentials
import aws.smithy.kotlin.runtime.net.url.Url
import kotlinx.coroutines.runBlocking
import kotlin.time.Duration
import kotlin.time.Duration.Companion.seconds
import aws.sdk.kotlin.runtime.auth.AuthTokenGenerator

/**
* Generates an IAM authentication token for use with DSQL databases
* @param credentials The credentials to use when generating the auth token, defaults to resolving credentials from the [DefaultChainCredentialsProvider]
*/
public class AuthTokenGenerator(
public val credentials: Credentials? = runBlocking { DefaultChainCredentialsProvider().resolve() }
public val credentials: Credentials? = runBlocking { DefaultChainCredentialsProvider().resolve() },
) {
private val generator = AuthTokenGenerator("dsql", credentials)

Expand Down Expand Up @@ -56,4 +56,4 @@ public class AuthTokenGenerator(

return generator.generateAuthToken(dbConnectAdminEndpoint, region, expiration)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class AuthTokenGeneratorTest {
.generateDbConnectAuthToken(
endpoint = Url { host = Host.parse("peccy.dsql.us-east-1.on.aws") },
region = "us-east-1",
expiration = 450.seconds
expiration = 450.seconds,
)

// Token should have a parameter Action=DbConnect
Expand All @@ -49,7 +49,7 @@ class AuthTokenGeneratorTest {
.generateDbConnectAdminAuthToken(
endpoint = Url { host = Host.parse("peccy.dsql.us-east-1.on.aws") },
region = "us-east-1",
expiration = 450.seconds
expiration = 450.seconds,
)

// Token should have a parameter Action=DbConnect
Expand All @@ -66,4 +66,4 @@ class AuthTokenGeneratorTest {
assertFalse(token.contains(it))
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import kotlin.time.Duration.Companion.seconds
* @param credentials The credentials to use when generating the auth token, defaults to resolving credentials from the [DefaultChainCredentialsProvider]
*/
public class AuthTokenGenerator(
public val credentials: Credentials? = runBlocking { DefaultChainCredentialsProvider().resolve() }
public val credentials: Credentials? = runBlocking { DefaultChainCredentialsProvider().resolve() },
) {
private val generator = AuthTokenGenerator("rds-db", credentials)

Expand All @@ -40,4 +40,4 @@ public class AuthTokenGenerator(

return generator.generateAuthToken(dbConnectEndpoint, region, expiration)
}
}
}
4 changes: 2 additions & 2 deletions services/rds/common/test/AuthTokenGeneratorTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class AuthTokenGeneratorTest {
},
region = "us-east-1",
username = "peccy",
expiration = 450.seconds
expiration = 450.seconds,
)

// Token should have a parameter Action=DbConnect
Expand All @@ -44,4 +44,4 @@ class AuthTokenGeneratorTest {
assertFalse(token.contains(it))
}
}
}
}

0 comments on commit 2631b3a

Please sign in to comment.