Skip to content

Commit bcff673

Browse files
authored
Merge branch 'main' into dependabot/gradle/otel-version-1.52.0
2 parents 41101fd + 1285977 commit bcff673

File tree

9 files changed

+74
-19
lines changed

9 files changed

+74
-19
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Changelog
22

3+
## [1.5.4] - 08/07/2025
4+
35
## [1.5.3] - 07/28/2025
46

57
### Features

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ buildscript {
1919
https://github.com/Kotlin/dokka/issues/3472#issuecomment-1929712374
2020
https://github.com/Kotlin/dokka/issues/3194#issuecomment-1929382630
2121
*/
22-
classpath(enforcedPlatform("com.fasterxml.jackson:jackson-bom:2.19.2"))
22+
classpath(enforcedPlatform("com.fasterxml.jackson:jackson-bom:2.15.3"))
2323
}
2424
}
2525

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ kotlinx.atomicfu.enableNativeIrTransformation=false
1313
org.gradle.jvmargs=-Xmx2G -XX:MaxMetaspaceSize=1G
1414

1515
# SDK
16-
sdkVersion=1.5.4-SNAPSHOT
16+
sdkVersion=1.5.5-SNAPSHOT
1717

1818
# codegen
19-
codegenVersion=0.35.4-SNAPSHOT
19+
codegenVersion=0.35.5-SNAPSHOT
2020

2121
# FIXME Remove after Dokka 2.0 Gradle plugin is stable
2222
org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled

gradle/libs.versions.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ okhttp-version = "5.1.0"
1111
okhttp4-version = "4.12.0"
1212
okio-version = "3.16.0"
1313
otel-version = "1.52.0"
14-
slf4j-version = "2.0.16"
14+
slf4j-version = "2.0.17"
1515
slf4j-v1x-version = "1.7.36"
1616
crt-kotlin-version = "0.10.0"
1717
micrometer-version = "1.15.2"
@@ -25,7 +25,7 @@ junit-version = "5.13.4"
2525
kotest-version = "5.9.1"
2626
kotlin-compile-testing-version = "0.8.0"
2727
kotlinx-benchmark-version = "0.4.14"
28-
kotlinx-serialization-version = "1.7.3"
28+
kotlinx-serialization-version = "1.9.0"
2929
docker-java-version = "3.4.0"
3030
ktor-version = "3.2.3"
3131
kaml-version = "0.55.0"

