diff --git a/.changes/next-release/feature-AWSSDKforJavav2-c73b965.json b/.changes/next-release/feature-AWSSDKforJavav2-c73b965.json new file mode 100644 index 000000000000..d83e3c35dc22 --- /dev/null +++ b/.changes/next-release/feature-AWSSDKforJavav2-c73b965.json @@ -0,0 +1,6 @@ +{ + "type": "feature", + "category": "AWS SDK for Java v2", + "contributor": "", + "description": "Fixes codegeneration issues for eventstreams with shared event shapes: Duplicate and rename all eventstream event shapes with a unique name + add new disableUniqueEventStreamShapePreprocessing customization config." +} diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/IntermediateModelBuilder.java b/codegen/src/main/java/software/amazon/awssdk/codegen/IntermediateModelBuilder.java index 33290241d534..ae13fe41eb6c 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/IntermediateModelBuilder.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/IntermediateModelBuilder.java @@ -94,7 +94,7 @@ private List createShapeProcessors() { public IntermediateModel build() { CodegenCustomizationProcessor customization = DefaultCustomizationProcessor - .getProcessorFor(customConfig); + .getProcessorFor(customConfig, namingStrategy); customization.preprocess(service); diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/customization/processors/DefaultCustomizationProcessor.java b/codegen/src/main/java/software/amazon/awssdk/codegen/customization/processors/DefaultCustomizationProcessor.java index 0e09eca03747..5f1de129a04c 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/customization/processors/DefaultCustomizationProcessor.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/customization/processors/DefaultCustomizationProcessor.java @@ -18,6 +18,7 @@ import software.amazon.awssdk.codegen.customization.CodegenCustomizationProcessor; import software.amazon.awssdk.codegen.customization.CodegenCustomizationProcessorChain; import software.amazon.awssdk.codegen.model.config.customization.CustomizationConfig; +import software.amazon.awssdk.codegen.naming.NamingStrategy; public final class DefaultCustomizationProcessor { @@ -25,7 +26,7 @@ private DefaultCustomizationProcessor() { } public static CodegenCustomizationProcessor getProcessorFor( - CustomizationConfig config) { + CustomizationConfig config, NamingStrategy namingStrategy) { return new CodegenCustomizationProcessorChain( new MetadataModifiersProcessor(config.getCustomServiceMetadata()), @@ -37,6 +38,10 @@ public static CodegenCustomizationProcessor getProcessorFor( new SmithyRpcV2CborProtocolProcessor(), new RemoveExceptionMessagePropertyProcessor(), new UseLegacyEventGenerationSchemeProcessor(), + new EventStreamUniqueEventShapesProcessor( + config.getUseLegacyEventGenerationScheme(), + config.getDisableUniqueEventStreamShapePreprocessing(), + namingStrategy), new NewAndLegacyEventStreamProcessor(), new S3RemoveBucketFromUriProcessor(), new S3ControlRemoveAccountIdHostPrefixProcessor(), diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/customization/processors/EventStreamUniqueEventShapesProcessor.java b/codegen/src/main/java/software/amazon/awssdk/codegen/customization/processors/EventStreamUniqueEventShapesProcessor.java new file mode 100644 index 000000000000..333fa3b0db00 --- /dev/null +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/customization/processors/EventStreamUniqueEventShapesProcessor.java @@ -0,0 +1,102 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +package software.amazon.awssdk.codegen.customization.processors; + +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import software.amazon.awssdk.codegen.customization.CodegenCustomizationProcessor; +import software.amazon.awssdk.codegen.model.intermediate.IntermediateModel; +import software.amazon.awssdk.codegen.model.service.ServiceModel; +import software.amazon.awssdk.codegen.model.service.Shape; +import software.amazon.awssdk.codegen.naming.NamingStrategy; +import software.amazon.awssdk.utils.Logger; + +/** + * Processor for eventstreams that ensures that all eventstream event shapes are unique - for each eventstream/event it creates a + * new shape with a unique name constructed from the EventStream and Event shape names: `[ShapeName][EventStreamName]`. Any legacy + * eventstream/events (configured with the useLegacyEventGenerationScheme customization) are skipped. When an event shape is + * shared between multiple eventstreams, it causes SDK generation/compilation failures. The top level shape POJO implements the + * event stream interface for each stream and the return type of the sdkEventType method conflicts. + */ +public final class EventStreamUniqueEventShapesProcessor implements CodegenCustomizationProcessor { + private static final Logger log = Logger.loggerFor(EventStreamUniqueEventShapesProcessor.class); + + private final Map> useLegacyEventGenerationScheme; + private final Map> disableUniqueEventStreamShapePreprocessing; + private final NamingStrategy namingStrategy; + + public EventStreamUniqueEventShapesProcessor( + Map> useLegacyEventGenerationScheme, + Map> disableUniqueEventStreamShapePreprocessing, + NamingStrategy namingStrategy) { + this.useLegacyEventGenerationScheme = useLegacyEventGenerationScheme; + this.disableUniqueEventStreamShapePreprocessing = disableUniqueEventStreamShapePreprocessing; + this.namingStrategy = namingStrategy; + } + + @Override + public void preprocess(ServiceModel serviceModel) { + Map newEventShapes = new HashMap<>(); + serviceModel.getShapes().forEach((name, shape) -> { + if (!shape.isEventstream()) { + return; + } + + preprocessEventStream(serviceModel, name, shape, newEventShapes); + }); + serviceModel.getShapes().putAll(newEventShapes); + } + + private void preprocessEventStream(ServiceModel serviceModel, String eventStreamName, Shape eventStreamShape, Map newEventShapes) { + Set disableUniqueEventDuplication = + Stream.of( + useLegacyEventGenerationScheme.getOrDefault(eventStreamName, Collections.emptyList()), + disableUniqueEventStreamShapePreprocessing.getOrDefault(eventStreamName, Collections.emptyList()) + ) + .flatMap(List::stream) + .collect(Collectors.toSet()); + + eventStreamShape.getMembers().forEach((memberName, member) -> { + String eventShapeName = member.getShape(); + Shape memberTargetShape = serviceModel.getShape(eventShapeName); + + if (memberTargetShape.isEvent() && !disableUniqueEventDuplication.contains(memberName)) { + String newShapeName = namingStrategy.getUniqueEventStreamEventShapeName(member, eventStreamName); + if (serviceModel.getShapes().containsKey(newShapeName)) { + log.warn(() -> String.format("Shape name conflict, unable to create a new unique event shape name for %s in" + + " eventstream %s because %s already exists in the model. Skipping.", + eventShapeName, eventStreamName, newShapeName)); + } else { + log.debug(() -> String.format("Creating new, unique, event shape for %s in eventstream %s: %s", + eventShapeName, eventStreamName, newShapeName)); + newEventShapes.put(newShapeName, memberTargetShape); + member.setShape(newShapeName); + } + } + }); + } + + @Override + public void postprocess(IntermediateModel intermediateModel) { + // no-op + } +} diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/model/config/customization/CustomizationConfig.java b/codegen/src/main/java/software/amazon/awssdk/codegen/model/config/customization/CustomizationConfig.java index 32cecd79feb5..6dcd23153f96 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/model/config/customization/CustomizationConfig.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/model/config/customization/CustomizationConfig.java @@ -210,6 +210,15 @@ public class CustomizationConfig { */ private Map> useLegacyEventGenerationScheme = new HashMap<>(); + /** + * Customization to instruct the code generator to not duplicate event shapes to ensure that event stream shapes + * are unique + *

+ * NOTEThis customization is primarily here to preserve backwards compatibility with existing code before the + * EventStreamUniqueEventShapesProcessor was added. + */ + private Map> disableUniqueEventStreamShapePreprocessing = new HashMap<>(); + /** * How the code generator should behave when it encounters shapes with underscores in the name. */ @@ -654,6 +663,15 @@ public void setUseLegacyEventGenerationScheme(Map> useLegac this.useLegacyEventGenerationScheme = useLegacyEventGenerationScheme; } + public Map> getDisableUniqueEventStreamShapePreprocessing() { + return disableUniqueEventStreamShapePreprocessing; + } + + public void setDisableUniqueEventStreamShapePreprocessing( + Map> disableUniqueEventStreamShapePreprocessing) { + this.disableUniqueEventStreamShapePreprocessing = disableUniqueEventStreamShapePreprocessing; + } + public UnderscoresInNameBehavior getUnderscoresInNameBehavior() { return underscoresInNameBehavior; } diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/naming/DefaultNamingStrategy.java b/codegen/src/main/java/software/amazon/awssdk/codegen/naming/DefaultNamingStrategy.java index e5a4904f295f..b1b1313f4d15 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/naming/DefaultNamingStrategy.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/naming/DefaultNamingStrategy.java @@ -41,6 +41,7 @@ import software.amazon.awssdk.codegen.model.intermediate.IntermediateModel; import software.amazon.awssdk.codegen.model.intermediate.MemberModel; import software.amazon.awssdk.codegen.model.intermediate.Metadata; +import software.amazon.awssdk.codegen.model.service.Member; import software.amazon.awssdk.codegen.model.service.ServiceModel; import software.amazon.awssdk.codegen.model.service.Shape; import software.amazon.awssdk.utils.Logger; @@ -411,6 +412,12 @@ public String getUnionEnumTypeName(MemberModel memberModel) { return screamCase(memberModel.getName()); } + @Override + public String getUniqueEventStreamEventShapeName(Member eventMember, String eventStreamName) { + return eventStreamName + eventMember.getShape(); + } + + private String rewriteInvalidMemberName(String memberName, Shape parentShape) { if (isJavaKeyword(memberName) || isDisallowedNameForShape(memberName, parentShape)) { return Utils.unCapitalize(memberName + CONFLICTING_NAME_SUFFIX); diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/naming/NamingStrategy.java b/codegen/src/main/java/software/amazon/awssdk/codegen/naming/NamingStrategy.java index 1fe32773d71f..5545da6ca9da 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/naming/NamingStrategy.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/naming/NamingStrategy.java @@ -17,6 +17,7 @@ import software.amazon.awssdk.codegen.model.intermediate.IntermediateModel; import software.amazon.awssdk.codegen.model.intermediate.MemberModel; +import software.amazon.awssdk.codegen.model.service.Member; import software.amazon.awssdk.codegen.model.service.Shape; import software.amazon.awssdk.core.SdkField; @@ -200,6 +201,15 @@ public interface NamingStrategy { */ String getExistenceCheckMethodName(String memberName, Shape parentShape); + /** + * Returns a unique shape name to use for an event member of an eventStream. + * + * @param eventMember The event member to get the shape name for. + * @param eventStreamName The name of the eventStream containing the member. + * @return Unique name for the event shape / eventStream combo. + */ + String getUniqueEventStreamEventShapeName(Member eventMember, String eventStreamName); + /** * Verify the customer-visible naming in the provided intermediate model will compile and is idiomatic to Java. */ diff --git a/codegen/src/test/java/software/amazon/awssdk/codegen/customization/processors/UseLegacyEventGenerationSchemeProcessorTest.java b/codegen/src/test/java/software/amazon/awssdk/codegen/customization/processors/UseLegacyEventGenerationSchemeProcessorTest.java index ff041882bbc7..a49acc9537da 100644 --- a/codegen/src/test/java/software/amazon/awssdk/codegen/customization/processors/UseLegacyEventGenerationSchemeProcessorTest.java +++ b/codegen/src/test/java/software/amazon/awssdk/codegen/customization/processors/UseLegacyEventGenerationSchemeProcessorTest.java @@ -17,7 +17,7 @@ import java.io.File; -import org.junit.BeforeClass; +import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; @@ -39,11 +39,11 @@ public class UseLegacyEventGenerationSchemeProcessorTest { @Rule public ExpectedException thrown = ExpectedException.none(); - private static ServiceModel serviceModel; + private ServiceModel serviceModel; - @BeforeClass - public static void setup() { + @Before + public void setup() { String c2jFilePath = UseLegacyEventGenerationSchemeProcessorTest.class.getResource(RESOURCE_ROOT + "/service-2.json").getFile(); File c2jFile = new File(c2jFilePath); @@ -67,7 +67,7 @@ public void testPostProcess_customizationIsValid_succeeds() { } - private static IntermediateModel intermediateModelWithConfig(String configName) { + private IntermediateModel intermediateModelWithConfig(String configName) { return new IntermediateModelBuilder(C2jModels.builder() .serviceModel(serviceModel) .customizationConfig(loadCustomizationConfig(configName)) diff --git a/codegen/src/test/java/software/amazon/awssdk/codegen/poet/model/SharedStreamAwsModelSpecTest.java b/codegen/src/test/java/software/amazon/awssdk/codegen/poet/model/SharedStreamAwsModelSpecTest.java index dffbe834b6fd..141ee860479a 100644 --- a/codegen/src/test/java/software/amazon/awssdk/codegen/poet/model/SharedStreamAwsModelSpecTest.java +++ b/codegen/src/test/java/software/amazon/awssdk/codegen/poet/model/SharedStreamAwsModelSpecTest.java @@ -21,7 +21,6 @@ import static software.amazon.awssdk.utils.FunctionalUtils.invokeSafely; import java.io.File; -import java.io.IOException; import java.util.Collection; import java.util.Locale; import org.junit.Test; @@ -52,7 +51,7 @@ public SharedStreamAwsModelSpecTest(ShapeModel shapeModel) { } @Test - public void basicGeneration() throws Exception { + public void basicGeneration() { assertThat(new AwsServiceModel(intermediateModel, shapeModel), generatesTo(referenceFileForShape())); } @@ -60,7 +59,7 @@ private String referenceFileForShape() { return "sharedstream/" + shapeModel.getShapeName().toLowerCase(Locale.ENGLISH) + ".java"; } - private static void setUp() throws IOException { + private static void setUp() { File serviceModelFile = new File(SharedStreamAwsModelSpecTest.class.getResource("sharedstream/service-2.json").getFile()); ServiceModel serviceModel = ModelLoaderUtils.loadModel(ServiceModel.class, serviceModelFile); diff --git a/codegen/src/test/java/software/amazon/awssdk/codegen/poet/model/SharedStreamEventModelSpecTest.java b/codegen/src/test/java/software/amazon/awssdk/codegen/poet/model/SharedStreamEventModelSpecTest.java new file mode 100644 index 000000000000..06d951099ee4 --- /dev/null +++ b/codegen/src/test/java/software/amazon/awssdk/codegen/poet/model/SharedStreamEventModelSpecTest.java @@ -0,0 +1,66 @@ +package software.amazon.awssdk.codegen.poet.model; + +import static java.util.stream.Collectors.toList; +import static org.hamcrest.MatcherAssert.assertThat; +import static software.amazon.awssdk.codegen.poet.PoetMatchers.generatesTo; +import static software.amazon.awssdk.utils.FunctionalUtils.invokeSafely; +import java.io.File; +import java.util.Collection; +import java.util.Locale; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import software.amazon.awssdk.codegen.C2jModels; +import software.amazon.awssdk.codegen.IntermediateModelBuilder; +import software.amazon.awssdk.codegen.model.config.customization.CustomizationConfig; +import software.amazon.awssdk.codegen.model.intermediate.IntermediateModel; +import software.amazon.awssdk.codegen.model.intermediate.MemberModel; +import software.amazon.awssdk.codegen.model.intermediate.ShapeModel; +import software.amazon.awssdk.codegen.model.service.ServiceModel; +import software.amazon.awssdk.codegen.utils.ModelLoaderUtils; + +@RunWith(Parameterized.class) +public class SharedStreamEventModelSpecTest { + private static IntermediateModel intermediateModel; + + private final MemberModel event; + private final ShapeModel eventStream; + + @Parameterized.Parameters(name = "{1}-{0}") + public static Collection data() { + invokeSafely(SharedStreamEventModelSpecTest::setUp); + return intermediateModel.getShapes().values().stream() + .filter(ShapeModel::isEventStream) + .flatMap(eventStream -> eventStream.getMembers().stream() + .filter(m -> m.getShape().isEvent()) + .map(e -> new Object[]{e, eventStream})) + .collect(toList()); + } + + public SharedStreamEventModelSpecTest(MemberModel event, ShapeModel eventStream) { + this.event = event; + this.eventStream = eventStream; + } + + @Test + public void basicGeneration() { + assertThat(new EventModelSpec(event, eventStream, intermediateModel), generatesTo(referenceFileForShape())); + } + + private String referenceFileForShape() { + String namespacedEventImpl = eventStream.getShapeName() + "/default" + event.getName(); + return "sharedstream/" + namespacedEventImpl.toLowerCase(Locale.ENGLISH) + ".java"; + } + + private static void setUp() { + File serviceModelFile = new File(SharedStreamEventModelSpecTest.class.getResource("sharedstream/service-2.json").getFile()); + ServiceModel serviceModel = ModelLoaderUtils.loadModel(ServiceModel.class, serviceModelFile); + + intermediateModel = new IntermediateModelBuilder( + C2jModels.builder() + .serviceModel(serviceModel) + .customizationConfig(CustomizationConfig.create()) + .build()) + .build(); + } +} diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/c2j/cbor/customization.config b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/c2j/cbor/customization.config index 29eb1e7f6981..63c2b99f3db2 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/c2j/cbor/customization.config +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/c2j/cbor/customization.config @@ -1,28 +1,50 @@ { - "authPolicyActions" : { - "skip" : true + "authPolicyActions": { + "skip": true }, "presignersFqcn": "software.amazon.awssdk.services.acm.presign.AcmClientPresigners", "serviceSpecificHttpConfig": "software.amazon.MyServiceHttpConfig", "serviceConfig": { - "className": "ServiceConfiguration", - "hasDualstackProperty": true, - "hasFipsProperty": true + "className": "ServiceConfiguration", + "hasDualstackProperty": true, + "hasFipsProperty": true }, "customRetryPolicy": "software.amazon.MyServiceRetryPolicy", "customRetryStrategy": "software.amazon.MyServiceRetryStrategy", - "verifiedSimpleMethods" : ["paginatedOperationWithResultKey"], - "excludedSimpleMethods" : [ + "verifiedSimpleMethods": [ + "paginatedOperationWithResultKey" + ], + "excludedSimpleMethods": [ "eventStreamOperation" ], - "utilitiesMethod": { - "returnType": "software.amazon.awssdk.services.json.JsonUtilities", - "createMethodParams": ["param1", "param2", "param3"] - }, - "useLegacyEventGenerationScheme": { - "EventStream": ["EventOne", "event-two", "eventThree"] - }, - "customServiceMetadata": { - "protocol": "cbor" - } -} + "utilitiesMethod": { + "returnType": "software.amazon.awssdk.services.json.JsonUtilities", + "createMethodParams": [ + "param1", + "param2", + "param3" + ] + }, + "useLegacyEventGenerationScheme": { + "EventStream": [ + "EventOne", + "eventThree" + ] + }, + "customServiceMetadata": { + "protocol": "cbor" + }, + "disableUniqueEventStreamShapePreprocessing": { + "InputEventStream": [ + "InputEvent" + ], + "InputEventStreamTwo": [ + "InputEventOne", + "InputEventTwo" + ], + "EventStream": [ + "EventTheSecond", + "secondEventOne" + ] + } +} \ No newline at end of file diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/c2j/json/customization.config b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/c2j/json/customization.config index b22f02b7debe..e136f4de2844 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/c2j/json/customization.config +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/c2j/json/customization.config @@ -1,25 +1,47 @@ { - "authPolicyActions" : { - "skip" : true + "authPolicyActions": { + "skip": true }, "presignersFqcn": "software.amazon.awssdk.services.acm.presign.AcmClientPresigners", "serviceSpecificHttpConfig": "software.amazon.MyServiceHttpConfig", "serviceConfig": { - "className": "ServiceConfiguration", - "hasDualstackProperty": true, - "hasFipsProperty": true + "className": "ServiceConfiguration", + "hasDualstackProperty": true, + "hasFipsProperty": true }, "customRetryPolicy": "software.amazon.MyServiceRetryPolicy", "customRetryStrategy": "software.amazon.MyServiceRetryStrategy", - "verifiedSimpleMethods" : ["paginatedOperationWithResultKey"], - "excludedSimpleMethods" : [ + "verifiedSimpleMethods": [ + "paginatedOperationWithResultKey" + ], + "excludedSimpleMethods": [ "eventStreamOperation" ], - "utilitiesMethod": { - "returnType": "software.amazon.awssdk.services.json.JsonUtilities", - "createMethodParams": ["param1", "param2", "param3"] - }, - "useLegacyEventGenerationScheme": { - "EventStream": ["EventOne", "event-two", "eventThree"] - } -} + "utilitiesMethod": { + "returnType": "software.amazon.awssdk.services.json.JsonUtilities", + "createMethodParams": [ + "param1", + "param2", + "param3" + ] + }, + "useLegacyEventGenerationScheme": { + "EventStream": [ + "EventOne", + "eventThree" + ] + }, + "disableUniqueEventStreamShapePreprocessing": { + "InputEventStream": [ + "InputEvent" + ], + "InputEventStreamTwo": [ + "InputEventOne", + "InputEventTwo" + ], + "EventStream": [ + "EventTheSecond", + "secondEventOne" + ] + } +} \ No newline at end of file diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/c2j/rest-json/customization.config b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/c2j/rest-json/customization.config index 250560d3535f..9cf48b1ecb88 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/c2j/rest-json/customization.config +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/c2j/rest-json/customization.config @@ -1,71 +1,92 @@ { - "authPolicyActions" : { - "skip" : true + "authPolicyActions": { + "skip": true }, "presignersFqcn": "software.amazon.awssdk.services.acm.presign.AcmClientPresigners", "serviceSpecificHttpConfig": "software.amazon.MyServiceHttpConfig", "serviceConfig": { - "className": "ServiceConfiguration", - "hasDualstackProperty": true, - "hasFipsProperty": true, - "hasUseArnRegionProperty": true, - "hasMultiRegionEnabledProperty": true, - "hasPathStyleAccessEnabledProperty":true, - "hasAccelerateModeEnabledProperty":true, - "hasChecksumValidationEnabledProperty":true + "className": "ServiceConfiguration", + "hasDualstackProperty": true, + "hasFipsProperty": true, + "hasUseArnRegionProperty": true, + "hasMultiRegionEnabledProperty": true, + "hasPathStyleAccessEnabledProperty": true, + "hasAccelerateModeEnabledProperty": true, + "hasChecksumValidationEnabledProperty": true }, "customRetryPolicy": "software.amazon.MyServiceRetryPolicy", "customRetryStrategy": "software.amazon.MyServiceRetryStrategy", - "verifiedSimpleMethods" : ["paginatedOperationWithResultKey"], - "excludedSimpleMethods" : [ + "verifiedSimpleMethods": [ + "paginatedOperationWithResultKey" + ], + "excludedSimpleMethods": [ "eventStreamOperation" ], - "utilitiesMethod": { - "returnType": "software.amazon.awssdk.services.json.JsonUtilities", - "createMethodParams": ["param1", "param2", "param3"] - }, + "utilitiesMethod": { + "returnType": "software.amazon.awssdk.services.json.JsonUtilities", + "createMethodParams": [ + "param1", + "param2", + "param3" + ] + }, "additionalBuilderMethods": [ { - "methodName": "builderOne", - "clientType": "ASYNC", - "instanceType": "software.amazon.awssdk.services.builder.DefaultBuilder", - "returnType": "software.amazon.awssdk.services.builder.CustomBuilder", - "statement": "builder().build()", - "javaDoc": "Create a default builder" + "methodName": "builderOne", + "clientType": "ASYNC", + "instanceType": "software.amazon.awssdk.services.builder.DefaultBuilder", + "returnType": "software.amazon.awssdk.services.builder.CustomBuilder", + "statement": "builder().build()", + "javaDoc": "Create a default builder" }, { - "methodName": "builderTwo", - "clientType": "ASYNC", - "instanceType": "software.amazon.awssdk.services.builder.DefaultBuilderTwo", - "returnType": "software.amazon.awssdk.services.builder.Builder", - "statement": "builder2().build()", - "javaDoc": "Create a default builder two" + "methodName": "builderTwo", + "clientType": "ASYNC", + "instanceType": "software.amazon.awssdk.services.builder.DefaultBuilderTwo", + "returnType": "software.amazon.awssdk.services.builder.Builder", + "statement": "builder2().build()", + "javaDoc": "Create a default builder two" }, - { - "methodName": "builderThree", - "clientType": "SYNC", - "instanceType": "software.amazon.awssdk.services.builder.DefaultBuilder", - "returnType": "software.amazon.awssdk.services.builder.CustomBuilder", - "statement": "builder().build()", - "javaDoc": "Create a default builder" + "methodName": "builderThree", + "clientType": "SYNC", + "instanceType": "software.amazon.awssdk.services.builder.DefaultBuilder", + "returnType": "software.amazon.awssdk.services.builder.CustomBuilder", + "statement": "builder().build()", + "javaDoc": "Create a default builder" }, { - "methodName": "builderFour", - "instanceType": "software.amazon.awssdk.services.builder.DefaultBuilder", - "returnType": "software.amazon.awssdk.services.builder.CustomBuilder", - "statement": "builder().build()", - "javaDoc": "Create a default builder" + "methodName": "builderFour", + "instanceType": "software.amazon.awssdk.services.builder.DefaultBuilder", + "returnType": "software.amazon.awssdk.services.builder.CustomBuilder", + "statement": "builder().build()", + "javaDoc": "Create a default builder" } ], - "internalPlugins": [ - "software.amazon.awssdk.codegen.poet.plugins.InternalTestPlugin1", - "software.amazon.awssdk.codegen.poet.plugins.InternalTestPlugin2" - ], - "useLegacyEventGenerationScheme": { - "EventStream": ["EventOne", "event-two", "eventThree"] - }, - "asyncClientDecoratorClass": true, - "syncClientDecoratorClass": true, - "batchManagerSupported": true -} + "internalPlugins": [ + "software.amazon.awssdk.codegen.poet.plugins.InternalTestPlugin1", + "software.amazon.awssdk.codegen.poet.plugins.InternalTestPlugin2" + ], + "useLegacyEventGenerationScheme": { + "EventStream": [ + "EventOne", + "eventThree" + ] + }, + "asyncClientDecoratorClass": true, + "syncClientDecoratorClass": true, + "batchManagerSupported": true, + "disableUniqueEventStreamShapePreprocessing": { + "InputEventStream": [ + "InputEvent" + ], + "InputEventStreamTwo": [ + "InputEventOne", + "InputEventTwo" + ], + "EventStream": [ + "EventTheSecond", + "secondEventOne" + ] + } +} \ No newline at end of file diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/eventstream/customization.config b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/eventstream/customization.config index 2c63c0851048..6996818bf503 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/eventstream/customization.config +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/eventstream/customization.config @@ -1,2 +1,18 @@ { -} + "useLegacyEventGenerationScheme": {}, + "disableUniqueEventStreamShapePreprocessing": { + "InputEventStream": [ + "InputEvent" + ], + "InputEventStreamTwo": [ + "InputEventOne", + "InputEventTwo" + ], + "EventStream": [ + "EventOne", + "EventTwo", + "secondEventOne", + "secondeventtwo" + ] + } +} \ No newline at end of file diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/customization.config b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/customization.config index 0375c733e912..ee070677a7c0 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/customization.config +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/customization.config @@ -1,5 +1,5 @@ { - "excludedSimpleMethods" : [ + "excludedSimpleMethods": [ "allTypes", "nestedContainers", "operationWithNoInputOrOutput", @@ -10,7 +10,7 @@ "modify": [ { "OriginalNameNoDeprecation": { - "emitPropertyName":"NewNameNoDeprecation" + "emitPropertyName": "NewNameNoDeprecation" }, "OriginalNameDeprecated": { "emitPropertyName": "NewName", @@ -35,30 +35,46 @@ ] }, "BaseType": { - "inject": [ - { - "CustomShape1": { - "shape": "CustomShape1", - "documentation": "Custom shape of type string" - }, - "CustomShape2": { - "shape": "CustomShape2", - "documentation": "Custom shape of type integer" - } - } - ] + "inject": [ + { + "CustomShape1": { + "shape": "CustomShape1", + "documentation": "Custom shape of type string" + }, + "CustomShape2": { + "shape": "CustomShape2", + "documentation": "Custom shape of type integer" + } + } + ] } }, "customSdkShapes": { - "shapes": { - "CustomShape1": { - "type":"string" - }, - "CustomShape2": { - "type":"integer" + "shapes": { + "CustomShape1": { + "type": "string" + }, + "CustomShape2": { + "type": "integer" + } } - } }, "underscoresInNameBehavior": "ALLOW", - "requiredTraitValidationEnabled": true -} + "requiredTraitValidationEnabled": true, + "useLegacyEventGenerationScheme": {}, + "disableUniqueEventStreamShapePreprocessing": { + "InputEventStream": [ + "InputEvent" + ], + "InputEventStreamTwo": [ + "InputEventTwo" + ], + "EventStream": [ + "EventOne", + "SecondEventOne", + "EventTwo", + "SecondEventTwo", + "eventthree" + ] + } +} \ No newline at end of file diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/eventstream.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/eventstream.java index 7b4ee13981f9..d5f5919561e3 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/eventstream.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/eventstream.java @@ -41,7 +41,7 @@ public void accept(StreamDeathsResponseHandler.Visitor visitor) { /** * Create a builder for the {@code Person} event type for this stream. */ - static Person.Builder personBuilder() { + static EventStreamPerson.Builder personBuilder() { return DefaultPerson.builder(); } diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/eventstream/defaultperson.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/eventstream/defaultperson.java new file mode 100644 index 000000000000..cccde3b3af18 --- /dev/null +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/eventstream/defaultperson.java @@ -0,0 +1,66 @@ +package software.amazon.awssdk.services.sharedeventstream.model.eventstream; + +import software.amazon.awssdk.annotations.Generated; +import software.amazon.awssdk.annotations.SdkInternalApi; +import software.amazon.awssdk.services.sharedeventstream.model.EventStream; +import software.amazon.awssdk.services.sharedeventstream.model.EventStreamPerson; +import software.amazon.awssdk.services.sharedeventstream.model.StreamBirthsResponseHandler; +import software.amazon.awssdk.services.sharedeventstream.model.StreamDeathsResponseHandler; + +/** + * A specialization of {@code software.amazon.awssdk.services.sharedeventstream.model.EventStreamPerson} that represents + * the {@code EventStream$Person} event. Do not use this class directly. Instead, use the static builder methods on + * {@link software.amazon.awssdk.services.sharedeventstream.model.EventStream}. + */ +@SdkInternalApi +@Generated("software.amazon.awssdk:codegen") +public final class DefaultPerson extends EventStreamPerson { + private static final long serialVersionUID = 1L; + + DefaultPerson(BuilderImpl builderImpl) { + super(builderImpl); + } + + @Override + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + @Override + public void accept(StreamBirthsResponseHandler.Visitor visitor) { + visitor.visitPerson(this); + } + + @Override + public void accept(StreamDeathsResponseHandler.Visitor visitor) { + visitor.visitPerson(this); + } + + @Override + public EventStream.EventType sdkEventType() { + return EventStream.EventType.PERSON; + } + + public interface Builder extends EventStreamPerson.Builder { + @Override + DefaultPerson build(); + } + + private static final class BuilderImpl extends EventStreamPerson.BuilderImpl implements Builder { + private BuilderImpl() { + } + + private BuilderImpl(DefaultPerson event) { + super(event); + } + + @Override + public DefaultPerson build() { + return new DefaultPerson(this); + } + } +} diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/person.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/eventstreamperson.java similarity index 87% rename from codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/person.java rename to codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/eventstreamperson.java index 9a994cecca29..d2a5882dfb96 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/person.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/eventstreamperson.java @@ -27,13 +27,14 @@ /** */ @Generated("software.amazon.awssdk:codegen") -public class Person implements SdkPojo, Serializable, ToCopyableBuilder, EventStream { +public class EventStreamPerson implements SdkPojo, Serializable, ToCopyableBuilder, + EventStream { private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Name") - .getter(getter(Person::name)).setter(setter(Builder::name)) + .getter(getter(EventStreamPerson::name)).setter(setter(Builder::name)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build(); private static final SdkField BIRTHDAY_FIELD = SdkField. builder(MarshallingType.INSTANT) - .memberName("Birthday").getter(getter(Person::birthday)).setter(setter(Builder::birthday)) + .memberName("Birthday").getter(getter(EventStreamPerson::birthday)).setter(setter(Builder::birthday)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Birthday").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(NAME_FIELD, BIRTHDAY_FIELD)); @@ -46,7 +47,7 @@ public class Person implements SdkPojo, Serializable, ToCopyableBuilder Optional getValueForField(String fieldName, Class clazz) { @@ -131,7 +132,7 @@ public final Optional getValueForField(String fieldName, Class clazz) } @Override - public final Person copy(Consumer modifier) { + public final EventStreamPerson copy(Consumer modifier) { return ToCopyableBuilder.super.copy(modifier); } @@ -152,8 +153,8 @@ private static Map> memberNameToFieldInitializer() { return Collections.unmodifiableMap(map); } - private static Function getter(Function g) { - return obj -> g.apply((Person) obj); + private static Function getter(Function g) { + return obj -> g.apply((EventStreamPerson) obj); } private static BiConsumer setter(BiConsumer s) { @@ -161,7 +162,7 @@ private static BiConsumer setter(BiConsumer s) { } /** - * Calls the appropriate visit method depending on the subtype of {@link Person}. + * Calls the appropriate visit method depending on the subtype of {@link EventStreamPerson}. * * @param visitor * Visitor to invoke. @@ -172,7 +173,7 @@ public void accept(StreamBirthsResponseHandler.Visitor visitor) { } /** - * Calls the appropriate visit method depending on the subtype of {@link Person}. + * Calls the appropriate visit method depending on the subtype of {@link EventStreamPerson}. * * @param visitor * Visitor to invoke. @@ -184,7 +185,7 @@ public void accept(StreamDeathsResponseHandler.Visitor visitor) { @Mutable @NotThreadSafe - public interface Builder extends SdkPojo, CopyableBuilder { + public interface Builder extends SdkPojo, CopyableBuilder { /** * Sets the value of the Name property for this object. * @@ -212,7 +213,7 @@ protected static class BuilderImpl implements Builder { protected BuilderImpl() { } - protected BuilderImpl(Person model) { + protected BuilderImpl(EventStreamPerson model) { name(model.name); birthday(model.birthday); } @@ -246,8 +247,8 @@ public final Builder birthday(Instant birthday) { } @Override - public Person build() { - return new Person(this); + public EventStreamPerson build() { + return new EventStreamPerson(this); } @Override diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/service-2.json b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/service-2.json index 4fa3c6714366..afc9c3816424 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/service-2.json +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/service-2.json @@ -33,6 +33,26 @@ "shape": "PeopleOutput" } }, + "StreamBirthsInput" : { + "name": "StreamBirths", + "http": { + "method": "POST", + "requestUri": "/births" + }, + "input": { + "shape": "StreamBirthsInputRequest" + } + }, + "StreamDeathsInput" : { + "name": "StreamDeathsInput", + "http": { + "method": "POST", + "requestUri": "/deaths" + }, + "input": { + "shape": "StreamDeathsInputRequest" + } + }, "GetRandomPerson" : { "name" : "GetRandomPerson", "http": { @@ -79,6 +99,40 @@ } }, "event": true + }, + "StreamBirthsInputRequest": { + "type": "structure", + "members": { + "StreamBirthsInputEventStream": { + "shape": "StreamBirthsInputEventStream" + } + } + }, + "StreamDeathsInputRequest": { + "type": "structure", + "members": { + "StreamDeathsInputEventStream": { + "shape": "StreamDeathsInputEventStream" + } + } + }, + "StreamBirthsInputEventStream": { + "type": "structure", + "members": { + "Person": { + "shape": "Person" + } + }, + "eventstream": true + }, + "StreamDeathsInputEventStream": { + "type": "structure", + "members": { + "Person": { + "shape": "Person" + } + }, + "eventstream": true } }, "documentation": "A service that streams births and deaths" diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/streambirthsinputeventstream.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/streambirthsinputeventstream.java new file mode 100644 index 000000000000..ef902a6f7291 --- /dev/null +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/streambirthsinputeventstream.java @@ -0,0 +1,79 @@ +package software.amazon.awssdk.services.sharedeventstream.model; + +import java.util.EnumSet; +import java.util.Map; +import java.util.Set; +import software.amazon.awssdk.annotations.Generated; +import software.amazon.awssdk.annotations.SdkPublicApi; +import software.amazon.awssdk.services.sharedeventstream.model.streambirthsinputeventstream.DefaultPerson; +import software.amazon.awssdk.utils.internal.EnumUtils; + +/** + * Base interface for all event types in StreamBirthsInputEventStream. + */ +@Generated("software.amazon.awssdk:codegen") +@SdkPublicApi +public interface StreamBirthsInputEventStream { + /** + * Create a builder for the {@code Person} event type for this stream. + */ + static StreamBirthsInputEventStreamPerson.Builder personBuilder() { + return DefaultPerson.builder(); + } + + /** + * The type of this event. Corresponds to the {@code :event-type} header on the Message. + */ + default EventType sdkEventType() { + return EventType.UNKNOWN_TO_SDK_VERSION; + } + + /** + * The known possible types of events for {@code StreamBirthsInputEventStream}. + */ + @Generated("software.amazon.awssdk:codegen") + enum EventType { + PERSON("Person"), + + UNKNOWN_TO_SDK_VERSION(null); + + private static final Map VALUE_MAP = EnumUtils.uniqueIndex(EventType.class, EventType::toString); + + private final String value; + + private EventType(String value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + /** + * Use this in place of valueOf to convert the raw string returned by the service into the enum value. + * + * @param value + * real value + * @return EventType corresponding to the value + */ + public static EventType fromValue(String value) { + if (value == null) { + return null; + } + return VALUE_MAP.getOrDefault(value, UNKNOWN_TO_SDK_VERSION); + } + + /** + * Use this in place of {@link #values()} to return a {@link Set} of all values known to the SDK. This will + * return all known enum values except {@link #UNKNOWN_TO_SDK_VERSION}. + * + * @return a {@link Set} of known {@link EventType}s + */ + public static Set knownValues() { + Set knownValues = EnumSet.allOf(EventType.class); + knownValues.remove(UNKNOWN_TO_SDK_VERSION); + return knownValues; + } + } +} diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/streambirthsinputeventstream/defaultperson.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/streambirthsinputeventstream/defaultperson.java new file mode 100644 index 000000000000..53ed5f55ae4a --- /dev/null +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/streambirthsinputeventstream/defaultperson.java @@ -0,0 +1,55 @@ +package software.amazon.awssdk.services.sharedeventstream.model.streambirthsinputeventstream; + +import software.amazon.awssdk.annotations.Generated; +import software.amazon.awssdk.annotations.SdkInternalApi; +import software.amazon.awssdk.services.sharedeventstream.model.StreamBirthsInputEventStream; +import software.amazon.awssdk.services.sharedeventstream.model.StreamBirthsInputEventStreamPerson; + +/** + * A specialization of + * {@code software.amazon.awssdk.services.sharedeventstream.model.StreamBirthsInputEventStreamPerson} that represents + * the {@code StreamBirthsInputEventStream$Person} event. Do not use this class directly. Instead, use the static + * builder methods on {@link software.amazon.awssdk.services.sharedeventstream.model.StreamBirthsInputEventStream}. + */ +@SdkInternalApi +@Generated("software.amazon.awssdk:codegen") +public final class DefaultPerson extends StreamBirthsInputEventStreamPerson { + private static final long serialVersionUID = 1L; + + DefaultPerson(BuilderImpl builderImpl) { + super(builderImpl); + } + + @Override + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + @Override + public StreamBirthsInputEventStream.EventType sdkEventType() { + return StreamBirthsInputEventStream.EventType.PERSON; + } + + public interface Builder extends StreamBirthsInputEventStreamPerson.Builder { + @Override + DefaultPerson build(); + } + + private static final class BuilderImpl extends StreamBirthsInputEventStreamPerson.BuilderImpl implements Builder { + private BuilderImpl() { + } + + private BuilderImpl(DefaultPerson event) { + super(event); + } + + @Override + public DefaultPerson build() { + return new DefaultPerson(this); + } + } +} diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/streambirthsinputeventstreamperson.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/streambirthsinputeventstreamperson.java new file mode 100644 index 000000000000..bc5724187ff8 --- /dev/null +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/streambirthsinputeventstreamperson.java @@ -0,0 +1,244 @@ +package software.amazon.awssdk.services.sharedeventstream.model; + +import java.io.Serializable; +import java.time.Instant; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.function.BiConsumer; +import java.util.function.Consumer; +import java.util.function.Function; +import software.amazon.awssdk.annotations.Generated; +import software.amazon.awssdk.annotations.Mutable; +import software.amazon.awssdk.annotations.NotThreadSafe; +import software.amazon.awssdk.core.SdkField; +import software.amazon.awssdk.core.SdkPojo; +import software.amazon.awssdk.core.protocol.MarshallLocation; +import software.amazon.awssdk.core.protocol.MarshallingType; +import software.amazon.awssdk.core.traits.LocationTrait; +import software.amazon.awssdk.utils.ToString; +import software.amazon.awssdk.utils.builder.CopyableBuilder; +import software.amazon.awssdk.utils.builder.ToCopyableBuilder; + +/** + */ +@Generated("software.amazon.awssdk:codegen") +public class StreamBirthsInputEventStreamPerson implements SdkPojo, Serializable, + ToCopyableBuilder, + StreamBirthsInputEventStream { + private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Name") + .getter(getter(StreamBirthsInputEventStreamPerson::name)).setter(setter(Builder::name)) + .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build(); + + private static final SdkField BIRTHDAY_FIELD = SdkField. builder(MarshallingType.INSTANT) + .memberName("Birthday").getter(getter(StreamBirthsInputEventStreamPerson::birthday)) + .setter(setter(Builder::birthday)) + .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Birthday").build()).build(); + + private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(NAME_FIELD, BIRTHDAY_FIELD)); + + private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer(); + + private static final long serialVersionUID = 1L; + + private final String name; + + private final Instant birthday; + + protected StreamBirthsInputEventStreamPerson(BuilderImpl builder) { + this.name = builder.name; + this.birthday = builder.birthday; + } + + /** + * Returns the value of the Name property for this object. + * + * @return The value of the Name property for this object. + */ + public final String name() { + return name; + } + + /** + * Returns the value of the Birthday property for this object. + * + * @return The value of the Birthday property for this object. + */ + public final Instant birthday() { + return birthday; + } + + @Override + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public static Class serializableBuilderClass() { + return BuilderImpl.class; + } + + @Override + public final int hashCode() { + int hashCode = 1; + hashCode = 31 * hashCode + Objects.hashCode(name()); + hashCode = 31 * hashCode + Objects.hashCode(birthday()); + return hashCode; + } + + @Override + public final boolean equals(Object obj) { + return equalsBySdkFields(obj); + } + + @Override + public final boolean equalsBySdkFields(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (!(obj instanceof StreamBirthsInputEventStreamPerson)) { + return false; + } + StreamBirthsInputEventStreamPerson other = (StreamBirthsInputEventStreamPerson) obj; + return Objects.equals(name(), other.name()) && Objects.equals(birthday(), other.birthday()); + } + + /** + * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be + * redacted from this string using a placeholder value. + */ + @Override + public final String toString() { + return ToString.builder("StreamBirthsInputEventStreamPerson").add("Name", name()).add("Birthday", birthday()).build(); + } + + public final Optional getValueForField(String fieldName, Class clazz) { + switch (fieldName) { + case "Name": + return Optional.ofNullable(clazz.cast(name())); + case "Birthday": + return Optional.ofNullable(clazz.cast(birthday())); + default: + return Optional.empty(); + } + } + + @Override + public final StreamBirthsInputEventStreamPerson copy(Consumer modifier) { + return ToCopyableBuilder.super.copy(modifier); + } + + @Override + public final List> sdkFields() { + return SDK_FIELDS; + } + + @Override + public final Map> sdkFieldNameToField() { + return SDK_NAME_TO_FIELD; + } + + private static Map> memberNameToFieldInitializer() { + Map> map = new HashMap<>(); + map.put("Name", NAME_FIELD); + map.put("Birthday", BIRTHDAY_FIELD); + return Collections.unmodifiableMap(map); + } + + private static Function getter(Function g) { + return obj -> g.apply((StreamBirthsInputEventStreamPerson) obj); + } + + private static BiConsumer setter(BiConsumer s) { + return (obj, val) -> s.accept((Builder) obj, val); + } + + @Mutable + @NotThreadSafe + public interface Builder extends SdkPojo, CopyableBuilder { + /** + * Sets the value of the Name property for this object. + * + * @param name + * The new value for the Name property for this object. + * @return Returns a reference to this object so that method calls can be chained together. + */ + Builder name(String name); + + /** + * Sets the value of the Birthday property for this object. + * + * @param birthday + * The new value for the Birthday property for this object. + * @return Returns a reference to this object so that method calls can be chained together. + */ + Builder birthday(Instant birthday); + } + + protected static class BuilderImpl implements Builder { + private String name; + + private Instant birthday; + + protected BuilderImpl() { + } + + protected BuilderImpl(StreamBirthsInputEventStreamPerson model) { + name(model.name); + birthday(model.birthday); + } + + public final String getName() { + return name; + } + + public final void setName(String name) { + this.name = name; + } + + @Override + public final Builder name(String name) { + this.name = name; + return this; + } + + public final Instant getBirthday() { + return birthday; + } + + public final void setBirthday(Instant birthday) { + this.birthday = birthday; + } + + @Override + public final Builder birthday(Instant birthday) { + this.birthday = birthday; + return this; + } + + @Override + public StreamBirthsInputEventStreamPerson build() { + return new StreamBirthsInputEventStreamPerson(this); + } + + @Override + public List> sdkFields() { + return SDK_FIELDS; + } + + @Override + public Map> sdkFieldNameToField() { + return SDK_NAME_TO_FIELD; + } + } +} diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/streambirthsinputrequest.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/streambirthsinputrequest.java new file mode 100644 index 000000000000..a6ea3c99e65a --- /dev/null +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/streambirthsinputrequest.java @@ -0,0 +1,143 @@ +package software.amazon.awssdk.services.sharedeventstream.model; + +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.function.Consumer; +import software.amazon.awssdk.annotations.Generated; +import software.amazon.awssdk.annotations.Mutable; +import software.amazon.awssdk.annotations.NotThreadSafe; +import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration; +import software.amazon.awssdk.core.SdkField; +import software.amazon.awssdk.core.SdkPojo; +import software.amazon.awssdk.utils.ToString; +import software.amazon.awssdk.utils.builder.CopyableBuilder; +import software.amazon.awssdk.utils.builder.ToCopyableBuilder; + +/** + */ +@Generated("software.amazon.awssdk:codegen") +public final class StreamBirthsInputRequest extends SharedEventStreamRequest implements + ToCopyableBuilder { + private static final List> SDK_FIELDS = Collections.emptyList(); + + private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer(); + + private StreamBirthsInputRequest(BuilderImpl builder) { + super(builder); + } + + @Override + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public static Class serializableBuilderClass() { + return BuilderImpl.class; + } + + @Override + public final int hashCode() { + int hashCode = 1; + hashCode = 31 * hashCode + super.hashCode(); + return hashCode; + } + + @Override + public final boolean equals(Object obj) { + return super.equals(obj) && equalsBySdkFields(obj); + } + + @Override + public final boolean equalsBySdkFields(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (!(obj instanceof StreamBirthsInputRequest)) { + return false; + } + return true; + } + + /** + * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be + * redacted from this string using a placeholder value. + */ + @Override + public final String toString() { + return ToString.builder("StreamBirthsInputRequest").build(); + } + + public final Optional getValueForField(String fieldName, Class clazz) { + return Optional.empty(); + } + + @Override + public final List> sdkFields() { + return SDK_FIELDS; + } + + @Override + public final Map> sdkFieldNameToField() { + return SDK_NAME_TO_FIELD; + } + + private static Map> memberNameToFieldInitializer() { + return Collections.emptyMap(); + } + + @Mutable + @NotThreadSafe + public interface Builder extends SharedEventStreamRequest.Builder, SdkPojo, + CopyableBuilder { + @Override + Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); + + @Override + Builder overrideConfiguration(Consumer builderConsumer); + } + + static final class BuilderImpl extends SharedEventStreamRequest.BuilderImpl implements Builder { + private BuilderImpl() { + } + + private BuilderImpl(StreamBirthsInputRequest model) { + super(model); + } + + @Override + public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { + super.overrideConfiguration(overrideConfiguration); + return this; + } + + @Override + public Builder overrideConfiguration(Consumer builderConsumer) { + super.overrideConfiguration(builderConsumer); + return this; + } + + @Override + public StreamBirthsInputRequest build() { + return new StreamBirthsInputRequest(this); + } + + @Override + public List> sdkFields() { + return SDK_FIELDS; + } + + @Override + public Map> sdkFieldNameToField() { + return SDK_NAME_TO_FIELD; + } + } +} diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/streambirthsinputresponse.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/streambirthsinputresponse.java new file mode 100644 index 000000000000..f1d03c15fe26 --- /dev/null +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/streambirthsinputresponse.java @@ -0,0 +1,122 @@ +package software.amazon.awssdk.services.sharedeventstream.model; + +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import software.amazon.awssdk.annotations.Generated; +import software.amazon.awssdk.annotations.Mutable; +import software.amazon.awssdk.annotations.NotThreadSafe; +import software.amazon.awssdk.core.SdkField; +import software.amazon.awssdk.core.SdkPojo; +import software.amazon.awssdk.utils.ToString; +import software.amazon.awssdk.utils.builder.CopyableBuilder; +import software.amazon.awssdk.utils.builder.ToCopyableBuilder; + +@Generated("software.amazon.awssdk:codegen") +public final class StreamBirthsInputResponse extends SharedEventStreamResponse implements + ToCopyableBuilder { + private static final List> SDK_FIELDS = Collections.emptyList(); + + private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer(); + + private StreamBirthsInputResponse(BuilderImpl builder) { + super(builder); + } + + @Override + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public static Class serializableBuilderClass() { + return BuilderImpl.class; + } + + @Override + public final int hashCode() { + int hashCode = 1; + hashCode = 31 * hashCode + super.hashCode(); + return hashCode; + } + + @Override + public final boolean equals(Object obj) { + return super.equals(obj) && equalsBySdkFields(obj); + } + + @Override + public final boolean equalsBySdkFields(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (!(obj instanceof StreamBirthsInputResponse)) { + return false; + } + return true; + } + + /** + * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be + * redacted from this string using a placeholder value. + */ + @Override + public final String toString() { + return ToString.builder("StreamBirthsInputResponse").build(); + } + + public final Optional getValueForField(String fieldName, Class clazz) { + return Optional.empty(); + } + + @Override + public final List> sdkFields() { + return SDK_FIELDS; + } + + @Override + public final Map> sdkFieldNameToField() { + return SDK_NAME_TO_FIELD; + } + + private static Map> memberNameToFieldInitializer() { + return Collections.emptyMap(); + } + + @Mutable + @NotThreadSafe + public interface Builder extends SharedEventStreamResponse.Builder, SdkPojo, + CopyableBuilder { + } + + static final class BuilderImpl extends SharedEventStreamResponse.BuilderImpl implements Builder { + private BuilderImpl() { + } + + private BuilderImpl(StreamBirthsInputResponse model) { + super(model); + } + + @Override + public StreamBirthsInputResponse build() { + return new StreamBirthsInputResponse(this); + } + + @Override + public List> sdkFields() { + return SDK_FIELDS; + } + + @Override + public Map> sdkFieldNameToField() { + return SDK_NAME_TO_FIELD; + } + } +} diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/streamdeathsinputeventstream.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/streamdeathsinputeventstream.java new file mode 100644 index 000000000000..1ed28bf4d5e8 --- /dev/null +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/streamdeathsinputeventstream.java @@ -0,0 +1,79 @@ +package software.amazon.awssdk.services.sharedeventstream.model; + +import java.util.EnumSet; +import java.util.Map; +import java.util.Set; +import software.amazon.awssdk.annotations.Generated; +import software.amazon.awssdk.annotations.SdkPublicApi; +import software.amazon.awssdk.services.sharedeventstream.model.streamdeathsinputeventstream.DefaultPerson; +import software.amazon.awssdk.utils.internal.EnumUtils; + +/** + * Base interface for all event types in StreamDeathsInputEventStream. + */ +@Generated("software.amazon.awssdk:codegen") +@SdkPublicApi +public interface StreamDeathsInputEventStream { + /** + * Create a builder for the {@code Person} event type for this stream. + */ + static StreamDeathsInputEventStreamPerson.Builder personBuilder() { + return DefaultPerson.builder(); + } + + /** + * The type of this event. Corresponds to the {@code :event-type} header on the Message. + */ + default EventType sdkEventType() { + return EventType.UNKNOWN_TO_SDK_VERSION; + } + + /** + * The known possible types of events for {@code StreamDeathsInputEventStream}. + */ + @Generated("software.amazon.awssdk:codegen") + enum EventType { + PERSON("Person"), + + UNKNOWN_TO_SDK_VERSION(null); + + private static final Map VALUE_MAP = EnumUtils.uniqueIndex(EventType.class, EventType::toString); + + private final String value; + + private EventType(String value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + /** + * Use this in place of valueOf to convert the raw string returned by the service into the enum value. + * + * @param value + * real value + * @return EventType corresponding to the value + */ + public static EventType fromValue(String value) { + if (value == null) { + return null; + } + return VALUE_MAP.getOrDefault(value, UNKNOWN_TO_SDK_VERSION); + } + + /** + * Use this in place of {@link #values()} to return a {@link Set} of all values known to the SDK. This will + * return all known enum values except {@link #UNKNOWN_TO_SDK_VERSION}. + * + * @return a {@link Set} of known {@link EventType}s + */ + public static Set knownValues() { + Set knownValues = EnumSet.allOf(EventType.class); + knownValues.remove(UNKNOWN_TO_SDK_VERSION); + return knownValues; + } + } +} diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/streamdeathsinputeventstream/defaultperson.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/streamdeathsinputeventstream/defaultperson.java new file mode 100644 index 000000000000..6cd2d6fde6db --- /dev/null +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/streamdeathsinputeventstream/defaultperson.java @@ -0,0 +1,55 @@ +package software.amazon.awssdk.services.sharedeventstream.model.streamdeathsinputeventstream; + +import software.amazon.awssdk.annotations.Generated; +import software.amazon.awssdk.annotations.SdkInternalApi; +import software.amazon.awssdk.services.sharedeventstream.model.StreamDeathsInputEventStream; +import software.amazon.awssdk.services.sharedeventstream.model.StreamDeathsInputEventStreamPerson; + +/** + * A specialization of + * {@code software.amazon.awssdk.services.sharedeventstream.model.StreamDeathsInputEventStreamPerson} that represents + * the {@code StreamDeathsInputEventStream$Person} event. Do not use this class directly. Instead, use the static + * builder methods on {@link software.amazon.awssdk.services.sharedeventstream.model.StreamDeathsInputEventStream}. + */ +@SdkInternalApi +@Generated("software.amazon.awssdk:codegen") +public final class DefaultPerson extends StreamDeathsInputEventStreamPerson { + private static final long serialVersionUID = 1L; + + DefaultPerson(BuilderImpl builderImpl) { + super(builderImpl); + } + + @Override + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + @Override + public StreamDeathsInputEventStream.EventType sdkEventType() { + return StreamDeathsInputEventStream.EventType.PERSON; + } + + public interface Builder extends StreamDeathsInputEventStreamPerson.Builder { + @Override + DefaultPerson build(); + } + + private static final class BuilderImpl extends StreamDeathsInputEventStreamPerson.BuilderImpl implements Builder { + private BuilderImpl() { + } + + private BuilderImpl(DefaultPerson event) { + super(event); + } + + @Override + public DefaultPerson build() { + return new DefaultPerson(this); + } + } +} diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/streamdeathsinputeventstreamperson.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/streamdeathsinputeventstreamperson.java new file mode 100644 index 000000000000..6fbdbe803fd2 --- /dev/null +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/streamdeathsinputeventstreamperson.java @@ -0,0 +1,244 @@ +package software.amazon.awssdk.services.sharedeventstream.model; + +import java.io.Serializable; +import java.time.Instant; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.function.BiConsumer; +import java.util.function.Consumer; +import java.util.function.Function; +import software.amazon.awssdk.annotations.Generated; +import software.amazon.awssdk.annotations.Mutable; +import software.amazon.awssdk.annotations.NotThreadSafe; +import software.amazon.awssdk.core.SdkField; +import software.amazon.awssdk.core.SdkPojo; +import software.amazon.awssdk.core.protocol.MarshallLocation; +import software.amazon.awssdk.core.protocol.MarshallingType; +import software.amazon.awssdk.core.traits.LocationTrait; +import software.amazon.awssdk.utils.ToString; +import software.amazon.awssdk.utils.builder.CopyableBuilder; +import software.amazon.awssdk.utils.builder.ToCopyableBuilder; + +/** + */ +@Generated("software.amazon.awssdk:codegen") +public class StreamDeathsInputEventStreamPerson implements SdkPojo, Serializable, + ToCopyableBuilder, + StreamDeathsInputEventStream { + private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Name") + .getter(getter(StreamDeathsInputEventStreamPerson::name)).setter(setter(Builder::name)) + .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build(); + + private static final SdkField BIRTHDAY_FIELD = SdkField. builder(MarshallingType.INSTANT) + .memberName("Birthday").getter(getter(StreamDeathsInputEventStreamPerson::birthday)) + .setter(setter(Builder::birthday)) + .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Birthday").build()).build(); + + private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(NAME_FIELD, BIRTHDAY_FIELD)); + + private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer(); + + private static final long serialVersionUID = 1L; + + private final String name; + + private final Instant birthday; + + protected StreamDeathsInputEventStreamPerson(BuilderImpl builder) { + this.name = builder.name; + this.birthday = builder.birthday; + } + + /** + * Returns the value of the Name property for this object. + * + * @return The value of the Name property for this object. + */ + public final String name() { + return name; + } + + /** + * Returns the value of the Birthday property for this object. + * + * @return The value of the Birthday property for this object. + */ + public final Instant birthday() { + return birthday; + } + + @Override + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public static Class serializableBuilderClass() { + return BuilderImpl.class; + } + + @Override + public final int hashCode() { + int hashCode = 1; + hashCode = 31 * hashCode + Objects.hashCode(name()); + hashCode = 31 * hashCode + Objects.hashCode(birthday()); + return hashCode; + } + + @Override + public final boolean equals(Object obj) { + return equalsBySdkFields(obj); + } + + @Override + public final boolean equalsBySdkFields(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (!(obj instanceof StreamDeathsInputEventStreamPerson)) { + return false; + } + StreamDeathsInputEventStreamPerson other = (StreamDeathsInputEventStreamPerson) obj; + return Objects.equals(name(), other.name()) && Objects.equals(birthday(), other.birthday()); + } + + /** + * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be + * redacted from this string using a placeholder value. + */ + @Override + public final String toString() { + return ToString.builder("StreamDeathsInputEventStreamPerson").add("Name", name()).add("Birthday", birthday()).build(); + } + + public final Optional getValueForField(String fieldName, Class clazz) { + switch (fieldName) { + case "Name": + return Optional.ofNullable(clazz.cast(name())); + case "Birthday": + return Optional.ofNullable(clazz.cast(birthday())); + default: + return Optional.empty(); + } + } + + @Override + public final StreamDeathsInputEventStreamPerson copy(Consumer modifier) { + return ToCopyableBuilder.super.copy(modifier); + } + + @Override + public final List> sdkFields() { + return SDK_FIELDS; + } + + @Override + public final Map> sdkFieldNameToField() { + return SDK_NAME_TO_FIELD; + } + + private static Map> memberNameToFieldInitializer() { + Map> map = new HashMap<>(); + map.put("Name", NAME_FIELD); + map.put("Birthday", BIRTHDAY_FIELD); + return Collections.unmodifiableMap(map); + } + + private static Function getter(Function g) { + return obj -> g.apply((StreamDeathsInputEventStreamPerson) obj); + } + + private static BiConsumer setter(BiConsumer s) { + return (obj, val) -> s.accept((Builder) obj, val); + } + + @Mutable + @NotThreadSafe + public interface Builder extends SdkPojo, CopyableBuilder { + /** + * Sets the value of the Name property for this object. + * + * @param name + * The new value for the Name property for this object. + * @return Returns a reference to this object so that method calls can be chained together. + */ + Builder name(String name); + + /** + * Sets the value of the Birthday property for this object. + * + * @param birthday + * The new value for the Birthday property for this object. + * @return Returns a reference to this object so that method calls can be chained together. + */ + Builder birthday(Instant birthday); + } + + protected static class BuilderImpl implements Builder { + private String name; + + private Instant birthday; + + protected BuilderImpl() { + } + + protected BuilderImpl(StreamDeathsInputEventStreamPerson model) { + name(model.name); + birthday(model.birthday); + } + + public final String getName() { + return name; + } + + public final void setName(String name) { + this.name = name; + } + + @Override + public final Builder name(String name) { + this.name = name; + return this; + } + + public final Instant getBirthday() { + return birthday; + } + + public final void setBirthday(Instant birthday) { + this.birthday = birthday; + } + + @Override + public final Builder birthday(Instant birthday) { + this.birthday = birthday; + return this; + } + + @Override + public StreamDeathsInputEventStreamPerson build() { + return new StreamDeathsInputEventStreamPerson(this); + } + + @Override + public List> sdkFields() { + return SDK_FIELDS; + } + + @Override + public Map> sdkFieldNameToField() { + return SDK_NAME_TO_FIELD; + } + } +} diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/streamdeathsinputrequest.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/streamdeathsinputrequest.java new file mode 100644 index 000000000000..db313986ec21 --- /dev/null +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/streamdeathsinputrequest.java @@ -0,0 +1,143 @@ +package software.amazon.awssdk.services.sharedeventstream.model; + +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.function.Consumer; +import software.amazon.awssdk.annotations.Generated; +import software.amazon.awssdk.annotations.Mutable; +import software.amazon.awssdk.annotations.NotThreadSafe; +import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration; +import software.amazon.awssdk.core.SdkField; +import software.amazon.awssdk.core.SdkPojo; +import software.amazon.awssdk.utils.ToString; +import software.amazon.awssdk.utils.builder.CopyableBuilder; +import software.amazon.awssdk.utils.builder.ToCopyableBuilder; + +/** + */ +@Generated("software.amazon.awssdk:codegen") +public final class StreamDeathsInputRequest extends SharedEventStreamRequest implements + ToCopyableBuilder { + private static final List> SDK_FIELDS = Collections.emptyList(); + + private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer(); + + private StreamDeathsInputRequest(BuilderImpl builder) { + super(builder); + } + + @Override + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public static Class serializableBuilderClass() { + return BuilderImpl.class; + } + + @Override + public final int hashCode() { + int hashCode = 1; + hashCode = 31 * hashCode + super.hashCode(); + return hashCode; + } + + @Override + public final boolean equals(Object obj) { + return super.equals(obj) && equalsBySdkFields(obj); + } + + @Override + public final boolean equalsBySdkFields(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (!(obj instanceof StreamDeathsInputRequest)) { + return false; + } + return true; + } + + /** + * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be + * redacted from this string using a placeholder value. + */ + @Override + public final String toString() { + return ToString.builder("StreamDeathsInputRequest").build(); + } + + public final Optional getValueForField(String fieldName, Class clazz) { + return Optional.empty(); + } + + @Override + public final List> sdkFields() { + return SDK_FIELDS; + } + + @Override + public final Map> sdkFieldNameToField() { + return SDK_NAME_TO_FIELD; + } + + private static Map> memberNameToFieldInitializer() { + return Collections.emptyMap(); + } + + @Mutable + @NotThreadSafe + public interface Builder extends SharedEventStreamRequest.Builder, SdkPojo, + CopyableBuilder { + @Override + Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); + + @Override + Builder overrideConfiguration(Consumer builderConsumer); + } + + static final class BuilderImpl extends SharedEventStreamRequest.BuilderImpl implements Builder { + private BuilderImpl() { + } + + private BuilderImpl(StreamDeathsInputRequest model) { + super(model); + } + + @Override + public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { + super.overrideConfiguration(overrideConfiguration); + return this; + } + + @Override + public Builder overrideConfiguration(Consumer builderConsumer) { + super.overrideConfiguration(builderConsumer); + return this; + } + + @Override + public StreamDeathsInputRequest build() { + return new StreamDeathsInputRequest(this); + } + + @Override + public List> sdkFields() { + return SDK_FIELDS; + } + + @Override + public Map> sdkFieldNameToField() { + return SDK_NAME_TO_FIELD; + } + } +} diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/streamdeathsinputresponse.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/streamdeathsinputresponse.java new file mode 100644 index 000000000000..7cfc7f200877 --- /dev/null +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/sharedstream/streamdeathsinputresponse.java @@ -0,0 +1,122 @@ +package software.amazon.awssdk.services.sharedeventstream.model; + +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import software.amazon.awssdk.annotations.Generated; +import software.amazon.awssdk.annotations.Mutable; +import software.amazon.awssdk.annotations.NotThreadSafe; +import software.amazon.awssdk.core.SdkField; +import software.amazon.awssdk.core.SdkPojo; +import software.amazon.awssdk.utils.ToString; +import software.amazon.awssdk.utils.builder.CopyableBuilder; +import software.amazon.awssdk.utils.builder.ToCopyableBuilder; + +@Generated("software.amazon.awssdk:codegen") +public final class StreamDeathsInputResponse extends SharedEventStreamResponse implements + ToCopyableBuilder { + private static final List> SDK_FIELDS = Collections.emptyList(); + + private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer(); + + private StreamDeathsInputResponse(BuilderImpl builder) { + super(builder); + } + + @Override + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public static Class serializableBuilderClass() { + return BuilderImpl.class; + } + + @Override + public final int hashCode() { + int hashCode = 1; + hashCode = 31 * hashCode + super.hashCode(); + return hashCode; + } + + @Override + public final boolean equals(Object obj) { + return super.equals(obj) && equalsBySdkFields(obj); + } + + @Override + public final boolean equalsBySdkFields(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (!(obj instanceof StreamDeathsInputResponse)) { + return false; + } + return true; + } + + /** + * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be + * redacted from this string using a placeholder value. + */ + @Override + public final String toString() { + return ToString.builder("StreamDeathsInputResponse").build(); + } + + public final Optional getValueForField(String fieldName, Class clazz) { + return Optional.empty(); + } + + @Override + public final List> sdkFields() { + return SDK_FIELDS; + } + + @Override + public final Map> sdkFieldNameToField() { + return SDK_NAME_TO_FIELD; + } + + private static Map> memberNameToFieldInitializer() { + return Collections.emptyMap(); + } + + @Mutable + @NotThreadSafe + public interface Builder extends SharedEventStreamResponse.Builder, SdkPojo, + CopyableBuilder { + } + + static final class BuilderImpl extends SharedEventStreamResponse.BuilderImpl implements Builder { + private BuilderImpl() { + } + + private BuilderImpl(StreamDeathsInputResponse model) { + super(model); + } + + @Override + public StreamDeathsInputResponse build() { + return new StreamDeathsInputResponse(this); + } + + @Override + public List> sdkFields() { + return SDK_FIELDS; + } + + @Override + public Map> sdkFieldNameToField() { + return SDK_NAME_TO_FIELD; + } + } +} diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/transform/customization.config b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/transform/customization.config index e66eb09003af..a4f50785ba98 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/transform/customization.config +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/transform/customization.config @@ -1,11 +1,25 @@ { - "excludedSimpleMethods" : [ + "excludedSimpleMethods": [ "allTypes", "nestedContainers", "operationWithNoInputOrOutput", "eventStreamOperation" ], "modelMarshallerDefaultValueSupplier": { - "StringMember" : "software.amazon.awssdk.codegen.poet.transform.CustomDefaultValueSupplier.getInstance()" + "StringMember": "software.amazon.awssdk.codegen.poet.transform.CustomDefaultValueSupplier.getInstance()" + }, + "useLegacyEventGenerationScheme": {}, + "disableUniqueEventStreamShapePreprocessing": { + "InputEventStream": [ + "InputEvent" + ], + "InputEventStreamTwo": [ + "InputEventTwo" + ], + "EventStream": [ + "EventOne", + "EventTwo", + "EventThree" + ] } } \ No newline at end of file diff --git a/services/bedrockagentruntime/src/main/resources/codegen-resources/customization.config b/services/bedrockagentruntime/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..d76bb09f7f5a 100644 --- a/services/bedrockagentruntime/src/main/resources/codegen-resources/customization.config +++ b/services/bedrockagentruntime/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,75 @@ { - "enableGenerateCompiledEndpointRules": true + "enableGenerateCompiledEndpointRules": true, + "disableUniqueEventStreamShapePreprocessing": { + "FlowResponseStream": [ + "accessDeniedException", + "badGatewayException", + "conflictException", + "dependencyFailedException", + "flowCompletionEvent", + "flowMultiTurnInputRequestEvent", + "flowOutputEvent", + "flowTraceEvent", + "internalServerException", + "resourceNotFoundException", + "serviceQuotaExceededException", + "throttlingException", + "validationException" + ], + "InlineAgentResponseStream": [ + "accessDeniedException", + "badGatewayException", + "chunk", + "conflictException", + "dependencyFailedException", + "files", + "internalServerException", + "resourceNotFoundException", + "returnControl", + "serviceQuotaExceededException", + "throttlingException", + "trace", + "validationException" + ], + "OptimizedPromptStream": [ + "accessDeniedException", + "analyzePromptEvent", + "badGatewayException", + "dependencyFailedException", + "internalServerException", + "optimizedPromptEvent", + "throttlingException", + "validationException" + ], + "ResponseStream": [ + "accessDeniedException", + "badGatewayException", + "chunk", + "conflictException", + "dependencyFailedException", + "files", + "internalServerException", + "modelNotReadyException", + "resourceNotFoundException", + "returnControl", + "serviceQuotaExceededException", + "throttlingException", + "trace", + "validationException" + ], + "RetrieveAndGenerateStreamResponseOutput": [ + "accessDeniedException", + "badGatewayException", + "citation", + "conflictException", + "dependencyFailedException", + "guardrail", + "internalServerException", + "output", + "resourceNotFoundException", + "serviceQuotaExceededException", + "throttlingException", + "validationException" + ] + } } diff --git a/services/bedrockruntime/src/main/resources/codegen-resources/customization.config b/services/bedrockruntime/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..9de5bf3c6461 100644 --- a/services/bedrockruntime/src/main/resources/codegen-resources/customization.config +++ b/services/bedrockruntime/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,39 @@ { - "enableGenerateCompiledEndpointRules": true + "enableGenerateCompiledEndpointRules": true, + "disableUniqueEventStreamShapePreprocessing": { + "ConverseStreamOutput": [ + "messageStart", + "contentBlockStart", + "contentBlockDelta", + "contentBlockStop", + "messageStop", + "metadata", + "internalServerException", + "modelStreamErrorException", + "validationException", + "throttlingException", + "serviceUnavailableException" + ], + "InvokeModelWithBidirectionalStreamInput": [ + "chunk" + ], + "InvokeModelWithBidirectionalStreamOutput": [ + "chunk", + "internalServerException", + "modelStreamErrorException", + "validationException", + "throttlingException", + "modelTimeoutException", + "serviceUnavailableException" + ], + "ResponseStream": [ + "chunk", + "internalServerException", + "modelStreamErrorException", + "validationException", + "throttlingException", + "modelTimeoutException", + "serviceUnavailableException" + ] + } } diff --git a/services/cloudwatchlogs/src/main/resources/codegen-resources/customization.config b/services/cloudwatchlogs/src/main/resources/codegen-resources/customization.config index beec95efc1d2..e7c1af2a4873 100644 --- a/services/cloudwatchlogs/src/main/resources/codegen-resources/customization.config +++ b/services/cloudwatchlogs/src/main/resources/codegen-resources/customization.config @@ -14,5 +14,13 @@ "paginationCustomization": { "GetLogEvents": "LastPageHasPreviousToken" }, - "enableGenerateCompiledEndpointRules": true + "enableGenerateCompiledEndpointRules": true, + "disableUniqueEventStreamShapePreprocessing": { + "StartLiveTailResponseStream": [ + "sessionStart", + "sessionUpdate", + "SessionTimeoutException", + "SessionStreamingException" + ] + } } diff --git a/services/iotsitewise/src/main/resources/codegen-resources/customization.config b/services/iotsitewise/src/main/resources/codegen-resources/customization.config index cdf857bdc287..a0426b0228ff 100644 --- a/services/iotsitewise/src/main/resources/codegen-resources/customization.config +++ b/services/iotsitewise/src/main/resources/codegen-resources/customization.config @@ -1,4 +1,17 @@ { "generateEndpointClientTests": true, - "enableGenerateCompiledEndpointRules": true + "enableGenerateCompiledEndpointRules": true, + "disableUniqueEventStreamShapePreprocessing": { + "ResponseStream": [ + "trace", + "output", + "accessDeniedException", + "conflictingOperationException", + "internalFailureException", + "invalidRequestException", + "limitExceededException", + "resourceNotFoundException", + "throttlingException" + ] + } } diff --git a/services/lambda/src/main/resources/codegen-resources/customization.config b/services/lambda/src/main/resources/codegen-resources/customization.config index 952021ded000..7c134b654cbb 100644 --- a/services/lambda/src/main/resources/codegen-resources/customization.config +++ b/services/lambda/src/main/resources/codegen-resources/customization.config @@ -8,5 +8,11 @@ "deprecatedOperations": [ "InvokeAsync" ], - "enableGenerateCompiledEndpointRules": true + "enableGenerateCompiledEndpointRules": true, + "disableUniqueEventStreamShapePreprocessing": { + "InvokeWithResponseStreamResponseEvent": [ + "PayloadChunk", + "InvokeComplete" + ] + } } diff --git a/services/lexruntimev2/src/main/resources/codegen-resources/customization.config b/services/lexruntimev2/src/main/resources/codegen-resources/customization.config index a10b6cbcf23a..8ec01d92e2e0 100644 --- a/services/lexruntimev2/src/main/resources/codegen-resources/customization.config +++ b/services/lexruntimev2/src/main/resources/codegen-resources/customization.config @@ -3,5 +3,31 @@ "contentType": "application/json" }, "enableGenerateCompiledEndpointRules": true, - "usePriorKnowledgeForH2": true + "usePriorKnowledgeForH2": true, + "disableUniqueEventStreamShapePreprocessing": { + "StartConversationRequestEventStream": [ + "ConfigurationEvent", + "AudioInputEvent", + "DTMFInputEvent", + "TextInputEvent", + "PlaybackCompletionEvent", + "DisconnectionEvent" + ], + "StartConversationResponseEventStream": [ + "PlaybackInterruptionEvent", + "TranscriptEvent", + "IntentResultEvent", + "TextResponseEvent", + "AudioResponseEvent", + "HeartbeatEvent", + "AccessDeniedException", + "ResourceNotFoundException", + "ValidationException", + "ThrottlingException", + "InternalServerException", + "ConflictException", + "DependencyFailedException", + "BadGatewayException" + ] + } } diff --git a/services/qbusiness/src/main/resources/codegen-resources/customization.config b/services/qbusiness/src/main/resources/codegen-resources/customization.config index f754ccb8740d..5f754403836f 100644 --- a/services/qbusiness/src/main/resources/codegen-resources/customization.config +++ b/services/qbusiness/src/main/resources/codegen-resources/customization.config @@ -1,4 +1,21 @@ { "enableGenerateCompiledEndpointRules": true, - "usePriorKnowledgeForH2": true + "usePriorKnowledgeForH2": true, + "disableUniqueEventStreamShapePreprocessing": { + "ChatInputStream": [ + "configurationEvent", + "textEvent", + "attachmentEvent", + "actionExecutionEvent", + "endOfInputEvent", + "authChallengeResponseEvent" + ], + "ChatOutputStream": [ + "textEvent", + "metadataEvent", + "actionReviewEvent", + "failedAttachmentEvent", + "authChallengeRequestEvent" + ] + } } diff --git a/services/s3/src/main/resources/codegen-resources/customization.config b/services/s3/src/main/resources/codegen-resources/customization.config index 8acd43509eab..4689d081bc6f 100644 --- a/services/s3/src/main/resources/codegen-resources/customization.config +++ b/services/s3/src/main/resources/codegen-resources/customization.config @@ -358,5 +358,14 @@ "methodName": "modifyUploadPartCopyRequest", "className": "software.amazon.awssdk.services.s3.internal.CustomRequestTransformerUtils" } + }, + "disableUniqueEventStreamShapePreprocessing": { + "SelectObjectContentEventStream": [ + "Records", + "Stats", + "Progress", + "Cont", + "End" + ] } } diff --git a/services/sagemakerruntime/src/main/resources/codegen-resources/customization.config b/services/sagemakerruntime/src/main/resources/codegen-resources/customization.config index e824e95e8fbd..8c0090c606b0 100644 --- a/services/sagemakerruntime/src/main/resources/codegen-resources/customization.config +++ b/services/sagemakerruntime/src/main/resources/codegen-resources/customization.config @@ -1,3 +1,10 @@ { - "enableGenerateCompiledEndpointRules": true + "enableGenerateCompiledEndpointRules": true, + "disableUniqueEventStreamShapePreprocessing": { + "ResponseStream": [ + "PayloadPart", + "ModelStreamError", + "InternalStreamFailure" + ] + } } diff --git a/test/codegen-generated-classes-test/src/main/resources/codegen-resources/customresponsemetadata/customization.config b/test/codegen-generated-classes-test/src/main/resources/codegen-resources/customresponsemetadata/customization.config index b23341dbf867..73abd39e99fe 100644 --- a/test/codegen-generated-classes-test/src/main/resources/codegen-resources/customresponsemetadata/customization.config +++ b/test/codegen-generated-classes-test/src/main/resources/codegen-resources/customresponsemetadata/customization.config @@ -1,5 +1,5 @@ { - "verifiedSimpleMethods" : [ + "verifiedSimpleMethods": [ "allTypes", "deleteOperation", "mapOfStringToListOfStringInQueryParams", @@ -15,8 +15,8 @@ "nestedContainers" ], "customResponseMetadata": { - "FOO_ID" : "x-foo-id", - "BAR_ID" : "x-bar-id", + "FOO_ID": "x-foo-id", + "BAR_ID": "x-bar-id", "REQUEST_ID": "x-foobar-id" }, "skipEndpointTestGeneration": true, @@ -26,18 +26,28 @@ "useSraAuth": true, "endpointParameters": { "Tables": { - "required": false, - "type": "StringArray" + "required": false, + "type": "StringArray" } }, "customOperationContextParams": [ - { - "operationName": "GetOperationWithMapEndpointParam", - "operationContextParamsMap": { - "Tables": { - "path" : "keys(MapOfStrings)" - } + { + "operationName": "GetOperationWithMapEndpointParam", + "operationContextParamsMap": { + "Tables": { + "path": "keys(MapOfStrings)" + } + } } - } - ] -} + ], + "useLegacyEventGenerationScheme": {}, + "disableUniqueEventStreamShapePreprocessing": { + "InputEventStream": [ + "InputEvent" + ], + "EventStream": [ + "EventOne", + "EventTwo" + ] + } +} \ No newline at end of file diff --git a/test/codegen-generated-classes-test/src/main/resources/codegen-resources/endpointproviders/customization.config b/test/codegen-generated-classes-test/src/main/resources/codegen-resources/endpointproviders/customization.config index 341d2bca3aa5..ce700024d659 100644 --- a/test/codegen-generated-classes-test/src/main/resources/codegen-resources/endpointproviders/customization.config +++ b/test/codegen-generated-classes-test/src/main/resources/codegen-resources/endpointproviders/customization.config @@ -1,6 +1,5 @@ { "skipEndpointTestGeneration": true, - "enableGenerateCompiledEndpointRules": false, "endpointParameters": { "PojoString": { @@ -23,11 +22,11 @@ "documentation": "A list of string that are map keys", "type": "StringArray" }, - "MissingRequestValuesListOfString": { - "required": false, - "documentation": "A list of string from a field that is not populated in the request", - "type": "StringArray" - } + "MissingRequestValuesListOfString": { + "required": false, + "documentation": "A list of string from a field that is not populated in the request", + "type": "StringArray" + } }, "customOperationContextParams": [ { @@ -50,5 +49,15 @@ } } } - ] -} + ], + "useLegacyEventGenerationScheme": {}, + "disableUniqueEventStreamShapePreprocessing": { + "InputEventStream": [ + "InputEvent" + ], + "EventStream": [ + "EventOne", + "EventTwo" + ] + } +} \ No newline at end of file diff --git a/test/codegen-generated-classes-test/src/main/resources/codegen-resources/eventstreams/customization.config b/test/codegen-generated-classes-test/src/main/resources/codegen-resources/eventstreams/customization.config index 40ae9f6030f1..5bb06e0fb2c5 100644 --- a/test/codegen-generated-classes-test/src/main/resources/codegen-resources/eventstreams/customization.config +++ b/test/codegen-generated-classes-test/src/main/resources/codegen-resources/eventstreams/customization.config @@ -1,6 +1,20 @@ { + "skipEndpointTestGeneration": true, "useLegacyEventGenerationScheme": { - "EventStream": ["LegacyGeneratedEvent"] + "EventStream": [ + "LegacyGeneratedEvent" + ] }, - "skipEndpointTestGeneration": true -} + "disableUniqueEventStreamShapePreprocessing": { + "InputEventStream": [ + "InputEvent", + "InputEventB", + "InputEventTwo" + ], + "EventStream": [ + "TheEventOne", + "EventTwo", + "SecondEventTwo" + ] + } +} \ No newline at end of file diff --git a/test/codegen-generated-classes-test/src/main/resources/codegen-resources/query/customization.config b/test/codegen-generated-classes-test/src/main/resources/codegen-resources/query/customization.config index b5c73436bb3f..c12d78902658 100644 --- a/test/codegen-generated-classes-test/src/main/resources/codegen-resources/query/customization.config +++ b/test/codegen-generated-classes-test/src/main/resources/codegen-resources/query/customization.config @@ -1,3 +1,13 @@ { - "skipEndpointTestGeneration": true + "skipEndpointTestGeneration": true, + "useLegacyEventGenerationScheme": {}, + "disableUniqueEventStreamShapePreprocessing": { + "InputEventStream": [ + "InputEvent" + ], + "EventStream": [ + "EventOne", + "EventTwo" + ] + } } \ No newline at end of file diff --git a/test/codegen-generated-classes-test/src/main/resources/codegen-resources/serviceconfig/customization.config b/test/codegen-generated-classes-test/src/main/resources/codegen-resources/serviceconfig/customization.config index 17a346db4f7d..1ef946649ce1 100644 --- a/test/codegen-generated-classes-test/src/main/resources/codegen-resources/serviceconfig/customization.config +++ b/test/codegen-generated-classes-test/src/main/resources/codegen-resources/serviceconfig/customization.config @@ -1,9 +1,19 @@ { - "verifiedSimpleMethods" : [ + "verifiedSimpleMethods": [ "allTypes" ], "serviceConfig": { "className": "ProtocolRestJsonWithConfigConfiguration", "hasDualstackProperty": true + }, + "useLegacyEventGenerationScheme": {}, + "disableUniqueEventStreamShapePreprocessing": { + "InputEventStream": [ + "InputEvent" + ], + "EventStream": [ + "EventOne", + "EventTwo" + ] } -} +} \ No newline at end of file diff --git a/test/codegen-generated-classes-test/src/main/resources/codegen-resources/waiters/customization.config b/test/codegen-generated-classes-test/src/main/resources/codegen-resources/waiters/customization.config index b5c73436bb3f..c12d78902658 100644 --- a/test/codegen-generated-classes-test/src/main/resources/codegen-resources/waiters/customization.config +++ b/test/codegen-generated-classes-test/src/main/resources/codegen-resources/waiters/customization.config @@ -1,3 +1,13 @@ { - "skipEndpointTestGeneration": true + "skipEndpointTestGeneration": true, + "useLegacyEventGenerationScheme": {}, + "disableUniqueEventStreamShapePreprocessing": { + "InputEventStream": [ + "InputEvent" + ], + "EventStream": [ + "EventOne", + "EventTwo" + ] + } } \ No newline at end of file diff --git a/test/codegen-generated-classes-test/src/main/resources/codegen-resources/xml/customization.config b/test/codegen-generated-classes-test/src/main/resources/codegen-resources/xml/customization.config index 293c611d1e24..7a94ec3f84c6 100644 --- a/test/codegen-generated-classes-test/src/main/resources/codegen-resources/xml/customization.config +++ b/test/codegen-generated-classes-test/src/main/resources/codegen-resources/xml/customization.config @@ -2,26 +2,36 @@ "skipEndpointTestGeneration": true, "requiredTraitValidationEnabled": true, "customSdkShapes": { - "shapes":{ - "SdkPartType":{ - "type":"string", - "enum":[ - "DEFAULT", - "LAST" - ] + "shapes": { + "SdkPartType": { + "type": "string", + "enum": [ + "DEFAULT", + "LAST" + ] + } } - } }, "shapeModifiers": { - "AllTypesStructure": { - "inject": [ - { - "SdkPartType": { - "shape": "SdkPartType", - "documentation": "Indicates whether the request is a last part or not. This field will not be included in the request payload." - } - } + "AllTypesStructure": { + "inject": [ + { + "SdkPartType": { + "shape": "SdkPartType", + "documentation": "Indicates whether the request is a last part or not. This field will not be included in the request payload." + } + } + ] + } + }, + "useLegacyEventGenerationScheme": {}, + "disableUniqueEventStreamShapePreprocessing": { + "InputEventStream": [ + "InputEvent" + ], + "EventStream": [ + "EventOne", + "EventTwo" ] - } } -} +} \ No newline at end of file diff --git a/test/codegen-generated-classes-test/src/main/resources/codegen-resources/xmlinternalplugins/customization.config b/test/codegen-generated-classes-test/src/main/resources/codegen-resources/xmlinternalplugins/customization.config index b40406d580de..3d43518854b8 100644 --- a/test/codegen-generated-classes-test/src/main/resources/codegen-resources/xmlinternalplugins/customization.config +++ b/test/codegen-generated-classes-test/src/main/resources/codegen-resources/xmlinternalplugins/customization.config @@ -2,29 +2,39 @@ "skipEndpointTestGeneration": true, "requiredTraitValidationEnabled": true, "customSdkShapes": { - "shapes":{ - "SdkPartType":{ - "type":"string", - "enum":[ - "DEFAULT", - "LAST" - ] + "shapes": { + "SdkPartType": { + "type": "string", + "enum": [ + "DEFAULT", + "LAST" + ] + } } - } }, "shapeModifiers": { - "AllTypesStructure": { - "inject": [ - { - "SdkPartType": { - "shape": "SdkPartType", - "documentation": "Indicates whether the request is a last part or not. This field will not be included in the request payload." - } - } - ] - } + "AllTypesStructure": { + "inject": [ + { + "SdkPartType": { + "shape": "SdkPartType", + "documentation": "Indicates whether the request is a last part or not. This field will not be included in the request payload." + } + } + ] + } }, "internalPlugins": [ "software.amazon.awssdk.plugins.EndpointOverrideInternalTestPlugin" - ] -} + ], + "useLegacyEventGenerationScheme": {}, + "disableUniqueEventStreamShapePreprocessing": { + "InputEventStream": [ + "InputEvent" + ], + "EventStream": [ + "EventOne", + "EventTwo" + ] + } +} \ No newline at end of file diff --git a/test/protocol-tests/src/main/resources/codegen-resources/restjson/contenttype/customization.config b/test/protocol-tests/src/main/resources/codegen-resources/restjson/contenttype/customization.config index ec7c8d355d50..daa626d75452 100644 --- a/test/protocol-tests/src/main/resources/codegen-resources/restjson/contenttype/customization.config +++ b/test/protocol-tests/src/main/resources/codegen-resources/restjson/contenttype/customization.config @@ -1,3 +1,17 @@ { - "skipEndpointTestGeneration": true -} + "skipEndpointTestGeneration": true, + "useLegacyEventGenerationScheme": {}, + "disableUniqueEventStreamShapePreprocessing": { + "InputEventStream": [ + "BlobAndHeadersEvent", + "StringAndHeadersEvent", + "HeadersOnlyEvent", + "EndEvent", + "ImplicitPayloadAndHeadersEvent" + ], + "EventStream": [ + "EventOne", + "EventTwo" + ] + } +} \ No newline at end of file diff --git a/test/protocol-tests/src/main/resources/codegen-resources/restjson/customization.config b/test/protocol-tests/src/main/resources/codegen-resources/restjson/customization.config index a2df149f84de..968efa7d4e6a 100644 --- a/test/protocol-tests/src/main/resources/codegen-resources/restjson/customization.config +++ b/test/protocol-tests/src/main/resources/codegen-resources/restjson/customization.config @@ -1,5 +1,5 @@ { - "verifiedSimpleMethods" : [ + "verifiedSimpleMethods": [ "allTypes", "deleteOperation", "mapOfStringToListOfStringInQueryParams", @@ -17,5 +17,19 @@ "statusCodeInOutputOperation", "getOperationWithBody" ], - "skipEndpointTestGeneration": true -} + "skipEndpointTestGeneration": true, + "useLegacyEventGenerationScheme": {}, + "disableUniqueEventStreamShapePreprocessing": { + "InputEventStream": [ + "InputEvent" + ], + "InputEventStreamStringPayload": [ + "InputEvent" + ], + "EventStream": [ + "EventOne", + "EventTwo", + "errorOne" + ] + } +} \ No newline at end of file diff --git a/test/protocol-tests/src/main/resources/codegen-resources/restxml/customization.config b/test/protocol-tests/src/main/resources/codegen-resources/restxml/customization.config index 2ca221e9d30e..4c4264e4935c 100644 --- a/test/protocol-tests/src/main/resources/codegen-resources/restxml/customization.config +++ b/test/protocol-tests/src/main/resources/codegen-resources/restxml/customization.config @@ -1,5 +1,5 @@ { - "verifiedSimpleMethods" : [ + "verifiedSimpleMethods": [ "allTypes", "deleteOperation", "mapOfStringToListOfStringInQueryParams", @@ -10,5 +10,13 @@ "queryParamWithoutValue", "restXmlTypes" ], - "skipEndpointTestGeneration": true -} + "skipEndpointTestGeneration": true, + "useLegacyEventGenerationScheme": {}, + "disableUniqueEventStreamShapePreprocessing": { + "EventStream": [ + "EventPayloadEvent", + "NonEventPayloadEvent", + "SecondEventPayloadEvent" + ] + } +} \ No newline at end of file