Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: only enable aws-chunked content encoding for S3 #1224

Merged
merged 8 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changes/d3a9b18c-7f36-4718-a855-91e3ac6f6531.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"id": "d3a9b18c-7f36-4718-a855-91e3ac6f6531",
"type": "bugfix",
"description": "Only enable aws-chunked content encoding for S3",
"issues": [
"https://github.com/awslabs/aws-sdk-kotlin/issues/1217"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ class ClientConfigIntegration : KotlinIntegration {
Flag to disable [S3 multi-region access points](https://docs.aws.amazon.com/AmazonS3/latest/userguide/MultiRegionAccessPoints.html).
""".trimIndent()
}

val EnableAwsChunked: ConfigProperty = ConfigProperty {
name = "enableAwsChunked"
useSymbolWithNullableBuilder(KotlinTypes.Boolean, "true")
documentation = "Flag to enable [aws-chunked](https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-streaming.html) content encoding."
}
}

override fun preprocessModel(model: Model, settings: KotlinSettings): Model {
Expand All @@ -86,6 +92,7 @@ class ClientConfigIntegration : KotlinIntegration {
ForcePathStyleProp,
UseArnRegionProp,
DisableMrapProp,
EnableAwsChunked,
)

override val sectionWriters: List<SectionWriterBinding>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import software.amazon.smithy.model.shapes.ServiceShape
* Set default signing attributes in the execution context (which ultimately becomes the signing context) for S3.
*/
class S3SigningConfig : KotlinIntegration {
// auth schemes are de-duped by taking the last one registered
override val order: Byte
get() = 127

Expand All @@ -40,5 +39,6 @@ class S3SigningConfig : KotlinIntegration {
writer.putIfAbsent(signingAttrs, "NormalizeUriPath", "false")
writer.putIfAbsent(signingAttrs, "UseDoubleUriEncode", "false")
writer.putIfAbsent(signingAttrs, "SignedBodyHeader", writer.format("#T.X_AMZ_CONTENT_SHA256", RuntimeTypes.Auth.Signing.AwsSigningCommon.AwsSignedBodyHeader))
writer.putIfAbsent(signingAttrs, "EnableAwsChunked", "config.enableAwsChunked")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import aws.sdk.kotlin.codegen.customization.s3.isS3Control
import software.amazon.smithy.kotlin.codegen.KotlinSettings
import software.amazon.smithy.kotlin.codegen.core.CodegenContext
import software.amazon.smithy.kotlin.codegen.integration.KotlinIntegration
import software.amazon.smithy.kotlin.codegen.lang.KotlinTypes
import software.amazon.smithy.kotlin.codegen.model.expectShape
import software.amazon.smithy.kotlin.codegen.rendering.util.ConfigProperty
import software.amazon.smithy.model.Model
Expand All @@ -32,6 +33,12 @@ class ClientConfigIntegration : KotlinIntegration {
[S3 access points](https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-points.html).
""".trimIndent(),
)

val EnableAwsChunked: ConfigProperty = ConfigProperty {
name = "enableAwsChunked"
useSymbolWithNullableBuilder(KotlinTypes.Boolean, "true")
documentation = "Flag to enable [aws-chunked](https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-streaming.html) content encoding."
}
}

override fun preprocessModel(model: Model, settings: KotlinSettings): Model {
Expand All @@ -51,5 +58,6 @@ class ClientConfigIntegration : KotlinIntegration {
override fun additionalServiceConfigProps(ctx: CodegenContext): List<ConfigProperty> =
listOf(
UseArnRegionProp,
EnableAwsChunked,
)
}
Loading