Skip to content

Commit b9b146c

Browse files
authoredDec 16, 2024··
chore(middleware-flexible-checksums): use object for requestAlgorithmMember (#6698)
1 parent 0054a3d commit b9b146c

25 files changed

+41
-56
lines changed
 

‎clients/client-s3/src/commands/CreateBucketMetadataTableConfigurationCommand.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,7 @@ export class CreateBucketMetadataTableConfigurationCommand extends $Command
143143
getSerdePlugin(config, this.serialize, this.deserialize),
144144
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
145145
getFlexibleChecksumsPlugin(config, {
146-
requestAlgorithmMember: "ChecksumAlgorithm",
147-
requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm",
146+
requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" },
148147
requestChecksumRequired: true,
149148
}),
150149
];

‎clients/client-s3/src/commands/DeleteObjectsCommand.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,7 @@ export class DeleteObjectsCommand extends $Command
322322
getSerdePlugin(config, this.serialize, this.deserialize),
323323
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
324324
getFlexibleChecksumsPlugin(config, {
325-
requestAlgorithmMember: "ChecksumAlgorithm",
326-
requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm",
325+
requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" },
327326
requestChecksumRequired: true,
328327
}),
329328
getThrow200ExceptionsPlugin(config),

‎clients/client-s3/src/commands/PutBucketAccelerateConfigurationCommand.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,7 @@ export class PutBucketAccelerateConfigurationCommand extends $Command
123123
getSerdePlugin(config, this.serialize, this.deserialize),
124124
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
125125
getFlexibleChecksumsPlugin(config, {
126-
requestAlgorithmMember: "ChecksumAlgorithm",
127-
requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm",
126+
requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" },
128127
requestChecksumRequired: false,
129128
}),
130129
];

‎clients/client-s3/src/commands/PutBucketAclCommand.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,7 @@ export class PutBucketAclCommand extends $Command
314314
getSerdePlugin(config, this.serialize, this.deserialize),
315315
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
316316
getFlexibleChecksumsPlugin(config, {
317-
requestAlgorithmMember: "ChecksumAlgorithm",
318-
requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm",
317+
requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" },
319318
requestChecksumRequired: true,
320319
}),
321320
];

‎clients/client-s3/src/commands/PutBucketCorsCommand.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,7 @@ export class PutBucketCorsCommand extends $Command
198198
getSerdePlugin(config, this.serialize, this.deserialize),
199199
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
200200
getFlexibleChecksumsPlugin(config, {
201-
requestAlgorithmMember: "ChecksumAlgorithm",
202-
requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm",
201+
requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" },
203202
requestChecksumRequired: true,
204203
}),
205204
];

‎clients/client-s3/src/commands/PutBucketEncryptionCommand.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,7 @@ export class PutBucketEncryptionCommand extends $Command
214214
getSerdePlugin(config, this.serialize, this.deserialize),
215215
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
216216
getFlexibleChecksumsPlugin(config, {
217-
requestAlgorithmMember: "ChecksumAlgorithm",
218-
requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm",
217+
requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" },
219218
requestChecksumRequired: true,
220219
}),
221220
];

‎clients/client-s3/src/commands/PutBucketLifecycleConfigurationCommand.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,7 @@ export class PutBucketLifecycleConfigurationCommand extends $Command
304304
getSerdePlugin(config, this.serialize, this.deserialize),
305305
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
306306
getFlexibleChecksumsPlugin(config, {
307-
requestAlgorithmMember: "ChecksumAlgorithm",
308-
requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm",
307+
requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" },
309308
requestChecksumRequired: true,
310309
}),
311310
getThrow200ExceptionsPlugin(config),

‎clients/client-s3/src/commands/PutBucketLoggingCommand.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,7 @@ export class PutBucketLoggingCommand extends $Command
214214
getSerdePlugin(config, this.serialize, this.deserialize),
215215
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
216216
getFlexibleChecksumsPlugin(config, {
217-
requestAlgorithmMember: "ChecksumAlgorithm",
218-
requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm",
217+
requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" },
219218
requestChecksumRequired: true,
220219
}),
221220
];

‎clients/client-s3/src/commands/PutBucketPolicyCommand.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,7 @@ export class PutBucketPolicyCommand extends $Command
167167
getSerdePlugin(config, this.serialize, this.deserialize),
168168
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
169169
getFlexibleChecksumsPlugin(config, {
170-
requestAlgorithmMember: "ChecksumAlgorithm",
171-
requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm",
170+
requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" },
172171
requestChecksumRequired: true,
173172
}),
174173
];

‎clients/client-s3/src/commands/PutBucketReplicationCommand.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,7 @@ export class PutBucketReplicationCommand extends $Command
238238
getSerdePlugin(config, this.serialize, this.deserialize),
239239
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
240240
getFlexibleChecksumsPlugin(config, {
241-
requestAlgorithmMember: "ChecksumAlgorithm",
242-
requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm",
241+
requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" },
243242
requestChecksumRequired: true,
244243
}),
245244
];

