Skip to content

Commit b14626d

Browse files
luigi617ianbotsfaws-sdk-kotlin-ciluigi
authored
Merge main into server sdk (#1337)
Co-authored-by: Ian Botsford <[email protected]> Co-authored-by: aws-sdk-kotlin-ci <[email protected]> Co-authored-by: luigi <[email protected]>
1 parent 23606bd commit b14626d

File tree

79 files changed

+1501
-1159
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+1501
-1159
lines changed

.brazil.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55

66
"com.squareup.okhttp3:okhttp-coroutines:5.*": "OkHttp3Coroutines-5.x",
77
"com.squareup.okhttp3:okhttp:5.*": "OkHttp3-5.x",
8+
"com.squareup.okhttp3:okhttp-jvm:5.*": "OkHttp3-5.x",
89
"com.squareup.okio:okio-jvm:3.*": "OkioJvm-3.x",
910
"io.opentelemetry:opentelemetry-api:1.*": "Maven-io-opentelemetry_opentelemetry-api-1.x",
1011
"io.opentelemetry:opentelemetry-extension-kotlin:1.*": "Maven-io-opentelemetry_opentelemetry-extension-kotlin-1.x",
1112
"org.slf4j:slf4j-api:2.*": "Maven-org-slf4j_slf4j-api-2.x",
13+
"aws.sdk.kotlin.crt:aws-crt-kotlin:0.10.*": "AwsCrtKotlin-0.10.x",
1214
"aws.sdk.kotlin.crt:aws-crt-kotlin:0.9.*": "AwsCrtKotlin-0.9.x",
1315
"aws.sdk.kotlin.crt:aws-crt-kotlin:0.8.*": "AwsCrtKotlin-0.8.x",
1416
"com.squareup.okhttp3:okhttp:4.*": "OkHttp3-4.x",

.github/workflows/merge-main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ jobs:
1212
uses: awslabs/aws-kotlin-repo-tools/.github/actions/merge-main@main
1313
with:
1414
ci-user-pat: ${{ secrets.CI_USER_PAT }}
15-
exempt-branches: # Add any if required
15+
exempt-branches: # Add any if required

CHANGELOG.md

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

3+
## [1.5.1] - 07/17/2025
4+
5+
## [1.5.0] - 07/17/2025
6+
7+
### Features
8+
* Upgrade to Kotlin 2.2.0
9+
* [#1413](https://github.com/awslabs/aws-sdk-kotlin/issues/1413) ⚠️ **IMPORTANT**: Refactor endpoint discoverer classes into interfaces so custom implementations may be provided
10+
11+
### Fixes
12+
* [#1311](https://github.com/smithy-lang/smithy-kotlin/issues/1311) Reimplement idle connection monitoring using `okhttp3.EventListener` instead of now-internal `okhttp3.ConnectionListener`
13+
* [#1608](https://github.com/awslabs/aws-sdk-kotlin/issues/1608) Switch to always serialize defaults in requests. Previously fields were not serialized in requests if they weren't `@required` and hadn't been changed from the default value.
14+
* [#1413](https://github.com/awslabs/aws-sdk-kotlin/issues/1413) Favor `endpointUrl` instead of endpoint discovery if both are provided
15+
16+
### Miscellaneous
17+
* Add telemetry provider configuration to `DefaultAwsSigner`
18+
319
## [1.4.23] - 07/15/2025
420

521
## [1.4.22] - 07/02/2025

bom/build.gradle.kts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
77
import org.jetbrains.kotlin.gradle.plugin.KotlinMultiplatformPluginWrapper
88
import org.jetbrains.kotlin.gradle.plugin.KotlinTarget
99
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinMetadataTarget
10-
import org.jetbrains.kotlin.gradle.targets.js.KotlinJsTarget
11-
import java.util.*
1210

1311
plugins {
1412
`maven-publish`
@@ -52,7 +50,6 @@ fun createBomConstraintsAndVersionCatalog() {
5250

5351
fun Project.artifactId(target: KotlinTarget): String = when (target) {
5452
is KotlinMetadataTarget -> name
55-
is KotlinJsTarget -> "$name-js"
5653
else -> "$name-${target.targetName.lowercase()}"
5754
}
5855

codegen/smithy-aws-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/aws/customization/RegionSupport.kt

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,27 @@ class RegionSupport : KotlinIntegration {
4040
name = "region"
4141
symbol = KotlinTypes.String.toBuilder().nullable().build()
4242
documentation = """
43-
The region to sign with and make requests to.
43+
The AWS region to sign with and make requests to. When specified, this static region configuration
44+
takes precedence over other region resolution methods.
45+
46+
The region resolution order is:
47+
1. Static region (if specified)
48+
2. Custom region provider (if configured)
49+
3. Default region provider chain
50+
""".trimIndent()
51+
}
52+
53+
val RegionProviderProp: ConfigProperty = ConfigProperty {
54+
name = "regionProvider"
55+
symbol = RuntimeTypes.SmithyClient.Region.RegionProvider
56+
documentation = """
57+
An optional region provider that determines the AWS region for client operations. When specified, this provider
58+
takes precedence over the default region provider chain, unless a static region is explicitly configured.
59+
60+
The region resolution order is:
61+
1. Static region (if specified)
62+
2. Custom region provider (if configured)
63+
3. Default region provider chain
4464
""".trimIndent()
4565
}
4666
}
@@ -57,7 +77,7 @@ class RegionSupport : KotlinIntegration {
5777
return supportsSigv4 || hasRegionBuiltin || isAwsSdk
5878
}
5979

60-
override fun additionalServiceConfigProps(ctx: CodegenContext): List<ConfigProperty> = listOf(RegionProp)
80+
override fun additionalServiceConfigProps(ctx: CodegenContext): List<ConfigProperty> = listOf(RegionProp, RegionProviderProp)
6181

6282
override fun customizeEndpointResolution(ctx: ProtocolGenerator.GenerationContext): EndpointCustomization =
6383
object : EndpointCustomization {

codegen/smithy-aws-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/aws/protocols/AwsQuery.kt

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,23 @@ import software.amazon.smithy.kotlin.codegen.aws.protocols.core.AbstractQueryFor
1111
import software.amazon.smithy.kotlin.codegen.aws.protocols.core.AwsHttpBindingProtocolGenerator
1212
import software.amazon.smithy.kotlin.codegen.aws.protocols.core.QueryHttpBindingProtocolGenerator
1313
import software.amazon.smithy.kotlin.codegen.aws.protocols.formurl.QuerySerdeFormUrlDescriptorGenerator
14-
import software.amazon.smithy.kotlin.codegen.core.*
14+
import software.amazon.smithy.kotlin.codegen.core.KotlinWriter
15+
import software.amazon.smithy.kotlin.codegen.core.RenderingContext
16+
import software.amazon.smithy.kotlin.codegen.core.RuntimeTypes
17+
import software.amazon.smithy.kotlin.codegen.core.withBlock
1518
import software.amazon.smithy.kotlin.codegen.lang.KotlinTypes
16-
import software.amazon.smithy.kotlin.codegen.model.*
17-
import software.amazon.smithy.kotlin.codegen.rendering.protocol.*
18-
import software.amazon.smithy.kotlin.codegen.rendering.serde.*
19+
import software.amazon.smithy.kotlin.codegen.model.buildSymbol
20+
import software.amazon.smithy.kotlin.codegen.model.getTrait
21+
import software.amazon.smithy.kotlin.codegen.model.hasTrait
22+
import software.amazon.smithy.kotlin.codegen.rendering.protocol.ProtocolGenerator
23+
import software.amazon.smithy.kotlin.codegen.rendering.protocol.toRenderingContext
24+
import software.amazon.smithy.kotlin.codegen.rendering.serde.FormUrlSerdeDescriptorGenerator
25+
import software.amazon.smithy.kotlin.codegen.rendering.serde.StructuredDataParserGenerator
26+
import software.amazon.smithy.kotlin.codegen.rendering.serde.StructuredDataSerializerGenerator
27+
import software.amazon.smithy.kotlin.codegen.rendering.serde.XmlParserGenerator
1928
import software.amazon.smithy.model.shapes.*
20-
import software.amazon.smithy.model.traits.*
29+
import software.amazon.smithy.model.traits.XmlFlattenedTrait
30+
import software.amazon.smithy.model.traits.XmlNameTrait
2131

2232
/**
2333
* Handles generating the aws.protocols#awsQuery protocol for services.
@@ -45,7 +55,7 @@ class AwsQuery : QueryHttpBindingProtocolGenerator() {
4555
writer: KotlinWriter,
4656
) {
4757
writer.write("""checkNotNull(payload){ "unable to parse error from empty response" }""")
48-
writer.write("#T(payload)", RuntimeTypes.AwsXmlProtocols.parseRestXmlErrorResponseNoSuspend)
58+
writer.write("#T(payload)", RuntimeTypes.AwsXmlProtocols.parseRestXmlErrorResponse)
4959
}
5060
}
5161

codegen/smithy-aws-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/aws/protocols/Ec2Query.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ import software.amazon.smithy.codegen.core.Symbol
1010
import software.amazon.smithy.kotlin.codegen.aws.protocols.core.AbstractQueryFormUrlSerializerGenerator
1111
import software.amazon.smithy.kotlin.codegen.aws.protocols.core.QueryHttpBindingProtocolGenerator
1212
import software.amazon.smithy.kotlin.codegen.aws.protocols.formurl.QuerySerdeFormUrlDescriptorGenerator
13-
import software.amazon.smithy.kotlin.codegen.core.*
13+
import software.amazon.smithy.kotlin.codegen.core.KotlinWriter
14+
import software.amazon.smithy.kotlin.codegen.core.RenderingContext
15+
import software.amazon.smithy.kotlin.codegen.core.RuntimeTypes
16+
import software.amazon.smithy.kotlin.codegen.core.withBlock
1417
import software.amazon.smithy.kotlin.codegen.model.buildSymbol
1518
import software.amazon.smithy.kotlin.codegen.model.getTrait
1619
import software.amazon.smithy.kotlin.codegen.model.isNullable
@@ -39,7 +42,7 @@ class Ec2Query : QueryHttpBindingProtocolGenerator() {
3942
writer: KotlinWriter,
4043
) {
4144
writer.write("""checkNotNull(payload){ "unable to parse error from empty response" }""")
42-
writer.write("#T(payload)", RuntimeTypes.AwsXmlProtocols.parseEc2QueryErrorResponseNoSuspend)
45+
writer.write("#T(payload)", RuntimeTypes.AwsXmlProtocols.parseEc2QueryErrorResponse)
4346
}
4447
}
4548

codegen/smithy-aws-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/aws/protocols/RestXml.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ open class RestXml : AwsHttpBindingProtocolGenerator() {
6363
writer: KotlinWriter,
6464
) {
6565
writer.write("""checkNotNull(payload){ "unable to parse error from empty response" }""")
66-
writer.write("#T(payload)", RuntimeTypes.AwsXmlProtocols.parseRestXmlErrorResponseNoSuspend)
66+
writer.write("#T(payload)", RuntimeTypes.AwsXmlProtocols.parseRestXmlErrorResponse)
6767
}
6868
}
6969

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
package software.amazon.smithy.kotlin.codegen.aws.customization
2+
3+
import org.junit.jupiter.api.Test
4+
import software.amazon.smithy.kotlin.codegen.core.KotlinWriter
5+
import software.amazon.smithy.kotlin.codegen.model.expectShape
6+
import software.amazon.smithy.kotlin.codegen.rendering.ServiceClientConfigGenerator
7+
import software.amazon.smithy.kotlin.codegen.test.*
8+
import software.amazon.smithy.model.shapes.ServiceShape
9+
10+
class RegionSupportTest {
11+
@Test
12+
fun testRegionSupportProperties() {
13+
val model = """
14+
namespace com.test
15+
16+
use aws.protocols#awsJson1_1
17+
use aws.api#service
18+
use aws.auth#sigv4
19+
20+
@service(sdkId: "service with overrides", endpointPrefix: "service-with-overrides")
21+
@sigv4(name: "example")
22+
@awsJson1_1
23+
service Example {
24+
version: "1.0.0",
25+
operations: [GetFoo]
26+
}
27+
28+
operation GetFoo {}
29+
""".toSmithyModel()
30+
31+
val serviceShape = model.expectShape<ServiceShape>("com.test#Example")
32+
33+
val testCtx = model.newTestContext(serviceName = "Example")
34+
val writer = KotlinWriter("com.test")
35+
36+
val renderingCtx = testCtx.toRenderingContext(writer, serviceShape)
37+
.copy(integrations = listOf(RegionSupport()))
38+
39+
ServiceClientConfigGenerator(serviceShape, detectDefaultProps = false).render(renderingCtx, renderingCtx.writer)
40+
val contents = writer.toString()
41+
42+
val expectedProps = """
43+
public val region: String? = builder.region
44+
public val regionProvider: RegionProvider? = builder.regionProvider
45+
""".formatForTest()
46+
contents.shouldContainOnlyOnceWithDiff(expectedProps)
47+
48+
val expectedImpl = """
49+
/**
50+
* The AWS region to sign with and make requests to. When specified, this static region configuration
51+
* takes precedence over other region resolution methods.
52+
*
53+
* The region resolution order is:
54+
* 1. Static region (if specified)
55+
* 2. Custom region provider (if configured)
56+
* 3. Default region provider chain
57+
*/
58+
public var region: String? = null
59+
60+
/**
61+
* An optional region provider that determines the AWS region for client operations. When specified, this provider
62+
* takes precedence over the default region provider chain, unless a static region is explicitly configured.
63+
*
64+
* The region resolution order is:
65+
* 1. Static region (if specified)
66+
* 2. Custom region provider (if configured)
67+
* 3. Default region provider chain
68+
*/
69+
public var regionProvider: RegionProvider? = null
70+
""".formatForTest(indent = " ")
71+
contents.shouldContainOnlyOnceWithDiff(expectedImpl)
72+
}
73+
}

codegen/smithy-kotlin-codegen-testutils/src/main/kotlin/software/amazon/smithy/kotlin/codegen/test/ModelTestUtils.kt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import software.amazon.smithy.build.MockManifest
88
import software.amazon.smithy.codegen.core.SymbolProvider
99
import software.amazon.smithy.kotlin.codegen.*
1010
import software.amazon.smithy.kotlin.codegen.core.CodegenContext
11+
import software.amazon.smithy.kotlin.codegen.core.GenerationContext
1112
import software.amazon.smithy.kotlin.codegen.core.KotlinDelegator
1213
import software.amazon.smithy.kotlin.codegen.integration.KotlinIntegration
1314
import software.amazon.smithy.kotlin.codegen.model.OperationNormalizer
@@ -122,9 +123,11 @@ fun Model.newTestContext(
122123
val manifest = MockManifest()
123124
val provider: SymbolProvider = KotlinCodegenPlugin.createSymbolProvider(model = this, rootNamespace = packageName, serviceName = serviceName, settings = settings)
124125
val service = this.getShape(ShapeId.from("$packageName#$serviceName")).get().asServiceShape().get()
125-
val delegator = KotlinDelegator(settings, this, manifest, provider, integrations)
126126

127-
val ctx = ProtocolGenerator.GenerationContext(
127+
val codegenCtx = GenerationContext(this, provider, settings, generator, integrations)
128+
val delegator = KotlinDelegator(codegenCtx, manifest, integrations)
129+
130+
val generationCtx = ProtocolGenerator.GenerationContext(
128131
settings,
129132
this,
130133
service,
@@ -133,7 +136,8 @@ fun Model.newTestContext(
133136
generator.protocol,
134137
delegator,
135138
)
136-
return TestContext(ctx, manifest, generator)
139+
140+
return TestContext(generationCtx, manifest, generator)
137141
}
138142

139143
fun TestContext.toCodegenContext() = object : CodegenContext {
@@ -173,7 +177,7 @@ fun Model.defaultSettings(
173177
sdkId: String = TestModelDefault.SDK_ID,
174178
generateDefaultBuildFiles: Boolean = false,
175179
nullabilityCheckMode: CheckMode = CheckMode.CLIENT_CAREFUL,
176-
defaultValueSerializationMode: DefaultValueSerializationMode = DefaultValueSerializationMode.WHEN_DIFFERENT,
180+
defaultValueSerializationMode: DefaultValueSerializationMode = DefaultValueSerializationMode.DEFAULT,
177181
): KotlinSettings {
178182
val serviceId = if (serviceName == null) {
179183
this.inferService()

0 commit comments

Comments
 (0)