serializer = CodegenSerializerResolver.getDefault().serializerFor(value);
+ serializer.serialize(value, initializationCodeBlockBuilder);
+ initializationCodeBlockBuilder.add(")");
+ }
+
if (shapeModel.isHasStreamingMember()) {
initializationCodeBlockBuilder.add(".hasStreamingInput(true)");
}
@@ -117,4 +137,40 @@ protected FieldSpec operationInfoField() {
.initializer(codeBlock)
.build();
}
+
+
+ /**
+ * This method resolves a static reference to its name, for instance, when called with
+ *
+ * fieldName(AwsClientOption.class, AwsClientOption.AWS_REGION)
+ *
+ * it will return the string "AWS_REGION" that we can use for codegen. Using the value directly avoid typo bugs and allows the
+ * compiler and the IDE to know about this relationship.
+ *
+ * This method uses the fully qualified names in the reflection package to avoid polluting this class imports. Adapted from
+ * https://stackoverflow.com/a/35416606
+ */
+ private static String fieldName(Class> containingClass, Object fieldObject) {
+ java.lang.reflect.Field[] allFields = containingClass.getFields();
+ for (java.lang.reflect.Field field : allFields) {
+ int modifiers = field.getModifiers();
+ if (!java.lang.reflect.Modifier.isStatic(modifiers)) {
+ continue;
+ }
+ Object currentFieldObject;
+ try {
+ // For static fields you can pass a null to get back its value.
+ currentFieldObject = field.get(null);
+ } catch (Exception e) {
+ throw new IllegalArgumentException(e);
+ }
+ boolean isWantedField = fieldObject.equals(currentFieldObject);
+ if (isWantedField) {
+ return field.getName();
+ }
+ }
+ throw new java.util.NoSuchElementException(String.format("cannot find constant %s in class %s",
+ fieldObject,
+ fieldObject.getClass().getName()));
+ }
}
diff --git a/codegen/src/test/java/software/amazon/awssdk/codegen/poet/ClientTestModels.java b/codegen/src/test/java/software/amazon/awssdk/codegen/poet/ClientTestModels.java
index d67baa9fa240..8dbac88e09b8 100644
--- a/codegen/src/test/java/software/amazon/awssdk/codegen/poet/ClientTestModels.java
+++ b/codegen/src/test/java/software/amazon/awssdk/codegen/poet/ClientTestModels.java
@@ -398,6 +398,17 @@ public static IntermediateModel internalConfigModels() {
return new IntermediateModelBuilder(models).build();
}
+ public static IntermediateModel rpcv2ServiceModels() {
+ File serviceModel = new File(ClientTestModels.class.getResource("client/c2j/rpcv2/service-2.json").getFile());
+ File customizationModel = new File(ClientTestModels.class.getResource("client/c2j/rpcv2/customization.config").getFile());
+ C2jModels models = C2jModels.builder()
+ .serviceModel(getServiceModel(serviceModel))
+ .customizationConfig(getCustomizationConfig(customizationModel))
+ .build();
+
+ return new IntermediateModelBuilder(models).build();
+ }
+
public static IntermediateModel batchManagerModels() {
File serviceModel = new File(ClientTestModels.class.getResource("client/c2j/batchmanager/service-2.json").getFile());
File customizationModel = new File(ClientTestModels.class.getResource("client/c2j/batchmanager/customization.config").getFile());
diff --git a/codegen/src/test/java/software/amazon/awssdk/codegen/poet/client/AsyncClientClassTest.java b/codegen/src/test/java/software/amazon/awssdk/codegen/poet/client/AsyncClientClassTest.java
index 60ca355827ef..3d6922461423 100644
--- a/codegen/src/test/java/software/amazon/awssdk/codegen/poet/client/AsyncClientClassTest.java
+++ b/codegen/src/test/java/software/amazon/awssdk/codegen/poet/client/AsyncClientClassTest.java
@@ -24,6 +24,7 @@
import static software.amazon.awssdk.codegen.poet.ClientTestModels.endpointDiscoveryModels;
import static software.amazon.awssdk.codegen.poet.ClientTestModels.queryServiceModels;
import static software.amazon.awssdk.codegen.poet.ClientTestModels.restJsonServiceModels;
+import static software.amazon.awssdk.codegen.poet.ClientTestModels.rpcv2ServiceModels;
import static software.amazon.awssdk.codegen.poet.ClientTestModels.xmlServiceModels;
import static software.amazon.awssdk.codegen.poet.PoetMatchers.generatesTo;
@@ -93,6 +94,12 @@ public void asyncClientCustomPackageName() {
assertThat(syncClientCustomServiceMetaData, generatesTo("test-custompackage-async.java"));
}
+ @Test
+ public void asyncClientClassRpcv2() {
+ AsyncClientClass asyncClientClass = createAsyncClientClass(rpcv2ServiceModels(), true);
+ assertThat(asyncClientClass, generatesTo("test-rpcv2-async-client-class.java"));
+ }
+
@Test
public void asyncClientBatchManager() {
ClassSpec aSyncClientBatchManager = createAsyncClientClass(batchManagerModels());
diff --git a/codegen/src/test/java/software/amazon/awssdk/codegen/poet/client/SyncClientClassTest.java b/codegen/src/test/java/software/amazon/awssdk/codegen/poet/client/SyncClientClassTest.java
index ebd088d143ec..2da02c594bc2 100644
--- a/codegen/src/test/java/software/amazon/awssdk/codegen/poet/client/SyncClientClassTest.java
+++ b/codegen/src/test/java/software/amazon/awssdk/codegen/poet/client/SyncClientClassTest.java
@@ -22,6 +22,7 @@
import static software.amazon.awssdk.codegen.poet.ClientTestModels.endpointDiscoveryModels;
import static software.amazon.awssdk.codegen.poet.ClientTestModels.queryServiceModels;
import static software.amazon.awssdk.codegen.poet.ClientTestModels.restJsonServiceModels;
+import static software.amazon.awssdk.codegen.poet.ClientTestModels.rpcv2ServiceModels;
import static software.amazon.awssdk.codegen.poet.ClientTestModels.xmlServiceModels;
import static software.amazon.awssdk.codegen.poet.PoetMatchers.generatesTo;
@@ -82,6 +83,12 @@ public void syncClientCustomPackageName() {
assertThat(syncClientCustomServiceMetaData, generatesTo("test-custompackage-sync.java"));
}
+ @Test
+ public void syncClientClassRpcV2() {
+ ClassSpec syncClientCustomServiceMetaData = createSyncClientClass(rpcv2ServiceModels(), true);
+ assertThat(syncClientCustomServiceMetaData, generatesTo("test-rpcv2-sync.java"));
+ }
+
private SyncClientClass createSyncClientClass(IntermediateModel model) {
return new SyncClientClass(GeneratorTaskParams.create(model, "sources/", "tests/", "resources/"));
}
diff --git a/codegen/src/test/java/software/amazon/awssdk/codegen/poet/transform/TransformMarshallerSpecTest.java b/codegen/src/test/java/software/amazon/awssdk/codegen/poet/transform/TransformMarshallerSpecTest.java
new file mode 100644
index 000000000000..5bb5184e9a34
--- /dev/null
+++ b/codegen/src/test/java/software/amazon/awssdk/codegen/poet/transform/TransformMarshallerSpecTest.java
@@ -0,0 +1,83 @@
+/*
+ * 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.poet.transform;
+
+import static java.util.stream.Collectors.toList;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static software.amazon.awssdk.codegen.poet.ClientTestModels.rpcv2ServiceModels;
+import static software.amazon.awssdk.codegen.poet.PoetMatchers.generatesTo;
+
+import java.util.Collection;
+import java.util.Locale;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+import software.amazon.awssdk.codegen.model.intermediate.IntermediateModel;
+import software.amazon.awssdk.codegen.model.intermediate.ShapeModel;
+
+public class TransformMarshallerSpecTest {
+
+ @ParameterizedTest(name = "{index} - {0}")
+ @MethodSource("testCases")
+ public void runtCase(TestCase testCase) {
+ IntermediateModel model = testCase.model();
+ model.getShapes().values().stream()
+ .filter(shape -> "Request".equals(shape.getType()) || shape.isEvent())
+ .map(shape -> new Object[] {shape}).collect(toList());
+
+ String expectedFileName = String.format("%s/%s-transformer.java",
+ model.getMetadata().getProtocol().toString().toLowerCase(Locale.ENGLISH),
+ testCase.shapeModel().getShapeName().toLowerCase(Locale.ENGLISH));
+
+ assertThat(new MarshallerSpec(model, testCase.shapeModel()), generatesTo(expectedFileName));
+
+ }
+
+ public static Collection testCases() {
+ IntermediateModel model = rpcv2ServiceModels();
+ return
+ model.getShapes().values().stream()
+ .filter(shape -> "Request".equals(shape.getType()) || shape.isEvent())
+ .map(s -> new TestCase(model, s))
+ .collect(toList());
+ }
+
+ static class TestCase {
+ private final IntermediateModel model;
+ private final ShapeModel shapeModel;
+
+ TestCase(IntermediateModel model, ShapeModel shapeModel) {
+ this.model = model;
+ this.shapeModel = shapeModel;
+ }
+
+ public IntermediateModel model() {
+ return model;
+ }
+
+ public ShapeModel shapeModel() {
+ return shapeModel;
+ }
+
+ @Override
+ public String toString() {
+ return this.shapeModel.getShapeName();
+ }
+ }
+
+ public IntermediateModel getModel() {
+ return rpcv2ServiceModels();
+ }
+}
diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/c2j/rpcv2/customization.config b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/c2j/rpcv2/customization.config
new file mode 100644
index 000000000000..2c63c0851048
--- /dev/null
+++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/c2j/rpcv2/customization.config
@@ -0,0 +1,2 @@
+{
+}
diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/c2j/rpcv2/endpoint-rule-set.json b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/c2j/rpcv2/endpoint-rule-set.json
new file mode 100644
index 000000000000..2c63c0851048
--- /dev/null
+++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/c2j/rpcv2/endpoint-rule-set.json
@@ -0,0 +1,2 @@
+{
+}
diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/c2j/rpcv2/endpoint-tests.json b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/c2j/rpcv2/endpoint-tests.json
new file mode 100644
index 000000000000..2c63c0851048
--- /dev/null
+++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/c2j/rpcv2/endpoint-tests.json
@@ -0,0 +1,2 @@
+{
+}
diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/c2j/rpcv2/service-2.json b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/c2j/rpcv2/service-2.json
new file mode 100644
index 000000000000..0cc5eeb51db6
--- /dev/null
+++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/c2j/rpcv2/service-2.json
@@ -0,0 +1,546 @@
+{
+ "version":"2.0",
+ "metadata":{
+ "apiVersion":"2023-03-10",
+ "auth":["aws.auth#sigv4"],
+ "endpointPrefix":"smithyrpcv2protocol",
+ "protocol":"smithy-rpc-v2-cbor",
+ "protocols":["smithy-rpc-v2-cbor"],
+ "serviceFullName":"RpcV2 Protocol Service",
+ "serviceId":"SmithyRpcV2Protocol",
+ "signatureVersion":"v4",
+ "signingName":"execute-api",
+ "targetPrefix":"RpcV2Protocol",
+ "uid":"smithy-rpcv2protocol-2023-03-10"
+ },
+ "operations":{
+ "EmptyInputOutput":{
+ "name":"EmptyInputOutput",
+ "http":{
+ "method":"POST",
+ "requestUri":"/"
+ },
+ "input":{"shape":"EmptyStructure"},
+ "output":{"shape":"EmptyStructure"}
+ },
+ "Float16":{
+ "name":"Float16",
+ "http":{
+ "method":"POST",
+ "requestUri":"/"
+ },
+ "output":{"shape":"Float16Output"}
+ },
+ "FractionalSeconds":{
+ "name":"FractionalSeconds",
+ "http":{
+ "method":"POST",
+ "requestUri":"/"
+ },
+ "output":{"shape":"FractionalSecondsOutput"}
+ },
+ "GreetingWithErrors":{
+ "name":"GreetingWithErrors",
+ "http":{
+ "method":"POST",
+ "requestUri":"/"
+ },
+ "output":{"shape":"GreetingWithErrorsOutput"},
+ "errors":[
+ {"shape":"ComplexError"},
+ {"shape":"InvalidGreeting"}
+ ],
+ "idempotent":true
+ },
+ "NoInputOutput":{
+ "name":"NoInputOutput",
+ "http":{
+ "method":"POST",
+ "requestUri":"/"
+ }
+ },
+ "OperationWithDefaults":{
+ "name":"OperationWithDefaults",
+ "http":{
+ "method":"POST",
+ "requestUri":"/"
+ },
+ "input":{"shape":"OperationWithDefaultsInput"},
+ "output":{"shape":"OperationWithDefaultsOutput"},
+ "errors":[
+ {"shape":"ValidationException"}
+ ]
+ },
+ "OptionalInputOutput":{
+ "name":"OptionalInputOutput",
+ "http":{
+ "method":"POST",
+ "requestUri":"/"
+ },
+ "input":{"shape":"SimpleStructure"},
+ "output":{"shape":"SimpleStructure"}
+ },
+ "RecursiveShapes":{
+ "name":"RecursiveShapes",
+ "http":{
+ "method":"POST",
+ "requestUri":"/"
+ },
+ "input":{"shape":"RecursiveShapesInputOutput"},
+ "output":{"shape":"RecursiveShapesInputOutput"}
+ },
+ "RpcV2CborDenseMaps":{
+ "name":"RpcV2CborDenseMaps",
+ "http":{
+ "method":"POST",
+ "requestUri":"/"
+ },
+ "input":{"shape":"RpcV2CborDenseMapsInputOutput"},
+ "output":{"shape":"RpcV2CborDenseMapsInputOutput"},
+ "errors":[
+ {"shape":"ValidationException"}
+ ]
+ },
+ "RpcV2CborLists":{
+ "name":"RpcV2CborLists",
+ "http":{
+ "method":"POST",
+ "requestUri":"/"
+ },
+ "input":{"shape":"RpcV2CborListInputOutput"},
+ "output":{"shape":"RpcV2CborListInputOutput"},
+ "errors":[
+ {"shape":"ValidationException"}
+ ],
+ "idempotent":true
+ },
+ "RpcV2CborSparseMaps":{
+ "name":"RpcV2CborSparseMaps",
+ "http":{
+ "method":"POST",
+ "requestUri":"/"
+ },
+ "input":{"shape":"RpcV2CborSparseMapsInputOutput"},
+ "output":{"shape":"RpcV2CborSparseMapsInputOutput"},
+ "errors":[
+ {"shape":"ValidationException"}
+ ]
+ },
+ "SimpleScalarProperties":{
+ "name":"SimpleScalarProperties",
+ "http":{
+ "method":"POST",
+ "requestUri":"/"
+ },
+ "input":{"shape":"SimpleScalarStructure"},
+ "output":{"shape":"SimpleScalarStructure"}
+ },
+ "SparseNullsOperation":{
+ "name":"SparseNullsOperation",
+ "http":{
+ "method":"POST",
+ "requestUri":"/"
+ },
+ "input":{"shape":"SparseNullsOperationInputOutput"},
+ "output":{"shape":"SparseNullsOperationInputOutput"}
+ }
+ },
+ "shapes":{
+ "Blob":{"type":"blob"},
+ "BlobList":{
+ "type":"list",
+ "member":{"shape":"Blob"}
+ },
+ "Boolean":{
+ "type":"boolean",
+ "box":true
+ },
+ "BooleanList":{
+ "type":"list",
+ "member":{"shape":"Boolean"}
+ },
+ "Byte":{
+ "type":"byte",
+ "box":true
+ },
+ "ClientOptionalDefaults":{
+ "type":"structure",
+ "members":{
+ "member":{"shape":"Integer"}
+ }
+ },
+ "ComplexError":{
+ "type":"structure",
+ "members":{
+ "TopLevel":{"shape":"String"},
+ "Nested":{"shape":"ComplexNestedErrorData"}
+ },
+ "exception":true
+ },
+ "ComplexNestedErrorData":{
+ "type":"structure",
+ "members":{
+ "Foo":{"shape":"String"}
+ }
+ },
+ "DateTime":{
+ "type":"timestamp"
+ },
+ "Defaults":{
+ "type":"structure",
+ "members":{
+ "defaultString":{"shape":"String"},
+ "defaultBoolean":{"shape":"Boolean"},
+ "defaultList":{"shape":"TestStringList"},
+ "defaultTimestamp":{"shape":"Timestamp"},
+ "defaultBlob":{"shape":"Blob"},
+ "defaultByte":{"shape":"Byte"},
+ "defaultShort":{"shape":"Short"},
+ "defaultInteger":{"shape":"Integer"},
+ "defaultLong":{"shape":"Long"},
+ "defaultFloat":{"shape":"Float"},
+ "defaultDouble":{"shape":"Double"},
+ "defaultMap":{"shape":"TestStringMap"},
+ "defaultEnum":{"shape":"TestEnum"},
+ "defaultIntEnum":{"shape":"TestIntEnum"},
+ "emptyString":{"shape":"String"},
+ "falseBoolean":{"shape":"Boolean"},
+ "emptyBlob":{"shape":"Blob"},
+ "zeroByte":{"shape":"Byte"},
+ "zeroShort":{"shape":"Short"},
+ "zeroInteger":{"shape":"Integer"},
+ "zeroLong":{"shape":"Long"},
+ "zeroFloat":{"shape":"Float"},
+ "zeroDouble":{"shape":"Double"}
+ }
+ },
+ "DenseBooleanMap":{
+ "type":"map",
+ "key":{"shape":"String"},
+ "value":{"shape":"Boolean"}
+ },
+ "DenseNumberMap":{
+ "type":"map",
+ "key":{"shape":"String"},
+ "value":{"shape":"Integer"}
+ },
+ "DenseSetMap":{
+ "type":"map",
+ "key":{"shape":"String"},
+ "value":{"shape":"StringSet"}
+ },
+ "DenseStringMap":{
+ "type":"map",
+ "key":{"shape":"String"},
+ "value":{"shape":"String"}
+ },
+ "DenseStructMap":{
+ "type":"map",
+ "key":{"shape":"String"},
+ "value":{"shape":"GreetingStruct"}
+ },
+ "Double":{
+ "type":"double",
+ "box":true
+ },
+ "EmptyStructure":{
+ "type":"structure",
+ "members":{
+ }
+ },
+ "Float":{
+ "type":"float",
+ "box":true
+ },
+ "Float16Output":{
+ "type":"structure",
+ "members":{
+ "value":{"shape":"Double"}
+ }
+ },
+ "FooEnum":{
+ "type":"string",
+ "enum":[
+ "Foo",
+ "Baz",
+ "Bar"
+ ]
+ },
+ "FooEnumList":{
+ "type":"list",
+ "member":{"shape":"FooEnum"}
+ },
+ "FractionalSecondsOutput":{
+ "type":"structure",
+ "members":{
+ "datetime":{"shape":"DateTime"}
+ }
+ },
+ "GreetingStruct":{
+ "type":"structure",
+ "members":{
+ "hi":{"shape":"String"}
+ }
+ },
+ "GreetingWithErrorsOutput":{
+ "type":"structure",
+ "members":{
+ "greeting":{"shape":"String"}
+ }
+ },
+ "Integer":{
+ "type":"integer",
+ "box":true
+ },
+ "IntegerEnum":{
+ "type":"integer",
+ "box":true
+ },
+ "IntegerEnumList":{
+ "type":"list",
+ "member":{"shape":"IntegerEnum"}
+ },
+ "IntegerList":{
+ "type":"list",
+ "member":{"shape":"Integer"}
+ },
+ "InvalidGreeting":{
+ "type":"structure",
+ "members":{
+ "Message":{"shape":"String"}
+ },
+ "exception":true
+ },
+ "Long":{
+ "type":"long",
+ "box":true
+ },
+ "NestedStringList":{
+ "type":"list",
+ "member":{"shape":"StringList"}
+ },
+ "OperationWithDefaultsInput":{
+ "type":"structure",
+ "members":{
+ "defaults":{"shape":"Defaults"},
+ "clientOptionalDefaults":{"shape":"ClientOptionalDefaults"},
+ "topLevelDefault":{"shape":"String"},
+ "otherTopLevelDefault":{"shape":"Integer"}
+ }
+ },
+ "OperationWithDefaultsOutput":{
+ "type":"structure",
+ "members":{
+ "defaultString":{"shape":"String"},
+ "defaultBoolean":{"shape":"Boolean"},
+ "defaultList":{"shape":"TestStringList"},
+ "defaultTimestamp":{"shape":"Timestamp"},
+ "defaultBlob":{"shape":"Blob"},
+ "defaultByte":{"shape":"Byte"},
+ "defaultShort":{"shape":"Short"},
+ "defaultInteger":{"shape":"Integer"},
+ "defaultLong":{"shape":"Long"},
+ "defaultFloat":{"shape":"Float"},
+ "defaultDouble":{"shape":"Double"},
+ "defaultMap":{"shape":"TestStringMap"},
+ "defaultEnum":{"shape":"TestEnum"},
+ "defaultIntEnum":{"shape":"TestIntEnum"},
+ "emptyString":{"shape":"String"},
+ "falseBoolean":{"shape":"Boolean"},
+ "emptyBlob":{"shape":"Blob"},
+ "zeroByte":{"shape":"Byte"},
+ "zeroShort":{"shape":"Short"},
+ "zeroInteger":{"shape":"Integer"},
+ "zeroLong":{"shape":"Long"},
+ "zeroFloat":{"shape":"Float"},
+ "zeroDouble":{"shape":"Double"}
+ }
+ },
+ "RecursiveShapesInputOutput":{
+ "type":"structure",
+ "members":{
+ "nested":{"shape":"RecursiveShapesInputOutputNested1"}
+ }
+ },
+ "RecursiveShapesInputOutputNested1":{
+ "type":"structure",
+ "members":{
+ "foo":{"shape":"String"},
+ "nested":{"shape":"RecursiveShapesInputOutputNested2"}
+ }
+ },
+ "RecursiveShapesInputOutputNested2":{
+ "type":"structure",
+ "members":{
+ "bar":{"shape":"String"},
+ "recursiveMember":{"shape":"RecursiveShapesInputOutputNested1"}
+ }
+ },
+ "RpcV2CborDenseMapsInputOutput":{
+ "type":"structure",
+ "members":{
+ "denseStructMap":{"shape":"DenseStructMap"},
+ "denseNumberMap":{"shape":"DenseNumberMap"},
+ "denseBooleanMap":{"shape":"DenseBooleanMap"},
+ "denseStringMap":{"shape":"DenseStringMap"},
+ "denseSetMap":{"shape":"DenseSetMap"}
+ }
+ },
+ "RpcV2CborListInputOutput":{
+ "type":"structure",
+ "members":{
+ "stringList":{"shape":"StringList"},
+ "stringSet":{"shape":"StringSet"},
+ "integerList":{"shape":"IntegerList"},
+ "booleanList":{"shape":"BooleanList"},
+ "timestampList":{"shape":"TimestampList"},
+ "enumList":{"shape":"FooEnumList"},
+ "intEnumList":{"shape":"IntegerEnumList"},
+ "nestedStringList":{"shape":"NestedStringList"},
+ "structureList":{"shape":"StructureList"},
+ "blobList":{"shape":"BlobList"}
+ }
+ },
+ "RpcV2CborSparseMapsInputOutput":{
+ "type":"structure",
+ "members":{
+ "sparseStructMap":{"shape":"SparseStructMap"},
+ "sparseNumberMap":{"shape":"SparseNumberMap"},
+ "sparseBooleanMap":{"shape":"SparseBooleanMap"},
+ "sparseStringMap":{"shape":"SparseStringMap"},
+ "sparseSetMap":{"shape":"SparseSetMap"}
+ }
+ },
+ "Short":{
+ "type":"short",
+ "box":true
+ },
+ "SimpleScalarStructure":{
+ "type":"structure",
+ "members":{
+ "trueBooleanValue":{"shape":"Boolean"},
+ "falseBooleanValue":{"shape":"Boolean"},
+ "byteValue":{"shape":"Byte"},
+ "doubleValue":{"shape":"Double"},
+ "floatValue":{"shape":"Float"},
+ "integerValue":{"shape":"Integer"},
+ "longValue":{"shape":"Long"},
+ "shortValue":{"shape":"Short"},
+ "stringValue":{"shape":"String"},
+ "blobValue":{"shape":"Blob"}
+ }
+ },
+ "SimpleStructure":{
+ "type":"structure",
+ "members":{
+ "value":{"shape":"String"}
+ }
+ },
+ "SparseBooleanMap":{
+ "type":"map",
+ "key":{"shape":"String"},
+ "value":{"shape":"Boolean"}
+ },
+ "SparseNullsOperationInputOutput":{
+ "type":"structure",
+ "members":{
+ "sparseStringList":{"shape":"SparseStringList"},
+ "sparseStringMap":{"shape":"SparseStringMap"}
+ }
+ },
+ "SparseNumberMap":{
+ "type":"map",
+ "key":{"shape":"String"},
+ "value":{"shape":"Integer"}
+ },
+ "SparseSetMap":{
+ "type":"map",
+ "key":{"shape":"String"},
+ "value":{"shape":"StringSet"}
+ },
+ "SparseStringList":{
+ "type":"list",
+ "member":{"shape":"String"}
+ },
+ "SparseStringMap":{
+ "type":"map",
+ "key":{"shape":"String"},
+ "value":{"shape":"String"}
+ },
+ "SparseStructMap":{
+ "type":"map",
+ "key":{"shape":"String"},
+ "value":{"shape":"GreetingStruct"}
+ },
+ "String":{"type":"string"},
+ "StringList":{
+ "type":"list",
+ "member":{"shape":"String"}
+ },
+ "StringSet":{
+ "type":"list",
+ "member":{"shape":"String"}
+ },
+ "StructureList":{
+ "type":"list",
+ "member":{"shape":"StructureListMember"}
+ },
+ "StructureListMember":{
+ "type":"structure",
+ "members":{
+ "a":{"shape":"String"},
+ "b":{"shape":"String"}
+ }
+ },
+ "TestEnum":{
+ "type":"string",
+ "enum":[
+ "FOO",
+ "BAR",
+ "BAZ"
+ ]
+ },
+ "TestIntEnum":{
+ "type":"integer",
+ "box":true
+ },
+ "TestStringList":{
+ "type":"list",
+ "member":{"shape":"String"}
+ },
+ "TestStringMap":{
+ "type":"map",
+ "key":{"shape":"String"},
+ "value":{"shape":"String"}
+ },
+ "Timestamp":{"type":"timestamp"},
+ "TimestampList":{
+ "type":"list",
+ "member":{"shape":"Timestamp"}
+ },
+ "ValidationException":{
+ "type":"structure",
+ "required":["message"],
+ "members":{
+ "message":{"shape":"String"},
+ "fieldList":{"shape":"ValidationExceptionFieldList"}
+ },
+ "exception":true
+ },
+ "ValidationExceptionField":{
+ "type":"structure",
+ "required":[
+ "path",
+ "message"
+ ],
+ "members":{
+ "path":{"shape":"String"},
+ "message":{"shape":"String"}
+ }
+ },
+ "ValidationExceptionFieldList":{
+ "type":"list",
+ "member":{"shape":"ValidationExceptionField"}
+ }
+ }
+}
diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-rpcv2-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-rpcv2-async-client-class.java
new file mode 100644
index 000000000000..b182b7e56b24
--- /dev/null
+++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-rpcv2-async-client-class.java
@@ -0,0 +1,959 @@
+package software.amazon.awssdk.services.smithyrpcv2protocol;
+
+import static software.amazon.awssdk.utils.FunctionalUtils.runAndLogError;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+import java.util.function.Consumer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import software.amazon.awssdk.annotations.Generated;
+import software.amazon.awssdk.annotations.SdkInternalApi;
+import software.amazon.awssdk.awscore.client.handler.AwsAsyncClientHandler;
+import software.amazon.awssdk.awscore.exception.AwsServiceException;
+import software.amazon.awssdk.awscore.internal.AwsProtocolMetadata;
+import software.amazon.awssdk.awscore.internal.AwsServiceProtocol;
+import software.amazon.awssdk.awscore.retry.AwsRetryStrategy;
+import software.amazon.awssdk.core.RequestOverrideConfiguration;
+import software.amazon.awssdk.core.SdkPlugin;
+import software.amazon.awssdk.core.SdkRequest;
+import software.amazon.awssdk.core.client.config.ClientOverrideConfiguration;
+import software.amazon.awssdk.core.client.config.SdkClientConfiguration;
+import software.amazon.awssdk.core.client.config.SdkClientOption;
+import software.amazon.awssdk.core.client.handler.AsyncClientHandler;
+import software.amazon.awssdk.core.client.handler.ClientExecutionParams;
+import software.amazon.awssdk.core.http.HttpResponseHandler;
+import software.amazon.awssdk.core.metrics.CoreMetric;
+import software.amazon.awssdk.core.retry.RetryMode;
+import software.amazon.awssdk.metrics.MetricCollector;
+import software.amazon.awssdk.metrics.MetricPublisher;
+import software.amazon.awssdk.metrics.NoOpMetricCollector;
+import software.amazon.awssdk.protocols.core.ExceptionMetadata;
+import software.amazon.awssdk.protocols.json.AwsJsonProtocol;
+import software.amazon.awssdk.protocols.json.BaseAwsJsonProtocolFactory;
+import software.amazon.awssdk.protocols.json.JsonOperationMetadata;
+import software.amazon.awssdk.protocols.rpcv2.SmithyRpcV2CborProtocolFactory;
+import software.amazon.awssdk.retries.api.RetryStrategy;
+import software.amazon.awssdk.services.smithyrpcv2protocol.internal.SmithyRpcV2ProtocolServiceClientConfigurationBuilder;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.ComplexErrorException;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.EmptyInputOutputRequest;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.EmptyInputOutputResponse;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.Float16Request;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.Float16Response;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.FractionalSecondsRequest;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.FractionalSecondsResponse;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.GreetingWithErrorsRequest;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.GreetingWithErrorsResponse;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.InvalidGreetingException;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.NoInputOutputRequest;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.NoInputOutputResponse;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.OperationWithDefaultsRequest;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.OperationWithDefaultsResponse;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.OptionalInputOutputRequest;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.OptionalInputOutputResponse;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.RecursiveShapesRequest;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.RecursiveShapesResponse;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.RpcV2CborDenseMapsRequest;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.RpcV2CborDenseMapsResponse;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.RpcV2CborListsRequest;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.RpcV2CborListsResponse;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.RpcV2CborSparseMapsRequest;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.RpcV2CborSparseMapsResponse;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.SimpleScalarPropertiesRequest;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.SimpleScalarPropertiesResponse;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.SmithyRpcV2ProtocolException;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.SparseNullsOperationRequest;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.SparseNullsOperationResponse;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.ValidationException;
+import software.amazon.awssdk.services.smithyrpcv2protocol.transform.EmptyInputOutputRequestMarshaller;
+import software.amazon.awssdk.services.smithyrpcv2protocol.transform.Float16RequestMarshaller;
+import software.amazon.awssdk.services.smithyrpcv2protocol.transform.FractionalSecondsRequestMarshaller;
+import software.amazon.awssdk.services.smithyrpcv2protocol.transform.GreetingWithErrorsRequestMarshaller;
+import software.amazon.awssdk.services.smithyrpcv2protocol.transform.NoInputOutputRequestMarshaller;
+import software.amazon.awssdk.services.smithyrpcv2protocol.transform.OperationWithDefaultsRequestMarshaller;
+import software.amazon.awssdk.services.smithyrpcv2protocol.transform.OptionalInputOutputRequestMarshaller;
+import software.amazon.awssdk.services.smithyrpcv2protocol.transform.RecursiveShapesRequestMarshaller;
+import software.amazon.awssdk.services.smithyrpcv2protocol.transform.RpcV2CborDenseMapsRequestMarshaller;
+import software.amazon.awssdk.services.smithyrpcv2protocol.transform.RpcV2CborListsRequestMarshaller;
+import software.amazon.awssdk.services.smithyrpcv2protocol.transform.RpcV2CborSparseMapsRequestMarshaller;
+import software.amazon.awssdk.services.smithyrpcv2protocol.transform.SimpleScalarPropertiesRequestMarshaller;
+import software.amazon.awssdk.services.smithyrpcv2protocol.transform.SparseNullsOperationRequestMarshaller;
+import software.amazon.awssdk.utils.CompletableFutureUtils;
+
+/**
+ * Internal implementation of {@link SmithyRpcV2ProtocolAsyncClient}.
+ *
+ * @see SmithyRpcV2ProtocolAsyncClient#builder()
+ */
+@Generated("software.amazon.awssdk:codegen")
+@SdkInternalApi
+final class DefaultSmithyRpcV2ProtocolAsyncClient implements SmithyRpcV2ProtocolAsyncClient {
+ private static final Logger log = LoggerFactory.getLogger(DefaultSmithyRpcV2ProtocolAsyncClient.class);
+
+ private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder()
+ .serviceProtocol(AwsServiceProtocol.SMITHY_RPC_V2_CBOR).build();
+
+ private final AsyncClientHandler clientHandler;
+
+ private final SmithyRpcV2CborProtocolFactory protocolFactory;
+
+ private final SdkClientConfiguration clientConfiguration;
+
+ protected DefaultSmithyRpcV2ProtocolAsyncClient(SdkClientConfiguration clientConfiguration) {
+ this.clientHandler = new AwsAsyncClientHandler(clientConfiguration);
+ this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
+ this.protocolFactory = init(SmithyRpcV2CborProtocolFactory.builder()).build();
+ }
+
+ /**
+ * Invokes the EmptyInputOutput operation asynchronously.
+ *
+ * @param emptyInputOutputRequest
+ * @return A Java Future containing the result of the EmptyInputOutput operation returned by the service.
+ * The CompletableFuture returned by this method can be completed exceptionally with the following
+ * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
+ * {@link Throwable#getCause} to retrieve the underlying exception.
+ *
+ * SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
+ * Can be used for catch all scenarios.
+ * SdkClientException If any client side error occurs such as an IO related failure, failure to get
+ * credentials, etc.
+ * SmithyRpcV2ProtocolException Base class for all service exceptions. Unknown exceptions will be thrown
+ * as an instance of this type.
+ *
+ * @sample SmithyRpcV2ProtocolAsyncClient.EmptyInputOutput
+ * @see AWS API Documentation
+ */
+ @Override
+ public CompletableFuture emptyInputOutput(EmptyInputOutputRequest emptyInputOutputRequest) {
+ SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(emptyInputOutputRequest,
+ this.clientConfiguration);
+ List metricPublishers = resolveMetricPublishers(clientConfiguration, emptyInputOutputRequest
+ .overrideConfiguration().orElse(null));
+ MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
+ .create("ApiCall");
+ try {
+ apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol");
+ apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "EmptyInputOutput");
+ JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
+ .isPayloadJson(true).build();
+
+ HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
+ operationMetadata, EmptyInputOutputResponse::builder);
+
+ HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
+ operationMetadata);
+
+ CompletableFuture executeFuture = clientHandler
+ .execute(new ClientExecutionParams()
+ .withOperationName("EmptyInputOutput").withProtocolMetadata(protocolMetadata)
+ .withMarshaller(new EmptyInputOutputRequestMarshaller(protocolFactory))
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
+ .withInput(emptyInputOutputRequest));
+ CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
+ metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
+ });
+ executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
+ return executeFuture;
+ } catch (Throwable t) {
+ metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
+ return CompletableFutureUtils.failedFuture(t);
+ }
+ }
+
+ /**
+ * Invokes the Float16 operation asynchronously.
+ *
+ * @param float16Request
+ * @return A Java Future containing the result of the Float16 operation returned by the service.
+ * The CompletableFuture returned by this method can be completed exceptionally with the following
+ * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
+ * {@link Throwable#getCause} to retrieve the underlying exception.
+ *
+ * SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
+ * Can be used for catch all scenarios.
+ * SdkClientException If any client side error occurs such as an IO related failure, failure to get
+ * credentials, etc.
+ * SmithyRpcV2ProtocolException Base class for all service exceptions. Unknown exceptions will be thrown
+ * as an instance of this type.
+ *
+ * @sample SmithyRpcV2ProtocolAsyncClient.Float16
+ * @see AWS
+ * API Documentation
+ */
+ @Override
+ public CompletableFuture float16(Float16Request float16Request) {
+ SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(float16Request, this.clientConfiguration);
+ List metricPublishers = resolveMetricPublishers(clientConfiguration, float16Request
+ .overrideConfiguration().orElse(null));
+ MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
+ .create("ApiCall");
+ try {
+ apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol");
+ apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "Float16");
+ JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
+ .isPayloadJson(true).build();
+
+ HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
+ Float16Response::builder);
+
+ HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
+ operationMetadata);
+
+ CompletableFuture executeFuture = clientHandler
+ .execute(new ClientExecutionParams().withOperationName("Float16")
+ .withProtocolMetadata(protocolMetadata).withMarshaller(new Float16RequestMarshaller(protocolFactory))
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
+ .withInput(float16Request));
+ CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
+ metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
+ });
+ executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
+ return executeFuture;
+ } catch (Throwable t) {
+ metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
+ return CompletableFutureUtils.failedFuture(t);
+ }
+ }
+
+ /**
+ * Invokes the FractionalSeconds operation asynchronously.
+ *
+ * @param fractionalSecondsRequest
+ * @return A Java Future containing the result of the FractionalSeconds operation returned by the service.
+ * The CompletableFuture returned by this method can be completed exceptionally with the following
+ * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
+ * {@link Throwable#getCause} to retrieve the underlying exception.
+ *
+ * SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
+ * Can be used for catch all scenarios.
+ * SdkClientException If any client side error occurs such as an IO related failure, failure to get
+ * credentials, etc.
+ * SmithyRpcV2ProtocolException Base class for all service exceptions. Unknown exceptions will be thrown
+ * as an instance of this type.
+ *
+ * @sample SmithyRpcV2ProtocolAsyncClient.FractionalSeconds
+ * @see AWS API Documentation
+ */
+ @Override
+ public CompletableFuture fractionalSeconds(FractionalSecondsRequest fractionalSecondsRequest) {
+ SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(fractionalSecondsRequest,
+ this.clientConfiguration);
+ List metricPublishers = resolveMetricPublishers(clientConfiguration, fractionalSecondsRequest
+ .overrideConfiguration().orElse(null));
+ MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
+ .create("ApiCall");
+ try {
+ apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol");
+ apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "FractionalSeconds");
+ JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
+ .isPayloadJson(true).build();
+
+ HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
+ operationMetadata, FractionalSecondsResponse::builder);
+
+ HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
+ operationMetadata);
+
+ CompletableFuture executeFuture = clientHandler
+ .execute(new ClientExecutionParams()
+ .withOperationName("FractionalSeconds").withProtocolMetadata(protocolMetadata)
+ .withMarshaller(new FractionalSecondsRequestMarshaller(protocolFactory))
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
+ .withInput(fractionalSecondsRequest));
+ CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
+ metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
+ });
+ executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
+ return executeFuture;
+ } catch (Throwable t) {
+ metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
+ return CompletableFutureUtils.failedFuture(t);
+ }
+ }
+
+ /**
+ * Invokes the GreetingWithErrors operation asynchronously.
+ *
+ * @param greetingWithErrorsRequest
+ * @return A Java Future containing the result of the GreetingWithErrors operation returned by the service.
+ * The CompletableFuture returned by this method can be completed exceptionally with the following
+ * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
+ * {@link Throwable#getCause} to retrieve the underlying exception.
+ *
+ * ComplexErrorException
+ * InvalidGreetingException
+ * SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
+ * Can be used for catch all scenarios.
+ * SdkClientException If any client side error occurs such as an IO related failure, failure to get
+ * credentials, etc.
+ * SmithyRpcV2ProtocolException Base class for all service exceptions. Unknown exceptions will be thrown
+ * as an instance of this type.
+ *
+ * @sample SmithyRpcV2ProtocolAsyncClient.GreetingWithErrors
+ * @see AWS API Documentation
+ */
+ @Override
+ public CompletableFuture greetingWithErrors(GreetingWithErrorsRequest greetingWithErrorsRequest) {
+ SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(greetingWithErrorsRequest,
+ this.clientConfiguration);
+ List metricPublishers = resolveMetricPublishers(clientConfiguration, greetingWithErrorsRequest
+ .overrideConfiguration().orElse(null));
+ MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
+ .create("ApiCall");
+ try {
+ apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol");
+ apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GreetingWithErrors");
+ JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
+ .isPayloadJson(true).build();
+
+ HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
+ operationMetadata, GreetingWithErrorsResponse::builder);
+
+ HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
+ operationMetadata);
+
+ CompletableFuture executeFuture = clientHandler
+ .execute(new ClientExecutionParams()
+ .withOperationName("GreetingWithErrors").withProtocolMetadata(protocolMetadata)
+ .withMarshaller(new GreetingWithErrorsRequestMarshaller(protocolFactory))
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
+ .withInput(greetingWithErrorsRequest));
+ CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
+ metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
+ });
+ executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
+ return executeFuture;
+ } catch (Throwable t) {
+ metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
+ return CompletableFutureUtils.failedFuture(t);
+ }
+ }
+
+ /**
+ * Invokes the NoInputOutput operation asynchronously.
+ *
+ * @param noInputOutputRequest
+ * @return A Java Future containing the result of the NoInputOutput operation returned by the service.
+ * The CompletableFuture returned by this method can be completed exceptionally with the following
+ * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
+ * {@link Throwable#getCause} to retrieve the underlying exception.
+ *
+ * SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
+ * Can be used for catch all scenarios.
+ * SdkClientException If any client side error occurs such as an IO related failure, failure to get
+ * credentials, etc.
+ * SmithyRpcV2ProtocolException Base class for all service exceptions. Unknown exceptions will be thrown
+ * as an instance of this type.
+ *
+ * @sample SmithyRpcV2ProtocolAsyncClient.NoInputOutput
+ * @see AWS API Documentation
+ */
+ @Override
+ public CompletableFuture noInputOutput(NoInputOutputRequest noInputOutputRequest) {
+ SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(noInputOutputRequest, this.clientConfiguration);
+ List metricPublishers = resolveMetricPublishers(clientConfiguration, noInputOutputRequest
+ .overrideConfiguration().orElse(null));
+ MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
+ .create("ApiCall");
+ try {
+ apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol");
+ apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "NoInputOutput");
+ JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
+ .isPayloadJson(true).build();
+
+ HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
+ NoInputOutputResponse::builder);
+
+ HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
+ operationMetadata);
+
+ CompletableFuture executeFuture = clientHandler
+ .execute(new ClientExecutionParams()
+ .withOperationName("NoInputOutput").withProtocolMetadata(protocolMetadata)
+ .withMarshaller(new NoInputOutputRequestMarshaller(protocolFactory))
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
+ .withInput(noInputOutputRequest));
+ CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
+ metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
+ });
+ executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
+ return executeFuture;
+ } catch (Throwable t) {
+ metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
+ return CompletableFutureUtils.failedFuture(t);
+ }
+ }
+
+ /**
+ * Invokes the OperationWithDefaults operation asynchronously.
+ *
+ * @param operationWithDefaultsRequest
+ * @return A Java Future containing the result of the OperationWithDefaults operation returned by the service.
+ * The CompletableFuture returned by this method can be completed exceptionally with the following
+ * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
+ * {@link Throwable#getCause} to retrieve the underlying exception.
+ *
+ * ValidationException
+ * SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
+ * Can be used for catch all scenarios.
+ * SdkClientException If any client side error occurs such as an IO related failure, failure to get
+ * credentials, etc.
+ * SmithyRpcV2ProtocolException Base class for all service exceptions. Unknown exceptions will be thrown
+ * as an instance of this type.
+ *
+ * @sample SmithyRpcV2ProtocolAsyncClient.OperationWithDefaults
+ * @see AWS API Documentation
+ */
+ @Override
+ public CompletableFuture operationWithDefaults(
+ OperationWithDefaultsRequest operationWithDefaultsRequest) {
+ SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithDefaultsRequest,
+ this.clientConfiguration);
+ List metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithDefaultsRequest
+ .overrideConfiguration().orElse(null));
+ MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
+ .create("ApiCall");
+ try {
+ apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol");
+ apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithDefaults");
+ JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
+ .isPayloadJson(true).build();
+
+ HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
+ operationMetadata, OperationWithDefaultsResponse::builder);
+
+ HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
+ operationMetadata);
+
+ CompletableFuture executeFuture = clientHandler
+ .execute(new ClientExecutionParams()
+ .withOperationName("OperationWithDefaults").withProtocolMetadata(protocolMetadata)
+ .withMarshaller(new OperationWithDefaultsRequestMarshaller(protocolFactory))
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
+ .withInput(operationWithDefaultsRequest));
+ CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
+ metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
+ });
+ executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
+ return executeFuture;
+ } catch (Throwable t) {
+ metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
+ return CompletableFutureUtils.failedFuture(t);
+ }
+ }
+
+ /**
+ * Invokes the OptionalInputOutput operation asynchronously.
+ *
+ * @param optionalInputOutputRequest
+ * @return A Java Future containing the result of the OptionalInputOutput operation returned by the service.
+ * The CompletableFuture returned by this method can be completed exceptionally with the following
+ * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
+ * {@link Throwable#getCause} to retrieve the underlying exception.
+ *
+ * SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
+ * Can be used for catch all scenarios.
+ * SdkClientException If any client side error occurs such as an IO related failure, failure to get
+ * credentials, etc.
+ * SmithyRpcV2ProtocolException Base class for all service exceptions. Unknown exceptions will be thrown
+ * as an instance of this type.
+ *
+ * @sample SmithyRpcV2ProtocolAsyncClient.OptionalInputOutput
+ * @see AWS API Documentation
+ */
+ @Override
+ public CompletableFuture optionalInputOutput(
+ OptionalInputOutputRequest optionalInputOutputRequest) {
+ SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(optionalInputOutputRequest,
+ this.clientConfiguration);
+ List metricPublishers = resolveMetricPublishers(clientConfiguration, optionalInputOutputRequest
+ .overrideConfiguration().orElse(null));
+ MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
+ .create("ApiCall");
+ try {
+ apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol");
+ apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OptionalInputOutput");
+ JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
+ .isPayloadJson(true).build();
+
+ HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
+ operationMetadata, OptionalInputOutputResponse::builder);
+
+ HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
+ operationMetadata);
+
+ CompletableFuture executeFuture = clientHandler
+ .execute(new ClientExecutionParams()
+ .withOperationName("OptionalInputOutput").withProtocolMetadata(protocolMetadata)
+ .withMarshaller(new OptionalInputOutputRequestMarshaller(protocolFactory))
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
+ .withInput(optionalInputOutputRequest));
+ CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
+ metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
+ });
+ executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
+ return executeFuture;
+ } catch (Throwable t) {
+ metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
+ return CompletableFutureUtils.failedFuture(t);
+ }
+ }
+
+ /**
+ * Invokes the RecursiveShapes operation asynchronously.
+ *
+ * @param recursiveShapesRequest
+ * @return A Java Future containing the result of the RecursiveShapes operation returned by the service.
+ * The CompletableFuture returned by this method can be completed exceptionally with the following
+ * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
+ * {@link Throwable#getCause} to retrieve the underlying exception.
+ *
+ * SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
+ * Can be used for catch all scenarios.
+ * SdkClientException If any client side error occurs such as an IO related failure, failure to get
+ * credentials, etc.
+ * SmithyRpcV2ProtocolException Base class for all service exceptions. Unknown exceptions will be thrown
+ * as an instance of this type.
+ *
+ * @sample SmithyRpcV2ProtocolAsyncClient.RecursiveShapes
+ * @see AWS API Documentation
+ */
+ @Override
+ public CompletableFuture recursiveShapes(RecursiveShapesRequest recursiveShapesRequest) {
+ SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(recursiveShapesRequest,
+ this.clientConfiguration);
+ List metricPublishers = resolveMetricPublishers(clientConfiguration, recursiveShapesRequest
+ .overrideConfiguration().orElse(null));
+ MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
+ .create("ApiCall");
+ try {
+ apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol");
+ apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "RecursiveShapes");
+ JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
+ .isPayloadJson(true).build();
+
+ HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
+ operationMetadata, RecursiveShapesResponse::builder);
+
+ HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
+ operationMetadata);
+
+ CompletableFuture executeFuture = clientHandler
+ .execute(new ClientExecutionParams()
+ .withOperationName("RecursiveShapes").withProtocolMetadata(protocolMetadata)
+ .withMarshaller(new RecursiveShapesRequestMarshaller(protocolFactory))
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
+ .withInput(recursiveShapesRequest));
+ CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
+ metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
+ });
+ executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
+ return executeFuture;
+ } catch (Throwable t) {
+ metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
+ return CompletableFutureUtils.failedFuture(t);
+ }
+ }
+
+ /**
+ * Invokes the RpcV2CborDenseMaps operation asynchronously.
+ *
+ * @param rpcV2CborDenseMapsRequest
+ * @return A Java Future containing the result of the RpcV2CborDenseMaps operation returned by the service.
+ * The CompletableFuture returned by this method can be completed exceptionally with the following
+ * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
+ * {@link Throwable#getCause} to retrieve the underlying exception.
+ *
+ * ValidationException
+ * SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
+ * Can be used for catch all scenarios.
+ * SdkClientException If any client side error occurs such as an IO related failure, failure to get
+ * credentials, etc.
+ * SmithyRpcV2ProtocolException Base class for all service exceptions. Unknown exceptions will be thrown
+ * as an instance of this type.
+ *
+ * @sample SmithyRpcV2ProtocolAsyncClient.RpcV2CborDenseMaps
+ * @see AWS API Documentation
+ */
+ @Override
+ public CompletableFuture rpcV2CborDenseMaps(RpcV2CborDenseMapsRequest rpcV2CborDenseMapsRequest) {
+ SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(rpcV2CborDenseMapsRequest,
+ this.clientConfiguration);
+ List metricPublishers = resolveMetricPublishers(clientConfiguration, rpcV2CborDenseMapsRequest
+ .overrideConfiguration().orElse(null));
+ MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
+ .create("ApiCall");
+ try {
+ apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol");
+ apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "RpcV2CborDenseMaps");
+ JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
+ .isPayloadJson(true).build();
+
+ HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
+ operationMetadata, RpcV2CborDenseMapsResponse::builder);
+
+ HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
+ operationMetadata);
+
+ CompletableFuture executeFuture = clientHandler
+ .execute(new ClientExecutionParams()
+ .withOperationName("RpcV2CborDenseMaps").withProtocolMetadata(protocolMetadata)
+ .withMarshaller(new RpcV2CborDenseMapsRequestMarshaller(protocolFactory))
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
+ .withInput(rpcV2CborDenseMapsRequest));
+ CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
+ metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
+ });
+ executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
+ return executeFuture;
+ } catch (Throwable t) {
+ metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
+ return CompletableFutureUtils.failedFuture(t);
+ }
+ }
+
+ /**
+ * Invokes the RpcV2CborLists operation asynchronously.
+ *
+ * @param rpcV2CborListsRequest
+ * @return A Java Future containing the result of the RpcV2CborLists operation returned by the service.
+ * The CompletableFuture returned by this method can be completed exceptionally with the following
+ * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
+ * {@link Throwable#getCause} to retrieve the underlying exception.
+ *
+ * ValidationException
+ * SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
+ * Can be used for catch all scenarios.
+ * SdkClientException If any client side error occurs such as an IO related failure, failure to get
+ * credentials, etc.
+ * SmithyRpcV2ProtocolException Base class for all service exceptions. Unknown exceptions will be thrown
+ * as an instance of this type.
+ *
+ * @sample SmithyRpcV2ProtocolAsyncClient.RpcV2CborLists
+ * @see AWS API Documentation
+ */
+ @Override
+ public CompletableFuture rpcV2CborLists(RpcV2CborListsRequest rpcV2CborListsRequest) {
+ SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(rpcV2CborListsRequest, this.clientConfiguration);
+ List metricPublishers = resolveMetricPublishers(clientConfiguration, rpcV2CborListsRequest
+ .overrideConfiguration().orElse(null));
+ MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
+ .create("ApiCall");
+ try {
+ apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol");
+ apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "RpcV2CborLists");
+ JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
+ .isPayloadJson(true).build();
+
+ HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
+ operationMetadata, RpcV2CborListsResponse::builder);
+
+ HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
+ operationMetadata);
+
+ CompletableFuture executeFuture = clientHandler
+ .execute(new ClientExecutionParams()
+ .withOperationName("RpcV2CborLists").withProtocolMetadata(protocolMetadata)
+ .withMarshaller(new RpcV2CborListsRequestMarshaller(protocolFactory))
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
+ .withInput(rpcV2CborListsRequest));
+ CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
+ metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
+ });
+ executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
+ return executeFuture;
+ } catch (Throwable t) {
+ metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
+ return CompletableFutureUtils.failedFuture(t);
+ }
+ }
+
+ /**
+ * Invokes the RpcV2CborSparseMaps operation asynchronously.
+ *
+ * @param rpcV2CborSparseMapsRequest
+ * @return A Java Future containing the result of the RpcV2CborSparseMaps operation returned by the service.
+ * The CompletableFuture returned by this method can be completed exceptionally with the following
+ * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
+ * {@link Throwable#getCause} to retrieve the underlying exception.
+ *
+ * ValidationException
+ * SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
+ * Can be used for catch all scenarios.
+ * SdkClientException If any client side error occurs such as an IO related failure, failure to get
+ * credentials, etc.
+ * SmithyRpcV2ProtocolException Base class for all service exceptions. Unknown exceptions will be thrown
+ * as an instance of this type.
+ *
+ * @sample SmithyRpcV2ProtocolAsyncClient.RpcV2CborSparseMaps
+ * @see AWS API Documentation
+ */
+ @Override
+ public CompletableFuture rpcV2CborSparseMaps(
+ RpcV2CborSparseMapsRequest rpcV2CborSparseMapsRequest) {
+ SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(rpcV2CborSparseMapsRequest,
+ this.clientConfiguration);
+ List metricPublishers = resolveMetricPublishers(clientConfiguration, rpcV2CborSparseMapsRequest
+ .overrideConfiguration().orElse(null));
+ MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
+ .create("ApiCall");
+ try {
+ apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol");
+ apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "RpcV2CborSparseMaps");
+ JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
+ .isPayloadJson(true).build();
+
+ HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
+ operationMetadata, RpcV2CborSparseMapsResponse::builder);
+
+ HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
+ operationMetadata);
+
+ CompletableFuture executeFuture = clientHandler
+ .execute(new ClientExecutionParams()
+ .withOperationName("RpcV2CborSparseMaps").withProtocolMetadata(protocolMetadata)
+ .withMarshaller(new RpcV2CborSparseMapsRequestMarshaller(protocolFactory))
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
+ .withInput(rpcV2CborSparseMapsRequest));
+ CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
+ metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
+ });
+ executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
+ return executeFuture;
+ } catch (Throwable t) {
+ metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
+ return CompletableFutureUtils.failedFuture(t);
+ }
+ }
+
+ /**
+ * Invokes the SimpleScalarProperties operation asynchronously.
+ *
+ * @param simpleScalarPropertiesRequest
+ * @return A Java Future containing the result of the SimpleScalarProperties operation returned by the service.
+ * The CompletableFuture returned by this method can be completed exceptionally with the following
+ * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
+ * {@link Throwable#getCause} to retrieve the underlying exception.
+ *
+ * SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
+ * Can be used for catch all scenarios.
+ * SdkClientException If any client side error occurs such as an IO related failure, failure to get
+ * credentials, etc.
+ * SmithyRpcV2ProtocolException Base class for all service exceptions. Unknown exceptions will be thrown
+ * as an instance of this type.
+ *
+ * @sample SmithyRpcV2ProtocolAsyncClient.SimpleScalarProperties
+ * @see AWS API Documentation
+ */
+ @Override
+ public CompletableFuture simpleScalarProperties(
+ SimpleScalarPropertiesRequest simpleScalarPropertiesRequest) {
+ SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(simpleScalarPropertiesRequest,
+ this.clientConfiguration);
+ List metricPublishers = resolveMetricPublishers(clientConfiguration, simpleScalarPropertiesRequest
+ .overrideConfiguration().orElse(null));
+ MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
+ .create("ApiCall");
+ try {
+ apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol");
+ apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "SimpleScalarProperties");
+ JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
+ .isPayloadJson(true).build();
+
+ HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
+ operationMetadata, SimpleScalarPropertiesResponse::builder);
+
+ HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
+ operationMetadata);
+
+ CompletableFuture executeFuture = clientHandler
+ .execute(new ClientExecutionParams()
+ .withOperationName("SimpleScalarProperties").withProtocolMetadata(protocolMetadata)
+ .withMarshaller(new SimpleScalarPropertiesRequestMarshaller(protocolFactory))
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
+ .withInput(simpleScalarPropertiesRequest));
+ CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
+ metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
+ });
+ executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
+ return executeFuture;
+ } catch (Throwable t) {
+ metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
+ return CompletableFutureUtils.failedFuture(t);
+ }
+ }
+
+ /**
+ * Invokes the SparseNullsOperation operation asynchronously.
+ *
+ * @param sparseNullsOperationRequest
+ * @return A Java Future containing the result of the SparseNullsOperation operation returned by the service.
+ * The CompletableFuture returned by this method can be completed exceptionally with the following
+ * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
+ * {@link Throwable#getCause} to retrieve the underlying exception.
+ *
+ * SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
+ * Can be used for catch all scenarios.
+ * SdkClientException If any client side error occurs such as an IO related failure, failure to get
+ * credentials, etc.
+ * SmithyRpcV2ProtocolException Base class for all service exceptions. Unknown exceptions will be thrown
+ * as an instance of this type.
+ *
+ * @sample SmithyRpcV2ProtocolAsyncClient.SparseNullsOperation
+ * @see AWS API Documentation
+ */
+ @Override
+ public CompletableFuture sparseNullsOperation(
+ SparseNullsOperationRequest sparseNullsOperationRequest) {
+ SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(sparseNullsOperationRequest,
+ this.clientConfiguration);
+ List metricPublishers = resolveMetricPublishers(clientConfiguration, sparseNullsOperationRequest
+ .overrideConfiguration().orElse(null));
+ MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
+ .create("ApiCall");
+ try {
+ apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol");
+ apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "SparseNullsOperation");
+ JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
+ .isPayloadJson(true).build();
+
+ HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
+ operationMetadata, SparseNullsOperationResponse::builder);
+
+ HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
+ operationMetadata);
+
+ CompletableFuture executeFuture = clientHandler
+ .execute(new ClientExecutionParams()
+ .withOperationName("SparseNullsOperation").withProtocolMetadata(protocolMetadata)
+ .withMarshaller(new SparseNullsOperationRequestMarshaller(protocolFactory))
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
+ .withInput(sparseNullsOperationRequest));
+ CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
+ metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
+ });
+ executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
+ return executeFuture;
+ } catch (Throwable t) {
+ metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
+ return CompletableFutureUtils.failedFuture(t);
+ }
+ }
+
+ @Override
+ public final SmithyRpcV2ProtocolServiceClientConfiguration serviceClientConfiguration() {
+ return new SmithyRpcV2ProtocolServiceClientConfigurationBuilder(this.clientConfiguration.toBuilder()).build();
+ }
+
+ @Override
+ public final String serviceName() {
+ return SERVICE_NAME;
+ }
+
+ private > T init(T builder) {
+ return builder
+ .clientConfiguration(clientConfiguration)
+ .defaultServiceExceptionSupplier(SmithyRpcV2ProtocolException::builder)
+ .protocol(AwsJsonProtocol.SMITHY_RPC_V2_CBOR)
+ .protocolVersion("1.1")
+ .registerModeledException(
+ ExceptionMetadata.builder().errorCode("ValidationException")
+ .exceptionBuilderSupplier(ValidationException::builder).build())
+ .registerModeledException(
+ ExceptionMetadata.builder().errorCode("InvalidGreeting")
+ .exceptionBuilderSupplier(InvalidGreetingException::builder).build())
+ .registerModeledException(
+ ExceptionMetadata.builder().errorCode("ComplexError")
+ .exceptionBuilderSupplier(ComplexErrorException::builder).build());
+ }
+
+ private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration,
+ RequestOverrideConfiguration requestOverrideConfiguration) {
+ List publishers = null;
+ if (requestOverrideConfiguration != null) {
+ publishers = requestOverrideConfiguration.metricPublishers();
+ }
+ if (publishers == null || publishers.isEmpty()) {
+ publishers = clientConfiguration.option(SdkClientOption.METRIC_PUBLISHERS);
+ }
+ if (publishers == null) {
+ publishers = Collections.emptyList();
+ }
+ return publishers;
+ }
+
+ private void updateRetryStrategyClientConfiguration(SdkClientConfiguration.Builder configuration) {
+ ClientOverrideConfiguration.Builder builder = configuration.asOverrideConfigurationBuilder();
+ RetryMode retryMode = builder.retryMode();
+ if (retryMode != null) {
+ configuration.option(SdkClientOption.RETRY_STRATEGY, AwsRetryStrategy.forRetryMode(retryMode));
+ } else {
+ Consumer> configurator = builder.retryStrategyConfigurator();
+ if (configurator != null) {
+ RetryStrategy.Builder, ?> defaultBuilder = AwsRetryStrategy.defaultRetryStrategy().toBuilder();
+ configurator.accept(defaultBuilder);
+ configuration.option(SdkClientOption.RETRY_STRATEGY, defaultBuilder.build());
+ } else {
+ RetryStrategy retryStrategy = builder.retryStrategy();
+ if (retryStrategy != null) {
+ configuration.option(SdkClientOption.RETRY_STRATEGY, retryStrategy);
+ }
+ }
+ }
+ configuration.option(SdkClientOption.CONFIGURED_RETRY_MODE, null);
+ configuration.option(SdkClientOption.CONFIGURED_RETRY_STRATEGY, null);
+ configuration.option(SdkClientOption.CONFIGURED_RETRY_CONFIGURATOR, null);
+ }
+
+ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, SdkClientConfiguration clientConfiguration) {
+ List plugins = request.overrideConfiguration().map(c -> c.plugins()).orElse(Collections.emptyList());
+ SdkClientConfiguration.Builder configuration = clientConfiguration.toBuilder();
+ if (plugins.isEmpty()) {
+ return configuration.build();
+ }
+ SmithyRpcV2ProtocolServiceClientConfigurationBuilder serviceConfigBuilder = new SmithyRpcV2ProtocolServiceClientConfigurationBuilder(
+ configuration);
+ for (SdkPlugin plugin : plugins) {
+ plugin.configureClient(serviceConfigBuilder);
+ }
+ updateRetryStrategyClientConfiguration(configuration);
+ return configuration.build();
+ }
+
+ private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory,
+ JsonOperationMetadata operationMetadata) {
+ return protocolFactory.createErrorResponseHandler(operationMetadata);
+ }
+
+ @Override
+ public void close() {
+ clientHandler.close();
+ }
+}
diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-rpcv2-sync.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-rpcv2-sync.java
new file mode 100644
index 000000000000..c02466218908
--- /dev/null
+++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-rpcv2-sync.java
@@ -0,0 +1,822 @@
+package software.amazon.awssdk.services.smithyrpcv2protocol;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.function.Consumer;
+import software.amazon.awssdk.annotations.Generated;
+import software.amazon.awssdk.annotations.SdkInternalApi;
+import software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler;
+import software.amazon.awssdk.awscore.exception.AwsServiceException;
+import software.amazon.awssdk.awscore.internal.AwsProtocolMetadata;
+import software.amazon.awssdk.awscore.internal.AwsServiceProtocol;
+import software.amazon.awssdk.awscore.retry.AwsRetryStrategy;
+import software.amazon.awssdk.core.RequestOverrideConfiguration;
+import software.amazon.awssdk.core.SdkPlugin;
+import software.amazon.awssdk.core.SdkRequest;
+import software.amazon.awssdk.core.client.config.ClientOverrideConfiguration;
+import software.amazon.awssdk.core.client.config.SdkClientConfiguration;
+import software.amazon.awssdk.core.client.config.SdkClientOption;
+import software.amazon.awssdk.core.client.handler.ClientExecutionParams;
+import software.amazon.awssdk.core.client.handler.SyncClientHandler;
+import software.amazon.awssdk.core.exception.SdkClientException;
+import software.amazon.awssdk.core.http.HttpResponseHandler;
+import software.amazon.awssdk.core.metrics.CoreMetric;
+import software.amazon.awssdk.core.retry.RetryMode;
+import software.amazon.awssdk.metrics.MetricCollector;
+import software.amazon.awssdk.metrics.MetricPublisher;
+import software.amazon.awssdk.metrics.NoOpMetricCollector;
+import software.amazon.awssdk.protocols.core.ExceptionMetadata;
+import software.amazon.awssdk.protocols.json.AwsJsonProtocol;
+import software.amazon.awssdk.protocols.json.BaseAwsJsonProtocolFactory;
+import software.amazon.awssdk.protocols.json.JsonOperationMetadata;
+import software.amazon.awssdk.protocols.rpcv2.SmithyRpcV2CborProtocolFactory;
+import software.amazon.awssdk.retries.api.RetryStrategy;
+import software.amazon.awssdk.services.smithyrpcv2protocol.internal.SmithyRpcV2ProtocolServiceClientConfigurationBuilder;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.ComplexErrorException;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.EmptyInputOutputRequest;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.EmptyInputOutputResponse;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.Float16Request;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.Float16Response;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.FractionalSecondsRequest;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.FractionalSecondsResponse;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.GreetingWithErrorsRequest;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.GreetingWithErrorsResponse;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.InvalidGreetingException;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.NoInputOutputRequest;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.NoInputOutputResponse;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.OperationWithDefaultsRequest;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.OperationWithDefaultsResponse;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.OptionalInputOutputRequest;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.OptionalInputOutputResponse;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.RecursiveShapesRequest;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.RecursiveShapesResponse;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.RpcV2CborDenseMapsRequest;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.RpcV2CborDenseMapsResponse;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.RpcV2CborListsRequest;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.RpcV2CborListsResponse;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.RpcV2CborSparseMapsRequest;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.RpcV2CborSparseMapsResponse;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.SimpleScalarPropertiesRequest;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.SimpleScalarPropertiesResponse;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.SmithyRpcV2ProtocolException;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.SparseNullsOperationRequest;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.SparseNullsOperationResponse;
+import software.amazon.awssdk.services.smithyrpcv2protocol.model.ValidationException;
+import software.amazon.awssdk.services.smithyrpcv2protocol.transform.EmptyInputOutputRequestMarshaller;
+import software.amazon.awssdk.services.smithyrpcv2protocol.transform.Float16RequestMarshaller;
+import software.amazon.awssdk.services.smithyrpcv2protocol.transform.FractionalSecondsRequestMarshaller;
+import software.amazon.awssdk.services.smithyrpcv2protocol.transform.GreetingWithErrorsRequestMarshaller;
+import software.amazon.awssdk.services.smithyrpcv2protocol.transform.NoInputOutputRequestMarshaller;
+import software.amazon.awssdk.services.smithyrpcv2protocol.transform.OperationWithDefaultsRequestMarshaller;
+import software.amazon.awssdk.services.smithyrpcv2protocol.transform.OptionalInputOutputRequestMarshaller;
+import software.amazon.awssdk.services.smithyrpcv2protocol.transform.RecursiveShapesRequestMarshaller;
+import software.amazon.awssdk.services.smithyrpcv2protocol.transform.RpcV2CborDenseMapsRequestMarshaller;
+import software.amazon.awssdk.services.smithyrpcv2protocol.transform.RpcV2CborListsRequestMarshaller;
+import software.amazon.awssdk.services.smithyrpcv2protocol.transform.RpcV2CborSparseMapsRequestMarshaller;
+import software.amazon.awssdk.services.smithyrpcv2protocol.transform.SimpleScalarPropertiesRequestMarshaller;
+import software.amazon.awssdk.services.smithyrpcv2protocol.transform.SparseNullsOperationRequestMarshaller;
+import software.amazon.awssdk.utils.Logger;
+
+/**
+ * Internal implementation of {@link SmithyRpcV2ProtocolClient}.
+ *
+ * @see SmithyRpcV2ProtocolClient#builder()
+ */
+@Generated("software.amazon.awssdk:codegen")
+@SdkInternalApi
+final class DefaultSmithyRpcV2ProtocolClient implements SmithyRpcV2ProtocolClient {
+ private static final Logger log = Logger.loggerFor(DefaultSmithyRpcV2ProtocolClient.class);
+
+ private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder()
+ .serviceProtocol(AwsServiceProtocol.SMITHY_RPC_V2_CBOR).build();
+
+ private final SyncClientHandler clientHandler;
+
+ private final SmithyRpcV2CborProtocolFactory protocolFactory;
+
+ private final SdkClientConfiguration clientConfiguration;
+
+ protected DefaultSmithyRpcV2ProtocolClient(SdkClientConfiguration clientConfiguration) {
+ this.clientHandler = new AwsSyncClientHandler(clientConfiguration);
+ this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
+ this.protocolFactory = init(SmithyRpcV2CborProtocolFactory.builder()).build();
+ }
+
+ /**
+ * Invokes the EmptyInputOutput operation.
+ *
+ * @param emptyInputOutputRequest
+ * @return Result of the EmptyInputOutput operation returned by the service.
+ * @throws SdkException
+ * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException
+ * If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SmithyRpcV2ProtocolException
+ * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SmithyRpcV2ProtocolClient.EmptyInputOutput
+ * @see AWS API Documentation
+ */
+ @Override
+ public EmptyInputOutputResponse emptyInputOutput(EmptyInputOutputRequest emptyInputOutputRequest) throws AwsServiceException,
+ SdkClientException, SmithyRpcV2ProtocolException {
+ JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
+ .isPayloadJson(true).build();
+
+ HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
+ EmptyInputOutputResponse::builder);
+
+ HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
+ operationMetadata);
+ SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(emptyInputOutputRequest,
+ this.clientConfiguration);
+ List metricPublishers = resolveMetricPublishers(clientConfiguration, emptyInputOutputRequest
+ .overrideConfiguration().orElse(null));
+ MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
+ .create("ApiCall");
+ try {
+ apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol");
+ apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "EmptyInputOutput");
+
+ return clientHandler.execute(new ClientExecutionParams()
+ .withOperationName("EmptyInputOutput").withProtocolMetadata(protocolMetadata)
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .withRequestConfiguration(clientConfiguration).withInput(emptyInputOutputRequest)
+ .withMetricCollector(apiCallMetricCollector)
+ .withMarshaller(new EmptyInputOutputRequestMarshaller(protocolFactory)));
+ } finally {
+ metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
+ }
+ }
+
+ /**
+ * Invokes the Float16 operation.
+ *
+ * @param float16Request
+ * @return Result of the Float16 operation returned by the service.
+ * @throws SdkException
+ * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException
+ * If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SmithyRpcV2ProtocolException
+ * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SmithyRpcV2ProtocolClient.Float16
+ * @see AWS
+ * API Documentation
+ */
+ @Override
+ public Float16Response float16(Float16Request float16Request) throws AwsServiceException, SdkClientException,
+ SmithyRpcV2ProtocolException {
+ JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
+ .isPayloadJson(true).build();
+
+ HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
+ Float16Response::builder);
+
+ HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
+ operationMetadata);
+ SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(float16Request, this.clientConfiguration);
+ List metricPublishers = resolveMetricPublishers(clientConfiguration, float16Request
+ .overrideConfiguration().orElse(null));
+ MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
+ .create("ApiCall");
+ try {
+ apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol");
+ apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "Float16");
+
+ return clientHandler.execute(new ClientExecutionParams()
+ .withOperationName("Float16").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler)
+ .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration)
+ .withInput(float16Request).withMetricCollector(apiCallMetricCollector)
+ .withMarshaller(new Float16RequestMarshaller(protocolFactory)));
+ } finally {
+ metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
+ }
+ }
+
+ /**
+ * Invokes the FractionalSeconds operation.
+ *
+ * @param fractionalSecondsRequest
+ * @return Result of the FractionalSeconds operation returned by the service.
+ * @throws SdkException
+ * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException
+ * If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SmithyRpcV2ProtocolException
+ * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SmithyRpcV2ProtocolClient.FractionalSeconds
+ * @see AWS API Documentation
+ */
+ @Override
+ public FractionalSecondsResponse fractionalSeconds(FractionalSecondsRequest fractionalSecondsRequest)
+ throws AwsServiceException, SdkClientException, SmithyRpcV2ProtocolException {
+ JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
+ .isPayloadJson(true).build();
+
+ HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
+ FractionalSecondsResponse::builder);
+
+ HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
+ operationMetadata);
+ SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(fractionalSecondsRequest,
+ this.clientConfiguration);
+ List metricPublishers = resolveMetricPublishers(clientConfiguration, fractionalSecondsRequest
+ .overrideConfiguration().orElse(null));
+ MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
+ .create("ApiCall");
+ try {
+ apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol");
+ apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "FractionalSeconds");
+
+ return clientHandler.execute(new ClientExecutionParams()
+ .withOperationName("FractionalSeconds").withProtocolMetadata(protocolMetadata)
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .withRequestConfiguration(clientConfiguration).withInput(fractionalSecondsRequest)
+ .withMetricCollector(apiCallMetricCollector)
+ .withMarshaller(new FractionalSecondsRequestMarshaller(protocolFactory)));
+ } finally {
+ metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
+ }
+ }
+
+ /**
+ * Invokes the GreetingWithErrors operation.
+ *
+ * @param greetingWithErrorsRequest
+ * @return Result of the GreetingWithErrors operation returned by the service.
+ * @throws ComplexErrorException
+ * @throws InvalidGreetingException
+ * @throws SdkException
+ * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException
+ * If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SmithyRpcV2ProtocolException
+ * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SmithyRpcV2ProtocolClient.GreetingWithErrors
+ * @see AWS API Documentation
+ */
+ @Override
+ public GreetingWithErrorsResponse greetingWithErrors(GreetingWithErrorsRequest greetingWithErrorsRequest)
+ throws ComplexErrorException, InvalidGreetingException, AwsServiceException, SdkClientException,
+ SmithyRpcV2ProtocolException {
+ JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
+ .isPayloadJson(true).build();
+
+ HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
+ operationMetadata, GreetingWithErrorsResponse::builder);
+
+ HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
+ operationMetadata);
+ SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(greetingWithErrorsRequest,
+ this.clientConfiguration);
+ List metricPublishers = resolveMetricPublishers(clientConfiguration, greetingWithErrorsRequest
+ .overrideConfiguration().orElse(null));
+ MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
+ .create("ApiCall");
+ try {
+ apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol");
+ apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GreetingWithErrors");
+
+ return clientHandler.execute(new ClientExecutionParams()
+ .withOperationName("GreetingWithErrors").withProtocolMetadata(protocolMetadata)
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .withRequestConfiguration(clientConfiguration).withInput(greetingWithErrorsRequest)
+ .withMetricCollector(apiCallMetricCollector)
+ .withMarshaller(new GreetingWithErrorsRequestMarshaller(protocolFactory)));
+ } finally {
+ metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
+ }
+ }
+
+ /**
+ * Invokes the NoInputOutput operation.
+ *
+ * @param noInputOutputRequest
+ * @return Result of the NoInputOutput operation returned by the service.
+ * @throws SdkException
+ * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException
+ * If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SmithyRpcV2ProtocolException
+ * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SmithyRpcV2ProtocolClient.NoInputOutput
+ * @see AWS API Documentation
+ */
+ @Override
+ public NoInputOutputResponse noInputOutput(NoInputOutputRequest noInputOutputRequest) throws AwsServiceException,
+ SdkClientException, SmithyRpcV2ProtocolException {
+ JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
+ .isPayloadJson(true).build();
+
+ HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
+ NoInputOutputResponse::builder);
+
+ HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
+ operationMetadata);
+ SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(noInputOutputRequest, this.clientConfiguration);
+ List metricPublishers = resolveMetricPublishers(clientConfiguration, noInputOutputRequest
+ .overrideConfiguration().orElse(null));
+ MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
+ .create("ApiCall");
+ try {
+ apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol");
+ apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "NoInputOutput");
+
+ return clientHandler.execute(new ClientExecutionParams()
+ .withOperationName("NoInputOutput").withProtocolMetadata(protocolMetadata)
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .withRequestConfiguration(clientConfiguration).withInput(noInputOutputRequest)
+ .withMetricCollector(apiCallMetricCollector)
+ .withMarshaller(new NoInputOutputRequestMarshaller(protocolFactory)));
+ } finally {
+ metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
+ }
+ }
+
+ /**
+ * Invokes the OperationWithDefaults operation.
+ *
+ * @param operationWithDefaultsRequest
+ * @return Result of the OperationWithDefaults operation returned by the service.
+ * @throws ValidationException
+ * @throws SdkException
+ * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException
+ * If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SmithyRpcV2ProtocolException
+ * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SmithyRpcV2ProtocolClient.OperationWithDefaults
+ * @see AWS API Documentation
+ */
+ @Override
+ public OperationWithDefaultsResponse operationWithDefaults(OperationWithDefaultsRequest operationWithDefaultsRequest)
+ throws ValidationException, AwsServiceException, SdkClientException, SmithyRpcV2ProtocolException {
+ JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
+ .isPayloadJson(true).build();
+
+ HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
+ operationMetadata, OperationWithDefaultsResponse::builder);
+
+ HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
+ operationMetadata);
+ SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithDefaultsRequest,
+ this.clientConfiguration);
+ List metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithDefaultsRequest
+ .overrideConfiguration().orElse(null));
+ MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
+ .create("ApiCall");
+ try {
+ apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol");
+ apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithDefaults");
+
+ return clientHandler.execute(new ClientExecutionParams()
+ .withOperationName("OperationWithDefaults").withProtocolMetadata(protocolMetadata)
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .withRequestConfiguration(clientConfiguration).withInput(operationWithDefaultsRequest)
+ .withMetricCollector(apiCallMetricCollector)
+ .withMarshaller(new OperationWithDefaultsRequestMarshaller(protocolFactory)));
+ } finally {
+ metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
+ }
+ }
+
+ /**
+ * Invokes the OptionalInputOutput operation.
+ *
+ * @param optionalInputOutputRequest
+ * @return Result of the OptionalInputOutput operation returned by the service.
+ * @throws SdkException
+ * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException
+ * If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SmithyRpcV2ProtocolException
+ * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SmithyRpcV2ProtocolClient.OptionalInputOutput
+ * @see AWS API Documentation
+ */
+ @Override
+ public OptionalInputOutputResponse optionalInputOutput(OptionalInputOutputRequest optionalInputOutputRequest)
+ throws AwsServiceException, SdkClientException, SmithyRpcV2ProtocolException {
+ JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
+ .isPayloadJson(true).build();
+
+ HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
+ operationMetadata, OptionalInputOutputResponse::builder);
+
+ HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
+ operationMetadata);
+ SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(optionalInputOutputRequest,
+ this.clientConfiguration);
+ List metricPublishers = resolveMetricPublishers(clientConfiguration, optionalInputOutputRequest
+ .overrideConfiguration().orElse(null));
+ MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
+ .create("ApiCall");
+ try {
+ apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol");
+ apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OptionalInputOutput");
+
+ return clientHandler.execute(new ClientExecutionParams()
+ .withOperationName("OptionalInputOutput").withProtocolMetadata(protocolMetadata)
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .withRequestConfiguration(clientConfiguration).withInput(optionalInputOutputRequest)
+ .withMetricCollector(apiCallMetricCollector)
+ .withMarshaller(new OptionalInputOutputRequestMarshaller(protocolFactory)));
+ } finally {
+ metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
+ }
+ }
+
+ /**
+ * Invokes the RecursiveShapes operation.
+ *
+ * @param recursiveShapesRequest
+ * @return Result of the RecursiveShapes operation returned by the service.
+ * @throws SdkException
+ * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException
+ * If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SmithyRpcV2ProtocolException
+ * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SmithyRpcV2ProtocolClient.RecursiveShapes
+ * @see AWS API Documentation
+ */
+ @Override
+ public RecursiveShapesResponse recursiveShapes(RecursiveShapesRequest recursiveShapesRequest) throws AwsServiceException,
+ SdkClientException, SmithyRpcV2ProtocolException {
+ JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
+ .isPayloadJson(true).build();
+
+ HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
+ RecursiveShapesResponse::builder);
+
+ HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
+ operationMetadata);
+ SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(recursiveShapesRequest,
+ this.clientConfiguration);
+ List metricPublishers = resolveMetricPublishers(clientConfiguration, recursiveShapesRequest
+ .overrideConfiguration().orElse(null));
+ MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
+ .create("ApiCall");
+ try {
+ apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol");
+ apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "RecursiveShapes");
+
+ return clientHandler.execute(new ClientExecutionParams()
+ .withOperationName("RecursiveShapes").withProtocolMetadata(protocolMetadata)
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .withRequestConfiguration(clientConfiguration).withInput(recursiveShapesRequest)
+ .withMetricCollector(apiCallMetricCollector)
+ .withMarshaller(new RecursiveShapesRequestMarshaller(protocolFactory)));
+ } finally {
+ metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
+ }
+ }
+
+ /**
+ * Invokes the RpcV2CborDenseMaps operation.
+ *
+ * @param rpcV2CborDenseMapsRequest
+ * @return Result of the RpcV2CborDenseMaps operation returned by the service.
+ * @throws ValidationException
+ * @throws SdkException
+ * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException
+ * If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SmithyRpcV2ProtocolException
+ * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SmithyRpcV2ProtocolClient.RpcV2CborDenseMaps
+ * @see AWS API Documentation
+ */
+ @Override
+ public RpcV2CborDenseMapsResponse rpcV2CborDenseMaps(RpcV2CborDenseMapsRequest rpcV2CborDenseMapsRequest)
+ throws ValidationException, AwsServiceException, SdkClientException, SmithyRpcV2ProtocolException {
+ JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
+ .isPayloadJson(true).build();
+
+ HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
+ operationMetadata, RpcV2CborDenseMapsResponse::builder);
+
+ HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
+ operationMetadata);
+ SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(rpcV2CborDenseMapsRequest,
+ this.clientConfiguration);
+ List metricPublishers = resolveMetricPublishers(clientConfiguration, rpcV2CborDenseMapsRequest
+ .overrideConfiguration().orElse(null));
+ MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
+ .create("ApiCall");
+ try {
+ apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol");
+ apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "RpcV2CborDenseMaps");
+
+ return clientHandler.execute(new ClientExecutionParams()
+ .withOperationName("RpcV2CborDenseMaps").withProtocolMetadata(protocolMetadata)
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .withRequestConfiguration(clientConfiguration).withInput(rpcV2CborDenseMapsRequest)
+ .withMetricCollector(apiCallMetricCollector)
+ .withMarshaller(new RpcV2CborDenseMapsRequestMarshaller(protocolFactory)));
+ } finally {
+ metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
+ }
+ }
+
+ /**
+ * Invokes the RpcV2CborLists operation.
+ *
+ * @param rpcV2CborListsRequest
+ * @return Result of the RpcV2CborLists operation returned by the service.
+ * @throws ValidationException
+ * @throws SdkException
+ * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException
+ * If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SmithyRpcV2ProtocolException
+ * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SmithyRpcV2ProtocolClient.RpcV2CborLists
+ * @see AWS API Documentation
+ */
+ @Override
+ public RpcV2CborListsResponse rpcV2CborLists(RpcV2CborListsRequest rpcV2CborListsRequest) throws ValidationException,
+ AwsServiceException, SdkClientException, SmithyRpcV2ProtocolException {
+ JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
+ .isPayloadJson(true).build();
+
+ HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
+ RpcV2CborListsResponse::builder);
+
+ HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
+ operationMetadata);
+ SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(rpcV2CborListsRequest, this.clientConfiguration);
+ List metricPublishers = resolveMetricPublishers(clientConfiguration, rpcV2CborListsRequest
+ .overrideConfiguration().orElse(null));
+ MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
+ .create("ApiCall");
+ try {
+ apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol");
+ apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "RpcV2CborLists");
+
+ return clientHandler.execute(new ClientExecutionParams()
+ .withOperationName("RpcV2CborLists").withProtocolMetadata(protocolMetadata)
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .withRequestConfiguration(clientConfiguration).withInput(rpcV2CborListsRequest)
+ .withMetricCollector(apiCallMetricCollector)
+ .withMarshaller(new RpcV2CborListsRequestMarshaller(protocolFactory)));
+ } finally {
+ metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
+ }
+ }
+
+ /**
+ * Invokes the RpcV2CborSparseMaps operation.
+ *
+ * @param rpcV2CborSparseMapsRequest
+ * @return Result of the RpcV2CborSparseMaps operation returned by the service.
+ * @throws ValidationException
+ * @throws SdkException
+ * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException
+ * If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SmithyRpcV2ProtocolException
+ * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SmithyRpcV2ProtocolClient.RpcV2CborSparseMaps
+ * @see AWS API Documentation
+ */
+ @Override
+ public RpcV2CborSparseMapsResponse rpcV2CborSparseMaps(RpcV2CborSparseMapsRequest rpcV2CborSparseMapsRequest)
+ throws ValidationException, AwsServiceException, SdkClientException, SmithyRpcV2ProtocolException {
+ JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
+ .isPayloadJson(true).build();
+
+ HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
+ operationMetadata, RpcV2CborSparseMapsResponse::builder);
+
+ HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
+ operationMetadata);
+ SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(rpcV2CborSparseMapsRequest,
+ this.clientConfiguration);
+ List metricPublishers = resolveMetricPublishers(clientConfiguration, rpcV2CborSparseMapsRequest
+ .overrideConfiguration().orElse(null));
+ MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
+ .create("ApiCall");
+ try {
+ apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol");
+ apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "RpcV2CborSparseMaps");
+
+ return clientHandler.execute(new ClientExecutionParams()
+ .withOperationName("RpcV2CborSparseMaps").withProtocolMetadata(protocolMetadata)
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .withRequestConfiguration(clientConfiguration).withInput(rpcV2CborSparseMapsRequest)
+ .withMetricCollector(apiCallMetricCollector)
+ .withMarshaller(new RpcV2CborSparseMapsRequestMarshaller(protocolFactory)));
+ } finally {
+ metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
+ }
+ }
+
+ /**
+ * Invokes the SimpleScalarProperties operation.
+ *
+ * @param simpleScalarPropertiesRequest
+ * @return Result of the SimpleScalarProperties operation returned by the service.
+ * @throws SdkException
+ * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException
+ * If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SmithyRpcV2ProtocolException
+ * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SmithyRpcV2ProtocolClient.SimpleScalarProperties
+ * @see AWS API Documentation
+ */
+ @Override
+ public SimpleScalarPropertiesResponse simpleScalarProperties(SimpleScalarPropertiesRequest simpleScalarPropertiesRequest)
+ throws AwsServiceException, SdkClientException, SmithyRpcV2ProtocolException {
+ JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
+ .isPayloadJson(true).build();
+
+ HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
+ operationMetadata, SimpleScalarPropertiesResponse::builder);
+
+ HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
+ operationMetadata);
+ SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(simpleScalarPropertiesRequest,
+ this.clientConfiguration);
+ List metricPublishers = resolveMetricPublishers(clientConfiguration, simpleScalarPropertiesRequest
+ .overrideConfiguration().orElse(null));
+ MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
+ .create("ApiCall");
+ try {
+ apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol");
+ apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "SimpleScalarProperties");
+
+ return clientHandler
+ .execute(new ClientExecutionParams()
+ .withOperationName("SimpleScalarProperties").withProtocolMetadata(protocolMetadata)
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .withRequestConfiguration(clientConfiguration).withInput(simpleScalarPropertiesRequest)
+ .withMetricCollector(apiCallMetricCollector)
+ .withMarshaller(new SimpleScalarPropertiesRequestMarshaller(protocolFactory)));
+ } finally {
+ metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
+ }
+ }
+
+ /**
+ * Invokes the SparseNullsOperation operation.
+ *
+ * @param sparseNullsOperationRequest
+ * @return Result of the SparseNullsOperation operation returned by the service.
+ * @throws SdkException
+ * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
+ * catch all scenarios.
+ * @throws SdkClientException
+ * If any client side error occurs such as an IO related failure, failure to get credentials, etc.
+ * @throws SmithyRpcV2ProtocolException
+ * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
+ * @sample SmithyRpcV2ProtocolClient.SparseNullsOperation
+ * @see AWS API Documentation
+ */
+ @Override
+ public SparseNullsOperationResponse sparseNullsOperation(SparseNullsOperationRequest sparseNullsOperationRequest)
+ throws AwsServiceException, SdkClientException, SmithyRpcV2ProtocolException {
+ JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
+ .isPayloadJson(true).build();
+
+ HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
+ operationMetadata, SparseNullsOperationResponse::builder);
+
+ HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
+ operationMetadata);
+ SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(sparseNullsOperationRequest,
+ this.clientConfiguration);
+ List metricPublishers = resolveMetricPublishers(clientConfiguration, sparseNullsOperationRequest
+ .overrideConfiguration().orElse(null));
+ MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
+ .create("ApiCall");
+ try {
+ apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol");
+ apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "SparseNullsOperation");
+
+ return clientHandler.execute(new ClientExecutionParams()
+ .withOperationName("SparseNullsOperation").withProtocolMetadata(protocolMetadata)
+ .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
+ .withRequestConfiguration(clientConfiguration).withInput(sparseNullsOperationRequest)
+ .withMetricCollector(apiCallMetricCollector)
+ .withMarshaller(new SparseNullsOperationRequestMarshaller(protocolFactory)));
+ } finally {
+ metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
+ }
+ }
+
+ @Override
+ public final String serviceName() {
+ return SERVICE_NAME;
+ }
+
+ private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration,
+ RequestOverrideConfiguration requestOverrideConfiguration) {
+ List publishers = null;
+ if (requestOverrideConfiguration != null) {
+ publishers = requestOverrideConfiguration.metricPublishers();
+ }
+ if (publishers == null || publishers.isEmpty()) {
+ publishers = clientConfiguration.option(SdkClientOption.METRIC_PUBLISHERS);
+ }
+ if (publishers == null) {
+ publishers = Collections.emptyList();
+ }
+ return publishers;
+ }
+
+ private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory,
+ JsonOperationMetadata operationMetadata) {
+ return protocolFactory.createErrorResponseHandler(operationMetadata);
+ }
+
+ private void updateRetryStrategyClientConfiguration(SdkClientConfiguration.Builder configuration) {
+ ClientOverrideConfiguration.Builder builder = configuration.asOverrideConfigurationBuilder();
+ RetryMode retryMode = builder.retryMode();
+ if (retryMode != null) {
+ configuration.option(SdkClientOption.RETRY_STRATEGY, AwsRetryStrategy.forRetryMode(retryMode));
+ } else {
+ Consumer> configurator = builder.retryStrategyConfigurator();
+ if (configurator != null) {
+ RetryStrategy.Builder, ?> defaultBuilder = AwsRetryStrategy.defaultRetryStrategy().toBuilder();
+ configurator.accept(defaultBuilder);
+ configuration.option(SdkClientOption.RETRY_STRATEGY, defaultBuilder.build());
+ } else {
+ RetryStrategy retryStrategy = builder.retryStrategy();
+ if (retryStrategy != null) {
+ configuration.option(SdkClientOption.RETRY_STRATEGY, retryStrategy);
+ }
+ }
+ }
+ configuration.option(SdkClientOption.CONFIGURED_RETRY_MODE, null);
+ configuration.option(SdkClientOption.CONFIGURED_RETRY_STRATEGY, null);
+ configuration.option(SdkClientOption.CONFIGURED_RETRY_CONFIGURATOR, null);
+ }
+
+ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, SdkClientConfiguration clientConfiguration) {
+ List plugins = request.overrideConfiguration().map(c -> c.plugins()).orElse(Collections.emptyList());
+ SdkClientConfiguration.Builder configuration = clientConfiguration.toBuilder();
+ if (plugins.isEmpty()) {
+ return configuration.build();
+ }
+ SmithyRpcV2ProtocolServiceClientConfigurationBuilder serviceConfigBuilder = new SmithyRpcV2ProtocolServiceClientConfigurationBuilder(
+ configuration);
+ for (SdkPlugin plugin : plugins) {
+ plugin.configureClient(serviceConfigBuilder);
+ }
+ updateRetryStrategyClientConfiguration(configuration);
+ return configuration.build();
+ }
+
+ private > T init(T builder) {
+ return builder
+ .clientConfiguration(clientConfiguration)
+ .defaultServiceExceptionSupplier(SmithyRpcV2ProtocolException::builder)
+ .protocol(AwsJsonProtocol.SMITHY_RPC_V2_CBOR)
+ .protocolVersion("1.1")
+ .registerModeledException(
+ ExceptionMetadata.builder().errorCode("ValidationException")
+ .exceptionBuilderSupplier(ValidationException::builder).build())
+ .registerModeledException(
+ ExceptionMetadata.builder().errorCode("InvalidGreeting")
+ .exceptionBuilderSupplier(InvalidGreetingException::builder).build())
+ .registerModeledException(
+ ExceptionMetadata.builder().errorCode("ComplexError")
+ .exceptionBuilderSupplier(ComplexErrorException::builder).build());
+ }
+
+ @Override
+ public final SmithyRpcV2ProtocolServiceClientConfiguration serviceClientConfiguration() {
+ return new SmithyRpcV2ProtocolServiceClientConfigurationBuilder(this.clientConfiguration.toBuilder()).build();
+ }
+
+ @Override
+ public void close() {
+ clientHandler.close();
+ }
+}
diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/alltypesrequest.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/alltypesrequest.java
index d2ecca7be480..72788016688a 100644
--- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/alltypesrequest.java
+++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/alltypesrequest.java
@@ -37,414 +37,418 @@
*/
@Generated("software.amazon.awssdk:codegen")
public final class AllTypesRequest extends JsonProtocolTestsRequest implements
- ToCopyableBuilder {
+ ToCopyableBuilder {
private static final SdkField STRING_MEMBER_FIELD = SdkField. builder(MarshallingType.STRING)
- .memberName("StringMember").getter(getter(AllTypesRequest::stringMember)).setter(setter(Builder::stringMember))
- .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StringMember").build()).build();
+ .memberName("StringMember").getter(getter(AllTypesRequest::stringMember)).setter(setter(Builder::stringMember))
+ .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StringMember").build()).build();
private static final SdkField INTEGER_MEMBER_FIELD = SdkField. builder(MarshallingType.INTEGER)
- .memberName("IntegerMember").getter(getter(AllTypesRequest::integerMember)).setter(setter(Builder::integerMember))
- .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IntegerMember").build()).build();
+ .memberName("IntegerMember").getter(getter(AllTypesRequest::integerMember)).setter(setter(Builder::integerMember))
+ .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IntegerMember").build()).build();
private static final SdkField BOOLEAN_MEMBER_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
- .memberName("BooleanMember").getter(getter(AllTypesRequest::booleanMember)).setter(setter(Builder::booleanMember))
- .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BooleanMember").build()).build();
+ .memberName("BooleanMember").getter(getter(AllTypesRequest::booleanMember)).setter(setter(Builder::booleanMember))
+ .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BooleanMember").build()).build();
private static final SdkField FLOAT_MEMBER_FIELD = SdkField. builder(MarshallingType.FLOAT)
- .memberName("FloatMember").getter(getter(AllTypesRequest::floatMember)).setter(setter(Builder::floatMember))
- .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FloatMember").build()).build();
+ .memberName("FloatMember").getter(getter(AllTypesRequest::floatMember)).setter(setter(Builder::floatMember))
+ .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FloatMember").build()).build();
private static final SdkField DOUBLE_MEMBER_FIELD = SdkField. builder(MarshallingType.DOUBLE)
- .memberName("DoubleMember").getter(getter(AllTypesRequest::doubleMember)).setter(setter(Builder::doubleMember))
- .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DoubleMember").build()).build();
+ .memberName("DoubleMember").getter(getter(AllTypesRequest::doubleMember)).setter(setter(Builder::doubleMember))
+ .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DoubleMember").build()).build();
private static final SdkField LONG_MEMBER_FIELD = SdkField. builder(MarshallingType.LONG)
- .memberName("LongMember").getter(getter(AllTypesRequest::longMember)).setter(setter(Builder::longMember))
- .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LongMember").build()).build();
+ .memberName("LongMember").getter(getter(AllTypesRequest::longMember)).setter(setter(Builder::longMember))
+ .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LongMember").build()).build();
private static final SdkField SHORT_MEMBER_FIELD = SdkField. builder(MarshallingType.SHORT)
- .memberName("ShortMember").getter(getter(AllTypesRequest::shortMember)).setter(setter(Builder::shortMember))
- .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ShortMember").build()).build();
+ .memberName("ShortMember").getter(getter(AllTypesRequest::shortMember)).setter(setter(Builder::shortMember))
+ .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ShortMember").build()).build();
+
+ private static final SdkField BYTE_MEMBER_FIELD = SdkField. builder(MarshallingType.BYTE)
+ .memberName("ByteMember").getter(getter(AllTypesRequest::byteMember)).setter(setter(Builder::byteMember))
+ .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ByteMember").build()).build();
private static final SdkField> SIMPLE_LIST_FIELD = SdkField
- .> builder(MarshallingType.LIST)
- .memberName("SimpleList")
- .getter(getter(AllTypesRequest::simpleList))
- .setter(setter(Builder::simpleList))
- .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SimpleList").build(),
- ListTrait
- .builder()
- .memberLocationName(null)
- .memberFieldInfo(
- SdkField. builder(MarshallingType.STRING)
- .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
- .locationName("member").build()).build()).build()).build();
+ .> builder(MarshallingType.LIST)
+ .memberName("SimpleList")
+ .getter(getter(AllTypesRequest::simpleList))
+ .setter(setter(Builder::simpleList))
+ .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SimpleList").build(),
+ ListTrait
+ .builder()
+ .memberLocationName(null)
+ .memberFieldInfo(
+ SdkField. builder(MarshallingType.STRING)
+ .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
+ .locationName("member").build()).build()).build()).build();
private static final SdkField> LIST_OF_ENUMS_FIELD = SdkField
- .> builder(MarshallingType.LIST)
- .memberName("ListOfEnums")
- .getter(getter(AllTypesRequest::listOfEnumsAsStrings))
- .setter(setter(Builder::listOfEnumsWithStrings))
- .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ListOfEnums").build(),
- ListTrait
- .builder()
- .memberLocationName(null)
- .memberFieldInfo(
- SdkField. builder(MarshallingType.STRING)
- .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
- .locationName("member").build()).build()).build()).build();
+ .> builder(MarshallingType.LIST)
+ .memberName("ListOfEnums")
+ .getter(getter(AllTypesRequest::listOfEnumsAsStrings))
+ .setter(setter(Builder::listOfEnumsWithStrings))
+ .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ListOfEnums").build(),
+ ListTrait
+ .builder()
+ .memberLocationName(null)
+ .memberFieldInfo(
+ SdkField. builder(MarshallingType.STRING)
+ .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
+ .locationName("member").build()).build()).build()).build();
private static final SdkField>> LIST_OF_MAPS_FIELD = SdkField
- .>> builder(MarshallingType.LIST)
- .memberName("ListOfMaps")
- .getter(getter(AllTypesRequest::listOfMaps))
- .setter(setter(Builder::listOfMaps))
- .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ListOfMaps").build(),
- ListTrait
- .builder()
- .memberLocationName(null)
- .memberFieldInfo(
- SdkField.> builder(MarshallingType.MAP)
- .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
- .locationName("member").build(),
- MapTrait.builder()
- .keyLocationName("key")
- .valueLocationName("value")
- .valueFieldInfo(
- SdkField. builder(MarshallingType.STRING)
- .traits(LocationTrait.builder()
- .location(MarshallLocation.PAYLOAD)
- .locationName("value").build()).build())
- .build()).build()).build()).build();
+ .>> builder(MarshallingType.LIST)
+ .memberName("ListOfMaps")
+ .getter(getter(AllTypesRequest::listOfMaps))
+ .setter(setter(Builder::listOfMaps))
+ .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ListOfMaps").build(),
+ ListTrait
+ .builder()
+ .memberLocationName(null)
+ .memberFieldInfo(
+ SdkField.> builder(MarshallingType.MAP)
+ .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
+ .locationName("member").build(),
+ MapTrait.builder()
+ .keyLocationName("key")
+ .valueLocationName("value")
+ .valueFieldInfo(
+ SdkField. builder(MarshallingType.STRING)
+ .traits(LocationTrait.builder()
+ .location(MarshallLocation.PAYLOAD)
+ .locationName("value").build()).build())
+ .build()).build()).build()).build();
private static final SdkField> LIST_OF_STRUCTS_FIELD = SdkField
- .> builder(MarshallingType.LIST)
- .memberName("ListOfStructs")
- .getter(getter(AllTypesRequest::listOfStructs))
- .setter(setter(Builder::listOfStructs))
- .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ListOfStructs").build(),
- ListTrait
- .builder()
- .memberLocationName(null)
- .memberFieldInfo(
- SdkField. builder(MarshallingType.SDK_POJO)
- .constructor(SimpleStruct::builder)
- .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
- .locationName("member").build()).build()).build()).build();
+ .> builder(MarshallingType.LIST)
+ .memberName("ListOfStructs")
+ .getter(getter(AllTypesRequest::listOfStructs))
+ .setter(setter(Builder::listOfStructs))
+ .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ListOfStructs").build(),
+ ListTrait
+ .builder()
+ .memberLocationName(null)
+ .memberFieldInfo(
+ SdkField. builder(MarshallingType.SDK_POJO)
+ .constructor(SimpleStruct::builder)
+ .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
+ .locationName("member").build()).build()).build()).build();
private static final SdkField>> LIST_OF_MAP_OF_ENUM_TO_STRING_FIELD = SdkField
- .>> builder(MarshallingType.LIST)
- .memberName("ListOfMapOfEnumToString")
- .getter(getter(AllTypesRequest::listOfMapOfEnumToStringAsStrings))
- .setter(setter(Builder::listOfMapOfEnumToStringWithStrings))
- .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ListOfMapOfEnumToString").build(),
- ListTrait
- .builder()
- .memberLocationName(null)
- .memberFieldInfo(
- SdkField.> builder(MarshallingType.MAP)
- .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
- .locationName("member").build(),
- MapTrait.builder()
- .keyLocationName("key")
- .valueLocationName("value")
- .valueFieldInfo(
- SdkField. builder(MarshallingType.STRING)
- .traits(LocationTrait.builder()
- .location(MarshallLocation.PAYLOAD)
- .locationName("value").build()).build())
- .build()).build()).build()).build();
+ .>> builder(MarshallingType.LIST)
+ .memberName("ListOfMapOfEnumToString")
+ .getter(getter(AllTypesRequest::listOfMapOfEnumToStringAsStrings))
+ .setter(setter(Builder::listOfMapOfEnumToStringWithStrings))
+ .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ListOfMapOfEnumToString").build(),
+ ListTrait
+ .builder()
+ .memberLocationName(null)
+ .memberFieldInfo(
+ SdkField.> builder(MarshallingType.MAP)
+ .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
+ .locationName("member").build(),
+ MapTrait.builder()
+ .keyLocationName("key")
+ .valueLocationName("value")
+ .valueFieldInfo(
+ SdkField. builder(MarshallingType.STRING)
+ .traits(LocationTrait.builder()
+ .location(MarshallLocation.PAYLOAD)
+ .locationName("value").build()).build())
+ .build()).build()).build()).build();
private static final SdkField>> LIST_OF_MAP_OF_STRING_TO_STRUCT_FIELD = SdkField
- .>> builder(MarshallingType.LIST)
- .memberName("ListOfMapOfStringToStruct")
- .getter(getter(AllTypesRequest::listOfMapOfStringToStruct))
- .setter(setter(Builder::listOfMapOfStringToStruct))
- .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ListOfMapOfStringToStruct").build(),
- ListTrait
- .builder()
- .memberLocationName(null)
- .memberFieldInfo(
- SdkField.> builder(MarshallingType.MAP)
- .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
- .locationName("member").build(),
- MapTrait.builder()
- .keyLocationName("key")
- .valueLocationName("value")
- .valueFieldInfo(
- SdkField. builder(MarshallingType.SDK_POJO)
- .constructor(SimpleStruct::builder)
- .traits(LocationTrait.builder()
- .location(MarshallLocation.PAYLOAD)
- .locationName("value").build()).build())
- .build()).build()).build()).build();
+ .>> builder(MarshallingType.LIST)
+ .memberName("ListOfMapOfStringToStruct")
+ .getter(getter(AllTypesRequest::listOfMapOfStringToStruct))
+ .setter(setter(Builder::listOfMapOfStringToStruct))
+ .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ListOfMapOfStringToStruct").build(),
+ ListTrait
+ .builder()
+ .memberLocationName(null)
+ .memberFieldInfo(
+ SdkField.> builder(MarshallingType.MAP)
+ .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
+ .locationName("member").build(),
+ MapTrait.builder()
+ .keyLocationName("key")
+ .valueLocationName("value")
+ .valueFieldInfo(
+ SdkField. builder(MarshallingType.SDK_POJO)
+ .constructor(SimpleStruct::builder)
+ .traits(LocationTrait.builder()
+ .location(MarshallLocation.PAYLOAD)
+ .locationName("value").build()).build())
+ .build()).build()).build()).build();
private static final SdkField>> MAP_OF_STRING_TO_INTEGER_LIST_FIELD = SdkField
- .>> builder(MarshallingType.MAP)
- .memberName("MapOfStringToIntegerList")
- .getter(getter(AllTypesRequest::mapOfStringToIntegerList))
- .setter(setter(Builder::mapOfStringToIntegerList))
- .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MapOfStringToIntegerList").build(),
- MapTrait.builder()
- .keyLocationName("key")
- .valueLocationName("value")
- .valueFieldInfo(
- SdkField.> builder(MarshallingType.LIST)
- .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
- .locationName("value").build(),
- ListTrait
- .builder()
- .memberLocationName(null)
- .memberFieldInfo(
- SdkField. builder(MarshallingType.INTEGER)
- .traits(LocationTrait.builder()
- .location(MarshallLocation.PAYLOAD)
- .locationName("member").build()).build())
- .build()).build()).build()).build();
+ .>> builder(MarshallingType.MAP)
+ .memberName("MapOfStringToIntegerList")
+ .getter(getter(AllTypesRequest::mapOfStringToIntegerList))
+ .setter(setter(Builder::mapOfStringToIntegerList))
+ .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MapOfStringToIntegerList").build(),
+ MapTrait.builder()
+ .keyLocationName("key")
+ .valueLocationName("value")
+ .valueFieldInfo(
+ SdkField.> builder(MarshallingType.LIST)
+ .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
+ .locationName("value").build(),
+ ListTrait
+ .builder()
+ .memberLocationName(null)
+ .memberFieldInfo(
+ SdkField. builder(MarshallingType.INTEGER)
+ .traits(LocationTrait.builder()
+ .location(MarshallLocation.PAYLOAD)
+ .locationName("member").build()).build())
+ .build()).build()).build()).build();
private static final SdkField> MAP_OF_STRING_TO_STRING_FIELD = SdkField
- .> builder(MarshallingType.MAP)
- .memberName("MapOfStringToString")
- .getter(getter(AllTypesRequest::mapOfStringToString))
- .setter(setter(Builder::mapOfStringToString))
- .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MapOfStringToString").build(),
- MapTrait.builder()
- .keyLocationName("key")
- .valueLocationName("value")
- .valueFieldInfo(
- SdkField.