From 58253485a81a7b2c528e3578e005b84190c7af5b Mon Sep 17 00:00:00 2001 From: AllanZhengYP Date: Mon, 21 Feb 2022 23:23:30 +0000 Subject: [PATCH] fix(client-s3): disable bucket endpoint pluggin for WriteGetObjectResponseCommand --- .../src/commands/WriteGetObjectResponseCommand.ts | 2 -- .../smithy/aws/typescript/codegen/AddS3Config.java | 12 +++++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/clients/client-s3/src/commands/WriteGetObjectResponseCommand.ts b/clients/client-s3/src/commands/WriteGetObjectResponseCommand.ts index 140edbda7e7f..7249899e073b 100644 --- a/clients/client-s3/src/commands/WriteGetObjectResponseCommand.ts +++ b/clients/client-s3/src/commands/WriteGetObjectResponseCommand.ts @@ -1,4 +1,3 @@ -import { getBucketEndpointPlugin } from "@aws-sdk/middleware-bucket-endpoint"; import { getSerdePlugin } from "@aws-sdk/middleware-serde"; import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http"; import { Command as $Command } from "@aws-sdk/smithy-client"; @@ -93,7 +92,6 @@ export class WriteGetObjectResponseCommand extends $Command< options?: __HttpHandlerOptions ): Handler { this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use(getBucketEndpointPlugin(configuration)); const stack = clientStack.concat(this.middlewareStack); diff --git a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddS3Config.java b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddS3Config.java index 20fa91b225d0..b346786473a9 100644 --- a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddS3Config.java +++ b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddS3Config.java @@ -55,7 +55,9 @@ public final class AddS3Config implements TypeScriptIntegration { private static final Logger LOGGER = Logger.getLogger(AddS3Config.class.getName()); - private static final Set SSEC_OPERATIONS = SetUtils.of("SSECustomerKey", "CopySourceSSECustomerKey"); + private static final Set SSEC_INPUT_KEYS = SetUtils.of("SSECustomerKey", "CopySourceSSECustomerKey"); + + private static final Set BUCKET_ENDPOINT_INPUT_KEYS = SetUtils.of("Bucket"); private static final Set NON_BUCKET_ENDPOINT_OPERATIONS = SetUtils.of( "CreateBucket", @@ -178,14 +180,13 @@ && testServiceId(s)) .build(), RuntimeClientPlugin.builder() .withConventions(AwsDependency.SSEC_MIDDLEWARE.dependency, "Ssec", HAS_MIDDLEWARE) - .operationPredicate((m, s, o) -> testInputContainsMember(m, o, SSEC_OPERATIONS) + .operationPredicate((m, s, o) -> testInputContainsMember(m, o, SSEC_INPUT_KEYS) && testServiceId(s)) .build(), RuntimeClientPlugin.builder() .withConventions(AwsDependency.LOCATION_CONSTRAINT.dependency, "LocationConstraint", HAS_MIDDLEWARE) - .operationPredicate((m, s, o) -> o.getId().getName(s).equals("CreateBucket") - && testServiceId(s)) + .operationPredicate((m, s, o) -> o.getId().getName(s).equals("CreateBucket") && testServiceId(s)) .build(), /** * BUCKET_ENDPOINT_MIDDLEWARE needs two separate plugins. The first resolves the config in the client. @@ -200,7 +201,8 @@ && testServiceId(s)) .withConventions(AwsDependency.BUCKET_ENDPOINT_MIDDLEWARE.dependency, "BucketEndpoint", HAS_MIDDLEWARE) .operationPredicate((m, s, o) -> !NON_BUCKET_ENDPOINT_OPERATIONS.contains(o.getId().getName(s)) - && testServiceId(s)) + && testServiceId(s) + && testInputContainsMember(m, o, BUCKET_ENDPOINT_INPUT_KEYS)) .build() ); }