Skip to content

Commit 88ca6c0

Browse files
authored
Merge branch 'main' into v1.5-main-merge
2 parents c232d57 + 3f52868 commit 88ca6c0

29 files changed

+18180
-738
lines changed

CHANGELOG.md

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

3+
## [1.4.124] - 07/17/2025
4+
5+
### Features
6+
* (**cleanroomsml**) This release introduces Parquet result format support for ML Input Channel models in AWS Clean Rooms ML.
7+
* (**ec2**) AWS Free Tier Version2 Support
8+
* (**mailmanager**) Allow underscores in the local part of the input of the "Email recipients rewrite" action in rule sets.
9+
* (**mediaconvert**) This release expands the range of supported audio outputs to include xHE, 192khz FLAC and the deprecation of dual mono for AC3.
10+
* (**synthetics**) This feature allows AWS Synthetics customers to provide code dependencies using lambda layer while creating a canary
11+
12+
### Documentation
13+
* (**cloudfront**) Doc only update for CloudFront that fixes some customer-reported issues
14+
* (**keyspacesstreams**) Doc only update for the Amazon Keyspaces Streams API.
15+
* (**sfn**) Align input with style guidelines.
16+
17+
## [1.4.123] - 07/16/2025
18+
19+
### Features
20+
* (**bedrock**) This release adds support for on-demand custom model inference through CustomModelDeployment APIs for Amazon Bedrock.
21+
* (**bedrockagentcore**) Initial release of Amazon Bedrock AgentCore SDK including Runtime, Built-In Tools, Memory, Gateway and Identity.
22+
* (**bedrockagentcorecontrol**) Initial release of Amazon Bedrock AgentCore SDK including Runtime, Built-In Tools, Memory, Gateway and Identity.
23+
* (**bedrockruntime**) document update to support on demand custom model.
24+
* (**cloudwatchlogs**) CloudWatch Logs updates: Added X-Ray tracing for Amazon Bedrock Agent resources. Logs introduced Log Group level resource policies (managed through Put/Delete/Describe Resource Policy APIs). For more information, see CloudWatch Logs API documentation.
25+
* (**datasync**) AWS DataSync now supports IPv6 address inputs and outputs in create, update, and describe operations for NFS, SMB, and Object Storage locations
26+
* (**glue**) AWS Glue now supports schema, partition and sort management of Apache Iceberg tables using Glue SDK
27+
* (**guardduty**) Add expectedBucketOwner parameter to ThreatIntel and IPSet APIs.
28+
* (**iotwireless**) FuotaTaskId is not a valid IdentifierType for EventConfiguration and is being removed from possible IdentifierType values.
29+
* (**mediapackagev2**) This release adds support for CDN Authentication using Static Headers in MediaPackage v2.
30+
* (**networkflowmonitor**) Introducing 2 new scope status types - DEACTIVATING and DEACTIVATED.
31+
* (**paymentcryptographydata**) Expand length of message data field for Mac generation and validation to 8192 characters.
32+
* Add support for Bearer authentication using a token set in an environment variable for Bedrock services
33+
34+
### Documentation
35+
* (**sfn**) Doc-only update to introduction, and edits to clarify input parameter and the set of control characters.
36+
37+
## [1.4.122] - 07/16/2025
38+
39+
### Features
40+
* (**ecs**) This release removes hookDetails for the Amazon ECS native blue/green deployments.
41+
342
## [1.4.121] - 07/15/2025
443