‎clients/client-s3/src/commands/PutBucketRequestPaymentCommand.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,7 @@ export class PutBucketRequestPaymentCommand extends $Command
114114
getSerdePlugin(config, this.serialize, this.deserialize),
115115
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
116116
getFlexibleChecksumsPlugin(config, {
117-
requestAlgorithmMember: "ChecksumAlgorithm",
118-
requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm",
117+
requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" },
119118
requestChecksumRequired: true,
120119
}),
121120
];

‎clients/client-s3/src/commands/PutBucketTaggingCommand.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,7 @@ export class PutBucketTaggingCommand extends $Command
168168
getSerdePlugin(config, this.serialize, this.deserialize),
169169
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
170170
getFlexibleChecksumsPlugin(config, {
171-
requestAlgorithmMember: "ChecksumAlgorithm",
172-
requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm",
171+
requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" },
173172
requestChecksumRequired: true,
174173
}),
175174
];

‎clients/client-s3/src/commands/PutBucketVersioningCommand.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,7 @@ export class PutBucketVersioningCommand extends $Command
148148
getSerdePlugin(config, this.serialize, this.deserialize),
149149
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
150150
getFlexibleChecksumsPlugin(config, {
151-
requestAlgorithmMember: "ChecksumAlgorithm",
152-
requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm",
151+
requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" },
153152
requestChecksumRequired: true,
154153
}),
155154
];

‎clients/client-s3/src/commands/PutBucketWebsiteCommand.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,7 @@ export class PutBucketWebsiteCommand extends $Command
249249
getSerdePlugin(config, this.serialize, this.deserialize),
250250
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
251251
getFlexibleChecksumsPlugin(config, {
252-
requestAlgorithmMember: "ChecksumAlgorithm",
253-
requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm",
252+
requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" },
254253
requestChecksumRequired: true,
255254
}),
256255
];

‎clients/client-s3/src/commands/PutObjectAclCommand.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,7 @@ export class PutObjectAclCommand extends $Command
313313
getSerdePlugin(config, this.serialize, this.deserialize),
314314
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
315315
getFlexibleChecksumsPlugin(config, {
316-
requestAlgorithmMember: "ChecksumAlgorithm",
317-
requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm",
316+
requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" },
318317
requestChecksumRequired: true,
319318
}),
320319
getThrow200ExceptionsPlugin(config),

‎clients/client-s3/src/commands/PutObjectCommand.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -463,8 +463,7 @@ export class PutObjectCommand extends $Command
463463
getSerdePlugin(config, this.serialize, this.deserialize),
464464
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
465465
getFlexibleChecksumsPlugin(config, {
466-
requestAlgorithmMember: "ChecksumAlgorithm",
467-
requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm",
466+
requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" },
468467
requestChecksumRequired: false,
469468
}),
470469
getCheckContentLengthHeaderPlugin(config),

‎clients/client-s3/src/commands/PutObjectLegalHoldCommand.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,7 @@ export class PutObjectLegalHoldCommand extends $Command
9191
getSerdePlugin(config, this.serialize, this.deserialize),
9292
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
9393
getFlexibleChecksumsPlugin(config, {
94-
requestAlgorithmMember: "ChecksumAlgorithm",
95-
requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm",
94+
requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" },
9695
requestChecksumRequired: true,
9796
}),
9897
getThrow200ExceptionsPlugin(config),

‎clients/client-s3/src/commands/PutObjectLockConfigurationCommand.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,7 @@ export class PutObjectLockConfigurationCommand extends $Command
114114
getSerdePlugin(config, this.serialize, this.deserialize),
115115
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
116116
getFlexibleChecksumsPlugin(config, {
117-
requestAlgorithmMember: "ChecksumAlgorithm",
118-
requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm",
117+
requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" },
119118
requestChecksumRequired: true,
120119
}),
121120
getThrow200ExceptionsPlugin(config),

‎clients/client-s3/src/commands/PutObjectRetentionCommand.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@ export class PutObjectRetentionCommand extends $Command
9494
getSerdePlugin(config, this.serialize, this.deserialize),
9595
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
9696
getFlexibleChecksumsPlugin(config, {
97-
requestAlgorithmMember: "ChecksumAlgorithm",
98-
requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm",
97+
requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" },
9998
requestChecksumRequired: true,
10099
}),
101100
getThrow200ExceptionsPlugin(config),

‎clients/client-s3/src/commands/PutObjectTaggingCommand.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,7 @@ export class PutObjectTaggingCommand extends $Command
174174
getSerdePlugin(config, this.serialize, this.deserialize),
175175
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
176176
getFlexibleChecksumsPlugin(config, {
177-
requestAlgorithmMember: "ChecksumAlgorithm",
178-
requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm",
177+
requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" },
179178
requestChecksumRequired: true,
180179
}),
181180
getThrow200ExceptionsPlugin(config),