runtime/auth/http-auth/api/http-auth.api

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ public abstract interface class aws/smithy/kotlin/runtime/http/auth/CloseableBea
6262
public final class aws/smithy/kotlin/runtime/http/auth/EnvironmentBearerTokenProvider : aws/smithy/kotlin/runtime/http/auth/BearerTokenProvider {
6363
public fun <init> (Ljava/lang/String;Laws/smithy/kotlin/runtime/util/PlatformProvider;)V
6464
public synthetic fun <init> (Ljava/lang/String;Laws/smithy/kotlin/runtime/util/PlatformProvider;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
65+
public fun <init> (Ljava/lang/String;Ljava/lang/String;Laws/smithy/kotlin/runtime/util/PlatformProvider;)V
66+
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Laws/smithy/kotlin/runtime/util/PlatformProvider;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
6567
public fun resolve (Laws/smithy/kotlin/runtime/collections/Attributes;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
6668
}
6769

runtime/auth/http-auth/common/src/aws/smithy/kotlin/runtime/http/auth/EnvironmentBearerTokenProvider.kt

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,37 @@
44
*/
55
package aws.smithy.kotlin.runtime.http.auth
66

7+
import aws.smithy.kotlin.runtime.businessmetrics.SmithyBusinessMetric
8+
import aws.smithy.kotlin.runtime.businessmetrics.emitBusinessMetric
79
import aws.smithy.kotlin.runtime.collections.Attributes
8-
import aws.smithy.kotlin.runtime.collections.emptyAttributes
10+
import aws.smithy.kotlin.runtime.collections.mutableAttributes
911
import aws.smithy.kotlin.runtime.time.Instant
1012
import aws.smithy.kotlin.runtime.util.PlatformProvider
1113

1214
/**
13-
* A [BearerTokenProvider] that extracts the bearer token from the target environment variable.
15+
* A [BearerTokenProvider] that extracts the bearer token from JVM system properties or environment variables.
1416
*/
1517
public class EnvironmentBearerTokenProvider(
16-
private val key: String,
18+
private val sysPropKey: String,
19+
private val envKey: String,
1720
private val platform: PlatformProvider = PlatformProvider.System,
1821
) : BearerTokenProvider {
22+
@Deprecated("This constructor does not support a parameter for a system property key and will be removed in version 1.6.x")
23+
public constructor(
24+
envKey: String,
25+
platform: PlatformProvider = PlatformProvider.System,
26+
) : this("", envKey, platform)
27+
1928
override suspend fun resolve(attributes: Attributes): BearerToken {
20-
val bearerToken = platform.getenv(key)
21-
?: error("$key environment variable is not set")
29+
val bearerToken = sysPropKey.takeUnless(String::isBlank)?.let(platform::getProperty)
30+
?: platform.getenv(envKey)
31+
if (bearerToken.isNullOrBlank()) throw IllegalStateException("""Missing values for system property "$sysPropKey" and environment variable "$envKey"""")
2232

2333
return object : BearerToken {
2434
override val token: String = bearerToken
25-
override val attributes: Attributes = emptyAttributes()
35+
override val attributes: Attributes = mutableAttributes().apply {
36+
emitBusinessMetric(SmithyBusinessMetric.BEARER_SERVICE_ENV_VARS)
37+
}
2638
override val expiration: Instant? = null
2739
}
2840
}
Lines changed: 45 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package aws.smithy.kotlin.runtime.http.auth
22

3-
import aws.smithy.kotlin.runtime.collections.emptyAttributes
43
import aws.smithy.kotlin.runtime.util.TestPlatformProvider
54
import kotlinx.coroutines.test.runTest
65
import kotlin.test.Test
@@ -9,27 +8,65 @@ import kotlin.test.assertFailsWith
98

109
class EnvironmentBearerTokenProviderTest {
1110
@Test
12-
fun testResolveWithValidToken() = runTest {
11+
fun testResolveFromEnvVar() = runTest {
1312
val provider = EnvironmentBearerTokenProvider(
14-
"TEST_TOKEN",
15-
TestPlatformProvider(mutableMapOf("TEST_TOKEN" to "test-bearer-token")),
13+
"TEST_SYS_PROPS_TOKEN",
14+
"TEST_ENV_TOKEN",
15+
TestPlatformProvider(
16+
env = mapOf("TEST_ENV_TOKEN" to "test-env-bearer-token"),
17+
),
1618
)
1719

1820
val token = provider.resolve()
1921

20-
assertEquals("test-bearer-token", token.token)
22+
assertEquals("test-env-bearer-token", token.token)
23+
}
24+
25+
@Test
26+
fun testResolveFromSysProps() = runTest {
27+
val provider = EnvironmentBearerTokenProvider(
28+
"TEST_SYS_PROPS_TOKEN",
29+
"TEST_ENV_TOKEN",
30+
TestPlatformProvider(
31+
props = mapOf("TEST_SYS_PROPS_TOKEN" to "test-sys-props-bearer-token"),
32+
),
33+
)
34+
35+
val token = provider.resolve()
36+
37+
assertEquals("test-sys-props-bearer-token", token.token)
38+
}
39+
40+
@Test
41+
fun testResolutionOrder() = runTest {
42+
val provider = EnvironmentBearerTokenProvider(
43+
"TEST_SYS_PROPS_TOKEN",
44+
"TEST_ENV_TOKEN",
45+
TestPlatformProvider(
46+
props = mapOf("TEST_SYS_PROPS_TOKEN" to "test-sys-props-bearer-token"),
47+
env = mapOf("TEST_ENV_TOKEN" to "test-env-bearer-token"),
48+
),
49+
)
50+
51+
val token = provider.resolve()
52+
53+
assertEquals("test-sys-props-bearer-token", token.token)
2154
}
2255

2356
@Test
2457
fun testResolveWithMissingToken() = runTest {
2558
val provider = EnvironmentBearerTokenProvider(
2659
"MISSING_TEST_TOKEN",
27-
TestPlatformProvider(mutableMapOf()),
60+
"MISSING_TEST_TOKEN",
61+
TestPlatformProvider(
62+
env = mapOf("TEST_TOKEN" to "test-env-bearer-token"),
63+
props = mapOf("TEST_TOKEN" to "test-sys-props-bearer-token"),
64+
),
2865
)
2966

3067
val exception = assertFailsWith<IllegalStateException> {
31-
provider.resolve(emptyAttributes())
68+
provider.resolve()
3269
}
33-
assertEquals("MISSING_TEST_TOKEN environment variable is not set", exception.message)
70+
assertEquals("Missing values for system property \"MISSING_TEST_TOKEN\" and environment variable \"MISSING_TEST_TOKEN\"", exception.message)
3471
}
3572
}

runtime/runtime-core/api/runtime-core.api

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ public final class aws/smithy/kotlin/runtime/businessmetrics/SmithyBusinessMetri
107107
public static final field ACCOUNT_ID_MODE_DISABLED Laws/smithy/kotlin/runtime/businessmetrics/SmithyBusinessMetric;
108108
public static final field ACCOUNT_ID_MODE_PREFERRED Laws/smithy/kotlin/runtime/businessmetrics/SmithyBusinessMetric;
109109
public static final field ACCOUNT_ID_MODE_REQUIRED Laws/smithy/kotlin/runtime/businessmetrics/SmithyBusinessMetric;
110+
public static final field BEARER_SERVICE_ENV_VARS Laws/smithy/kotlin/runtime/businessmetrics/SmithyBusinessMetric;
110111
public static final field FLEXIBLE_CHECKSUMS_REQ_CRC32 Laws/smithy/kotlin/runtime/businessmetrics/SmithyBusinessMetric;
111112
public static final field FLEXIBLE_CHECKSUMS_REQ_CRC32C Laws/smithy/kotlin/runtime/businessmetrics/SmithyBusinessMetric;
112113
public static final field FLEXIBLE_CHECKSUMS_REQ_SHA1 Laws/smithy/kotlin/runtime/businessmetrics/SmithyBusinessMetric;

runtime/runtime-core/common/src/aws/smithy/kotlin/runtime/businessmetrics/BusinessMetricsUtils.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ public enum class SmithyBusinessMetric(public override val identifier: String) :
102102
FLEXIBLE_CHECKSUMS_REQ_WHEN_REQUIRED("a"),
103103
FLEXIBLE_CHECKSUMS_RES_WHEN_SUPPORTED("b"),
104104
FLEXIBLE_CHECKSUMS_RES_WHEN_REQUIRED("c"),
105+
BEARER_SERVICE_ENV_VARS("3"),
105106
;
106107

107108
override fun toString(): String = identifier

0 commit comments

Comments
 (0)