544
### Features
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
package aws.sdk.kotlin.codegen.customization
6+
7+
import aws.sdk.kotlin.codegen.SdkIdTransform
8+
import aws.sdk.kotlin.codegen.ServiceClientCompanionObjectWriter
9+
import aws.sdk.kotlin.codegen.withTransform
10+
import software.amazon.smithy.kotlin.codegen.KotlinSettings
11+
import software.amazon.smithy.kotlin.codegen.core.*
12+
import software.amazon.smithy.kotlin.codegen.integration.AppendingSectionWriter
13+
import software.amazon.smithy.kotlin.codegen.integration.KotlinIntegration
14+
import software.amazon.smithy.kotlin.codegen.integration.SectionWriterBinding
15+
import software.amazon.smithy.kotlin.codegen.model.buildSymbol
16+
import software.amazon.smithy.kotlin.codegen.model.expectShape
17+
import software.amazon.smithy.kotlin.codegen.model.hasTrait
18+
import software.amazon.smithy.kotlin.codegen.model.knowledge.AwsSignatureVersion4
19+
import software.amazon.smithy.kotlin.codegen.rendering.ServiceClientGenerator
20+
import software.amazon.smithy.model.Model
21+
import software.amazon.smithy.model.shapes.ServiceShape
22+
import software.amazon.smithy.model.traits.HttpBearerAuthTrait
23+
24+
/**
25+
* Customization that enables sourcing Bearer tokens from an environment variable
26+
*
27+
* When a service-specific environment variable for bearer tokens is present (e.g., AWS_BEARER_TOKEN_BEDROCK),
28+
* this customization configures the auth scheme resolver to prefer the smithy.api#httpBearerAuth scheme
29+
* over other authentication methods. Additionally, it configures a token provider that extracts the bearer token
30+
* from the target environment variable.
31+
*/
32+
class EnvironmentBearerTokenCustomization : KotlinIntegration {
33+
// Currently only services with sigv4 service name 'bedrock' need this customization
34+
private val supportedSigningServiceNames = setOf("bedrock")
35+
36+
override fun enabledForService(model: Model, settings: KotlinSettings): Boolean {
37+
val serviceShape = settings.getService(model)
38+
if (!AwsSignatureVersion4.isSupportedAuthentication(model, serviceShape)) {
39+
return false
40+
}
41+
if (!serviceShape.hasTrait<HttpBearerAuthTrait>()) {
42+
return false
43+
}
44+
45+
return AwsSignatureVersion4.signingServiceName(serviceShape) in supportedSigningServiceNames
46+
}
47+
48+
override fun writeAdditionalFiles(ctx: CodegenContext, delegator: KotlinDelegator) {
49+
val serviceShape = ctx.model.expectShape<ServiceShape>(ctx.settings.service)
50+
val packageName = ctx.settings.pkg.name
51+
52+
delegator.useFileWriter(
53+
"FinalizeBearerTokenConfig.kt",
54+
"$packageName.auth",
55+
) { writer ->
56+
renderEnvironmentBearerTokenConfig(
57+
writer,
58+
ctx,
59+
serviceShape,
60+
)
61+
}
62+
}
63+
64+
private fun renderEnvironmentBearerTokenConfig(
65+
writer: KotlinWriter,
66+
ctx: CodegenContext,
67+
serviceShape: ServiceShape,
68+
) {
69+
val serviceSymbol = ctx.symbolProvider.toSymbol(serviceShape)
70+
val signingServiceName = AwsSignatureVersion4.signingServiceName(serviceShape)
71+
// Transform signing name to environment variable name
72+
val envVarSuffix = signingServiceName.withTransform(SdkIdTransform.UpperSnakeCase)
73+
val envVarName = "AWS_BEARER_TOKEN_$envVarSuffix"
74+
val authSchemeId = RuntimeTypes.Auth.Identity.AuthSchemeId
75+
76+
writer.withBlock(
77+
"internal fun finalizeBearerTokenConfig(builder: #1T.Builder, provider: #2T = #2T.System) {",
78+
"}",
79+
serviceSymbol,
80+
RuntimeTypes.Core.Utils.PlatformProvider,
81+
) {
82+
// The customization do nothing if environment variable is not set
83+
write("if (provider.getenv(#S) == null) { return }", envVarName)
84+
85+
// Configure auth scheme preference if customer hasn't specify one
86+
write("builder.config.authSchemePreference = builder.config.authSchemePreference ?: listOf(#T.HttpBearer)", authSchemeId)
87+
88+
// Promote HttpBearer to first position in auth scheme preference list
89+
withBlock("val filteredSchemes = builder.config.authSchemePreference?.filterNot {", "} ?: emptyList()") {
90+
write("it == #T.HttpBearer", authSchemeId)
91+
}
92+
93+
write("builder.config.authSchemePreference = listOf(#1T.HttpBearer) + filteredSchemes", authSchemeId)
94+
95+
write(
96+
"builder.config.bearerTokenProvider = builder.config.bearerTokenProvider ?: #T(#S, provider)",
97+
RuntimeTypes.Auth.HttpAuth.EnvironmentBearerTokenProvider,
98+
envVarName,
99+
)
100+
}
101+
}
102+
103+
override val sectionWriters: List<SectionWriterBinding>
104+
get() = listOf(
105+
SectionWriterBinding(
106+
ServiceClientCompanionObjectWriter.FinalizeEnvironmentalConfig,
107+
finalizeEnvironmentBearerTokenConfigWriter,
108+
),
109+
)
110+
111+
private val finalizeEnvironmentBearerTokenConfigWriter = AppendingSectionWriter { writer ->
112+
val serviceName = clientName(writer.getContextValue(ServiceClientGenerator.Sections.CompanionObject.SdkId))
113+
114+
val environmentBearerTokenConfig = buildSymbol {
115+
name = "finalizeBearerTokenConfig"
116+
namespace = "aws.sdk.kotlin.services.${serviceName.lowercase()}.auth"
117+
}
118+
119+
writer.write("#T(builder)", environmentBearerTokenConfig)
120+
}
121+
}

codegen/aws-sdk-codegen/src/main/resources/META-INF/services/software.amazon.smithy.kotlin.codegen.integration.KotlinIntegration

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,4 @@ aws.sdk.kotlin.codegen.smoketests.testing.SmokeTestSuccessHttpEngineIntegration
5050
aws.sdk.kotlin.codegen.smoketests.testing.SmokeTestFailHttpEngineIntegration
5151
aws.sdk.kotlin.codegen.customization.AwsQueryModeCustomization
5252
aws.sdk.kotlin.codegen.ModuleDocumentationIntegration
53+
aws.sdk.kotlin.codegen.customization.EnvironmentBearerTokenCustomization

