From b9b146c65b3b55572d4617a6d41d7b7d2bb470a7 Mon Sep 17 00:00:00 2001 From: Trivikram Kamat <16024985+trivikr@users.noreply.github.com> Date: Mon, 16 Dec 2024 14:19:41 -0800 Subject: [PATCH] chore(middleware-flexible-checksums): use object for requestAlgorithmMember (#6698) --- ...BucketMetadataTableConfigurationCommand.ts | 3 +-- .../src/commands/DeleteObjectsCommand.ts | 3 +-- ...PutBucketAccelerateConfigurationCommand.ts | 3 +-- .../src/commands/PutBucketAclCommand.ts | 3 +-- .../src/commands/PutBucketCorsCommand.ts | 3 +-- .../commands/PutBucketEncryptionCommand.ts | 3 +-- .../PutBucketLifecycleConfigurationCommand.ts | 3 +-- .../src/commands/PutBucketLoggingCommand.ts | 3 +-- .../src/commands/PutBucketPolicyCommand.ts | 3 +-- .../commands/PutBucketReplicationCommand.ts | 3 +-- .../PutBucketRequestPaymentCommand.ts | 3 +-- .../src/commands/PutBucketTaggingCommand.ts | 3 +-- .../commands/PutBucketVersioningCommand.ts | 3 +-- .../src/commands/PutBucketWebsiteCommand.ts | 3 +-- .../src/commands/PutObjectAclCommand.ts | 3 +-- .../src/commands/PutObjectCommand.ts | 3 +-- .../src/commands/PutObjectLegalHoldCommand.ts | 3 +-- .../PutObjectLockConfigurationCommand.ts | 3 +-- .../src/commands/PutObjectRetentionCommand.ts | 3 +-- .../src/commands/PutObjectTaggingCommand.ts | 3 +-- .../commands/PutPublicAccessBlockCommand.ts | 3 +-- .../src/commands/RestoreObjectCommand.ts | 3 +-- .../src/commands/UploadPartCommand.ts | 3 +-- .../codegen/AddHttpChecksumDependency.java | 7 +++++-- .../src/flexibleChecksumsMiddleware.ts | 21 ++++++++++++------- 25 files changed, 41 insertions(+), 56 deletions(-) diff --git a/clients/client-s3/src/commands/CreateBucketMetadataTableConfigurationCommand.ts b/clients/client-s3/src/commands/CreateBucketMetadataTableConfigurationCommand.ts index 1993ff7a0250..36e9a482f426 100644 --- a/clients/client-s3/src/commands/CreateBucketMetadataTableConfigurationCommand.ts +++ b/clients/client-s3/src/commands/CreateBucketMetadataTableConfigurationCommand.ts @@ -143,8 +143,7 @@ export class CreateBucketMetadataTableConfigurationCommand extends $Command getSerdePlugin(config, this.serialize, this.deserialize), getEndpointPlugin(config, Command.getEndpointParameterInstructions()), getFlexibleChecksumsPlugin(config, { - requestAlgorithmMember: "ChecksumAlgorithm", - requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm", + requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" }, requestChecksumRequired: true, }), ]; diff --git a/clients/client-s3/src/commands/DeleteObjectsCommand.ts b/clients/client-s3/src/commands/DeleteObjectsCommand.ts index 5f7a9c1c9492..79599b095fd2 100644 --- a/clients/client-s3/src/commands/DeleteObjectsCommand.ts +++ b/clients/client-s3/src/commands/DeleteObjectsCommand.ts @@ -322,8 +322,7 @@ export class DeleteObjectsCommand extends $Command getSerdePlugin(config, this.serialize, this.deserialize), getEndpointPlugin(config, Command.getEndpointParameterInstructions()), getFlexibleChecksumsPlugin(config, { - requestAlgorithmMember: "ChecksumAlgorithm", - requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm", + requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" }, requestChecksumRequired: true, }), getThrow200ExceptionsPlugin(config), diff --git a/clients/client-s3/src/commands/PutBucketAccelerateConfigurationCommand.ts b/clients/client-s3/src/commands/PutBucketAccelerateConfigurationCommand.ts index 14e4f31b4e7e..491ef5b11b54 100644 --- a/clients/client-s3/src/commands/PutBucketAccelerateConfigurationCommand.ts +++ b/clients/client-s3/src/commands/PutBucketAccelerateConfigurationCommand.ts @@ -123,8 +123,7 @@ export class PutBucketAccelerateConfigurationCommand extends $Command getSerdePlugin(config, this.serialize, this.deserialize), getEndpointPlugin(config, Command.getEndpointParameterInstructions()), getFlexibleChecksumsPlugin(config, { - requestAlgorithmMember: "ChecksumAlgorithm", - requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm", + requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" }, requestChecksumRequired: false, }), ]; diff --git a/clients/client-s3/src/commands/PutBucketAclCommand.ts b/clients/client-s3/src/commands/PutBucketAclCommand.ts index 12aa7505ab7d..9574345913da 100644 --- a/clients/client-s3/src/commands/PutBucketAclCommand.ts +++ b/clients/client-s3/src/commands/PutBucketAclCommand.ts @@ -314,8 +314,7 @@ export class PutBucketAclCommand extends $Command getSerdePlugin(config, this.serialize, this.deserialize), getEndpointPlugin(config, Command.getEndpointParameterInstructions()), getFlexibleChecksumsPlugin(config, { - requestAlgorithmMember: "ChecksumAlgorithm", - requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm", + requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" }, requestChecksumRequired: true, }), ]; diff --git a/clients/client-s3/src/commands/PutBucketCorsCommand.ts b/clients/client-s3/src/commands/PutBucketCorsCommand.ts index 32d7a3cbf238..b828bd29765c 100644 --- a/clients/client-s3/src/commands/PutBucketCorsCommand.ts +++ b/clients/client-s3/src/commands/PutBucketCorsCommand.ts @@ -198,8 +198,7 @@ export class PutBucketCorsCommand extends $Command getSerdePlugin(config, this.serialize, this.deserialize), getEndpointPlugin(config, Command.getEndpointParameterInstructions()), getFlexibleChecksumsPlugin(config, { - requestAlgorithmMember: "ChecksumAlgorithm", - requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm", + requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" }, requestChecksumRequired: true, }), ]; diff --git a/clients/client-s3/src/commands/PutBucketEncryptionCommand.ts b/clients/client-s3/src/commands/PutBucketEncryptionCommand.ts index fd57c71d1a37..527ffc49ef55 100644 --- a/clients/client-s3/src/commands/PutBucketEncryptionCommand.ts +++ b/clients/client-s3/src/commands/PutBucketEncryptionCommand.ts @@ -214,8 +214,7 @@ export class PutBucketEncryptionCommand extends $Command getSerdePlugin(config, this.serialize, this.deserialize), getEndpointPlugin(config, Command.getEndpointParameterInstructions()), getFlexibleChecksumsPlugin(config, { - requestAlgorithmMember: "ChecksumAlgorithm", - requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm", + requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" }, requestChecksumRequired: true, }), ]; diff --git a/clients/client-s3/src/commands/PutBucketLifecycleConfigurationCommand.ts b/clients/client-s3/src/commands/PutBucketLifecycleConfigurationCommand.ts index 784d751d7bc2..2f7d765d6084 100644 --- a/clients/client-s3/src/commands/PutBucketLifecycleConfigurationCommand.ts +++ b/clients/client-s3/src/commands/PutBucketLifecycleConfigurationCommand.ts @@ -304,8 +304,7 @@ export class PutBucketLifecycleConfigurationCommand extends $Command getSerdePlugin(config, this.serialize, this.deserialize), getEndpointPlugin(config, Command.getEndpointParameterInstructions()), getFlexibleChecksumsPlugin(config, { - requestAlgorithmMember: "ChecksumAlgorithm", - requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm", + requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" }, requestChecksumRequired: true, }), getThrow200ExceptionsPlugin(config), diff --git a/clients/client-s3/src/commands/PutBucketLoggingCommand.ts b/clients/client-s3/src/commands/PutBucketLoggingCommand.ts index 147483e2fe0a..ef056ca5c10d 100644 --- a/clients/client-s3/src/commands/PutBucketLoggingCommand.ts +++ b/clients/client-s3/src/commands/PutBucketLoggingCommand.ts @@ -214,8 +214,7 @@ export class PutBucketLoggingCommand extends $Command getSerdePlugin(config, this.serialize, this.deserialize), getEndpointPlugin(config, Command.getEndpointParameterInstructions()), getFlexibleChecksumsPlugin(config, { - requestAlgorithmMember: "ChecksumAlgorithm", - requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm", + requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" }, requestChecksumRequired: true, }), ]; diff --git a/clients/client-s3/src/commands/PutBucketPolicyCommand.ts b/clients/client-s3/src/commands/PutBucketPolicyCommand.ts index c34e83a26b0c..e92bb9413401 100644 --- a/clients/client-s3/src/commands/PutBucketPolicyCommand.ts +++ b/clients/client-s3/src/commands/PutBucketPolicyCommand.ts @@ -167,8 +167,7 @@ export class PutBucketPolicyCommand extends $Command getSerdePlugin(config, this.serialize, this.deserialize), getEndpointPlugin(config, Command.getEndpointParameterInstructions()), getFlexibleChecksumsPlugin(config, { - requestAlgorithmMember: "ChecksumAlgorithm", - requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm", + requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" }, requestChecksumRequired: true, }), ]; diff --git a/clients/client-s3/src/commands/PutBucketReplicationCommand.ts b/clients/client-s3/src/commands/PutBucketReplicationCommand.ts index c80902905ea5..ed78085b6a47 100644 --- a/clients/client-s3/src/commands/PutBucketReplicationCommand.ts +++ b/clients/client-s3/src/commands/PutBucketReplicationCommand.ts @@ -238,8 +238,7 @@ export class PutBucketReplicationCommand extends $Command getSerdePlugin(config, this.serialize, this.deserialize), getEndpointPlugin(config, Command.getEndpointParameterInstructions()), getFlexibleChecksumsPlugin(config, { - requestAlgorithmMember: "ChecksumAlgorithm", - requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm", + requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" }, requestChecksumRequired: true, }), ]; diff --git a/clients/client-s3/src/commands/PutBucketRequestPaymentCommand.ts b/clients/client-s3/src/commands/PutBucketRequestPaymentCommand.ts index 78a39025471c..b163f1cd900f 100644 --- a/clients/client-s3/src/commands/PutBucketRequestPaymentCommand.ts +++ b/clients/client-s3/src/commands/PutBucketRequestPaymentCommand.ts @@ -114,8 +114,7 @@ export class PutBucketRequestPaymentCommand extends $Command getSerdePlugin(config, this.serialize, this.deserialize), getEndpointPlugin(config, Command.getEndpointParameterInstructions()), getFlexibleChecksumsPlugin(config, { - requestAlgorithmMember: "ChecksumAlgorithm", - requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm", + requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" }, requestChecksumRequired: true, }), ]; diff --git a/clients/client-s3/src/commands/PutBucketTaggingCommand.ts b/clients/client-s3/src/commands/PutBucketTaggingCommand.ts index e6d51ba191ed..0e2ad316eda8 100644 --- a/clients/client-s3/src/commands/PutBucketTaggingCommand.ts +++ b/clients/client-s3/src/commands/PutBucketTaggingCommand.ts @@ -168,8 +168,7 @@ export class PutBucketTaggingCommand extends $Command getSerdePlugin(config, this.serialize, this.deserialize), getEndpointPlugin(config, Command.getEndpointParameterInstructions()), getFlexibleChecksumsPlugin(config, { - requestAlgorithmMember: "ChecksumAlgorithm", - requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm", + requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" }, requestChecksumRequired: true, }), ]; diff --git a/clients/client-s3/src/commands/PutBucketVersioningCommand.ts b/clients/client-s3/src/commands/PutBucketVersioningCommand.ts index 46c08e37a79b..fabfce34b465 100644 --- a/clients/client-s3/src/commands/PutBucketVersioningCommand.ts +++ b/clients/client-s3/src/commands/PutBucketVersioningCommand.ts @@ -148,8 +148,7 @@ export class PutBucketVersioningCommand extends $Command getSerdePlugin(config, this.serialize, this.deserialize), getEndpointPlugin(config, Command.getEndpointParameterInstructions()), getFlexibleChecksumsPlugin(config, { - requestAlgorithmMember: "ChecksumAlgorithm", - requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm", + requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" }, requestChecksumRequired: true, }), ]; diff --git a/clients/client-s3/src/commands/PutBucketWebsiteCommand.ts b/clients/client-s3/src/commands/PutBucketWebsiteCommand.ts index 7b1cc50f7ddb..a56df82c4871 100644 --- a/clients/client-s3/src/commands/PutBucketWebsiteCommand.ts +++ b/clients/client-s3/src/commands/PutBucketWebsiteCommand.ts @@ -249,8 +249,7 @@ export class PutBucketWebsiteCommand extends $Command getSerdePlugin(config, this.serialize, this.deserialize), getEndpointPlugin(config, Command.getEndpointParameterInstructions()), getFlexibleChecksumsPlugin(config, { - requestAlgorithmMember: "ChecksumAlgorithm", - requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm", + requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" }, requestChecksumRequired: true, }), ]; diff --git a/clients/client-s3/src/commands/PutObjectAclCommand.ts b/clients/client-s3/src/commands/PutObjectAclCommand.ts index 3248b7e0c015..f51c2373394c 100644 --- a/clients/client-s3/src/commands/PutObjectAclCommand.ts +++ b/clients/client-s3/src/commands/PutObjectAclCommand.ts @@ -313,8 +313,7 @@ export class PutObjectAclCommand extends $Command getSerdePlugin(config, this.serialize, this.deserialize), getEndpointPlugin(config, Command.getEndpointParameterInstructions()), getFlexibleChecksumsPlugin(config, { - requestAlgorithmMember: "ChecksumAlgorithm", - requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm", + requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" }, requestChecksumRequired: true, }), getThrow200ExceptionsPlugin(config), diff --git a/clients/client-s3/src/commands/PutObjectCommand.ts b/clients/client-s3/src/commands/PutObjectCommand.ts index ea55b20e73e7..85b924517a4b 100644 --- a/clients/client-s3/src/commands/PutObjectCommand.ts +++ b/clients/client-s3/src/commands/PutObjectCommand.ts @@ -463,8 +463,7 @@ export class PutObjectCommand extends $Command getSerdePlugin(config, this.serialize, this.deserialize), getEndpointPlugin(config, Command.getEndpointParameterInstructions()), getFlexibleChecksumsPlugin(config, { - requestAlgorithmMember: "ChecksumAlgorithm", - requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm", + requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" }, requestChecksumRequired: false, }), getCheckContentLengthHeaderPlugin(config), diff --git a/clients/client-s3/src/commands/PutObjectLegalHoldCommand.ts b/clients/client-s3/src/commands/PutObjectLegalHoldCommand.ts index 863f8651f072..c7dc9fbede3d 100644 --- a/clients/client-s3/src/commands/PutObjectLegalHoldCommand.ts +++ b/clients/client-s3/src/commands/PutObjectLegalHoldCommand.ts @@ -91,8 +91,7 @@ export class PutObjectLegalHoldCommand extends $Command getSerdePlugin(config, this.serialize, this.deserialize), getEndpointPlugin(config, Command.getEndpointParameterInstructions()), getFlexibleChecksumsPlugin(config, { - requestAlgorithmMember: "ChecksumAlgorithm", - requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm", + requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" }, requestChecksumRequired: true, }), getThrow200ExceptionsPlugin(config), diff --git a/clients/client-s3/src/commands/PutObjectLockConfigurationCommand.ts b/clients/client-s3/src/commands/PutObjectLockConfigurationCommand.ts index 247d5c326295..259fc0a56171 100644 --- a/clients/client-s3/src/commands/PutObjectLockConfigurationCommand.ts +++ b/clients/client-s3/src/commands/PutObjectLockConfigurationCommand.ts @@ -114,8 +114,7 @@ export class PutObjectLockConfigurationCommand extends $Command getSerdePlugin(config, this.serialize, this.deserialize), getEndpointPlugin(config, Command.getEndpointParameterInstructions()), getFlexibleChecksumsPlugin(config, { - requestAlgorithmMember: "ChecksumAlgorithm", - requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm", + requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" }, requestChecksumRequired: true, }), getThrow200ExceptionsPlugin(config), diff --git a/clients/client-s3/src/commands/PutObjectRetentionCommand.ts b/clients/client-s3/src/commands/PutObjectRetentionCommand.ts index 1a03e54aeceb..9db58143cd28 100644 --- a/clients/client-s3/src/commands/PutObjectRetentionCommand.ts +++ b/clients/client-s3/src/commands/PutObjectRetentionCommand.ts @@ -94,8 +94,7 @@ export class PutObjectRetentionCommand extends $Command getSerdePlugin(config, this.serialize, this.deserialize), getEndpointPlugin(config, Command.getEndpointParameterInstructions()), getFlexibleChecksumsPlugin(config, { - requestAlgorithmMember: "ChecksumAlgorithm", - requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm", + requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" }, requestChecksumRequired: true, }), getThrow200ExceptionsPlugin(config), diff --git a/clients/client-s3/src/commands/PutObjectTaggingCommand.ts b/clients/client-s3/src/commands/PutObjectTaggingCommand.ts index 7fcbf2aa1542..36035d1b6fcf 100644 --- a/clients/client-s3/src/commands/PutObjectTaggingCommand.ts +++ b/clients/client-s3/src/commands/PutObjectTaggingCommand.ts @@ -174,8 +174,7 @@ export class PutObjectTaggingCommand extends $Command getSerdePlugin(config, this.serialize, this.deserialize), getEndpointPlugin(config, Command.getEndpointParameterInstructions()), getFlexibleChecksumsPlugin(config, { - requestAlgorithmMember: "ChecksumAlgorithm", - requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm", + requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" }, requestChecksumRequired: true, }), getThrow200ExceptionsPlugin(config), diff --git a/clients/client-s3/src/commands/PutPublicAccessBlockCommand.ts b/clients/client-s3/src/commands/PutPublicAccessBlockCommand.ts index bd18f8531e12..aa4b74789ab5 100644 --- a/clients/client-s3/src/commands/PutPublicAccessBlockCommand.ts +++ b/clients/client-s3/src/commands/PutPublicAccessBlockCommand.ts @@ -122,8 +122,7 @@ export class PutPublicAccessBlockCommand extends $Command getSerdePlugin(config, this.serialize, this.deserialize), getEndpointPlugin(config, Command.getEndpointParameterInstructions()), getFlexibleChecksumsPlugin(config, { - requestAlgorithmMember: "ChecksumAlgorithm", - requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm", + requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" }, requestChecksumRequired: true, }), ]; diff --git a/clients/client-s3/src/commands/RestoreObjectCommand.ts b/clients/client-s3/src/commands/RestoreObjectCommand.ts index 4ca11760b8f4..a5c8a1648f06 100644 --- a/clients/client-s3/src/commands/RestoreObjectCommand.ts +++ b/clients/client-s3/src/commands/RestoreObjectCommand.ts @@ -388,8 +388,7 @@ export class RestoreObjectCommand extends $Command getSerdePlugin(config, this.serialize, this.deserialize), getEndpointPlugin(config, Command.getEndpointParameterInstructions()), getFlexibleChecksumsPlugin(config, { - requestAlgorithmMember: "ChecksumAlgorithm", - requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm", + requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" }, requestChecksumRequired: false, }), getThrow200ExceptionsPlugin(config), diff --git a/clients/client-s3/src/commands/UploadPartCommand.ts b/clients/client-s3/src/commands/UploadPartCommand.ts index 1b667f18d094..e2bdf5cad0c5 100644 --- a/clients/client-s3/src/commands/UploadPartCommand.ts +++ b/clients/client-s3/src/commands/UploadPartCommand.ts @@ -321,8 +321,7 @@ export class UploadPartCommand extends $Command getSerdePlugin(config, this.serialize, this.deserialize), getEndpointPlugin(config, Command.getEndpointParameterInstructions()), getFlexibleChecksumsPlugin(config, { - requestAlgorithmMember: "ChecksumAlgorithm", - requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm", + requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" }, requestChecksumRequired: false, }), getThrow200ExceptionsPlugin(config), diff --git a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddHttpChecksumDependency.java b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddHttpChecksumDependency.java index 60cc445817a8..34d248be0534 100644 --- a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddHttpChecksumDependency.java +++ b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddHttpChecksumDependency.java @@ -203,7 +203,8 @@ private static Map getPluginFunctionParams( HttpChecksumTrait httpChecksumTrait = operation.expectTrait(HttpChecksumTrait.class); params.put("requestChecksumRequired", httpChecksumTrait.isRequestChecksumRequired()); httpChecksumTrait.getRequestAlgorithmMember().ifPresent(requestAlgorithmMember -> { - params.put("requestAlgorithmMember", requestAlgorithmMember); + Map requestAlgorithmMemberMap = new TreeMap(); + requestAlgorithmMemberMap.put("name", requestAlgorithmMember); // We know that input shape is structure, and contains requestAlgorithmMember. StructureShape inputShape = model.expectShape(operation.getInput().get(), StructureShape.class); @@ -211,8 +212,10 @@ private static Map getPluginFunctionParams( // Set requestAlgorithmMemberHttpHeader if HttpHeaderTrait is present. requestAlgorithmMemberShape.getTrait(HttpHeaderTrait.class).ifPresent(httpHeaderTrait -> { - params.put("requestAlgorithmMemberHttpHeader", httpHeaderTrait.getValue()); + requestAlgorithmMemberMap.put("httpHeader", httpHeaderTrait.getValue()); }); + + params.put("requestAlgorithmMember", requestAlgorithmMemberMap); }); httpChecksumTrait.getRequestValidationModeMember().ifPresent(requestValidationModeMember -> { params.put("requestValidationModeMember", requestValidationModeMember); diff --git a/packages/middleware-flexible-checksums/src/flexibleChecksumsMiddleware.ts b/packages/middleware-flexible-checksums/src/flexibleChecksumsMiddleware.ts index bc3d6308851d..7a19714e8755 100644 --- a/packages/middleware-flexible-checksums/src/flexibleChecksumsMiddleware.ts +++ b/packages/middleware-flexible-checksums/src/flexibleChecksumsMiddleware.ts @@ -27,15 +27,20 @@ export interface FlexibleChecksumsRequestMiddlewareConfig { requestChecksumRequired: boolean; /** - * Defines a top-level operation input member that is used to configure request checksum behavior. + * Member that is used to configure request checksum behavior. */ - requestAlgorithmMember?: string; + requestAlgorithmMember?: { + /** + * Defines a top-level operation input member that is used to configure request checksum behavior. + */ + name: string; - /** - * The {@link httpHeader} value for {@link requestAlgorithmMember}, if present. - * {@link https://smithy.io/2.0/spec/http-bindings.html#httpheader-trait httpHeader} - */ - requestAlgorithmMemberHttpHeader?: string; + /** + * The {@link httpHeader} value, if present. + * {@link https://smithy.io/2.0/spec/http-bindings.html#httpheader-trait httpHeader} + */ + httpHeader?: string; + }; } export const flexibleChecksumsMiddlewareOptions: BuildHandlerOptions = { @@ -68,7 +73,7 @@ export const flexibleChecksumsMiddleware = input, { requestChecksumRequired, - requestAlgorithmMember, + requestAlgorithmMember: requestAlgorithmMember?.name, }, !!context.isS3ExpressBucket );