From 7bed1653abb1ef2dcf1f09e0de334fa9aff926fd Mon Sep 17 00:00:00 2001 From: skotambkar Date: Mon, 9 Nov 2020 09:49:30 -0800 Subject: [PATCH] fix concurrent-change exception and operation predicate behavior for runtime plugin --- .../aws/go/codegen/customization/S3UpdateEndpoint.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/S3UpdateEndpoint.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/S3UpdateEndpoint.java index b740ba7d8e9..72f19b910f9 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/S3UpdateEndpoint.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/S3UpdateEndpoint.java @@ -62,7 +62,7 @@ public class S3UpdateEndpoint implements GoIntegration { private static final String USE_ARNREGION_OPTION = "UseARNRegion"; // list of runtime-client plugins - private static final List runtimeClientPlugins = new ArrayList<>(); + private final List runtimeClientPlugins = new ArrayList<>(); private static boolean isS3Service(Model model, ServiceShape service) { return service.expectTrait(ServiceTrait.class).getSdkId().equalsIgnoreCase("S3"); @@ -145,7 +145,12 @@ public void processFinalizedModel(GoSettings settings, Model model) { ); runtimeClientPlugins.add(RuntimeClientPlugin.builder() - .servicePredicate(S3UpdateEndpoint::isS3SharedService) + .operationPredicate((m,s,o)-> { + if (!isS3SharedService(m, s)) { + return false; + } + return o.equals(operation); + }) .registerMiddleware(MiddlewareRegistrar.builder() .resolvedFunction(SymbolUtils.createValueSymbolBuilder(helperFuncName) .build())