codegen/aws-sdk-codegen/src/main/resources/aws/sdk/kotlin/codegen/endpoints.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13860,6 +13860,7 @@
1386013860
"endpoints" : {
1386113861
"af-south-1" : { },
1386213862
"ap-east-1" : { },
13863+
"ap-east-2" : { },
1386313864
"ap-northeast-1" : { },
1386413865
"ap-northeast-2" : { },
1386513866
"ap-northeast-3" : { },
@@ -21427,7 +21428,9 @@
2142721428
"ap-southeast-2" : { },
2142821429
"ap-southeast-3" : { },
2142921430
"ap-southeast-4" : { },
21431+
"ap-southeast-5" : { },
2143021432
"ca-central-1" : { },
21433+
"ca-west-1" : { },
2143121434
"eu-central-1" : { },
2143221435
"eu-central-2" : { },
2143321436
"eu-north-1" : { },
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
package aws.sdk.kotlin.codegen.customization
6+
7+
import software.amazon.smithy.kotlin.codegen.test.*
8+
import kotlin.test.Test
9+
import kotlin.test.assertFalse
10+
import kotlin.test.assertTrue
11+
12+
class EnvironmentBearerTokenCustomizationTest {
13+
@Test
14+
fun `test customization enabled for bedrock sigv4 signing name`() {
15+
val bedrockModel = """
16+
namespace com.test
17+
use aws.auth#sigv4
18+
use aws.api#service
19+
use smithy.api#httpBearerAuth
20+
21+
@sigv4(name: "bedrock")
22+
@httpBearerAuth
23+
@service(sdkId: "Bedrock")
24+
service Bedrock {
25+
version: "1.0.0"
26+
}
27+
""".trimIndent().toSmithyModel()
28+
29+
assertTrue {
30+
EnvironmentBearerTokenCustomization()
31+
.enabledForService(bedrockModel, bedrockModel.defaultSettings())
32+
}
33+
}
34+
35+
fun `test customization enabled for bedrock sigv4 signing name with different sdkId`() {
36+
val bedrockRuntimeModel = """
37+
namespace com.test
38+
use aws.auth#sigv4
39+
use aws.api#service
40+
use smithy.api#httpBearerAuth
41+
42+
@sigv4(name: "bedrock")
43+
@httpBearerAuth
44+
@service(sdkId: "Bedrock Runtime")
45+
service BedrockRuntime {
46+
version: "1.0.0"
47+
}
48+
""".trimIndent().toSmithyModel()
49+
50+
assertTrue {
51+
EnvironmentBearerTokenCustomization()
52+
.enabledForService(bedrockRuntimeModel, bedrockRuntimeModel.defaultSettings())
53+
}
54+
}
55+
56+
@Test
57+
fun `test customization not enabled for non-bedrock sigv4 signing name`() {
58+
val nonBedrockModel = """
59+
namespace com.test
60+
use aws.auth#sigv4
61+
use aws.api#service
62+
use smithy.api#httpBearerAuth
63+
64+
@sigv4(name: "s3")
65+
@httpBearerAuth
66+
@service(sdkId: "S3")
67+
service S3 {
68+
version: "1.0.0"
69+
}
70+
""".trimIndent().toSmithyModel()
71+
72+
assertFalse {
73+
EnvironmentBearerTokenCustomization()
74+
.enabledForService(nonBedrockModel, nonBedrockModel.defaultSettings())
75+
}
76+
}
77+
78+
@Test
79+
fun `test customization not enabled for model without sigv4 trait`() {
80+
val noSigV4Model = """
81+
namespace com.test
82+
use aws.api#service
83+
use smithy.api#httpBearerAuth
84+
85+
@service(sdkId: "NoSigV4")
86+
@httpBearerAuth
87+
service NoSigV4 {
88+
version: "1.0.0"
89+
}
90+
""".trimIndent().toSmithyModel()
91+
92+
assertFalse {
93+
EnvironmentBearerTokenCustomization()
94+
.enabledForService(noSigV4Model, noSigV4Model.defaultSettings())
95+
}
96+
}
97+
98+
@Test
99+
fun `test customization not enabled for model without bearer auth trait`() {
100+
val noBearerAuthModel = """
101+
namespace com.test
102+
use aws.auth#sigv4
103+
use aws.api#service
104+
105+
@sigv4(name: "bedrock")
106+
@service(sdkId: "BedrockNoBearerAuth")
107+
service BedrockNoBearerAuth {
108+
version: "1.0.0"
109+
}
110+
""".trimIndent().toSmithyModel()
111+
112+
assertFalse {
113+
EnvironmentBearerTokenCustomization()
114+
.enabledForService(noBearerAuthModel, noBearerAuthModel.defaultSettings())
115+
}
116+
}
117+
}

0 commit comments

Comments
 (0)