‎clients/client-s3/src/commands/PutPublicAccessBlockCommand.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,7 @@ export class PutPublicAccessBlockCommand extends $Command
122122
getSerdePlugin(config, this.serialize, this.deserialize),
123123
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
124124
getFlexibleChecksumsPlugin(config, {
125-
requestAlgorithmMember: "ChecksumAlgorithm",
126-
requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm",
125+
requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" },
127126
requestChecksumRequired: true,
128127
}),
129128
];

‎clients/client-s3/src/commands/RestoreObjectCommand.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,7 @@ export class RestoreObjectCommand extends $Command
388388
getSerdePlugin(config, this.serialize, this.deserialize),
389389
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
390390
getFlexibleChecksumsPlugin(config, {
391-
requestAlgorithmMember: "ChecksumAlgorithm",
392-
requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm",
391+
requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" },
393392
requestChecksumRequired: false,
394393
}),
395394
getThrow200ExceptionsPlugin(config),

‎clients/client-s3/src/commands/UploadPartCommand.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,7 @@ export class UploadPartCommand extends $Command
321321
getSerdePlugin(config, this.serialize, this.deserialize),
322322
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
323323
getFlexibleChecksumsPlugin(config, {
324-
requestAlgorithmMember: "ChecksumAlgorithm",
325-
requestAlgorithmMemberHttpHeader: "x-amz-sdk-checksum-algorithm",
324+
requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" },
326325
requestChecksumRequired: false,
327326
}),
328327
getThrow200ExceptionsPlugin(config),

‎codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddHttpChecksumDependency.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -203,16 +203,19 @@ private static Map<String, Object> getPluginFunctionParams(
203203
HttpChecksumTrait httpChecksumTrait = operation.expectTrait(HttpChecksumTrait.class);
204204
params.put("requestChecksumRequired", httpChecksumTrait.isRequestChecksumRequired());
205205
httpChecksumTrait.getRequestAlgorithmMember().ifPresent(requestAlgorithmMember -> {
206-
params.put("requestAlgorithmMember", requestAlgorithmMember);
206+
Map<String, String> requestAlgorithmMemberMap = new TreeMap<String, String>();
207+
requestAlgorithmMemberMap.put("name", requestAlgorithmMember);
207208

208209
// We know that input shape is structure, and contains requestAlgorithmMember.
209210
StructureShape inputShape = model.expectShape(operation.getInput().get(), StructureShape.class);
210211
MemberShape requestAlgorithmMemberShape = inputShape.getAllMembers().get(requestAlgorithmMember);
211212

212213
// Set requestAlgorithmMemberHttpHeader if HttpHeaderTrait is present.
213214
requestAlgorithmMemberShape.getTrait(HttpHeaderTrait.class).ifPresent(httpHeaderTrait -> {
214-
params.put("requestAlgorithmMemberHttpHeader", httpHeaderTrait.getValue());
215+
requestAlgorithmMemberMap.put("httpHeader", httpHeaderTrait.getValue());
215216
});
217+
218+
params.put("requestAlgorithmMember", requestAlgorithmMemberMap);
216219
});
217220
httpChecksumTrait.getRequestValidationModeMember().ifPresent(requestValidationModeMember -> {
218221
params.put("requestValidationModeMember", requestValidationModeMember);

‎packages/middleware-flexible-checksums/src/flexibleChecksumsMiddleware.ts

+13-8
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,20 @@ export interface FlexibleChecksumsRequestMiddlewareConfig {
2727
requestChecksumRequired: boolean;
2828

2929
/**
30-
* Defines a top-level operation input member that is used to configure request checksum behavior.
30+
* Member that is used to configure request checksum behavior.
3131
*/
32-
requestAlgorithmMember?: string;
32+
requestAlgorithmMember?: {
33+
/**
34+
* Defines a top-level operation input member that is used to configure request checksum behavior.
35+
*/
36+
name: string;
3337

34-
/**
35-
* The {@link httpHeader} value for {@link requestAlgorithmMember}, if present.
36-
* {@link https://smithy.io/2.0/spec/http-bindings.html#httpheader-trait httpHeader}
37-
*/
38-
requestAlgorithmMemberHttpHeader?: string;
38+
/**
39+
* The {@link httpHeader} value, if present.
40+
* {@link https://smithy.io/2.0/spec/http-bindings.html#httpheader-trait httpHeader}
41+
*/
42+
httpHeader?: string;
43+
};
3944
}
4045

4146
export const flexibleChecksumsMiddlewareOptions: BuildHandlerOptions = {
@@ -68,7 +73,7 @@ export const flexibleChecksumsMiddleware =
6873
input,
6974
{
7075
requestChecksumRequired,
71-
requestAlgorithmMember,
76+
requestAlgorithmMember: requestAlgorithmMember?.name,
7277
},
7378
!!context.isS3ExpressBucket
7479
);

0 commit comments

Comments
 (0)
Please sign in to comment.