From 6eaa95bd98bae2542fc6bb752a5847b033d68962 Mon Sep 17 00:00:00 2001 From: 0marperez Date: Wed, 18 Oct 2023 16:05:41 -0400 Subject: [PATCH 1/4] Removed CLI only S3 config options & refactor others to be top level --- .../s3/ClientConfigIntegration.kt | 36 +++++-------------- .../endpoints/BindAwsEndpointBuiltins.kt | 2 -- .../services/s3/internal/FinalizeS3Config.kt | 19 ++++------ 3 files changed, 14 insertions(+), 43 deletions(-) diff --git a/codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/customization/s3/ClientConfigIntegration.kt b/codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/customization/s3/ClientConfigIntegration.kt index 8222801d136..01dde8bf3b9 100644 --- a/codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/customization/s3/ClientConfigIntegration.kt +++ b/codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/customization/s3/ClientConfigIntegration.kt @@ -28,40 +28,22 @@ class ClientConfigIntegration : KotlinIntegration { model.expectShape(settings.service).isS3 companion object { - val EnableAccelerateProp: ConfigProperty = ConfigProperty { - name = "enableAccelerate" + val UseArnRegionProp: ConfigProperty = ConfigProperty { + name = "useArnRegion" useSymbolWithNullableBuilder(KotlinTypes.Boolean, "false") documentation = """ - Flag to support [S3 transfer acceleration](https://docs.aws.amazon.com/AmazonS3/latest/userguide/transfer-acceleration.html) - with this client. + Flag to enforce using a bucket arn with a region matching the client config when making requests with + [S3 access points](https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-points.html). """.trimIndent() } - val ForcePathStyleProp: ConfigProperty = ConfigProperty { - name = "forcePathStyle" - useSymbolWithNullableBuilder(KotlinTypes.Boolean, "false") + val DisableMrapProp: ConfigProperty = ConfigProperty { + name = "disableMrap" + useSymbolWithNullableBuilder(KotlinTypes.Boolean, "true") documentation = """ - Flag to use legacy path-style addressing when making requests. + Flag to disable [S3 multi-region access points](https://docs.aws.amazon.com/AmazonS3/latest/userguide/MultiRegionAccessPoints.html). """.trimIndent() } - - val UseArnRegionProp: ConfigProperty = ConfigProperty.Boolean( - "useArnRegion", - defaultValue = false, - documentation = """ - Flag to enforce using a bucket arn with a region matching the client config when making requests with - [S3 access points](https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-points.html). - """.trimIndent(), - ) - - // FUTURE: default signer doesn't yet implement sigv4a, default to mrap OFF until it does - val DisableMrapProp: ConfigProperty = ConfigProperty.Boolean( - "disableMrap", - defaultValue = true, - documentation = """ - Flag to disable [S3 multi-region access points](https://docs.aws.amazon.com/AmazonS3/latest/userguide/MultiRegionAccessPoints.html). - """.trimIndent(), - ) } override fun preprocessModel(model: Model, settings: KotlinSettings): Model { @@ -83,8 +65,6 @@ class ClientConfigIntegration : KotlinIntegration { override fun additionalServiceConfigProps(ctx: CodegenContext): List = listOf( - EnableAccelerateProp, - ForcePathStyleProp, UseArnRegionProp, DisableMrapProp, ) diff --git a/codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/protocols/endpoints/BindAwsEndpointBuiltins.kt b/codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/protocols/endpoints/BindAwsEndpointBuiltins.kt index 4344fefb4bd..0096cd59131 100644 --- a/codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/protocols/endpoints/BindAwsEndpointBuiltins.kt +++ b/codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/protocols/endpoints/BindAwsEndpointBuiltins.kt @@ -50,8 +50,6 @@ fun renderBindAwsBuiltins(ctx: ProtocolGenerator.GenerationContext, writer: Kotl "AWS::UseFIPS" -> renderBasicConfigBinding(writer, it, AwsServiceConfigIntegration.UseFipsProp.propertyName) "AWS::UseDualStack" -> renderBasicConfigBinding(writer, it, AwsServiceConfigIntegration.UseDualStackProp.propertyName) - "AWS::S3::Accelerate" -> renderBasicConfigBinding(writer, it, S3ClientConfigIntegration.EnableAccelerateProp.propertyName) - "AWS::S3::ForcePathStyle" -> renderBasicConfigBinding(writer, it, S3ClientConfigIntegration.ForcePathStyleProp.propertyName) "AWS::S3::DisableMultiRegionAccessPoints" -> renderBasicConfigBinding(writer, it, S3ClientConfigIntegration.DisableMrapProp.propertyName) "AWS::S3::UseArnRegion" -> renderBasicConfigBinding(writer, it, S3ClientConfigIntegration.DisableMrapProp.propertyName) "AWS::S3Control::UseArnRegion" -> renderBasicConfigBinding(writer, it, S3ControlClientConfigIntegration.UseArnRegionProp.propertyName) diff --git a/services/s3/common/src/aws/sdk/kotlin/services/s3/internal/FinalizeS3Config.kt b/services/s3/common/src/aws/sdk/kotlin/services/s3/internal/FinalizeS3Config.kt index 1376b0de02f..2806118eaca 100644 --- a/services/s3/common/src/aws/sdk/kotlin/services/s3/internal/FinalizeS3Config.kt +++ b/services/s3/common/src/aws/sdk/kotlin/services/s3/internal/FinalizeS3Config.kt @@ -4,7 +4,6 @@ */ package aws.sdk.kotlin.services.s3.internal -import aws.sdk.kotlin.runtime.ConfigurationException import aws.sdk.kotlin.runtime.config.profile.AwsProfile import aws.sdk.kotlin.runtime.config.profile.AwsSharedConfig import aws.sdk.kotlin.runtime.config.profile.getBooleanOrNull @@ -13,19 +12,13 @@ import aws.smithy.kotlin.runtime.util.LazyAsyncValue internal suspend fun finalizeS3Config(builder: S3Client.Builder, sharedConfig: LazyAsyncValue) { sharedConfig.get().activeProfile.let { - builder.config.forcePathStyle = builder.config.forcePathStyle ?: it.forcePathStyle - builder.config.enableAccelerate = builder.config.enableAccelerate ?: it.enableAccelerate + builder.config.useArnRegion = builder.config.useArnRegion ?: it.useArnRegion + builder.config.disableMrap = builder.config.disableMrap ?: it.disableMrap } } -private val AwsProfile.forcePathStyle: Boolean? - get() = getOrNull("s3", "addressing_style")?.lowercase()?.let { - when (it) { - "virtual", "auto" -> false - "path" -> true - else -> throw ConfigurationException("invalid value '$it' for config property s3.addressing_style") - } - } +private val AwsProfile.useArnRegion: Boolean? + get() = getBooleanOrNull("s3_use_arn_region") -private val AwsProfile.enableAccelerate: Boolean? - get() = getBooleanOrNull("s3", "use_accelerate_endpoint") +private val AwsProfile.disableMrap: Boolean? + get() = getBooleanOrNull("s3_disable_multiregion_access_points") From 51496bc3a7e37f7d1056fcb84d0f78fba370c6a7 Mon Sep 17 00:00:00 2001 From: 0marperez Date: Wed, 18 Oct 2023 16:15:49 -0400 Subject: [PATCH 2/4] Changelog --- .changes/5adb30dd-3a4f-4a3c-aa31-e6455785c9c4.json | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changes/5adb30dd-3a4f-4a3c-aa31-e6455785c9c4.json diff --git a/.changes/5adb30dd-3a4f-4a3c-aa31-e6455785c9c4.json b/.changes/5adb30dd-3a4f-4a3c-aa31-e6455785c9c4.json new file mode 100644 index 00000000000..04c59227aca --- /dev/null +++ b/.changes/5adb30dd-3a4f-4a3c-aa31-e6455785c9c4.json @@ -0,0 +1,5 @@ +{ + "id": "5adb30dd-3a4f-4a3c-aa31-e6455785c9c4", + "type": "misc", + "description": "**Breaking** Removed & from S3 config" +} \ No newline at end of file From 9f0499a9708f6f1d7dc2bd2192bac6028d74e292 Mon Sep 17 00:00:00 2001 From: 0marperez Date: Wed, 18 Oct 2023 16:17:31 -0400 Subject: [PATCH 3/4] Changelog correction --- .changes/5adb30dd-3a4f-4a3c-aa31-e6455785c9c4.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changes/5adb30dd-3a4f-4a3c-aa31-e6455785c9c4.json b/.changes/5adb30dd-3a4f-4a3c-aa31-e6455785c9c4.json index 04c59227aca..f93bf31bbbe 100644 --- a/.changes/5adb30dd-3a4f-4a3c-aa31-e6455785c9c4.json +++ b/.changes/5adb30dd-3a4f-4a3c-aa31-e6455785c9c4.json @@ -1,5 +1,5 @@ { "id": "5adb30dd-3a4f-4a3c-aa31-e6455785c9c4", "type": "misc", - "description": "**Breaking** Removed & from S3 config" + "description": "**Breaking** Removed `enableAccelerate` & `forcePathStyle` from S3 config" } \ No newline at end of file From 88bd428649d49890a0f06fad4bd5f93bcd420334 Mon Sep 17 00:00:00 2001 From: 0marperez Date: Thu, 19 Oct 2023 10:18:15 -0400 Subject: [PATCH 4/4] Imporved changelogs & re-added FIXME --- .changes/5adb30dd-3a4f-4a3c-aa31-e6455785c9c4.json | 2 +- .changes/86e02b43-e485-46be-ba3f-429c59e45078.json | 5 +++++ .../codegen/customization/s3/ClientConfigIntegration.kt | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changes/86e02b43-e485-46be-ba3f-429c59e45078.json diff --git a/.changes/5adb30dd-3a4f-4a3c-aa31-e6455785c9c4.json b/.changes/5adb30dd-3a4f-4a3c-aa31-e6455785c9c4.json index f93bf31bbbe..fada19823b3 100644 --- a/.changes/5adb30dd-3a4f-4a3c-aa31-e6455785c9c4.json +++ b/.changes/5adb30dd-3a4f-4a3c-aa31-e6455785c9c4.json @@ -1,5 +1,5 @@ { "id": "5adb30dd-3a4f-4a3c-aa31-e6455785c9c4", "type": "misc", - "description": "**Breaking** Removed `enableAccelerate` & `forcePathStyle` from S3 config" + "description": "**Breaking** Removed `enableAccelerate` & `forcePathStyle` from S3 config. As well as `use_accelerate_endpoint` & `addressing_style` from AWS profile configuration" } \ No newline at end of file diff --git a/.changes/86e02b43-e485-46be-ba3f-429c59e45078.json b/.changes/86e02b43-e485-46be-ba3f-429c59e45078.json new file mode 100644 index 00000000000..158a2e48cc9 --- /dev/null +++ b/.changes/86e02b43-e485-46be-ba3f-429c59e45078.json @@ -0,0 +1,5 @@ +{ + "id": "86e02b43-e485-46be-ba3f-429c59e45078", + "type": "misc", + "description": "Added `s3_use_arn_region` & `s3_disable_multiregion_access_points` to AWS profile configuration" +} \ No newline at end of file diff --git a/codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/customization/s3/ClientConfigIntegration.kt b/codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/customization/s3/ClientConfigIntegration.kt index 01dde8bf3b9..b04fa56f497 100644 --- a/codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/customization/s3/ClientConfigIntegration.kt +++ b/codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/customization/s3/ClientConfigIntegration.kt @@ -37,6 +37,7 @@ class ClientConfigIntegration : KotlinIntegration { """.trimIndent() } + // FIXME: default signer doesn't yet implement sigv4a, default to mrap OFF until it does val DisableMrapProp: ConfigProperty = ConfigProperty { name = "disableMrap" useSymbolWithNullableBuilder(KotlinTypes.Boolean, "true")