From f80bfcf5e890553a63af8b46eb75a783922b7624 Mon Sep 17 00:00:00 2001 From: Saranya Somepalli Date: Tue, 25 Mar 2025 16:14:38 -0700 Subject: [PATCH 01/22] Update non-streaming error unmarshalling to use new mapping function --- .../poet/client/specs/JsonProtocolSpec.java | 60 +- .../poet/client/specs/ProtocolSpec.java | 20 - .../poet/client/specs/QueryProtocolSpec.java | 2 - .../sra/test-aws-json-async-client-class.java | 144 ++++- .../sra/test-cbor-async-client-class.java | 144 ++++- .../sra/test-json-async-client-class.java | 154 ++++- .../client/sra/test-json-client-class.java | 573 +++++++++-------- .../sra/test-query-async-client-class.java | 454 +++++++------- .../client/sra/test-query-client-class.java | 471 +++++++------- .../sra/test-xml-async-client-class.java | 386 ++++++------ .../client/sra/test-xml-client-class.java | 325 +++++----- .../test-aws-json-async-client-class.java | 146 ++++- ...ry-compatible-json-async-client-class.java | 28 +- ...ery-compatible-json-sync-client-class.java | 57 +- .../poet/client/test-batchmanager-async.java | 15 +- .../client/test-cbor-async-client-class.java | 146 ++++- .../poet/client/test-cbor-client-class.java | 119 +++- .../poet/client/test-custompackage-async.java | 15 +- .../poet/client/test-custompackage-sync.java | 47 +- .../test-customservicemetadata-async.java | 15 +- .../test-customservicemetadata-sync.java | 47 +- .../client/test-endpoint-discovery-async.java | 39 +- .../client/test-endpoint-discovery-sync.java | 39 +- .../client/test-json-async-client-class.java | 154 ++++- .../poet/client/test-json-client-class.java | 579 ++++++++++-------- .../client/test-query-async-client-class.java | 462 +++++++------- .../poet/client/test-query-client-class.java | 477 +++++++-------- .../client/test-rpcv2-async-client-class.java | 146 ++++- .../codegen/poet/client/test-rpcv2-sync.java | 433 +++++++------ ...gned-payload-trait-async-client-class.java | 146 ++++- ...igned-payload-trait-sync-client-class.java | 137 ++++- .../client/test-xml-async-client-class.java | 394 ++++++------ .../poet/client/test-xml-client-class.java | 331 +++++----- .../kinesis/KinesisExceptionTest.java | 80 +++ 34 files changed, 4000 insertions(+), 2785 deletions(-) create mode 100644 services/kinesis/src/it/java/software/amazon/awssdk/services/kinesis/KinesisExceptionTest.java diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/JsonProtocolSpec.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/JsonProtocolSpec.java index 9fa214efb8fe..9f0adeadf15f 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/JsonProtocolSpec.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/JsonProtocolSpec.java @@ -25,7 +25,9 @@ import com.squareup.javapoet.TypeName; import com.squareup.javapoet.TypeVariableName; import com.squareup.javapoet.WildcardTypeName; +import java.util.HashSet; import java.util.Optional; +import java.util.Set; import java.util.concurrent.CompletableFuture; import java.util.function.Function; import javax.lang.model.element.Modifier; @@ -116,7 +118,6 @@ public MethodSpec initProtocolFactory(IntermediateModel model) { methodSpec.addCode("$L", hasAwsQueryCompatible()); } - registerModeledExceptions(model, poetExtensions).forEach(methodSpec::addCode); methodSpec.addCode(";"); return methodSpec.build(); @@ -170,11 +171,39 @@ public CodeBlock responseHandler(IntermediateModel model, OperationModel opModel public Optional errorResponseHandler(OperationModel opModel) { String protocolFactory = protocolFactoryLiteral(model, opModel); - return Optional.of( - CodeBlock.builder() - .add("\n\n$T<$T> errorResponseHandler = createErrorResponseHandler($L, operationMetadata);", - HttpResponseHandler.class, AwsServiceException.class, protocolFactory) - .build()); + CodeBlock.Builder builder = CodeBlock.builder(); + ParameterizedTypeName metadataMapperType = ParameterizedTypeName.get( + ClassName.get(Function.class), + ClassName.get(String.class), + ParameterizedTypeName.get(Optional.class, ExceptionMetadata.class)); + + builder.add("\n$T exceptionMetadataMapper = errorCode -> {\n", metadataMapperType); + builder.add("switch (errorCode) {\n"); + Set processedExceptions = new HashSet<>(); + + opModel.getExceptions().forEach(exception -> { + String exceptionName = exception.getExceptionName(); + if (!processedExceptions.add(exceptionName)) { + return; + } + ShapeModel exceptionShape = model.getShapes().get(exceptionName); + builder.add("case $S:\n", exceptionName); + builder.add("return $T.of($T.builder()\n", Optional.class, ExceptionMetadata.class) + .add(".errorCode($S)\n", exceptionName); + builder.add(populateHttpStatusCode(exceptionShape, model)); + builder.add(".exceptionBuilderSupplier($T::builder)\n", + poetExtensions.getModelClass(exceptionName)) + .add(".build());\n"); + }); + + builder.add("default: return $T.empty();\n", Optional.class); + builder.add("}\n"); + builder.add("};\n\n"); + + builder.add("$T<$T> errorResponseHandler = createErrorResponseHandler($L, operationMetadata, exceptionMetadataMapper);", + HttpResponseHandler.class, AwsServiceException.class, protocolFactory); + + return Optional.of(builder.build()); } @Override @@ -411,23 +440,10 @@ public Optional createErrorResponseHandler() { ClassName httpResponseHandler = ClassName.get(HttpResponseHandler.class); ClassName sdkBaseException = ClassName.get(AwsServiceException.class); TypeName responseHandlerOfException = ParameterizedTypeName.get(httpResponseHandler, sdkBaseException); - - return Optional.of(MethodSpec.methodBuilder("createErrorResponseHandler") - .addParameter(BaseAwsJsonProtocolFactory.class, "protocolFactory") - .addParameter(JsonOperationMetadata.class, "operationMetadata") - .returns(responseHandlerOfException) - .addModifiers(Modifier.PRIVATE) - .addStatement("return protocolFactory.createErrorResponseHandler(operationMetadata)") - .build()); - } - - @Override - public Optional createEventstreamErrorResponseHandler() { - ClassName httpResponseHandler = ClassName.get(HttpResponseHandler.class); - ClassName sdkBaseException = ClassName.get(AwsServiceException.class); - TypeName responseHandlerOfException = ParameterizedTypeName.get(httpResponseHandler, sdkBaseException); ParameterizedTypeName mapperType = ParameterizedTypeName.get(ClassName.get(Function.class), - ClassName.get(String.class), ParameterizedTypeName.get(Optional.class, ExceptionMetadata.class)); + ClassName.get(String.class), + ParameterizedTypeName.get(Optional.class, + ExceptionMetadata.class)); return Optional.of(MethodSpec.methodBuilder("createErrorResponseHandler") .addParameter(BaseAwsJsonProtocolFactory.class, "protocolFactory") diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/ProtocolSpec.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/ProtocolSpec.java index 37bd6252bc8b..c474e982afe0 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/ProtocolSpec.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/ProtocolSpec.java @@ -24,13 +24,11 @@ import java.util.ArrayList; import java.util.List; import java.util.Optional; -import java.util.stream.Collectors; import software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler; import software.amazon.awssdk.codegen.model.intermediate.IntermediateModel; import software.amazon.awssdk.codegen.model.intermediate.OperationModel; import software.amazon.awssdk.codegen.model.intermediate.Protocol; import software.amazon.awssdk.codegen.model.intermediate.ShapeModel; -import software.amazon.awssdk.codegen.model.intermediate.ShapeType; import software.amazon.awssdk.codegen.model.service.AuthType; import software.amazon.awssdk.codegen.poet.PoetExtension; import software.amazon.awssdk.codegen.utils.AuthUtils; @@ -38,7 +36,6 @@ import software.amazon.awssdk.core.client.handler.SyncClientHandler; import software.amazon.awssdk.core.runtime.transform.AsyncStreamingRequestMarshaller; import software.amazon.awssdk.core.runtime.transform.StreamingRequestMarshaller; -import software.amazon.awssdk.protocols.core.ExceptionMetadata; import software.amazon.awssdk.utils.StringUtils; public interface ProtocolSpec { @@ -74,23 +71,6 @@ default List additionalMethods() { return new ArrayList<>(); } - default List registerModeledExceptions(IntermediateModel model, PoetExtension poetExtensions) { - return model.getShapes().values().stream() - .filter(s -> s.getShapeType() == ShapeType.Exception) - .map(e -> CodeBlock.builder() - .add(".registerModeledException($T.builder()" - + ".errorCode($S)" - + ".exceptionBuilderSupplier($T::builder)" - + "$L" // populateHttpStatusCode - + ".build())", - ExceptionMetadata.class, - e.getErrorCode(), - poetExtensions.getModelClass(e.getShapeName()), - populateHttpStatusCode(e, model)) - .build()) - .collect(Collectors.toList()); - } - default String populateHttpStatusCode(ShapeModel shapeModel, IntermediateModel model) { Integer statusCode = shapeModel.getHttpStatusCode(); diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/QueryProtocolSpec.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/QueryProtocolSpec.java index b6cca23e38cf..cf6c331dba6d 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/QueryProtocolSpec.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/QueryProtocolSpec.java @@ -69,8 +69,6 @@ public MethodSpec initProtocolFactory(IntermediateModel model) { methodSpec.addCode("return $T.builder()\n", protocolFactoryClass()); - registerModeledExceptions(model, poetExtensions).forEach(methodSpec::addCode); - methodSpec.addCode(".clientConfiguration(clientConfiguration)\n" + ".defaultServiceExceptionSupplier($T::builder)\n", poetExtensions.getModelClass(model.getSdkModeledExceptionBaseClassName())); diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-aws-json-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-aws-json-async-client-class.java index 7298068aa6ad..bc67efafb31c 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-aws-json-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-aws-json-async-client-class.java @@ -189,9 +189,18 @@ public CompletableFuture aPostOperation(APostOperationRe HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, APostOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); String hostPrefix = "{StringMember}-foo."; HostnameValidator.validateHostnameCompliant(aPostOperationRequest.stringMember(), "StringMember", "aPostOperationRequest"); @@ -257,9 +266,21 @@ public CompletableFuture aPostOperationWithOut HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, APostOperationWithOutputResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -338,8 +359,15 @@ public CompletableFuture eventStreamOperation(EventStreamOperationRequest HttpResponseHandler errorEventResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, eventstreamExceptionMetadataMapper); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); EventStreamTaggedUnionJsonMarshaller eventMarshaller = EventStreamTaggedUnionJsonMarshaller.builder() .putMarshaller(DefaultInputEvent.class, new InputEventMarshaller(protocolFactory)).build(); SdkPublisher eventPublisher = SdkPublisher.adapt(requestStream); @@ -420,9 +448,15 @@ public CompletableFuture eventStreamO HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(operationMetadata, EventStreamOperationWithOnlyInputResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); EventStreamTaggedUnionJsonMarshaller eventMarshaller = EventStreamTaggedUnionJsonMarshaller.builder() .putMarshaller(DefaultInputEventOne.class, new InputEventMarshaller(protocolFactory)) .putMarshaller(DefaultInputEventTwo.class, new InputEventTwoMarshaller(protocolFactory)).build(); @@ -510,8 +544,15 @@ public CompletableFuture eventStreamOperationWithOnlyOutput( HttpResponseHandler errorEventResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, eventstreamExceptionMetadataMapper); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture future = new CompletableFuture<>(); EventStreamAsyncResponseTransformer asyncResponseTransformer = EventStreamAsyncResponseTransformer . builder() @@ -587,9 +628,18 @@ public CompletableFuture getWithoutRequiredMe HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetWithoutRequiredMembersResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -647,9 +697,15 @@ public CompletableFuture operationWithChe HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, OperationWithChecksumRequiredResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -710,9 +766,15 @@ public CompletableFuture operationWithNoneAut HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, OperationWithNoneAuthTypeResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -770,9 +832,15 @@ public CompletableFuture operationWithR HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, OperationWithRequestCompressionResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -835,9 +903,15 @@ public CompletableFuture paginatedOpera HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, PaginatedOperationWithResultKeyResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -895,9 +969,15 @@ public CompletableFuture paginatedOp HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(operationMetadata, PaginatedOperationWithoutResultKeyResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -959,9 +1039,15 @@ public CompletableFuture streamingInputOperatio HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, StreamingInputOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -1037,9 +1123,15 @@ public CompletableFuture streamingInputOutputOperation( HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, StreamingInputOutputOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler.execute( new ClientExecutionParams() @@ -1123,9 +1215,15 @@ public CompletableFuture streamingOutputOperation( HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, StreamingOutputOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler.execute( new ClientExecutionParams() @@ -1166,17 +1264,8 @@ public final String serviceName() { } private > T init(T builder) { - return builder - .clientConfiguration(clientConfiguration) - .defaultServiceExceptionSupplier(JsonException::builder) - .protocol(AwsJsonProtocol.AWS_JSON) - .protocolVersion("1.1") - .registerModeledException( - ExceptionMetadata.builder().errorCode("InvalidInputException") - .exceptionBuilderSupplier(InvalidInputException::builder).httpStatusCode(400).build()) - .registerModeledException( - ExceptionMetadata.builder().errorCode("ServiceFaultException") - .exceptionBuilderSupplier(ServiceFaultException::builder).httpStatusCode(500).build()); + return builder.clientConfiguration(clientConfiguration).defaultServiceExceptionSupplier(JsonException::builder) + .protocol(AwsJsonProtocol.AWS_JSON).protocolVersion("1.1"); } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, @@ -1231,11 +1320,6 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, return configuration.build(); } - private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, - JsonOperationMetadata operationMetadata) { - return protocolFactory.createErrorResponseHandler(operationMetadata); - } - private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-cbor-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-cbor-async-client-class.java index 8953d6a681c1..dd68f2d61c33 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-cbor-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-cbor-async-client-class.java @@ -193,9 +193,18 @@ public CompletableFuture aPostOperation(APostOperationRe HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, APostOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); String hostPrefix = "{StringMember}-foo."; HostnameValidator.validateHostnameCompliant(aPostOperationRequest.stringMember(), "StringMember", "aPostOperationRequest"); @@ -261,9 +270,21 @@ public CompletableFuture aPostOperationWithOut HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, APostOperationWithOutputResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -342,8 +363,15 @@ public CompletableFuture eventStreamOperation(EventStreamOperationRequest HttpResponseHandler errorEventResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, eventstreamExceptionMetadataMapper); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); EventStreamTaggedUnionJsonMarshaller eventMarshaller = EventStreamTaggedUnionJsonMarshaller.builder() .putMarshaller(DefaultInputEvent.class, new InputEventMarshaller(protocolFactory)).build(); SdkPublisher eventPublisher = SdkPublisher.adapt(requestStream); @@ -424,9 +452,15 @@ public CompletableFuture eventStreamO HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(operationMetadata, EventStreamOperationWithOnlyInputResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); EventStreamTaggedUnionJsonMarshaller eventMarshaller = EventStreamTaggedUnionJsonMarshaller.builder() .putMarshaller(DefaultInputEventOne.class, new InputEventMarshaller(protocolFactory)) .putMarshaller(DefaultInputEventTwo.class, new InputEventTwoMarshaller(protocolFactory)).build(); @@ -514,8 +548,15 @@ public CompletableFuture eventStreamOperationWithOnlyOutput( HttpResponseHandler errorEventResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, eventstreamExceptionMetadataMapper); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture future = new CompletableFuture<>(); EventStreamAsyncResponseTransformer asyncResponseTransformer = EventStreamAsyncResponseTransformer . builder() @@ -591,9 +632,18 @@ public CompletableFuture getWithoutRequiredMe HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetWithoutRequiredMembersResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -651,9 +701,15 @@ public CompletableFuture operationWithChe HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, OperationWithChecksumRequiredResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -714,9 +770,15 @@ public CompletableFuture operationWithNoneAut HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, OperationWithNoneAuthTypeResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -774,9 +836,15 @@ public CompletableFuture operationWithR HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, OperationWithRequestCompressionResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -839,9 +907,15 @@ public CompletableFuture paginatedOpera HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, PaginatedOperationWithResultKeyResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -899,9 +973,15 @@ public CompletableFuture paginatedOp HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(operationMetadata, PaginatedOperationWithoutResultKeyResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -963,9 +1043,15 @@ public CompletableFuture streamingInputOperatio HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, StreamingInputOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -1041,9 +1127,15 @@ public CompletableFuture streamingInputOutputOperation( HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, StreamingInputOutputOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler.execute( new ClientExecutionParams() @@ -1127,9 +1219,15 @@ public CompletableFuture streamingOutputOperation( HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, StreamingOutputOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler.execute( new ClientExecutionParams() @@ -1170,17 +1268,8 @@ public final String serviceName() { } private > T init(T builder) { - return builder - .clientConfiguration(clientConfiguration) - .defaultServiceExceptionSupplier(JsonException::builder) - .protocol(AwsJsonProtocol.AWS_JSON) - .protocolVersion("1.1") - .registerModeledException( - ExceptionMetadata.builder().errorCode("InvalidInputException") - .exceptionBuilderSupplier(InvalidInputException::builder).httpStatusCode(400).build()) - .registerModeledException( - ExceptionMetadata.builder().errorCode("ServiceFaultException") - .exceptionBuilderSupplier(ServiceFaultException::builder).httpStatusCode(500).build()); + return builder.clientConfiguration(clientConfiguration).defaultServiceExceptionSupplier(JsonException::builder) + .protocol(AwsJsonProtocol.AWS_JSON).protocolVersion("1.1"); } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, @@ -1235,11 +1324,6 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, return configuration.build(); } - private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, - JsonOperationMetadata operationMetadata) { - return protocolFactory.createErrorResponseHandler(operationMetadata); - } - private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-async-client-class.java index 4a99f346bc6c..d1e05914bd28 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-async-client-class.java @@ -203,9 +203,18 @@ public CompletableFuture aPostOperation(APostOperationRe HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, APostOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); String hostPrefix = "{StringMember}-foo."; HostnameValidator.validateHostnameCompliant(aPostOperationRequest.stringMember(), "StringMember", "aPostOperationRequest"); @@ -270,9 +279,18 @@ public CompletableFuture aPostOperationWithOut HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, APostOperationWithOutputResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -329,9 +347,15 @@ public CompletableFuture bearerAuthOperation( HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, BearerAuthOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -416,8 +440,15 @@ public CompletableFuture eventStreamOperation(EventStreamOperationRequest HttpResponseHandler errorEventResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, eventstreamExceptionMetadataMapper); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); EventStreamTaggedUnionJsonMarshaller eventMarshaller = EventStreamTaggedUnionJsonMarshaller.builder() .putMarshaller(DefaultInputEvent.class, new InputEventMarshaller(protocolFactory)).build(); SdkPublisher eventPublisher = SdkPublisher.adapt(requestStream); @@ -501,9 +532,15 @@ public CompletableFuture eventStreamO HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(operationMetadata, EventStreamOperationWithOnlyInputResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); EventStreamTaggedUnionJsonMarshaller eventMarshaller = EventStreamTaggedUnionJsonMarshaller.builder() .putMarshaller(DefaultInputEventOne.class, new InputEventMarshaller(protocolFactory)) .putMarshaller(DefaultInputEventTwo.class, new InputEventTwoMarshaller(protocolFactory)).build(); @@ -596,8 +633,15 @@ public CompletableFuture eventStreamOperationWithOnlyOutput( HttpResponseHandler errorEventResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, eventstreamExceptionMetadataMapper); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture future = new CompletableFuture<>(); EventStreamAsyncResponseTransformer asyncResponseTransformer = EventStreamAsyncResponseTransformer . builder() @@ -675,9 +719,15 @@ public CompletableFuture getOperationWithCheck HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetOperationWithChecksumResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -746,9 +796,18 @@ public CompletableFuture getWithoutRequiredMe HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetWithoutRequiredMembersResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -806,9 +865,15 @@ public CompletableFuture operationWithChe HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, OperationWithChecksumRequiredResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -870,9 +935,15 @@ public CompletableFuture operationWithR HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, OperationWithRequestCompressionResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -935,9 +1006,15 @@ public CompletableFuture paginatedOpera HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, PaginatedOperationWithResultKeyResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -995,9 +1072,15 @@ public CompletableFuture paginatedOp HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(operationMetadata, PaginatedOperationWithoutResultKeyResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -1077,9 +1160,15 @@ public CompletableFuture putOperationWithChecksum( HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, PutOperationWithChecksumResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler.execute( new ClientExecutionParams() @@ -1168,9 +1257,15 @@ public CompletableFuture streamingInputOperatio HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, StreamingInputOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -1246,9 +1341,15 @@ public CompletableFuture streamingInputOutputOperation( HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, StreamingInputOutputOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler.execute( new ClientExecutionParams() @@ -1332,9 +1433,15 @@ public CompletableFuture streamingOutputOperation( HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, StreamingOutputOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler.execute( new ClientExecutionParams() @@ -1380,14 +1487,8 @@ public final String serviceName() { } private > T init(T builder) { - return builder - .clientConfiguration(clientConfiguration) - .defaultServiceExceptionSupplier(JsonException::builder) - .protocol(AwsJsonProtocol.REST_JSON) - .protocolVersion("1.1") - .registerModeledException( - ExceptionMetadata.builder().errorCode("InvalidInput") - .exceptionBuilderSupplier(InvalidInputException::builder).httpStatusCode(400).build()); + return builder.clientConfiguration(clientConfiguration).defaultServiceExceptionSupplier(JsonException::builder) + .protocol(AwsJsonProtocol.REST_JSON).protocolVersion("1.1"); } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, @@ -1442,11 +1543,6 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, return configuration.build(); } - private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, - JsonOperationMetadata operationMetadata) { - return protocolFactory.createErrorResponseHandler(operationMetadata); - } - private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-client-class.java index 2ac6c6ae6d23..d24381b25e30 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-client-class.java @@ -2,7 +2,9 @@ import java.util.Collections; import java.util.List; +import java.util.Optional; import java.util.function.Consumer; +import java.util.function.Function; import software.amazon.awssdk.annotations.Generated; import software.amazon.awssdk.annotations.SdkInternalApi; import software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler; @@ -96,7 +98,7 @@ final class DefaultJsonClient implements JsonClient { private static final Logger log = Logger.loggerFor(DefaultJsonClient.class); private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder() - .serviceProtocol(AwsServiceProtocol.REST_JSON).build(); + .serviceProtocol(AwsServiceProtocol.REST_JSON).build(); private final SyncClientHandler clientHandler; @@ -132,34 +134,43 @@ protected DefaultJsonClient(SdkClientConfiguration clientConfiguration) { */ @Override public APostOperationResponse aPostOperation(APostOperationRequest aPostOperationRequest) throws InvalidInputException, - AwsServiceException, SdkClientException, JsonException { + AwsServiceException, SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, - APostOperationResponse::builder); + APostOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "APostOperation"); String hostPrefix = "{StringMember}-foo."; HostnameValidator.validateHostnameCompliant(aPostOperationRequest.stringMember(), "StringMember", - "aPostOperationRequest"); + "aPostOperationRequest"); String resolvedHostExpression = String.format("%s-foo.", aPostOperationRequest.stringMember()); return clientHandler.execute(new ClientExecutionParams() - .withOperationName("APostOperation").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .hostPrefixExpression(resolvedHostExpression).withRequestConfiguration(clientConfiguration) - .withInput(aPostOperationRequest).withMetricCollector(apiCallMetricCollector) - .withMarshaller(new APostOperationRequestMarshaller(protocolFactory))); + .withOperationName("APostOperation").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .hostPrefixExpression(resolvedHostExpression).withRequestConfiguration(clientConfiguration) + .withInput(aPostOperationRequest).withMetricCollector(apiCallMetricCollector) + .withMarshaller(new APostOperationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -187,33 +198,42 @@ public APostOperationResponse aPostOperation(APostOperationRequest aPostOperatio */ @Override public APostOperationWithOutputResponse aPostOperationWithOutput( - APostOperationWithOutputRequest aPostOperationWithOutputRequest) throws InvalidInputException, AwsServiceException, - SdkClientException, JsonException { + APostOperationWithOutputRequest aPostOperationWithOutputRequest) throws InvalidInputException, AwsServiceException, + SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, APostOperationWithOutputResponse::builder); + operationMetadata, APostOperationWithOutputResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationWithOutputRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationWithOutputRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "APostOperationWithOutput"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("APostOperationWithOutput").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(aPostOperationWithOutputRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new APostOperationWithOutputRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("APostOperationWithOutput").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(aPostOperationWithOutputRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new APostOperationWithOutputRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -237,31 +257,37 @@ public APostOperationWithOutputResponse aPostOperationWithOutput( */ @Override public BearerAuthOperationResponse bearerAuthOperation(BearerAuthOperationRequest bearerAuthOperationRequest) - throws AwsServiceException, SdkClientException, JsonException { + throws AwsServiceException, SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, BearerAuthOperationResponse::builder); + operationMetadata, BearerAuthOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(bearerAuthOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, bearerAuthOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "BearerAuthOperation"); return clientHandler.execute(new ClientExecutionParams() - .withOperationName("BearerAuthOperation").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .credentialType(CredentialType.TOKEN).withRequestConfiguration(clientConfiguration) - .withInput(bearerAuthOperationRequest).withMetricCollector(apiCallMetricCollector) - .withMarshaller(new BearerAuthOperationRequestMarshaller(protocolFactory))); + .withOperationName("BearerAuthOperation").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .credentialType(CredentialType.TOKEN).withRequestConfiguration(clientConfiguration) + .withInput(bearerAuthOperationRequest).withMetricCollector(apiCallMetricCollector) + .withMarshaller(new BearerAuthOperationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -285,41 +311,47 @@ public BearerAuthOperationResponse bearerAuthOperation(BearerAuthOperationReques */ @Override public GetOperationWithChecksumResponse getOperationWithChecksum( - GetOperationWithChecksumRequest getOperationWithChecksumRequest) throws AwsServiceException, SdkClientException, - JsonException { + GetOperationWithChecksumRequest getOperationWithChecksumRequest) throws AwsServiceException, SdkClientException, + JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(false).build(); + .isPayloadJson(false).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, GetOperationWithChecksumResponse::builder); + operationMetadata, GetOperationWithChecksumResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getOperationWithChecksumRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getOperationWithChecksumRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetOperationWithChecksum"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("GetOperationWithChecksum") - .withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withInput(getOperationWithChecksumRequest) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute( - SdkInternalExecutionAttribute.HTTP_CHECKSUM, - HttpChecksum.builder().requestChecksumRequired(true).isRequestStreaming(false) - .requestAlgorithm(getOperationWithChecksumRequest.checksumAlgorithmAsString()) - .requestAlgorithmHeader("x-amz-sdk-checksum-algorithm").build()) - .withMarshaller(new GetOperationWithChecksumRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("GetOperationWithChecksum") + .withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withInput(getOperationWithChecksumRequest) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute( + SdkInternalExecutionAttribute.HTTP_CHECKSUM, + HttpChecksum.builder().requestChecksumRequired(true).isRequestStreaming(false) + .requestAlgorithm(getOperationWithChecksumRequest.checksumAlgorithmAsString()) + .requestAlgorithmHeader("x-amz-sdk-checksum-algorithm").build()) + .withMarshaller(new GetOperationWithChecksumRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -347,33 +379,42 @@ public GetOperationWithChecksumResponse getOperationWithChecksum( */ @Override public GetWithoutRequiredMembersResponse getWithoutRequiredMembers( - GetWithoutRequiredMembersRequest getWithoutRequiredMembersRequest) throws InvalidInputException, AwsServiceException, - SdkClientException, JsonException { + GetWithoutRequiredMembersRequest getWithoutRequiredMembersRequest) throws InvalidInputException, AwsServiceException, + SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, GetWithoutRequiredMembersResponse::builder); + operationMetadata, GetWithoutRequiredMembersResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getWithoutRequiredMembersRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getWithoutRequiredMembersRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetWithoutRequiredMembers"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("GetWithoutRequiredMembers").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(getWithoutRequiredMembersRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new GetWithoutRequiredMembersRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("GetWithoutRequiredMembers").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(getWithoutRequiredMembersRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new GetWithoutRequiredMembersRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -397,38 +438,44 @@ public GetWithoutRequiredMembersResponse getWithoutRequiredMembers( */ @Override public OperationWithChecksumRequiredResponse operationWithChecksumRequired( - OperationWithChecksumRequiredRequest operationWithChecksumRequiredRequest) throws AwsServiceException, - SdkClientException, JsonException { + OperationWithChecksumRequiredRequest operationWithChecksumRequiredRequest) throws AwsServiceException, + SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, OperationWithChecksumRequiredResponse::builder); + operationMetadata, OperationWithChecksumRequiredResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithChecksumRequiredRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithChecksumRequiredRequest.overrideConfiguration().orElse(null)); + operationWithChecksumRequiredRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithChecksumRequired"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithChecksumRequired") - .withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withInput(operationWithChecksumRequiredRequest) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute(SdkInternalExecutionAttribute.HTTP_CHECKSUM_REQUIRED, - HttpChecksumRequired.create()) - .withMarshaller(new OperationWithChecksumRequiredRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithChecksumRequired") + .withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withInput(operationWithChecksumRequiredRequest) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute(SdkInternalExecutionAttribute.HTTP_CHECKSUM_REQUIRED, + HttpChecksumRequired.create()) + .withMarshaller(new OperationWithChecksumRequiredRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -452,38 +499,44 @@ public OperationWithChecksumRequiredResponse operationWithChecksumRequired( */ @Override public OperationWithRequestCompressionResponse operationWithRequestCompression( - OperationWithRequestCompressionRequest operationWithRequestCompressionRequest) throws AwsServiceException, - SdkClientException, JsonException { + OperationWithRequestCompressionRequest operationWithRequestCompressionRequest) throws AwsServiceException, + SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, OperationWithRequestCompressionResponse::builder); + operationMetadata, OperationWithRequestCompressionResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithRequestCompressionRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithRequestCompressionRequest.overrideConfiguration().orElse(null)); + operationWithRequestCompressionRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithRequestCompression"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithRequestCompression") - .withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withInput(operationWithRequestCompressionRequest) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute(SdkInternalExecutionAttribute.REQUEST_COMPRESSION, - RequestCompression.builder().encodings("gzip").isStreaming(false).build()) - .withMarshaller(new OperationWithRequestCompressionRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithRequestCompression") + .withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withInput(operationWithRequestCompressionRequest) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute(SdkInternalExecutionAttribute.REQUEST_COMPRESSION, + RequestCompression.builder().encodings("gzip").isStreaming(false).build()) + .withMarshaller(new OperationWithRequestCompressionRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -507,33 +560,39 @@ public OperationWithRequestCompressionResponse operationWithRequestCompression( */ @Override public PaginatedOperationWithResultKeyResponse paginatedOperationWithResultKey( - PaginatedOperationWithResultKeyRequest paginatedOperationWithResultKeyRequest) throws AwsServiceException, - SdkClientException, JsonException { + PaginatedOperationWithResultKeyRequest paginatedOperationWithResultKeyRequest) throws AwsServiceException, + SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, PaginatedOperationWithResultKeyResponse::builder); + operationMetadata, PaginatedOperationWithResultKeyResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(paginatedOperationWithResultKeyRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - paginatedOperationWithResultKeyRequest.overrideConfiguration().orElse(null)); + paginatedOperationWithResultKeyRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PaginatedOperationWithResultKey"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("PaginatedOperationWithResultKey").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(paginatedOperationWithResultKeyRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new PaginatedOperationWithResultKeyRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("PaginatedOperationWithResultKey").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(paginatedOperationWithResultKeyRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new PaginatedOperationWithResultKeyRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -557,33 +616,39 @@ public PaginatedOperationWithResultKeyResponse paginatedOperationWithResultKey( */ @Override public PaginatedOperationWithoutResultKeyResponse paginatedOperationWithoutResultKey( - PaginatedOperationWithoutResultKeyRequest paginatedOperationWithoutResultKeyRequest) throws AwsServiceException, - SdkClientException, JsonException { + PaginatedOperationWithoutResultKeyRequest paginatedOperationWithoutResultKeyRequest) throws AwsServiceException, + SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, PaginatedOperationWithoutResultKeyResponse::builder); + operationMetadata, PaginatedOperationWithoutResultKeyResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(paginatedOperationWithoutResultKeyRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - paginatedOperationWithoutResultKeyRequest.overrideConfiguration().orElse(null)); + paginatedOperationWithoutResultKeyRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PaginatedOperationWithoutResultKey"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("PaginatedOperationWithoutResultKey").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(paginatedOperationWithoutResultKeyRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new PaginatedOperationWithoutResultKeyRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("PaginatedOperationWithoutResultKey").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(paginatedOperationWithoutResultKeyRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new PaginatedOperationWithoutResultKeyRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -633,50 +698,56 @@ public PaginatedOperationWithoutResultKeyResponse paginatedOperationWithoutResul */ @Override public ReturnT putOperationWithChecksum(PutOperationWithChecksumRequest putOperationWithChecksumRequest, - RequestBody requestBody, ResponseTransformer responseTransformer) - throws AwsServiceException, SdkClientException, JsonException { + RequestBody requestBody, ResponseTransformer responseTransformer) + throws AwsServiceException, SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(true) - .isPayloadJson(false).build(); + .isPayloadJson(false).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, PutOperationWithChecksumResponse::builder); + operationMetadata, PutOperationWithChecksumResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putOperationWithChecksumRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, putOperationWithChecksumRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PutOperationWithChecksum"); return clientHandler.execute( - new ClientExecutionParams() - .withOperationName("PutOperationWithChecksum") - .withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withInput(putOperationWithChecksumRequest) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute( - SdkInternalExecutionAttribute.HTTP_CHECKSUM, - HttpChecksum - .builder() - .requestChecksumRequired(false) - .isRequestStreaming(true) - .requestValidationMode(putOperationWithChecksumRequest.checksumModeAsString()) - .responseAlgorithmsV2(DefaultChecksumAlgorithm.CRC32C, - DefaultChecksumAlgorithm.CRC32, DefaultChecksumAlgorithm.SHA1, - DefaultChecksumAlgorithm.SHA256).build()) - .withRequestBody(requestBody) - .withMarshaller( - StreamingRequestMarshaller.builder() - .delegateMarshaller(new PutOperationWithChecksumRequestMarshaller(protocolFactory)) - .requestBody(requestBody).build()), responseTransformer); + new ClientExecutionParams() + .withOperationName("PutOperationWithChecksum") + .withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withInput(putOperationWithChecksumRequest) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute( + SdkInternalExecutionAttribute.HTTP_CHECKSUM, + HttpChecksum + .builder() + .requestChecksumRequired(false) + .isRequestStreaming(true) + .requestValidationMode(putOperationWithChecksumRequest.checksumModeAsString()) + .responseAlgorithmsV2(DefaultChecksumAlgorithm.CRC32C, + DefaultChecksumAlgorithm.CRC32, DefaultChecksumAlgorithm.SHA1, + DefaultChecksumAlgorithm.SHA256).build()) + .withRequestBody(requestBody) + .withMarshaller( + StreamingRequestMarshaller.builder() + .delegateMarshaller(new PutOperationWithChecksumRequestMarshaller(protocolFactory)) + .requestBody(requestBody).build()), responseTransformer); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -690,11 +761,11 @@ public ReturnT putOperationWithChecksum(PutOperationWithChecksumReques * The content to send to the service. A {@link RequestBody} can be created using one of several factory * methods for various sources of data. For example, to create a request body from a file you can do the * following. - * + * *
      * {@code RequestBody.fromFile(new File("myfile.txt"))}
      * 
- * + * * See documentation in {@link RequestBody} for additional details and which sources of data are supported. * The service documentation for the request content is as follows 'This be a stream' * @return Result of the StreamingInputOperation operation returned by the service. @@ -711,39 +782,45 @@ public ReturnT putOperationWithChecksum(PutOperationWithChecksumReques */ @Override public StreamingInputOperationResponse streamingInputOperation(StreamingInputOperationRequest streamingInputOperationRequest, - RequestBody requestBody) throws AwsServiceException, SdkClientException, JsonException { + RequestBody requestBody) throws AwsServiceException, SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, StreamingInputOperationResponse::builder); + operationMetadata, StreamingInputOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingInputOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingInputOperation"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("StreamingInputOperation") - .withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withInput(streamingInputOperationRequest) - .withMetricCollector(apiCallMetricCollector) - .withRequestBody(requestBody) - .withMarshaller( - StreamingRequestMarshaller.builder() - .delegateMarshaller(new StreamingInputOperationRequestMarshaller(protocolFactory)) - .requestBody(requestBody).build())); + .execute(new ClientExecutionParams() + .withOperationName("StreamingInputOperation") + .withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withInput(streamingInputOperationRequest) + .withMetricCollector(apiCallMetricCollector) + .withRequestBody(requestBody) + .withMarshaller( + StreamingRequestMarshaller.builder() + .delegateMarshaller(new StreamingInputOperationRequestMarshaller(protocolFactory)) + .requestBody(requestBody).build())); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -757,11 +834,11 @@ public StreamingInputOperationResponse streamingInputOperation(StreamingInputOpe * The content to send to the service. A {@link RequestBody} can be created using one of several factory * methods for various sources of data. For example, to create a request body from a file you can do the * following. - * + * *
      * {@code RequestBody.fromFile(new File("myfile.txt"))}
      * 
- * + * * See documentation in {@link RequestBody} for additional details and which sources of data are supported. * The service documentation for the request content is as follows 'This be a stream' * @param responseTransformer @@ -785,43 +862,49 @@ public StreamingInputOperationResponse streamingInputOperation(StreamingInputOpe */ @Override public ReturnT streamingInputOutputOperation( - StreamingInputOutputOperationRequest streamingInputOutputOperationRequest, RequestBody requestBody, - ResponseTransformer responseTransformer) throws AwsServiceException, - SdkClientException, JsonException { + StreamingInputOutputOperationRequest streamingInputOutputOperationRequest, RequestBody requestBody, + ResponseTransformer responseTransformer) throws AwsServiceException, + SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(true) - .isPayloadJson(false).build(); + .isPayloadJson(false).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, StreamingInputOutputOperationResponse::builder); + operationMetadata, StreamingInputOutputOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOutputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - streamingInputOutputOperationRequest.overrideConfiguration().orElse(null)); + streamingInputOutputOperationRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingInputOutputOperation"); return clientHandler.execute( - new ClientExecutionParams() - .withOperationName("StreamingInputOutputOperation") - .withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withInput(streamingInputOutputOperationRequest) - .withMetricCollector(apiCallMetricCollector) - .withRequestBody(requestBody) - .withMarshaller( - StreamingRequestMarshaller - .builder() - .delegateMarshaller( - new StreamingInputOutputOperationRequestMarshaller(protocolFactory)) - .requestBody(requestBody).transferEncoding(true).build()), responseTransformer); + new ClientExecutionParams() + .withOperationName("StreamingInputOutputOperation") + .withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withInput(streamingInputOutputOperationRequest) + .withMetricCollector(apiCallMetricCollector) + .withRequestBody(requestBody) + .withMarshaller( + StreamingRequestMarshaller + .builder() + .delegateMarshaller( + new StreamingInputOutputOperationRequestMarshaller(protocolFactory)) + .requestBody(requestBody).transferEncoding(true).build()), responseTransformer); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -852,33 +935,39 @@ public ReturnT streamingInputOutputOperation( */ @Override public ReturnT streamingOutputOperation(StreamingOutputOperationRequest streamingOutputOperationRequest, - ResponseTransformer responseTransformer) throws AwsServiceException, - SdkClientException, JsonException { + ResponseTransformer responseTransformer) throws AwsServiceException, + SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(true) - .isPayloadJson(false).build(); + .isPayloadJson(false).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, StreamingOutputOperationResponse::builder); + operationMetadata, StreamingOutputOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingOutputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingOutputOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingOutputOperation"); return clientHandler.execute( - new ClientExecutionParams() - .withOperationName("StreamingOutputOperation").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(streamingOutputOperationRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new StreamingOutputOperationRequestMarshaller(protocolFactory)), responseTransformer); + new ClientExecutionParams() + .withOperationName("StreamingOutputOperation").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(streamingOutputOperationRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new StreamingOutputOperationRequestMarshaller(protocolFactory)), responseTransformer); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -898,7 +987,7 @@ public final String serviceName() { } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, - RequestOverrideConfiguration requestOverrideConfiguration) { + RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); @@ -913,8 +1002,8 @@ private static List resolveMetricPublishers(SdkClientConfigurat } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, - JsonOperationMetadata operationMetadata) { - return protocolFactory.createErrorResponseHandler(operationMetadata); + JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { + return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); } private void updateRetryStrategyClientConfiguration(SdkClientConfiguration.Builder configuration) { @@ -955,14 +1044,8 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, } private > T init(T builder) { - return builder - .clientConfiguration(clientConfiguration) - .defaultServiceExceptionSupplier(JsonException::builder) - .protocol(AwsJsonProtocol.REST_JSON) - .protocolVersion("1.1") - .registerModeledException( - ExceptionMetadata.builder().errorCode("InvalidInput") - .exceptionBuilderSupplier(InvalidInputException::builder).httpStatusCode(400).build()); + return builder.clientConfiguration(clientConfiguration).defaultServiceExceptionSupplier(JsonException::builder) + .protocol(AwsJsonProtocol.REST_JSON).protocolVersion("1.1"); } @Override diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-async-client-class.java index 5c97f4ae619c..afefb7739f38 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-async-client-class.java @@ -41,7 +41,6 @@ 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.query.AwsQueryProtocolFactory; import software.amazon.awssdk.retries.api.RetryStrategy; import software.amazon.awssdk.services.query.internal.QueryServiceClientConfigurationBuilder; @@ -53,7 +52,6 @@ import software.amazon.awssdk.services.query.model.BearerAuthOperationResponse; import software.amazon.awssdk.services.query.model.GetOperationWithChecksumRequest; import software.amazon.awssdk.services.query.model.GetOperationWithChecksumResponse; -import software.amazon.awssdk.services.query.model.InvalidInputException; import software.amazon.awssdk.services.query.model.OperationWithChecksumRequiredRequest; import software.amazon.awssdk.services.query.model.OperationWithChecksumRequiredResponse; import software.amazon.awssdk.services.query.model.OperationWithContextParamRequest; @@ -110,7 +108,7 @@ final class DefaultQueryAsyncClient implements QueryAsyncClient { private static final Logger log = LoggerFactory.getLogger(DefaultQueryAsyncClient.class); private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder() - .serviceProtocol(AwsServiceProtocol.QUERY).build(); + .serviceProtocol(AwsServiceProtocol.QUERY).build(); private final AsyncClientHandler clientHandler; @@ -155,27 +153,27 @@ protected DefaultQueryAsyncClient(SdkClientConfiguration clientConfiguration) { public CompletableFuture aPostOperation(APostOperationRequest aPostOperationRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "APostOperation"); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(APostOperationResponse::builder); + .createResponseHandler(APostOperationResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); String hostPrefix = "foo-"; String resolvedHostExpression = "foo-"; CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("APostOperation").withProtocolMetadata(protocolMetadata) - .withMarshaller(new APostOperationRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .hostPrefixExpression(resolvedHostExpression).withInput(aPostOperationRequest)); + .execute(new ClientExecutionParams() + .withOperationName("APostOperation").withProtocolMetadata(protocolMetadata) + .withMarshaller(new APostOperationRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .hostPrefixExpression(resolvedHostExpression).withInput(aPostOperationRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -213,29 +211,29 @@ public CompletableFuture aPostOperation(APostOperationRe */ @Override public CompletableFuture aPostOperationWithOutput( - APostOperationWithOutputRequest aPostOperationWithOutputRequest) { + APostOperationWithOutputRequest aPostOperationWithOutputRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationWithOutputRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationWithOutputRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "APostOperationWithOutput"); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(APostOperationWithOutputResponse::builder); + .createResponseHandler(APostOperationWithOutputResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("APostOperationWithOutput").withProtocolMetadata(protocolMetadata) - .withMarshaller(new APostOperationWithOutputRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(aPostOperationWithOutputRequest)); + .execute(new ClientExecutionParams() + .withOperationName("APostOperationWithOutput").withProtocolMetadata(protocolMetadata) + .withMarshaller(new APostOperationWithOutputRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(aPostOperationWithOutputRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -269,29 +267,29 @@ public CompletableFuture aPostOperationWithOut */ @Override public CompletableFuture bearerAuthOperation( - BearerAuthOperationRequest bearerAuthOperationRequest) { + BearerAuthOperationRequest bearerAuthOperationRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(bearerAuthOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, bearerAuthOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "BearerAuthOperation"); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(BearerAuthOperationResponse::builder); + .createResponseHandler(BearerAuthOperationResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("BearerAuthOperation").withProtocolMetadata(protocolMetadata) - .withMarshaller(new BearerAuthOperationRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .credentialType(CredentialType.TOKEN).withRequestConfiguration(clientConfiguration) - .withMetricCollector(apiCallMetricCollector).withInput(bearerAuthOperationRequest)); + .execute(new ClientExecutionParams() + .withOperationName("BearerAuthOperation").withProtocolMetadata(protocolMetadata) + .withMarshaller(new BearerAuthOperationRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .credentialType(CredentialType.TOKEN).withRequestConfiguration(clientConfiguration) + .withMetricCollector(apiCallMetricCollector).withInput(bearerAuthOperationRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -325,37 +323,37 @@ public CompletableFuture bearerAuthOperation( */ @Override public CompletableFuture getOperationWithChecksum( - GetOperationWithChecksumRequest getOperationWithChecksumRequest) { + GetOperationWithChecksumRequest getOperationWithChecksumRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getOperationWithChecksumRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getOperationWithChecksumRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetOperationWithChecksum"); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(GetOperationWithChecksumResponse::builder); + .createResponseHandler(GetOperationWithChecksumResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("GetOperationWithChecksum") - .withProtocolMetadata(protocolMetadata) - .withMarshaller(new GetOperationWithChecksumRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute( - SdkInternalExecutionAttribute.HTTP_CHECKSUM, - HttpChecksum.builder().requestChecksumRequired(true).isRequestStreaming(false) - .requestAlgorithm(getOperationWithChecksumRequest.checksumAlgorithmAsString()) - .requestAlgorithmHeader("x-amz-sdk-checksum-algorithm").build()) - .withInput(getOperationWithChecksumRequest)); + .execute(new ClientExecutionParams() + .withOperationName("GetOperationWithChecksum") + .withProtocolMetadata(protocolMetadata) + .withMarshaller(new GetOperationWithChecksumRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute( + SdkInternalExecutionAttribute.HTTP_CHECKSUM, + HttpChecksum.builder().requestChecksumRequired(true).isRequestStreaming(false) + .requestAlgorithm(getOperationWithChecksumRequest.checksumAlgorithmAsString()) + .requestAlgorithmHeader("x-amz-sdk-checksum-algorithm").build()) + .withInput(getOperationWithChecksumRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -390,33 +388,33 @@ public CompletableFuture getOperationWithCheck */ @Override public CompletableFuture operationWithChecksumRequired( - OperationWithChecksumRequiredRequest operationWithChecksumRequiredRequest) { + OperationWithChecksumRequiredRequest operationWithChecksumRequiredRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithChecksumRequiredRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithChecksumRequiredRequest.overrideConfiguration().orElse(null)); + operationWithChecksumRequiredRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithChecksumRequired"); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(OperationWithChecksumRequiredResponse::builder); + .createResponseHandler(OperationWithChecksumRequiredResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithChecksumRequired") - .withProtocolMetadata(protocolMetadata) - .withMarshaller(new OperationWithChecksumRequiredRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute(SdkInternalExecutionAttribute.HTTP_CHECKSUM_REQUIRED, - HttpChecksumRequired.create()).withInput(operationWithChecksumRequiredRequest)); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithChecksumRequired") + .withProtocolMetadata(protocolMetadata) + .withMarshaller(new OperationWithChecksumRequiredRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute(SdkInternalExecutionAttribute.HTTP_CHECKSUM_REQUIRED, + HttpChecksumRequired.create()).withInput(operationWithChecksumRequiredRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -450,29 +448,29 @@ public CompletableFuture operationWithChe */ @Override public CompletableFuture operationWithContextParam( - OperationWithContextParamRequest operationWithContextParamRequest) { + OperationWithContextParamRequest operationWithContextParamRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithContextParamRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithContextParamRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithContextParam"); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(OperationWithContextParamResponse::builder); + .createResponseHandler(OperationWithContextParamResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithContextParam").withProtocolMetadata(protocolMetadata) - .withMarshaller(new OperationWithContextParamRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(operationWithContextParamRequest)); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithContextParam").withProtocolMetadata(protocolMetadata) + .withMarshaller(new OperationWithContextParamRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(operationWithContextParamRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -506,30 +504,30 @@ public CompletableFuture operationWithContext */ @Override public CompletableFuture operationWithCustomMember( - OperationWithCustomMemberRequest operationWithCustomMemberRequest) { + OperationWithCustomMemberRequest operationWithCustomMemberRequest) { operationWithCustomMemberRequest = UtilsTest.dummyRequestModifier(operationWithCustomMemberRequest); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithCustomMemberRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithCustomMemberRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithCustomMember"); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(OperationWithCustomMemberResponse::builder); + .createResponseHandler(OperationWithCustomMemberResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithCustomMember").withProtocolMetadata(protocolMetadata) - .withMarshaller(new OperationWithCustomMemberRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(operationWithCustomMemberRequest)); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithCustomMember").withProtocolMetadata(protocolMetadata) + .withMarshaller(new OperationWithCustomMemberRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(operationWithCustomMemberRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -565,30 +563,30 @@ public CompletableFuture operationWithCustomM */ @Override public CompletableFuture operationWithCustomizedOperationContextParam( - OperationWithCustomizedOperationContextParamRequest operationWithCustomizedOperationContextParamRequest) { + OperationWithCustomizedOperationContextParamRequest operationWithCustomizedOperationContextParamRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration( - operationWithCustomizedOperationContextParamRequest, this.clientConfiguration); + operationWithCustomizedOperationContextParamRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithCustomizedOperationContextParamRequest.overrideConfiguration().orElse(null)); + operationWithCustomizedOperationContextParamRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithCustomizedOperationContextParam"); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(OperationWithCustomizedOperationContextParamResponse::builder); + .createResponseHandler(OperationWithCustomizedOperationContextParamResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithCustomizedOperationContextParam") - .withProtocolMetadata(protocolMetadata) - .withMarshaller(new OperationWithCustomizedOperationContextParamRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(operationWithCustomizedOperationContextParamRequest)); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithCustomizedOperationContextParam") + .withProtocolMetadata(protocolMetadata) + .withMarshaller(new OperationWithCustomizedOperationContextParamRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(operationWithCustomizedOperationContextParamRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -624,29 +622,29 @@ public CompletableFuture o */ @Override public CompletableFuture operationWithMapOperationContextParam( - OperationWithMapOperationContextParamRequest operationWithMapOperationContextParamRequest) { + OperationWithMapOperationContextParamRequest operationWithMapOperationContextParamRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithMapOperationContextParamRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithMapOperationContextParamRequest.overrideConfiguration().orElse(null)); + operationWithMapOperationContextParamRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithMapOperationContextParam"); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(OperationWithMapOperationContextParamResponse::builder); + .createResponseHandler(OperationWithMapOperationContextParamResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithMapOperationContextParam").withProtocolMetadata(protocolMetadata) - .withMarshaller(new OperationWithMapOperationContextParamRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(operationWithMapOperationContextParamRequest)); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithMapOperationContextParam").withProtocolMetadata(protocolMetadata) + .withMarshaller(new OperationWithMapOperationContextParamRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(operationWithMapOperationContextParamRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -680,29 +678,29 @@ public CompletableFuture operatio */ @Override public CompletableFuture operationWithNoneAuthType( - OperationWithNoneAuthTypeRequest operationWithNoneAuthTypeRequest) { + OperationWithNoneAuthTypeRequest operationWithNoneAuthTypeRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithNoneAuthTypeRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithNoneAuthTypeRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithNoneAuthType"); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(OperationWithNoneAuthTypeResponse::builder); + .createResponseHandler(OperationWithNoneAuthTypeResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithNoneAuthType").withProtocolMetadata(protocolMetadata) - .withMarshaller(new OperationWithNoneAuthTypeRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(operationWithNoneAuthTypeRequest)); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithNoneAuthType").withProtocolMetadata(protocolMetadata) + .withMarshaller(new OperationWithNoneAuthTypeRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(operationWithNoneAuthTypeRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -738,29 +736,29 @@ public CompletableFuture operationWithNoneAut */ @Override public CompletableFuture operationWithOperationContextParam( - OperationWithOperationContextParamRequest operationWithOperationContextParamRequest) { + OperationWithOperationContextParamRequest operationWithOperationContextParamRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithOperationContextParamRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithOperationContextParamRequest.overrideConfiguration().orElse(null)); + operationWithOperationContextParamRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithOperationContextParam"); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(OperationWithOperationContextParamResponse::builder); + .createResponseHandler(OperationWithOperationContextParamResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithOperationContextParam").withProtocolMetadata(protocolMetadata) - .withMarshaller(new OperationWithOperationContextParamRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(operationWithOperationContextParamRequest)); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithOperationContextParam").withProtocolMetadata(protocolMetadata) + .withMarshaller(new OperationWithOperationContextParamRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(operationWithOperationContextParamRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -795,34 +793,34 @@ public CompletableFuture operationWi */ @Override public CompletableFuture operationWithRequestCompression( - OperationWithRequestCompressionRequest operationWithRequestCompressionRequest) { + OperationWithRequestCompressionRequest operationWithRequestCompressionRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithRequestCompressionRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithRequestCompressionRequest.overrideConfiguration().orElse(null)); + operationWithRequestCompressionRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithRequestCompression"); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(OperationWithRequestCompressionResponse::builder); + .createResponseHandler(OperationWithRequestCompressionResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithRequestCompression") - .withProtocolMetadata(protocolMetadata) - .withMarshaller(new OperationWithRequestCompressionRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute(SdkInternalExecutionAttribute.REQUEST_COMPRESSION, - RequestCompression.builder().encodings("gzip").isStreaming(false).build()) - .withInput(operationWithRequestCompressionRequest)); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithRequestCompression") + .withProtocolMetadata(protocolMetadata) + .withMarshaller(new OperationWithRequestCompressionRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute(SdkInternalExecutionAttribute.REQUEST_COMPRESSION, + RequestCompression.builder().encodings("gzip").isStreaming(false).build()) + .withInput(operationWithRequestCompressionRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -857,29 +855,29 @@ public CompletableFuture operationWithR */ @Override public CompletableFuture operationWithStaticContextParams( - OperationWithStaticContextParamsRequest operationWithStaticContextParamsRequest) { + OperationWithStaticContextParamsRequest operationWithStaticContextParamsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithStaticContextParamsRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithStaticContextParamsRequest.overrideConfiguration().orElse(null)); + operationWithStaticContextParamsRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithStaticContextParams"); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(OperationWithStaticContextParamsResponse::builder); + .createResponseHandler(OperationWithStaticContextParamsResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithStaticContextParams").withProtocolMetadata(protocolMetadata) - .withMarshaller(new OperationWithStaticContextParamsRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(operationWithStaticContextParamsRequest)); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithStaticContextParams").withProtocolMetadata(protocolMetadata) + .withMarshaller(new OperationWithStaticContextParamsRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(operationWithStaticContextParamsRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -931,56 +929,56 @@ public CompletableFuture operationWith */ @Override public CompletableFuture putOperationWithChecksum( - PutOperationWithChecksumRequest putOperationWithChecksumRequest, AsyncRequestBody requestBody, - AsyncResponseTransformer asyncResponseTransformer) { + PutOperationWithChecksumRequest putOperationWithChecksumRequest, AsyncRequestBody requestBody, + AsyncResponseTransformer asyncResponseTransformer) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putOperationWithChecksumRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, putOperationWithChecksumRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PutOperationWithChecksum"); Pair, CompletableFuture> pair = AsyncResponseTransformerUtils - .wrapWithEndOfStreamFuture(asyncResponseTransformer); + .wrapWithEndOfStreamFuture(asyncResponseTransformer); asyncResponseTransformer = pair.left(); CompletableFuture endOfStreamFuture = pair.right(); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(PutOperationWithChecksumResponse::builder); + .createResponseHandler(PutOperationWithChecksumResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler.execute( - new ClientExecutionParams() - .withOperationName("PutOperationWithChecksum") - .withProtocolMetadata(protocolMetadata) - .withMarshaller( - AsyncStreamingRequestMarshaller.builder() - .delegateMarshaller(new PutOperationWithChecksumRequestMarshaller(protocolFactory)) - .asyncRequestBody(requestBody).build()) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute( - SdkInternalExecutionAttribute.HTTP_CHECKSUM, - HttpChecksum - .builder() - .requestChecksumRequired(false) - .isRequestStreaming(true) - .requestValidationMode(putOperationWithChecksumRequest.checksumModeAsString()) - .responseAlgorithmsV2(DefaultChecksumAlgorithm.CRC32C, - DefaultChecksumAlgorithm.CRC32, DefaultChecksumAlgorithm.SHA1, - DefaultChecksumAlgorithm.SHA256).build()).withAsyncRequestBody(requestBody) - .withInput(putOperationWithChecksumRequest), asyncResponseTransformer); + new ClientExecutionParams() + .withOperationName("PutOperationWithChecksum") + .withProtocolMetadata(protocolMetadata) + .withMarshaller( + AsyncStreamingRequestMarshaller.builder() + .delegateMarshaller(new PutOperationWithChecksumRequestMarshaller(protocolFactory)) + .asyncRequestBody(requestBody).build()) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute( + SdkInternalExecutionAttribute.HTTP_CHECKSUM, + HttpChecksum + .builder() + .requestChecksumRequired(false) + .isRequestStreaming(true) + .requestValidationMode(putOperationWithChecksumRequest.checksumModeAsString()) + .responseAlgorithmsV2(DefaultChecksumAlgorithm.CRC32C, + DefaultChecksumAlgorithm.CRC32, DefaultChecksumAlgorithm.SHA1, + DefaultChecksumAlgorithm.SHA256).build()).withAsyncRequestBody(requestBody) + .withInput(putOperationWithChecksumRequest), asyncResponseTransformer); CompletableFuture whenCompleteFuture = null; AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { if (e != null) { runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> finalAsyncResponseTransformer.exceptionOccurred(e)); + () -> finalAsyncResponseTransformer.exceptionOccurred(e)); } endOfStreamFuture.whenComplete((r2, e2) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -990,7 +988,7 @@ public CompletableFuture putOperationWithChecksum( } catch (Throwable t) { AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> finalAsyncResponseTransformer.exceptionOccurred(t)); + () -> finalAsyncResponseTransformer.exceptionOccurred(t)); metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } @@ -1023,33 +1021,33 @@ public CompletableFuture putOperationWithChecksum( */ @Override public CompletableFuture streamingInputOperation( - StreamingInputOperationRequest streamingInputOperationRequest, AsyncRequestBody requestBody) { + StreamingInputOperationRequest streamingInputOperationRequest, AsyncRequestBody requestBody) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingInputOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingInputOperation"); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(StreamingInputOperationResponse::builder); + .createResponseHandler(StreamingInputOperationResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("StreamingInputOperation") - .withProtocolMetadata(protocolMetadata) - .withMarshaller( - AsyncStreamingRequestMarshaller.builder() - .delegateMarshaller(new StreamingInputOperationRequestMarshaller(protocolFactory)) - .asyncRequestBody(requestBody).build()).withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) - .withMetricCollector(apiCallMetricCollector).withAsyncRequestBody(requestBody) - .withInput(streamingInputOperationRequest)); + .execute(new ClientExecutionParams() + .withOperationName("StreamingInputOperation") + .withProtocolMetadata(protocolMetadata) + .withMarshaller( + AsyncStreamingRequestMarshaller.builder() + .delegateMarshaller(new StreamingInputOperationRequestMarshaller(protocolFactory)) + .asyncRequestBody(requestBody).build()).withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) + .withMetricCollector(apiCallMetricCollector).withAsyncRequestBody(requestBody) + .withInput(streamingInputOperationRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -1088,40 +1086,40 @@ public CompletableFuture streamingInputOperatio */ @Override public CompletableFuture streamingOutputOperation( - StreamingOutputOperationRequest streamingOutputOperationRequest, - AsyncResponseTransformer asyncResponseTransformer) { + StreamingOutputOperationRequest streamingOutputOperationRequest, + AsyncResponseTransformer asyncResponseTransformer) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingOutputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingOutputOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingOutputOperation"); Pair, CompletableFuture> pair = AsyncResponseTransformerUtils - .wrapWithEndOfStreamFuture(asyncResponseTransformer); + .wrapWithEndOfStreamFuture(asyncResponseTransformer); asyncResponseTransformer = pair.left(); CompletableFuture endOfStreamFuture = pair.right(); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(StreamingOutputOperationResponse::builder); + .createResponseHandler(StreamingOutputOperationResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler.execute( - new ClientExecutionParams() - .withOperationName("StreamingOutputOperation").withProtocolMetadata(protocolMetadata) - .withMarshaller(new StreamingOutputOperationRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(streamingOutputOperationRequest), asyncResponseTransformer); + new ClientExecutionParams() + .withOperationName("StreamingOutputOperation").withProtocolMetadata(protocolMetadata) + .withMarshaller(new StreamingOutputOperationRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(streamingOutputOperationRequest), asyncResponseTransformer); CompletableFuture whenCompleteFuture = null; AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { if (e != null) { runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> finalAsyncResponseTransformer.exceptionOccurred(e)); + () -> finalAsyncResponseTransformer.exceptionOccurred(e)); } endOfStreamFuture.whenComplete((r2, e2) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -1131,7 +1129,7 @@ public CompletableFuture streamingOutputOperation( } catch (Throwable t) { AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> finalAsyncResponseTransformer.exceptionOccurred(t)); + () -> finalAsyncResponseTransformer.exceptionOccurred(t)); metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } @@ -1153,16 +1151,12 @@ public final String serviceName() { } private AwsQueryProtocolFactory init() { - return AwsQueryProtocolFactory - .builder() - .registerModeledException( - ExceptionMetadata.builder().errorCode("InvalidInput") - .exceptionBuilderSupplier(InvalidInputException::builder).httpStatusCode(400).build()) - .clientConfiguration(clientConfiguration).defaultServiceExceptionSupplier(QueryException::builder).build(); + return AwsQueryProtocolFactory.builder().clientConfiguration(clientConfiguration) + .defaultServiceExceptionSupplier(QueryException::builder).build(); } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, - RequestOverrideConfiguration requestOverrideConfiguration) { + RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-client-class.java index 5961432e145d..42dcf987c214 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-client-class.java @@ -35,7 +35,6 @@ 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.query.AwsQueryProtocolFactory; import software.amazon.awssdk.retries.api.RetryStrategy; import software.amazon.awssdk.services.query.internal.QueryServiceClientConfigurationBuilder; @@ -103,7 +102,7 @@ final class DefaultQueryClient implements QueryClient { private static final Logger log = Logger.loggerFor(DefaultQueryClient.class); private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder() - .serviceProtocol(AwsServiceProtocol.QUERY).build(); + .serviceProtocol(AwsServiceProtocol.QUERY).build(); private final SyncClientHandler clientHandler; @@ -139,17 +138,17 @@ protected DefaultQueryClient(SdkClientConfiguration clientConfiguration) { */ @Override public APostOperationResponse aPostOperation(APostOperationRequest aPostOperationRequest) throws InvalidInputException, - AwsServiceException, SdkClientException, QueryException { + AwsServiceException, SdkClientException, QueryException { HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(APostOperationResponse::builder); + .createResponseHandler(APostOperationResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "APostOperation"); @@ -157,11 +156,11 @@ public APostOperationResponse aPostOperation(APostOperationRequest aPostOperatio String resolvedHostExpression = "foo-"; return clientHandler.execute(new ClientExecutionParams() - .withOperationName("APostOperation").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .hostPrefixExpression(resolvedHostExpression).withRequestConfiguration(clientConfiguration) - .withInput(aPostOperationRequest).withMetricCollector(apiCallMetricCollector) - .withMarshaller(new APostOperationRequestMarshaller(protocolFactory))); + .withOperationName("APostOperation").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .hostPrefixExpression(resolvedHostExpression).withRequestConfiguration(clientConfiguration) + .withInput(aPostOperationRequest).withMetricCollector(apiCallMetricCollector) + .withMarshaller(new APostOperationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -189,30 +188,30 @@ public APostOperationResponse aPostOperation(APostOperationRequest aPostOperatio */ @Override public APostOperationWithOutputResponse aPostOperationWithOutput( - APostOperationWithOutputRequest aPostOperationWithOutputRequest) throws InvalidInputException, AwsServiceException, - SdkClientException, QueryException { + APostOperationWithOutputRequest aPostOperationWithOutputRequest) throws InvalidInputException, AwsServiceException, + SdkClientException, QueryException { HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(APostOperationWithOutputResponse::builder); + .createResponseHandler(APostOperationWithOutputResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationWithOutputRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationWithOutputRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "APostOperationWithOutput"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("APostOperationWithOutput").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(aPostOperationWithOutputRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new APostOperationWithOutputRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("APostOperationWithOutput").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(aPostOperationWithOutputRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new APostOperationWithOutputRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -236,28 +235,28 @@ public APostOperationWithOutputResponse aPostOperationWithOutput( */ @Override public BearerAuthOperationResponse bearerAuthOperation(BearerAuthOperationRequest bearerAuthOperationRequest) - throws AwsServiceException, SdkClientException, QueryException { + throws AwsServiceException, SdkClientException, QueryException { HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(BearerAuthOperationResponse::builder); + .createResponseHandler(BearerAuthOperationResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(bearerAuthOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, bearerAuthOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "BearerAuthOperation"); return clientHandler.execute(new ClientExecutionParams() - .withOperationName("BearerAuthOperation").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .credentialType(CredentialType.TOKEN).withRequestConfiguration(clientConfiguration) - .withInput(bearerAuthOperationRequest).withMetricCollector(apiCallMetricCollector) - .withMarshaller(new BearerAuthOperationRequestMarshaller(protocolFactory))); + .withOperationName("BearerAuthOperation").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .credentialType(CredentialType.TOKEN).withRequestConfiguration(clientConfiguration) + .withInput(bearerAuthOperationRequest).withMetricCollector(apiCallMetricCollector) + .withMarshaller(new BearerAuthOperationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -281,38 +280,38 @@ public BearerAuthOperationResponse bearerAuthOperation(BearerAuthOperationReques */ @Override public GetOperationWithChecksumResponse getOperationWithChecksum( - GetOperationWithChecksumRequest getOperationWithChecksumRequest) throws AwsServiceException, SdkClientException, - QueryException { + GetOperationWithChecksumRequest getOperationWithChecksumRequest) throws AwsServiceException, SdkClientException, + QueryException { HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(GetOperationWithChecksumResponse::builder); + .createResponseHandler(GetOperationWithChecksumResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getOperationWithChecksumRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getOperationWithChecksumRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetOperationWithChecksum"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("GetOperationWithChecksum") - .withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withInput(getOperationWithChecksumRequest) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute( - SdkInternalExecutionAttribute.HTTP_CHECKSUM, - HttpChecksum.builder().requestChecksumRequired(true).isRequestStreaming(false) - .requestAlgorithm(getOperationWithChecksumRequest.checksumAlgorithmAsString()) - .requestAlgorithmHeader("x-amz-sdk-checksum-algorithm").build()) - .withMarshaller(new GetOperationWithChecksumRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("GetOperationWithChecksum") + .withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withInput(getOperationWithChecksumRequest) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute( + SdkInternalExecutionAttribute.HTTP_CHECKSUM, + HttpChecksum.builder().requestChecksumRequired(true).isRequestStreaming(false) + .requestAlgorithm(getOperationWithChecksumRequest.checksumAlgorithmAsString()) + .requestAlgorithmHeader("x-amz-sdk-checksum-algorithm").build()) + .withMarshaller(new GetOperationWithChecksumRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -336,35 +335,35 @@ public GetOperationWithChecksumResponse getOperationWithChecksum( */ @Override public OperationWithChecksumRequiredResponse operationWithChecksumRequired( - OperationWithChecksumRequiredRequest operationWithChecksumRequiredRequest) throws AwsServiceException, - SdkClientException, QueryException { + OperationWithChecksumRequiredRequest operationWithChecksumRequiredRequest) throws AwsServiceException, + SdkClientException, QueryException { HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(OperationWithChecksumRequiredResponse::builder); + .createResponseHandler(OperationWithChecksumRequiredResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithChecksumRequiredRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithChecksumRequiredRequest.overrideConfiguration().orElse(null)); + operationWithChecksumRequiredRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithChecksumRequired"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithChecksumRequired") - .withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withInput(operationWithChecksumRequiredRequest) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute(SdkInternalExecutionAttribute.HTTP_CHECKSUM_REQUIRED, - HttpChecksumRequired.create()) - .withMarshaller(new OperationWithChecksumRequiredRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithChecksumRequired") + .withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withInput(operationWithChecksumRequiredRequest) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute(SdkInternalExecutionAttribute.HTTP_CHECKSUM_REQUIRED, + HttpChecksumRequired.create()) + .withMarshaller(new OperationWithChecksumRequiredRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -388,30 +387,30 @@ public OperationWithChecksumRequiredResponse operationWithChecksumRequired( */ @Override public OperationWithContextParamResponse operationWithContextParam( - OperationWithContextParamRequest operationWithContextParamRequest) throws AwsServiceException, SdkClientException, - QueryException { + OperationWithContextParamRequest operationWithContextParamRequest) throws AwsServiceException, SdkClientException, + QueryException { HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(OperationWithContextParamResponse::builder); + .createResponseHandler(OperationWithContextParamResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithContextParamRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithContextParamRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithContextParam"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithContextParam").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(operationWithContextParamRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new OperationWithContextParamRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithContextParam").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(operationWithContextParamRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new OperationWithContextParamRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -435,31 +434,31 @@ public OperationWithContextParamResponse operationWithContextParam( */ @Override public OperationWithCustomMemberResponse operationWithCustomMember( - OperationWithCustomMemberRequest operationWithCustomMemberRequest) throws AwsServiceException, SdkClientException, - QueryException { + OperationWithCustomMemberRequest operationWithCustomMemberRequest) throws AwsServiceException, SdkClientException, + QueryException { operationWithCustomMemberRequest = UtilsTest.dummyRequestModifier(operationWithCustomMemberRequest); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(OperationWithCustomMemberResponse::builder); + .createResponseHandler(OperationWithCustomMemberResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithCustomMemberRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithCustomMemberRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithCustomMember"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithCustomMember").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(operationWithCustomMemberRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new OperationWithCustomMemberRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithCustomMember").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(operationWithCustomMemberRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new OperationWithCustomMemberRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -484,31 +483,31 @@ public OperationWithCustomMemberResponse operationWithCustomMember( */ @Override public OperationWithCustomizedOperationContextParamResponse operationWithCustomizedOperationContextParam( - OperationWithCustomizedOperationContextParamRequest operationWithCustomizedOperationContextParamRequest) - throws AwsServiceException, SdkClientException, QueryException { + OperationWithCustomizedOperationContextParamRequest operationWithCustomizedOperationContextParamRequest) + throws AwsServiceException, SdkClientException, QueryException { HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(OperationWithCustomizedOperationContextParamResponse::builder); + .createResponseHandler(OperationWithCustomizedOperationContextParamResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration( - operationWithCustomizedOperationContextParamRequest, this.clientConfiguration); + operationWithCustomizedOperationContextParamRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithCustomizedOperationContextParamRequest.overrideConfiguration().orElse(null)); + operationWithCustomizedOperationContextParamRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithCustomizedOperationContextParam"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithCustomizedOperationContextParam") - .withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) - .withInput(operationWithCustomizedOperationContextParamRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new OperationWithCustomizedOperationContextParamRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithCustomizedOperationContextParam") + .withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) + .withInput(operationWithCustomizedOperationContextParamRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new OperationWithCustomizedOperationContextParamRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -533,30 +532,30 @@ public OperationWithCustomizedOperationContextParamResponse operationWithCustomi */ @Override public OperationWithMapOperationContextParamResponse operationWithMapOperationContextParam( - OperationWithMapOperationContextParamRequest operationWithMapOperationContextParamRequest) - throws AwsServiceException, SdkClientException, QueryException { + OperationWithMapOperationContextParamRequest operationWithMapOperationContextParamRequest) + throws AwsServiceException, SdkClientException, QueryException { HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(OperationWithMapOperationContextParamResponse::builder); + .createResponseHandler(OperationWithMapOperationContextParamResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithMapOperationContextParamRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithMapOperationContextParamRequest.overrideConfiguration().orElse(null)); + operationWithMapOperationContextParamRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithMapOperationContextParam"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithMapOperationContextParam").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withInput(operationWithMapOperationContextParamRequest).withMetricCollector(apiCallMetricCollector) - .withMarshaller(new OperationWithMapOperationContextParamRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithMapOperationContextParam").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withInput(operationWithMapOperationContextParamRequest).withMetricCollector(apiCallMetricCollector) + .withMarshaller(new OperationWithMapOperationContextParamRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -580,30 +579,30 @@ public OperationWithMapOperationContextParamResponse operationWithMapOperationCo */ @Override public OperationWithNoneAuthTypeResponse operationWithNoneAuthType( - OperationWithNoneAuthTypeRequest operationWithNoneAuthTypeRequest) throws AwsServiceException, SdkClientException, - QueryException { + OperationWithNoneAuthTypeRequest operationWithNoneAuthTypeRequest) throws AwsServiceException, SdkClientException, + QueryException { HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(OperationWithNoneAuthTypeResponse::builder); + .createResponseHandler(OperationWithNoneAuthTypeResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithNoneAuthTypeRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithNoneAuthTypeRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithNoneAuthType"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithNoneAuthType").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(operationWithNoneAuthTypeRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new OperationWithNoneAuthTypeRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithNoneAuthType").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(operationWithNoneAuthTypeRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new OperationWithNoneAuthTypeRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -628,30 +627,30 @@ public OperationWithNoneAuthTypeResponse operationWithNoneAuthType( */ @Override public OperationWithOperationContextParamResponse operationWithOperationContextParam( - OperationWithOperationContextParamRequest operationWithOperationContextParamRequest) throws AwsServiceException, - SdkClientException, QueryException { + OperationWithOperationContextParamRequest operationWithOperationContextParamRequest) throws AwsServiceException, + SdkClientException, QueryException { HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(OperationWithOperationContextParamResponse::builder); + .createResponseHandler(OperationWithOperationContextParamResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithOperationContextParamRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithOperationContextParamRequest.overrideConfiguration().orElse(null)); + operationWithOperationContextParamRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithOperationContextParam"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithOperationContextParam").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(operationWithOperationContextParamRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new OperationWithOperationContextParamRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithOperationContextParam").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(operationWithOperationContextParamRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new OperationWithOperationContextParamRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -675,35 +674,35 @@ public OperationWithOperationContextParamResponse operationWithOperationContextP */ @Override public OperationWithRequestCompressionResponse operationWithRequestCompression( - OperationWithRequestCompressionRequest operationWithRequestCompressionRequest) throws AwsServiceException, - SdkClientException, QueryException { + OperationWithRequestCompressionRequest operationWithRequestCompressionRequest) throws AwsServiceException, + SdkClientException, QueryException { HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(OperationWithRequestCompressionResponse::builder); + .createResponseHandler(OperationWithRequestCompressionResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithRequestCompressionRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithRequestCompressionRequest.overrideConfiguration().orElse(null)); + operationWithRequestCompressionRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithRequestCompression"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithRequestCompression") - .withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withInput(operationWithRequestCompressionRequest) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute(SdkInternalExecutionAttribute.REQUEST_COMPRESSION, - RequestCompression.builder().encodings("gzip").isStreaming(false).build()) - .withMarshaller(new OperationWithRequestCompressionRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithRequestCompression") + .withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withInput(operationWithRequestCompressionRequest) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute(SdkInternalExecutionAttribute.REQUEST_COMPRESSION, + RequestCompression.builder().encodings("gzip").isStreaming(false).build()) + .withMarshaller(new OperationWithRequestCompressionRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -727,30 +726,30 @@ public OperationWithRequestCompressionResponse operationWithRequestCompression( */ @Override public OperationWithStaticContextParamsResponse operationWithStaticContextParams( - OperationWithStaticContextParamsRequest operationWithStaticContextParamsRequest) throws AwsServiceException, - SdkClientException, QueryException { + OperationWithStaticContextParamsRequest operationWithStaticContextParamsRequest) throws AwsServiceException, + SdkClientException, QueryException { HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(OperationWithStaticContextParamsResponse::builder); + .createResponseHandler(OperationWithStaticContextParamsResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithStaticContextParamsRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithStaticContextParamsRequest.overrideConfiguration().orElse(null)); + operationWithStaticContextParamsRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithStaticContextParams"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithStaticContextParams").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(operationWithStaticContextParamsRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new OperationWithStaticContextParamsRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithStaticContextParams").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(operationWithStaticContextParamsRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new OperationWithStaticContextParamsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -800,47 +799,47 @@ public OperationWithStaticContextParamsResponse operationWithStaticContextParams */ @Override public ReturnT putOperationWithChecksum(PutOperationWithChecksumRequest putOperationWithChecksumRequest, - RequestBody requestBody, ResponseTransformer responseTransformer) - throws AwsServiceException, SdkClientException, QueryException { + RequestBody requestBody, ResponseTransformer responseTransformer) + throws AwsServiceException, SdkClientException, QueryException { HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(PutOperationWithChecksumResponse::builder); + .createResponseHandler(PutOperationWithChecksumResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putOperationWithChecksumRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, putOperationWithChecksumRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PutOperationWithChecksum"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("PutOperationWithChecksum") - .withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withInput(putOperationWithChecksumRequest) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute( - SdkInternalExecutionAttribute.HTTP_CHECKSUM, - HttpChecksum - .builder() - .requestChecksumRequired(false) - .isRequestStreaming(true) - .requestValidationMode(putOperationWithChecksumRequest.checksumModeAsString()) - .responseAlgorithmsV2(DefaultChecksumAlgorithm.CRC32C, - DefaultChecksumAlgorithm.CRC32, DefaultChecksumAlgorithm.SHA1, - DefaultChecksumAlgorithm.SHA256).build()) - .withRequestBody(requestBody) - .withMarshaller( - StreamingRequestMarshaller.builder() - .delegateMarshaller(new PutOperationWithChecksumRequestMarshaller(protocolFactory)) - .requestBody(requestBody).build())); + .execute(new ClientExecutionParams() + .withOperationName("PutOperationWithChecksum") + .withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withInput(putOperationWithChecksumRequest) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute( + SdkInternalExecutionAttribute.HTTP_CHECKSUM, + HttpChecksum + .builder() + .requestChecksumRequired(false) + .isRequestStreaming(true) + .requestValidationMode(putOperationWithChecksumRequest.checksumModeAsString()) + .responseAlgorithmsV2(DefaultChecksumAlgorithm.CRC32C, + DefaultChecksumAlgorithm.CRC32, DefaultChecksumAlgorithm.SHA1, + DefaultChecksumAlgorithm.SHA256).build()) + .withRequestBody(requestBody) + .withMarshaller( + StreamingRequestMarshaller.builder() + .delegateMarshaller(new PutOperationWithChecksumRequestMarshaller(protocolFactory)) + .requestBody(requestBody).build())); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -875,36 +874,36 @@ public ReturnT putOperationWithChecksum(PutOperationWithChecksumReques */ @Override public StreamingInputOperationResponse streamingInputOperation(StreamingInputOperationRequest streamingInputOperationRequest, - RequestBody requestBody) throws AwsServiceException, SdkClientException, QueryException { + RequestBody requestBody) throws AwsServiceException, SdkClientException, QueryException { HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(StreamingInputOperationResponse::builder); + .createResponseHandler(StreamingInputOperationResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingInputOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingInputOperation"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("StreamingInputOperation") - .withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withInput(streamingInputOperationRequest) - .withMetricCollector(apiCallMetricCollector) - .withRequestBody(requestBody) - .withMarshaller( - StreamingRequestMarshaller.builder() - .delegateMarshaller(new StreamingInputOperationRequestMarshaller(protocolFactory)) - .requestBody(requestBody).build())); + .execute(new ClientExecutionParams() + .withOperationName("StreamingInputOperation") + .withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withInput(streamingInputOperationRequest) + .withMetricCollector(apiCallMetricCollector) + .withRequestBody(requestBody) + .withMarshaller( + StreamingRequestMarshaller.builder() + .delegateMarshaller(new StreamingInputOperationRequestMarshaller(protocolFactory)) + .requestBody(requestBody).build())); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -935,30 +934,30 @@ public StreamingInputOperationResponse streamingInputOperation(StreamingInputOpe */ @Override public ReturnT streamingOutputOperation(StreamingOutputOperationRequest streamingOutputOperationRequest, - ResponseTransformer responseTransformer) throws AwsServiceException, - SdkClientException, QueryException { + ResponseTransformer responseTransformer) throws AwsServiceException, + SdkClientException, QueryException { HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(StreamingOutputOperationResponse::builder); + .createResponseHandler(StreamingOutputOperationResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingOutputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingOutputOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingOutputOperation"); return clientHandler.execute( - new ClientExecutionParams() - .withOperationName("StreamingOutputOperation").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(streamingOutputOperationRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new StreamingOutputOperationRequestMarshaller(protocolFactory)), responseTransformer); + new ClientExecutionParams() + .withOperationName("StreamingOutputOperation").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(streamingOutputOperationRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new StreamingOutputOperationRequestMarshaller(protocolFactory)), responseTransformer); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -983,7 +982,7 @@ public final String serviceName() { } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, - RequestOverrideConfiguration requestOverrideConfiguration) { + RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); @@ -1035,12 +1034,8 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, } private AwsQueryProtocolFactory init() { - return AwsQueryProtocolFactory - .builder() - .registerModeledException( - ExceptionMetadata.builder().errorCode("InvalidInput") - .exceptionBuilderSupplier(InvalidInputException::builder).httpStatusCode(400).build()) - .clientConfiguration(clientConfiguration).defaultServiceExceptionSupplier(QueryException::builder).build(); + return AwsQueryProtocolFactory.builder().clientConfiguration(clientConfiguration) + .defaultServiceExceptionSupplier(QueryException::builder).build(); } @Override diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-async-client-class.java index c082dd8f8ab0..b6e33dd52c20 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-async-client-class.java @@ -46,7 +46,6 @@ 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.xml.AwsXmlProtocolFactory; import software.amazon.awssdk.protocols.xml.XmlOperationMetadata; import software.amazon.awssdk.retries.api.RetryStrategy; @@ -63,7 +62,6 @@ import software.amazon.awssdk.services.xml.model.EventStreamOperationResponseHandler; import software.amazon.awssdk.services.xml.model.GetOperationWithChecksumRequest; import software.amazon.awssdk.services.xml.model.GetOperationWithChecksumResponse; -import software.amazon.awssdk.services.xml.model.InvalidInputException; import software.amazon.awssdk.services.xml.model.OperationWithChecksumRequiredRequest; import software.amazon.awssdk.services.xml.model.OperationWithChecksumRequiredResponse; import software.amazon.awssdk.services.xml.model.OperationWithNoneAuthTypeRequest; @@ -102,7 +100,7 @@ final class DefaultXmlAsyncClient implements XmlAsyncClient { private static final Logger log = LoggerFactory.getLogger(DefaultXmlAsyncClient.class); private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder() - .serviceProtocol(AwsServiceProtocol.REST_XML).build(); + .serviceProtocol(AwsServiceProtocol.REST_XML).build(); private final AsyncClientHandler clientHandler; @@ -147,26 +145,26 @@ protected DefaultXmlAsyncClient(SdkClientConfiguration clientConfiguration) { public CompletableFuture aPostOperation(APostOperationRequest aPostOperationRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "APostOperation"); HttpResponseHandler> responseHandler = protocolFactory - .createCombinedResponseHandler(APostOperationResponse::builder, - new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + .createCombinedResponseHandler(APostOperationResponse::builder, + new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); String hostPrefix = "foo-"; String resolvedHostExpression = "foo-"; CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("APostOperation").withRequestConfiguration(clientConfiguration) - .withProtocolMetadata(protocolMetadata) - .withMarshaller(new APostOperationRequestMarshaller(protocolFactory)) - .withCombinedResponseHandler(responseHandler).hostPrefixExpression(resolvedHostExpression) - .withMetricCollector(apiCallMetricCollector).withInput(aPostOperationRequest)); + .execute(new ClientExecutionParams() + .withOperationName("APostOperation").withRequestConfiguration(clientConfiguration) + .withProtocolMetadata(protocolMetadata) + .withMarshaller(new APostOperationRequestMarshaller(protocolFactory)) + .withCombinedResponseHandler(responseHandler).hostPrefixExpression(resolvedHostExpression) + .withMetricCollector(apiCallMetricCollector).withInput(aPostOperationRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -205,28 +203,28 @@ public CompletableFuture aPostOperation(APostOperationRe */ @Override public CompletableFuture aPostOperationWithOutput( - APostOperationWithOutputRequest aPostOperationWithOutputRequest) { + APostOperationWithOutputRequest aPostOperationWithOutputRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationWithOutputRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationWithOutputRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "APostOperationWithOutput"); HttpResponseHandler> responseHandler = protocolFactory - .createCombinedResponseHandler(APostOperationWithOutputResponse::builder, - new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + .createCombinedResponseHandler(APostOperationWithOutputResponse::builder, + new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("APostOperationWithOutput").withRequestConfiguration(clientConfiguration) - .withProtocolMetadata(protocolMetadata) - .withMarshaller(new APostOperationWithOutputRequestMarshaller(protocolFactory)) - .withCombinedResponseHandler(responseHandler).withMetricCollector(apiCallMetricCollector) - .withInput(aPostOperationWithOutputRequest)); + .execute(new ClientExecutionParams() + .withOperationName("APostOperationWithOutput").withRequestConfiguration(clientConfiguration) + .withProtocolMetadata(protocolMetadata) + .withMarshaller(new APostOperationWithOutputRequestMarshaller(protocolFactory)) + .withCombinedResponseHandler(responseHandler).withMetricCollector(apiCallMetricCollector) + .withInput(aPostOperationWithOutputRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -261,28 +259,28 @@ public CompletableFuture aPostOperationWithOut */ @Override public CompletableFuture bearerAuthOperation( - BearerAuthOperationRequest bearerAuthOperationRequest) { + BearerAuthOperationRequest bearerAuthOperationRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(bearerAuthOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, bearerAuthOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "BearerAuthOperation"); HttpResponseHandler> responseHandler = protocolFactory - .createCombinedResponseHandler(BearerAuthOperationResponse::builder, - new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + .createCombinedResponseHandler(BearerAuthOperationResponse::builder, + new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("BearerAuthOperation").withRequestConfiguration(clientConfiguration) - .withProtocolMetadata(protocolMetadata) - .withMarshaller(new BearerAuthOperationRequestMarshaller(protocolFactory)) - .withCombinedResponseHandler(responseHandler).credentialType(CredentialType.TOKEN) - .withMetricCollector(apiCallMetricCollector).withInput(bearerAuthOperationRequest)); + .execute(new ClientExecutionParams() + .withOperationName("BearerAuthOperation").withRequestConfiguration(clientConfiguration) + .withProtocolMetadata(protocolMetadata) + .withMarshaller(new BearerAuthOperationRequestMarshaller(protocolFactory)) + .withCombinedResponseHandler(responseHandler).credentialType(CredentialType.TOKEN) + .withMetricCollector(apiCallMetricCollector).withInput(bearerAuthOperationRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -317,51 +315,51 @@ public CompletableFuture bearerAuthOperation( */ @Override public CompletableFuture eventStreamOperation(EventStreamOperationRequest eventStreamOperationRequest, - EventStreamOperationResponseHandler asyncResponseHandler) { + EventStreamOperationResponseHandler asyncResponseHandler) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(eventStreamOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, eventStreamOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "EventStreamOperation"); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - EventStreamOperationResponse::builder, XmlOperationMetadata.builder().hasStreamingSuccessResponse(true) - .build()); + EventStreamOperationResponse::builder, XmlOperationMetadata.builder().hasStreamingSuccessResponse(true) + .build()); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); HttpResponseHandler eventResponseHandler = protocolFactory.createResponseHandler( - EventStreamTaggedUnionPojoSupplier.builder() - .putSdkPojoSupplier("EventPayloadEvent", EventStream::eventPayloadEventBuilder) - .putSdkPojoSupplier("NonEventPayloadEvent", EventStream::nonEventPayloadEventBuilder) - .putSdkPojoSupplier("SecondEventPayloadEvent", EventStream::secondEventPayloadEventBuilder) - .defaultSdkPojoSupplier(() -> new SdkPojoBuilder(EventStream.UNKNOWN)).build(), XmlOperationMetadata - .builder().hasStreamingSuccessResponse(false).build()); + EventStreamTaggedUnionPojoSupplier.builder() + .putSdkPojoSupplier("EventPayloadEvent", EventStream::eventPayloadEventBuilder) + .putSdkPojoSupplier("NonEventPayloadEvent", EventStream::nonEventPayloadEventBuilder) + .putSdkPojoSupplier("SecondEventPayloadEvent", EventStream::secondEventPayloadEventBuilder) + .defaultSdkPojoSupplier(() -> new SdkPojoBuilder(EventStream.UNKNOWN)).build(), XmlOperationMetadata + .builder().hasStreamingSuccessResponse(false).build()); CompletableFuture eventStreamTransformFuture = new CompletableFuture<>(); EventStreamAsyncResponseTransformer asyncResponseTransformer = EventStreamAsyncResponseTransformer - . builder().eventStreamResponseHandler(asyncResponseHandler) - .eventResponseHandler(eventResponseHandler).initialResponseHandler(responseHandler) - .exceptionResponseHandler(errorResponseHandler).future(eventStreamTransformFuture).executor(executor) - .serviceName(serviceName()).build(); + . builder().eventStreamResponseHandler(asyncResponseHandler) + .eventResponseHandler(eventResponseHandler).initialResponseHandler(responseHandler) + .exceptionResponseHandler(errorResponseHandler).future(eventStreamTransformFuture).executor(executor) + .serviceName(serviceName()).build(); RestEventStreamAsyncResponseTransformer restAsyncResponseTransformer = RestEventStreamAsyncResponseTransformer - . builder() - .eventStreamAsyncResponseTransformer(asyncResponseTransformer) - .eventStreamResponseHandler(asyncResponseHandler).build(); + . builder() + .eventStreamAsyncResponseTransformer(asyncResponseTransformer) + .eventStreamResponseHandler(asyncResponseHandler).build(); CompletableFuture executeFuture = clientHandler.execute( - new ClientExecutionParams() - .withOperationName("EventStreamOperation").withRequestConfiguration(clientConfiguration) - .withProtocolMetadata(protocolMetadata) - .withMarshaller(new EventStreamOperationRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withMetricCollector(apiCallMetricCollector).withInput(eventStreamOperationRequest), - restAsyncResponseTransformer); + new ClientExecutionParams() + .withOperationName("EventStreamOperation").withRequestConfiguration(clientConfiguration) + .withProtocolMetadata(protocolMetadata) + .withMarshaller(new EventStreamOperationRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withMetricCollector(apiCallMetricCollector).withInput(eventStreamOperationRequest), + restAsyncResponseTransformer); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { if (e != null) { runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> asyncResponseHandler.exceptionOccurred(e)); + () -> asyncResponseHandler.exceptionOccurred(e)); eventStreamTransformFuture.completeExceptionally(e); } metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -370,7 +368,7 @@ public CompletableFuture eventStreamOperation(EventStreamOperationRequest return CompletableFutureUtils.forwardExceptionTo(eventStreamTransformFuture, executeFuture); } catch (Throwable t) { runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> asyncResponseHandler.exceptionOccurred(t)); + () -> asyncResponseHandler.exceptionOccurred(t)); metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } @@ -398,35 +396,35 @@ public CompletableFuture eventStreamOperation(EventStreamOperationRequest */ @Override public CompletableFuture getOperationWithChecksum( - GetOperationWithChecksumRequest getOperationWithChecksumRequest) { + GetOperationWithChecksumRequest getOperationWithChecksumRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getOperationWithChecksumRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getOperationWithChecksumRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetOperationWithChecksum"); HttpResponseHandler> responseHandler = protocolFactory - .createCombinedResponseHandler(GetOperationWithChecksumResponse::builder, - new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + .createCombinedResponseHandler(GetOperationWithChecksumResponse::builder, + new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("GetOperationWithChecksum") - .withRequestConfiguration(clientConfiguration) - .withProtocolMetadata(protocolMetadata) - .withMarshaller(new GetOperationWithChecksumRequestMarshaller(protocolFactory)) - .withCombinedResponseHandler(responseHandler) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute( - SdkInternalExecutionAttribute.HTTP_CHECKSUM, - HttpChecksum.builder().requestChecksumRequired(true).isRequestStreaming(false) - .requestAlgorithm(getOperationWithChecksumRequest.checksumAlgorithmAsString()) - .requestAlgorithmHeader("x-amz-sdk-checksum-algorithm").build()) - .withInput(getOperationWithChecksumRequest)); + .execute(new ClientExecutionParams() + .withOperationName("GetOperationWithChecksum") + .withRequestConfiguration(clientConfiguration) + .withProtocolMetadata(protocolMetadata) + .withMarshaller(new GetOperationWithChecksumRequestMarshaller(protocolFactory)) + .withCombinedResponseHandler(responseHandler) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute( + SdkInternalExecutionAttribute.HTTP_CHECKSUM, + HttpChecksum.builder().requestChecksumRequired(true).isRequestStreaming(false) + .requestAlgorithm(getOperationWithChecksumRequest.checksumAlgorithmAsString()) + .requestAlgorithmHeader("x-amz-sdk-checksum-algorithm").build()) + .withInput(getOperationWithChecksumRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -462,31 +460,31 @@ public CompletableFuture getOperationWithCheck */ @Override public CompletableFuture operationWithChecksumRequired( - OperationWithChecksumRequiredRequest operationWithChecksumRequiredRequest) { + OperationWithChecksumRequiredRequest operationWithChecksumRequiredRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithChecksumRequiredRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithChecksumRequiredRequest.overrideConfiguration().orElse(null)); + operationWithChecksumRequiredRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithChecksumRequired"); HttpResponseHandler> responseHandler = protocolFactory - .createCombinedResponseHandler(OperationWithChecksumRequiredResponse::builder, - new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + .createCombinedResponseHandler(OperationWithChecksumRequiredResponse::builder, + new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithChecksumRequired") - .withRequestConfiguration(clientConfiguration) - .withProtocolMetadata(protocolMetadata) - .withMarshaller(new OperationWithChecksumRequiredRequestMarshaller(protocolFactory)) - .withCombinedResponseHandler(responseHandler) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute(SdkInternalExecutionAttribute.HTTP_CHECKSUM_REQUIRED, - HttpChecksumRequired.create()).withInput(operationWithChecksumRequiredRequest)); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithChecksumRequired") + .withRequestConfiguration(clientConfiguration) + .withProtocolMetadata(protocolMetadata) + .withMarshaller(new OperationWithChecksumRequiredRequestMarshaller(protocolFactory)) + .withCombinedResponseHandler(responseHandler) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute(SdkInternalExecutionAttribute.HTTP_CHECKSUM_REQUIRED, + HttpChecksumRequired.create()).withInput(operationWithChecksumRequiredRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -521,28 +519,28 @@ public CompletableFuture operationWithChe */ @Override public CompletableFuture operationWithNoneAuthType( - OperationWithNoneAuthTypeRequest operationWithNoneAuthTypeRequest) { + OperationWithNoneAuthTypeRequest operationWithNoneAuthTypeRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithNoneAuthTypeRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithNoneAuthTypeRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithNoneAuthType"); HttpResponseHandler> responseHandler = protocolFactory - .createCombinedResponseHandler(OperationWithNoneAuthTypeResponse::builder, - new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + .createCombinedResponseHandler(OperationWithNoneAuthTypeResponse::builder, + new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithNoneAuthType").withRequestConfiguration(clientConfiguration) - .withProtocolMetadata(protocolMetadata) - .withMarshaller(new OperationWithNoneAuthTypeRequestMarshaller(protocolFactory)) - .withCombinedResponseHandler(responseHandler).withMetricCollector(apiCallMetricCollector) - .withInput(operationWithNoneAuthTypeRequest)); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithNoneAuthType").withRequestConfiguration(clientConfiguration) + .withProtocolMetadata(protocolMetadata) + .withMarshaller(new OperationWithNoneAuthTypeRequestMarshaller(protocolFactory)) + .withCombinedResponseHandler(responseHandler).withMetricCollector(apiCallMetricCollector) + .withInput(operationWithNoneAuthTypeRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -578,32 +576,32 @@ public CompletableFuture operationWithNoneAut */ @Override public CompletableFuture operationWithRequestCompression( - OperationWithRequestCompressionRequest operationWithRequestCompressionRequest) { + OperationWithRequestCompressionRequest operationWithRequestCompressionRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithRequestCompressionRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithRequestCompressionRequest.overrideConfiguration().orElse(null)); + operationWithRequestCompressionRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithRequestCompression"); HttpResponseHandler> responseHandler = protocolFactory - .createCombinedResponseHandler(OperationWithRequestCompressionResponse::builder, - new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + .createCombinedResponseHandler(OperationWithRequestCompressionResponse::builder, + new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithRequestCompression") - .withRequestConfiguration(clientConfiguration) - .withProtocolMetadata(protocolMetadata) - .withMarshaller(new OperationWithRequestCompressionRequestMarshaller(protocolFactory)) - .withCombinedResponseHandler(responseHandler) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute(SdkInternalExecutionAttribute.REQUEST_COMPRESSION, - RequestCompression.builder().encodings("gzip").isStreaming(false).build()) - .withInput(operationWithRequestCompressionRequest)); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithRequestCompression") + .withRequestConfiguration(clientConfiguration) + .withProtocolMetadata(protocolMetadata) + .withMarshaller(new OperationWithRequestCompressionRequestMarshaller(protocolFactory)) + .withCombinedResponseHandler(responseHandler) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute(SdkInternalExecutionAttribute.REQUEST_COMPRESSION, + RequestCompression.builder().encodings("gzip").isStreaming(false).build()) + .withInput(operationWithRequestCompressionRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -656,56 +654,56 @@ public CompletableFuture operationWithR */ @Override public CompletableFuture putOperationWithChecksum( - PutOperationWithChecksumRequest putOperationWithChecksumRequest, AsyncRequestBody requestBody, - AsyncResponseTransformer asyncResponseTransformer) { + PutOperationWithChecksumRequest putOperationWithChecksumRequest, AsyncRequestBody requestBody, + AsyncResponseTransformer asyncResponseTransformer) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putOperationWithChecksumRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, putOperationWithChecksumRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PutOperationWithChecksum"); Pair, CompletableFuture> pair = AsyncResponseTransformerUtils - .wrapWithEndOfStreamFuture(asyncResponseTransformer); + .wrapWithEndOfStreamFuture(asyncResponseTransformer); asyncResponseTransformer = pair.left(); CompletableFuture endOfStreamFuture = pair.right(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - PutOperationWithChecksumResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(true)); + PutOperationWithChecksumResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(true)); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler.execute( - new ClientExecutionParams() - .withOperationName("PutOperationWithChecksum") - .withProtocolMetadata(protocolMetadata) - .withMarshaller( - AsyncStreamingRequestMarshaller.builder() - .delegateMarshaller(new PutOperationWithChecksumRequestMarshaller(protocolFactory)) - .asyncRequestBody(requestBody).build()) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute( - SdkInternalExecutionAttribute.HTTP_CHECKSUM, - HttpChecksum - .builder() - .requestChecksumRequired(false) - .isRequestStreaming(true) - .requestValidationMode(putOperationWithChecksumRequest.checksumModeAsString()) - .responseAlgorithmsV2(DefaultChecksumAlgorithm.CRC32C, - DefaultChecksumAlgorithm.CRC32, DefaultChecksumAlgorithm.SHA1, - DefaultChecksumAlgorithm.SHA256).build()).withAsyncRequestBody(requestBody) - .withInput(putOperationWithChecksumRequest), asyncResponseTransformer); + new ClientExecutionParams() + .withOperationName("PutOperationWithChecksum") + .withProtocolMetadata(protocolMetadata) + .withMarshaller( + AsyncStreamingRequestMarshaller.builder() + .delegateMarshaller(new PutOperationWithChecksumRequestMarshaller(protocolFactory)) + .asyncRequestBody(requestBody).build()) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute( + SdkInternalExecutionAttribute.HTTP_CHECKSUM, + HttpChecksum + .builder() + .requestChecksumRequired(false) + .isRequestStreaming(true) + .requestValidationMode(putOperationWithChecksumRequest.checksumModeAsString()) + .responseAlgorithmsV2(DefaultChecksumAlgorithm.CRC32C, + DefaultChecksumAlgorithm.CRC32, DefaultChecksumAlgorithm.SHA1, + DefaultChecksumAlgorithm.SHA256).build()).withAsyncRequestBody(requestBody) + .withInput(putOperationWithChecksumRequest), asyncResponseTransformer); CompletableFuture whenCompleteFuture = null; AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { if (e != null) { runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> finalAsyncResponseTransformer.exceptionOccurred(e)); + () -> finalAsyncResponseTransformer.exceptionOccurred(e)); } endOfStreamFuture.whenComplete((r2, e2) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -715,7 +713,7 @@ public CompletableFuture putOperationWithChecksum( } catch (Throwable t) { AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> finalAsyncResponseTransformer.exceptionOccurred(t)); + () -> finalAsyncResponseTransformer.exceptionOccurred(t)); metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } @@ -748,32 +746,32 @@ public CompletableFuture putOperationWithChecksum( */ @Override public CompletableFuture streamingInputOperation( - StreamingInputOperationRequest streamingInputOperationRequest, AsyncRequestBody requestBody) { + StreamingInputOperationRequest streamingInputOperationRequest, AsyncRequestBody requestBody) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingInputOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingInputOperation"); HttpResponseHandler> responseHandler = protocolFactory - .createCombinedResponseHandler(StreamingInputOperationResponse::builder, - new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + .createCombinedResponseHandler(StreamingInputOperationResponse::builder, + new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("StreamingInputOperation") - .withRequestConfiguration(clientConfiguration) - .withProtocolMetadata(protocolMetadata) - .withMarshaller( - AsyncStreamingRequestMarshaller.builder() - .delegateMarshaller(new StreamingInputOperationRequestMarshaller(protocolFactory)) - .asyncRequestBody(requestBody).build()).withCombinedResponseHandler(responseHandler) - .withMetricCollector(apiCallMetricCollector).withAsyncRequestBody(requestBody) - .withInput(streamingInputOperationRequest)); + .execute(new ClientExecutionParams() + .withOperationName("StreamingInputOperation") + .withRequestConfiguration(clientConfiguration) + .withProtocolMetadata(protocolMetadata) + .withMarshaller( + AsyncStreamingRequestMarshaller.builder() + .delegateMarshaller(new StreamingInputOperationRequestMarshaller(protocolFactory)) + .asyncRequestBody(requestBody).build()).withCombinedResponseHandler(responseHandler) + .withMetricCollector(apiCallMetricCollector).withAsyncRequestBody(requestBody) + .withInput(streamingInputOperationRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -813,40 +811,40 @@ public CompletableFuture streamingInputOperatio */ @Override public CompletableFuture streamingOutputOperation( - StreamingOutputOperationRequest streamingOutputOperationRequest, - AsyncResponseTransformer asyncResponseTransformer) { + StreamingOutputOperationRequest streamingOutputOperationRequest, + AsyncResponseTransformer asyncResponseTransformer) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingOutputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingOutputOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingOutputOperation"); Pair, CompletableFuture> pair = AsyncResponseTransformerUtils - .wrapWithEndOfStreamFuture(asyncResponseTransformer); + .wrapWithEndOfStreamFuture(asyncResponseTransformer); asyncResponseTransformer = pair.left(); CompletableFuture endOfStreamFuture = pair.right(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - StreamingOutputOperationResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(true)); + StreamingOutputOperationResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(true)); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler.execute( - new ClientExecutionParams() - .withOperationName("StreamingOutputOperation").withProtocolMetadata(protocolMetadata) - .withMarshaller(new StreamingOutputOperationRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(streamingOutputOperationRequest), asyncResponseTransformer); + new ClientExecutionParams() + .withOperationName("StreamingOutputOperation").withProtocolMetadata(protocolMetadata) + .withMarshaller(new StreamingOutputOperationRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(streamingOutputOperationRequest), asyncResponseTransformer); CompletableFuture whenCompleteFuture = null; AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { if (e != null) { runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> finalAsyncResponseTransformer.exceptionOccurred(e)); + () -> finalAsyncResponseTransformer.exceptionOccurred(e)); } endOfStreamFuture.whenComplete((r2, e2) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -856,7 +854,7 @@ public CompletableFuture streamingOutputOperation( } catch (Throwable t) { AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> finalAsyncResponseTransformer.exceptionOccurred(t)); + () -> finalAsyncResponseTransformer.exceptionOccurred(t)); metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } @@ -873,16 +871,12 @@ public final String serviceName() { } private AwsXmlProtocolFactory init() { - return AwsXmlProtocolFactory - .builder() - .registerModeledException( - ExceptionMetadata.builder().errorCode("InvalidInput") - .exceptionBuilderSupplier(InvalidInputException::builder).httpStatusCode(400).build()) - .clientConfiguration(clientConfiguration).defaultServiceExceptionSupplier(XmlException::builder).build(); + return AwsXmlProtocolFactory.builder().clientConfiguration(clientConfiguration) + .defaultServiceExceptionSupplier(XmlException::builder).build(); } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, - RequestOverrideConfiguration requestOverrideConfiguration) { + RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-client-class.java index 457d5a36c2c3..3ea1c77e73c0 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-client-class.java @@ -35,7 +35,6 @@ 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.xml.AwsXmlProtocolFactory; import software.amazon.awssdk.protocols.xml.XmlOperationMetadata; import software.amazon.awssdk.retries.api.RetryStrategy; @@ -85,7 +84,7 @@ final class DefaultXmlClient implements XmlClient { private static final Logger log = Logger.loggerFor(DefaultXmlClient.class); private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder() - .serviceProtocol(AwsServiceProtocol.REST_XML).build(); + .serviceProtocol(AwsServiceProtocol.REST_XML).build(); private final SyncClientHandler clientHandler; @@ -121,15 +120,15 @@ protected DefaultXmlClient(SdkClientConfiguration clientConfiguration) { */ @Override public APostOperationResponse aPostOperation(APostOperationRequest aPostOperationRequest) throws InvalidInputException, - AwsServiceException, SdkClientException, XmlException { + AwsServiceException, SdkClientException, XmlException { HttpResponseHandler> responseHandler = protocolFactory.createCombinedResponseHandler( - APostOperationResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + APostOperationResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "APostOperation"); @@ -137,10 +136,10 @@ public APostOperationResponse aPostOperation(APostOperationRequest aPostOperatio String resolvedHostExpression = "foo-"; return clientHandler.execute(new ClientExecutionParams() - .withOperationName("APostOperation").withProtocolMetadata(protocolMetadata) - .withCombinedResponseHandler(responseHandler).withMetricCollector(apiCallMetricCollector) - .hostPrefixExpression(resolvedHostExpression).withRequestConfiguration(clientConfiguration) - .withInput(aPostOperationRequest).withMarshaller(new APostOperationRequestMarshaller(protocolFactory))); + .withOperationName("APostOperation").withProtocolMetadata(protocolMetadata) + .withCombinedResponseHandler(responseHandler).withMetricCollector(apiCallMetricCollector) + .hostPrefixExpression(resolvedHostExpression).withRequestConfiguration(clientConfiguration) + .withInput(aPostOperationRequest).withMarshaller(new APostOperationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -168,28 +167,28 @@ public APostOperationResponse aPostOperation(APostOperationRequest aPostOperatio */ @Override public APostOperationWithOutputResponse aPostOperationWithOutput( - APostOperationWithOutputRequest aPostOperationWithOutputRequest) throws InvalidInputException, AwsServiceException, - SdkClientException, XmlException { + APostOperationWithOutputRequest aPostOperationWithOutputRequest) throws InvalidInputException, AwsServiceException, + SdkClientException, XmlException { HttpResponseHandler> responseHandler = protocolFactory - .createCombinedResponseHandler(APostOperationWithOutputResponse::builder, - new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + .createCombinedResponseHandler(APostOperationWithOutputResponse::builder, + new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationWithOutputRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationWithOutputRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "APostOperationWithOutput"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("APostOperationWithOutput").withProtocolMetadata(protocolMetadata) - .withCombinedResponseHandler(responseHandler).withMetricCollector(apiCallMetricCollector) - .withRequestConfiguration(clientConfiguration).withInput(aPostOperationWithOutputRequest) - .withMarshaller(new APostOperationWithOutputRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("APostOperationWithOutput").withProtocolMetadata(protocolMetadata) + .withCombinedResponseHandler(responseHandler).withMetricCollector(apiCallMetricCollector) + .withRequestConfiguration(clientConfiguration).withInput(aPostOperationWithOutputRequest) + .withMarshaller(new APostOperationWithOutputRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -213,27 +212,27 @@ public APostOperationWithOutputResponse aPostOperationWithOutput( */ @Override public BearerAuthOperationResponse bearerAuthOperation(BearerAuthOperationRequest bearerAuthOperationRequest) - throws AwsServiceException, SdkClientException, XmlException { + throws AwsServiceException, SdkClientException, XmlException { HttpResponseHandler> responseHandler = protocolFactory - .createCombinedResponseHandler(BearerAuthOperationResponse::builder, - new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + .createCombinedResponseHandler(BearerAuthOperationResponse::builder, + new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(bearerAuthOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, bearerAuthOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "BearerAuthOperation"); return clientHandler.execute(new ClientExecutionParams() - .withOperationName("BearerAuthOperation").withProtocolMetadata(protocolMetadata) - .withCombinedResponseHandler(responseHandler).withMetricCollector(apiCallMetricCollector) - .credentialType(CredentialType.TOKEN).withRequestConfiguration(clientConfiguration) - .withInput(bearerAuthOperationRequest) - .withMarshaller(new BearerAuthOperationRequestMarshaller(protocolFactory))); + .withOperationName("BearerAuthOperation").withProtocolMetadata(protocolMetadata) + .withCombinedResponseHandler(responseHandler).withMetricCollector(apiCallMetricCollector) + .credentialType(CredentialType.TOKEN).withRequestConfiguration(clientConfiguration) + .withInput(bearerAuthOperationRequest) + .withMarshaller(new BearerAuthOperationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -257,36 +256,36 @@ public BearerAuthOperationResponse bearerAuthOperation(BearerAuthOperationReques */ @Override public GetOperationWithChecksumResponse getOperationWithChecksum( - GetOperationWithChecksumRequest getOperationWithChecksumRequest) throws AwsServiceException, SdkClientException, - XmlException { + GetOperationWithChecksumRequest getOperationWithChecksumRequest) throws AwsServiceException, SdkClientException, + XmlException { HttpResponseHandler> responseHandler = protocolFactory - .createCombinedResponseHandler(GetOperationWithChecksumResponse::builder, - new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + .createCombinedResponseHandler(GetOperationWithChecksumResponse::builder, + new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getOperationWithChecksumRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getOperationWithChecksumRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetOperationWithChecksum"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("GetOperationWithChecksum") - .withProtocolMetadata(protocolMetadata) - .withCombinedResponseHandler(responseHandler) - .withMetricCollector(apiCallMetricCollector) - .withRequestConfiguration(clientConfiguration) - .withInput(getOperationWithChecksumRequest) - .putExecutionAttribute( - SdkInternalExecutionAttribute.HTTP_CHECKSUM, - HttpChecksum.builder().requestChecksumRequired(true).isRequestStreaming(false) - .requestAlgorithm(getOperationWithChecksumRequest.checksumAlgorithmAsString()) - .requestAlgorithmHeader("x-amz-sdk-checksum-algorithm").build()) - .withMarshaller(new GetOperationWithChecksumRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("GetOperationWithChecksum") + .withProtocolMetadata(protocolMetadata) + .withCombinedResponseHandler(responseHandler) + .withMetricCollector(apiCallMetricCollector) + .withRequestConfiguration(clientConfiguration) + .withInput(getOperationWithChecksumRequest) + .putExecutionAttribute( + SdkInternalExecutionAttribute.HTTP_CHECKSUM, + HttpChecksum.builder().requestChecksumRequired(true).isRequestStreaming(false) + .requestAlgorithm(getOperationWithChecksumRequest.checksumAlgorithmAsString()) + .requestAlgorithmHeader("x-amz-sdk-checksum-algorithm").build()) + .withMarshaller(new GetOperationWithChecksumRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -310,33 +309,33 @@ public GetOperationWithChecksumResponse getOperationWithChecksum( */ @Override public OperationWithChecksumRequiredResponse operationWithChecksumRequired( - OperationWithChecksumRequiredRequest operationWithChecksumRequiredRequest) throws AwsServiceException, - SdkClientException, XmlException { + OperationWithChecksumRequiredRequest operationWithChecksumRequiredRequest) throws AwsServiceException, + SdkClientException, XmlException { HttpResponseHandler> responseHandler = protocolFactory - .createCombinedResponseHandler(OperationWithChecksumRequiredResponse::builder, - new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + .createCombinedResponseHandler(OperationWithChecksumRequiredResponse::builder, + new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithChecksumRequiredRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithChecksumRequiredRequest.overrideConfiguration().orElse(null)); + operationWithChecksumRequiredRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithChecksumRequired"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithChecksumRequired") - .withProtocolMetadata(protocolMetadata) - .withCombinedResponseHandler(responseHandler) - .withMetricCollector(apiCallMetricCollector) - .withRequestConfiguration(clientConfiguration) - .withInput(operationWithChecksumRequiredRequest) - .putExecutionAttribute(SdkInternalExecutionAttribute.HTTP_CHECKSUM_REQUIRED, - HttpChecksumRequired.create()) - .withMarshaller(new OperationWithChecksumRequiredRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithChecksumRequired") + .withProtocolMetadata(protocolMetadata) + .withCombinedResponseHandler(responseHandler) + .withMetricCollector(apiCallMetricCollector) + .withRequestConfiguration(clientConfiguration) + .withInput(operationWithChecksumRequiredRequest) + .putExecutionAttribute(SdkInternalExecutionAttribute.HTTP_CHECKSUM_REQUIRED, + HttpChecksumRequired.create()) + .withMarshaller(new OperationWithChecksumRequiredRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -360,28 +359,28 @@ public OperationWithChecksumRequiredResponse operationWithChecksumRequired( */ @Override public OperationWithNoneAuthTypeResponse operationWithNoneAuthType( - OperationWithNoneAuthTypeRequest operationWithNoneAuthTypeRequest) throws AwsServiceException, SdkClientException, - XmlException { + OperationWithNoneAuthTypeRequest operationWithNoneAuthTypeRequest) throws AwsServiceException, SdkClientException, + XmlException { HttpResponseHandler> responseHandler = protocolFactory - .createCombinedResponseHandler(OperationWithNoneAuthTypeResponse::builder, - new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + .createCombinedResponseHandler(OperationWithNoneAuthTypeResponse::builder, + new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithNoneAuthTypeRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithNoneAuthTypeRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithNoneAuthType"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithNoneAuthType").withProtocolMetadata(protocolMetadata) - .withCombinedResponseHandler(responseHandler).withMetricCollector(apiCallMetricCollector) - .withRequestConfiguration(clientConfiguration).withInput(operationWithNoneAuthTypeRequest) - .withMarshaller(new OperationWithNoneAuthTypeRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithNoneAuthType").withProtocolMetadata(protocolMetadata) + .withCombinedResponseHandler(responseHandler).withMetricCollector(apiCallMetricCollector) + .withRequestConfiguration(clientConfiguration).withInput(operationWithNoneAuthTypeRequest) + .withMarshaller(new OperationWithNoneAuthTypeRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -405,33 +404,33 @@ public OperationWithNoneAuthTypeResponse operationWithNoneAuthType( */ @Override public OperationWithRequestCompressionResponse operationWithRequestCompression( - OperationWithRequestCompressionRequest operationWithRequestCompressionRequest) throws AwsServiceException, - SdkClientException, XmlException { + OperationWithRequestCompressionRequest operationWithRequestCompressionRequest) throws AwsServiceException, + SdkClientException, XmlException { HttpResponseHandler> responseHandler = protocolFactory - .createCombinedResponseHandler(OperationWithRequestCompressionResponse::builder, - new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + .createCombinedResponseHandler(OperationWithRequestCompressionResponse::builder, + new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithRequestCompressionRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithRequestCompressionRequest.overrideConfiguration().orElse(null)); + operationWithRequestCompressionRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithRequestCompression"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithRequestCompression") - .withProtocolMetadata(protocolMetadata) - .withCombinedResponseHandler(responseHandler) - .withMetricCollector(apiCallMetricCollector) - .withRequestConfiguration(clientConfiguration) - .withInput(operationWithRequestCompressionRequest) - .putExecutionAttribute(SdkInternalExecutionAttribute.REQUEST_COMPRESSION, - RequestCompression.builder().encodings("gzip").isStreaming(false).build()) - .withMarshaller(new OperationWithRequestCompressionRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithRequestCompression") + .withProtocolMetadata(protocolMetadata) + .withCombinedResponseHandler(responseHandler) + .withMetricCollector(apiCallMetricCollector) + .withRequestConfiguration(clientConfiguration) + .withInput(operationWithRequestCompressionRequest) + .putExecutionAttribute(SdkInternalExecutionAttribute.REQUEST_COMPRESSION, + RequestCompression.builder().encodings("gzip").isStreaming(false).build()) + .withMarshaller(new OperationWithRequestCompressionRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -481,47 +480,47 @@ public OperationWithRequestCompressionResponse operationWithRequestCompression( */ @Override public ReturnT putOperationWithChecksum(PutOperationWithChecksumRequest putOperationWithChecksumRequest, - RequestBody requestBody, ResponseTransformer responseTransformer) - throws AwsServiceException, SdkClientException, XmlException { + RequestBody requestBody, ResponseTransformer responseTransformer) + throws AwsServiceException, SdkClientException, XmlException { HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - PutOperationWithChecksumResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(true)); + PutOperationWithChecksumResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(true)); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putOperationWithChecksumRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, putOperationWithChecksumRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PutOperationWithChecksum"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("PutOperationWithChecksum") - .withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withInput(putOperationWithChecksumRequest) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute( - SdkInternalExecutionAttribute.HTTP_CHECKSUM, - HttpChecksum - .builder() - .requestChecksumRequired(false) - .isRequestStreaming(true) - .requestValidationMode(putOperationWithChecksumRequest.checksumModeAsString()) - .responseAlgorithmsV2(DefaultChecksumAlgorithm.CRC32C, - DefaultChecksumAlgorithm.CRC32, DefaultChecksumAlgorithm.SHA1, - DefaultChecksumAlgorithm.SHA256).build()) - .withRequestBody(requestBody) - .withMarshaller( - StreamingRequestMarshaller.builder() - .delegateMarshaller(new PutOperationWithChecksumRequestMarshaller(protocolFactory)) - .requestBody(requestBody).build())); + .execute(new ClientExecutionParams() + .withOperationName("PutOperationWithChecksum") + .withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withInput(putOperationWithChecksumRequest) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute( + SdkInternalExecutionAttribute.HTTP_CHECKSUM, + HttpChecksum + .builder() + .requestChecksumRequired(false) + .isRequestStreaming(true) + .requestValidationMode(putOperationWithChecksumRequest.checksumModeAsString()) + .responseAlgorithmsV2(DefaultChecksumAlgorithm.CRC32C, + DefaultChecksumAlgorithm.CRC32, DefaultChecksumAlgorithm.SHA1, + DefaultChecksumAlgorithm.SHA256).build()) + .withRequestBody(requestBody) + .withMarshaller( + StreamingRequestMarshaller.builder() + .delegateMarshaller(new PutOperationWithChecksumRequestMarshaller(protocolFactory)) + .requestBody(requestBody).build())); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -556,34 +555,34 @@ public ReturnT putOperationWithChecksum(PutOperationWithChecksumReques */ @Override public StreamingInputOperationResponse streamingInputOperation(StreamingInputOperationRequest streamingInputOperationRequest, - RequestBody requestBody) throws AwsServiceException, SdkClientException, XmlException { + RequestBody requestBody) throws AwsServiceException, SdkClientException, XmlException { HttpResponseHandler> responseHandler = protocolFactory - .createCombinedResponseHandler(StreamingInputOperationResponse::builder, - new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + .createCombinedResponseHandler(StreamingInputOperationResponse::builder, + new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingInputOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingInputOperation"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("StreamingInputOperation") - .withProtocolMetadata(protocolMetadata) - .withCombinedResponseHandler(responseHandler) - .withMetricCollector(apiCallMetricCollector) - .withRequestConfiguration(clientConfiguration) - .withInput(streamingInputOperationRequest) - .withRequestBody(requestBody) - .withMarshaller( - StreamingRequestMarshaller.builder() - .delegateMarshaller(new StreamingInputOperationRequestMarshaller(protocolFactory)) - .requestBody(requestBody).build())); + .execute(new ClientExecutionParams() + .withOperationName("StreamingInputOperation") + .withProtocolMetadata(protocolMetadata) + .withCombinedResponseHandler(responseHandler) + .withMetricCollector(apiCallMetricCollector) + .withRequestConfiguration(clientConfiguration) + .withInput(streamingInputOperationRequest) + .withRequestBody(requestBody) + .withMarshaller( + StreamingRequestMarshaller.builder() + .delegateMarshaller(new StreamingInputOperationRequestMarshaller(protocolFactory)) + .requestBody(requestBody).build())); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -614,30 +613,30 @@ public StreamingInputOperationResponse streamingInputOperation(StreamingInputOpe */ @Override public ReturnT streamingOutputOperation(StreamingOutputOperationRequest streamingOutputOperationRequest, - ResponseTransformer responseTransformer) throws AwsServiceException, - SdkClientException, XmlException { + ResponseTransformer responseTransformer) throws AwsServiceException, + SdkClientException, XmlException { HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - StreamingOutputOperationResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(true)); + StreamingOutputOperationResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(true)); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingOutputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingOutputOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingOutputOperation"); return clientHandler.execute( - new ClientExecutionParams() - .withOperationName("StreamingOutputOperation").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(streamingOutputOperationRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new StreamingOutputOperationRequestMarshaller(protocolFactory)), responseTransformer); + new ClientExecutionParams() + .withOperationName("StreamingOutputOperation").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(streamingOutputOperationRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new StreamingOutputOperationRequestMarshaller(protocolFactory)), responseTransformer); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -649,7 +648,7 @@ public final String serviceName() { } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, - RequestOverrideConfiguration requestOverrideConfiguration) { + RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); @@ -701,12 +700,8 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, } private AwsXmlProtocolFactory init() { - return AwsXmlProtocolFactory - .builder() - .registerModeledException( - ExceptionMetadata.builder().errorCode("InvalidInput") - .exceptionBuilderSupplier(InvalidInputException::builder).httpStatusCode(400).build()) - .clientConfiguration(clientConfiguration).defaultServiceExceptionSupplier(XmlException::builder).build(); + return AwsXmlProtocolFactory.builder().clientConfiguration(clientConfiguration) + .defaultServiceExceptionSupplier(XmlException::builder).build(); } @Override diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-json-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-json-async-client-class.java index 9384c1c5d766..564a24b9831f 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-json-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-json-async-client-class.java @@ -195,9 +195,18 @@ public CompletableFuture aPostOperation(APostOperationRe HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, APostOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); String hostPrefix = "{StringMember}-foo."; HostnameValidator.validateHostnameCompliant(aPostOperationRequest.stringMember(), "StringMember", "aPostOperationRequest"); @@ -263,9 +272,21 @@ public CompletableFuture aPostOperationWithOut HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, APostOperationWithOutputResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -345,8 +366,15 @@ public CompletableFuture eventStreamOperation(EventStreamOperationRequest HttpResponseHandler errorEventResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, eventstreamExceptionMetadataMapper); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); EventStreamTaggedUnionJsonMarshaller eventMarshaller = EventStreamTaggedUnionJsonMarshaller.builder() .putMarshaller(DefaultInputEvent.class, new InputEventMarshaller(protocolFactory)).build(); SdkPublisher eventPublisher = SdkPublisher.adapt(requestStream); @@ -429,9 +457,15 @@ public CompletableFuture eventStreamO HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(operationMetadata, EventStreamOperationWithOnlyInputResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); EventStreamTaggedUnionJsonMarshaller eventMarshaller = EventStreamTaggedUnionJsonMarshaller.builder() .putMarshaller(DefaultInputEventOne.class, new InputEventMarshaller(protocolFactory)) .putMarshaller(DefaultInputEventTwo.class, new InputEventTwoMarshaller(protocolFactory)).build(); @@ -519,8 +553,15 @@ public CompletableFuture eventStreamOperationWithOnlyOutput( HttpResponseHandler errorEventResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, eventstreamExceptionMetadataMapper); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture future = new CompletableFuture<>(); EventStreamAsyncResponseTransformer asyncResponseTransformer = EventStreamAsyncResponseTransformer . builder() @@ -596,9 +637,18 @@ public CompletableFuture getWithoutRequiredMe HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetWithoutRequiredMembersResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -656,9 +706,15 @@ public CompletableFuture operationWithChe HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, OperationWithChecksumRequiredResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -719,9 +775,15 @@ public CompletableFuture operationWithNoneAut HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, OperationWithNoneAuthTypeResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -780,9 +842,15 @@ public CompletableFuture operationWithR HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, OperationWithRequestCompressionResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -845,9 +913,15 @@ public CompletableFuture paginatedOpera HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, PaginatedOperationWithResultKeyResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -905,9 +979,15 @@ public CompletableFuture paginatedOp HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(operationMetadata, PaginatedOperationWithoutResultKeyResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -972,9 +1052,15 @@ public CompletableFuture streamingInputOperatio HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, StreamingInputOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -1052,9 +1138,15 @@ public CompletableFuture streamingInputOutputOperation( HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, StreamingInputOutputOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler.execute( new ClientExecutionParams() @@ -1138,9 +1230,15 @@ public CompletableFuture streamingOutputOperation( HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, StreamingOutputOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler.execute( new ClientExecutionParams() @@ -1181,17 +1279,8 @@ public final String serviceName() { } private > T init(T builder) { - return builder - .clientConfiguration(clientConfiguration) - .defaultServiceExceptionSupplier(JsonException::builder) - .protocol(AwsJsonProtocol.AWS_JSON) - .protocolVersion("1.1") - .registerModeledException( - ExceptionMetadata.builder().errorCode("InvalidInputException") - .exceptionBuilderSupplier(InvalidInputException::builder).httpStatusCode(400).build()) - .registerModeledException( - ExceptionMetadata.builder().errorCode("ServiceFaultException") - .exceptionBuilderSupplier(ServiceFaultException::builder).httpStatusCode(500).build()); + return builder.clientConfiguration(clientConfiguration).defaultServiceExceptionSupplier(JsonException::builder) + .protocol(AwsJsonProtocol.AWS_JSON).protocolVersion("1.1"); } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, @@ -1261,11 +1350,6 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, return configuration.build(); } - private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, - JsonOperationMetadata operationMetadata) { - return protocolFactory.createErrorResponseHandler(operationMetadata); - } - private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); @@ -1275,4 +1359,4 @@ private HttpResponseHandler createErrorResponseHandler(Base public void close() { clientHandler.close(); } -} +} \ No newline at end of file diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-async-client-class.java index d06d668892ea..7658437377b5 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-async-client-class.java @@ -110,9 +110,18 @@ public CompletableFuture aPostOperation(APostOperationRe HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, APostOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); String hostPrefix = "{StringMember}-foo."; HostnameValidator.validateHostnameCompliant(aPostOperationRequest.stringMember(), "StringMember", "aPostOperationRequest"); @@ -147,15 +156,9 @@ public final String serviceName() { } private > T init(T builder) { - return builder - .clientConfiguration(clientConfiguration) - .defaultServiceExceptionSupplier(QueryToJsonCompatibleException::builder) - .protocol(AwsJsonProtocol.AWS_JSON) - .protocolVersion("1.1") - .hasAwsQueryCompatible(true) - .registerModeledException( - ExceptionMetadata.builder().errorCode("InvalidInput") - .exceptionBuilderSupplier(InvalidInputException::builder).httpStatusCode(400).build()); + return builder.clientConfiguration(clientConfiguration) + .defaultServiceExceptionSupplier(QueryToJsonCompatibleException::builder).protocol(AwsJsonProtocol.AWS_JSON) + .protocolVersion("1.1").hasAwsQueryCompatible(true); } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, @@ -211,11 +214,6 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, return configuration.build(); } - private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, - JsonOperationMetadata operationMetadata) { - return protocolFactory.createErrorResponseHandler(operationMetadata); - } - private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-sync-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-sync-client-class.java index 78f87a74dde3..67cbc41e5750 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-sync-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-sync-client-class.java @@ -2,7 +2,9 @@ import java.util.Collections; import java.util.List; +import java.util.Optional; import java.util.function.Consumer; +import java.util.function.Function; import software.amazon.awssdk.annotations.Generated; import software.amazon.awssdk.annotations.SdkInternalApi; import software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler; @@ -51,7 +53,7 @@ final class DefaultQueryToJsonCompatibleClient implements QueryToJsonCompatibleC private static final Logger log = Logger.loggerFor(DefaultQueryToJsonCompatibleClient.class); private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder() - .serviceProtocol(AwsServiceProtocol.AWS_JSON).build(); + .serviceProtocol(AwsServiceProtocol.AWS_JSON).build(); private final SyncClientHandler clientHandler; @@ -87,34 +89,43 @@ protected DefaultQueryToJsonCompatibleClient(SdkClientConfiguration clientConfig */ @Override public APostOperationResponse aPostOperation(APostOperationRequest aPostOperationRequest) throws InvalidInputException, - AwsServiceException, SdkClientException, QueryToJsonCompatibleException { + AwsServiceException, SdkClientException, QueryToJsonCompatibleException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, - APostOperationResponse::builder); + APostOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "QueryToJsonCompatibleService"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "APostOperation"); String hostPrefix = "{StringMember}-foo."; HostnameValidator.validateHostnameCompliant(aPostOperationRequest.stringMember(), "StringMember", - "aPostOperationRequest"); + "aPostOperationRequest"); String resolvedHostExpression = String.format("%s-foo.", aPostOperationRequest.stringMember()); return clientHandler.execute(new ClientExecutionParams() - .withOperationName("APostOperation").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .hostPrefixExpression(resolvedHostExpression).withRequestConfiguration(clientConfiguration) - .withInput(aPostOperationRequest).withMetricCollector(apiCallMetricCollector) - .withMarshaller(new APostOperationRequestMarshaller(protocolFactory))); + .withOperationName("APostOperation").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .hostPrefixExpression(resolvedHostExpression).withRequestConfiguration(clientConfiguration) + .withInput(aPostOperationRequest).withMetricCollector(apiCallMetricCollector) + .withMarshaller(new APostOperationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -126,7 +137,7 @@ public final String serviceName() { } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, - RequestOverrideConfiguration requestOverrideConfiguration) { + RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); @@ -141,8 +152,8 @@ private static List resolveMetricPublishers(SdkClientConfigurat } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, - JsonOperationMetadata operationMetadata) { - return protocolFactory.createErrorResponseHandler(operationMetadata); + JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { + return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); } private void updateRetryStrategyClientConfiguration(SdkClientConfiguration.Builder configuration) { @@ -175,7 +186,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, return configuration.build(); } QueryToJsonCompatibleServiceClientConfigurationBuilder serviceConfigBuilder = new QueryToJsonCompatibleServiceClientConfigurationBuilder( - configuration); + configuration); for (SdkPlugin plugin : plugins) { plugin.configureClient(serviceConfigBuilder); } @@ -184,15 +195,9 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, } private > T init(T builder) { - return builder - .clientConfiguration(clientConfiguration) - .defaultServiceExceptionSupplier(QueryToJsonCompatibleException::builder) - .protocol(AwsJsonProtocol.AWS_JSON) - .protocolVersion("1.1") - .hasAwsQueryCompatible(true) - .registerModeledException( - ExceptionMetadata.builder().errorCode("InvalidInput") - .exceptionBuilderSupplier(InvalidInputException::builder).httpStatusCode(400).build()); + return builder.clientConfiguration(clientConfiguration) + .defaultServiceExceptionSupplier(QueryToJsonCompatibleException::builder).protocol(AwsJsonProtocol.AWS_JSON) + .protocolVersion("1.1").hasAwsQueryCompatible(true); } @Override diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-batchmanager-async.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-batchmanager-async.java index 8081d9331cad..aa68cc26f981 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-batchmanager-async.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-batchmanager-async.java @@ -109,9 +109,15 @@ public CompletableFuture sendRequest(SendRequestRequest sen HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, SendRequestResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -205,11 +211,6 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, return configuration.build(); } - private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, - JsonOperationMetadata operationMetadata) { - return protocolFactory.createErrorResponseHandler(operationMetadata); - } - private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); @@ -219,4 +220,4 @@ private HttpResponseHandler createErrorResponseHandler(Base public void close() { clientHandler.close(); } -} +} \ No newline at end of file diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-cbor-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-cbor-async-client-class.java index 308abd62a314..f0d6c0e36e63 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-cbor-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-cbor-async-client-class.java @@ -199,9 +199,18 @@ public CompletableFuture aPostOperation(APostOperationRe HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, APostOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); String hostPrefix = "{StringMember}-foo."; HostnameValidator.validateHostnameCompliant(aPostOperationRequest.stringMember(), "StringMember", "aPostOperationRequest"); @@ -267,9 +276,21 @@ public CompletableFuture aPostOperationWithOut HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, APostOperationWithOutputResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -349,8 +370,15 @@ public CompletableFuture eventStreamOperation(EventStreamOperationRequest HttpResponseHandler errorEventResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, eventstreamExceptionMetadataMapper); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); EventStreamTaggedUnionJsonMarshaller eventMarshaller = EventStreamTaggedUnionJsonMarshaller.builder() .putMarshaller(DefaultInputEvent.class, new InputEventMarshaller(protocolFactory)).build(); SdkPublisher eventPublisher = SdkPublisher.adapt(requestStream); @@ -433,9 +461,15 @@ public CompletableFuture eventStreamO HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(operationMetadata, EventStreamOperationWithOnlyInputResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); EventStreamTaggedUnionJsonMarshaller eventMarshaller = EventStreamTaggedUnionJsonMarshaller.builder() .putMarshaller(DefaultInputEventOne.class, new InputEventMarshaller(protocolFactory)) .putMarshaller(DefaultInputEventTwo.class, new InputEventTwoMarshaller(protocolFactory)).build(); @@ -523,8 +557,15 @@ public CompletableFuture eventStreamOperationWithOnlyOutput( HttpResponseHandler errorEventResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, eventstreamExceptionMetadataMapper); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture future = new CompletableFuture<>(); EventStreamAsyncResponseTransformer asyncResponseTransformer = EventStreamAsyncResponseTransformer . builder() @@ -600,9 +641,18 @@ public CompletableFuture getWithoutRequiredMe HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetWithoutRequiredMembersResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -660,9 +710,15 @@ public CompletableFuture operationWithChe HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, OperationWithChecksumRequiredResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -723,9 +779,15 @@ public CompletableFuture operationWithNoneAut HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, OperationWithNoneAuthTypeResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -784,9 +846,15 @@ public CompletableFuture operationWithR HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, OperationWithRequestCompressionResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -849,9 +917,15 @@ public CompletableFuture paginatedOpera HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, PaginatedOperationWithResultKeyResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -909,9 +983,15 @@ public CompletableFuture paginatedOp HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(operationMetadata, PaginatedOperationWithoutResultKeyResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -976,9 +1056,15 @@ public CompletableFuture streamingInputOperatio HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, StreamingInputOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -1056,9 +1142,15 @@ public CompletableFuture streamingInputOutputOperation( HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, StreamingInputOutputOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler.execute( new ClientExecutionParams() @@ -1142,9 +1234,15 @@ public CompletableFuture streamingOutputOperation( HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, StreamingOutputOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler.execute( new ClientExecutionParams() @@ -1185,17 +1283,8 @@ public final String serviceName() { } private > T init(T builder) { - return builder - .clientConfiguration(clientConfiguration) - .defaultServiceExceptionSupplier(JsonException::builder) - .protocol(AwsJsonProtocol.AWS_JSON) - .protocolVersion("1.1") - .registerModeledException( - ExceptionMetadata.builder().errorCode("InvalidInputException") - .exceptionBuilderSupplier(InvalidInputException::builder).httpStatusCode(400).build()) - .registerModeledException( - ExceptionMetadata.builder().errorCode("ServiceFaultException") - .exceptionBuilderSupplier(ServiceFaultException::builder).httpStatusCode(500).build()); + return builder.clientConfiguration(clientConfiguration).defaultServiceExceptionSupplier(JsonException::builder) + .protocol(AwsJsonProtocol.AWS_JSON).protocolVersion("1.1"); } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, @@ -1265,11 +1354,6 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, return configuration.build(); } - private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, - JsonOperationMetadata operationMetadata) { - return protocolFactory.createErrorResponseHandler(operationMetadata); - } - private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); @@ -1279,4 +1363,4 @@ private HttpResponseHandler createErrorResponseHandler(Base public void close() { clientHandler.close(); } -} +} \ No newline at end of file diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-cbor-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-cbor-client-class.java index b6b072aad637..73d59c6f9a1c 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-cbor-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-cbor-client-class.java @@ -2,7 +2,9 @@ import java.util.Collections; import java.util.List; +import java.util.Optional; import java.util.function.Consumer; +import java.util.function.Function; import software.amazon.awssdk.annotations.Generated; import software.amazon.awssdk.annotations.SdkInternalApi; import software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler; @@ -130,9 +132,18 @@ public APostOperationResponse aPostOperation(APostOperationRequest aPostOperatio HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, APostOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationRequest .overrideConfiguration().orElse(null)); @@ -187,9 +198,21 @@ public APostOperationWithOutputResponse aPostOperationWithOutput( HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, APostOperationWithOutputResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationWithOutputRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationWithOutputRequest @@ -241,9 +264,18 @@ public GetWithoutRequiredMembersResponse getWithoutRequiredMembers( HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetWithoutRequiredMembersResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getWithoutRequiredMembersRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getWithoutRequiredMembersRequest @@ -291,9 +323,15 @@ public OperationWithChecksumRequiredResponse operationWithChecksumRequired( HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, OperationWithChecksumRequiredResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithChecksumRequiredRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, @@ -346,9 +384,15 @@ public OperationWithNoneAuthTypeResponse operationWithNoneAuthType( HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, OperationWithNoneAuthTypeResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithNoneAuthTypeRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithNoneAuthTypeRequest @@ -396,9 +440,15 @@ public OperationWithRequestCompressionResponse operationWithRequestCompression( HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, OperationWithRequestCompressionResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithRequestCompressionRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, @@ -451,9 +501,15 @@ public PaginatedOperationWithResultKeyResponse paginatedOperationWithResultKey( HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, PaginatedOperationWithResultKeyResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(paginatedOperationWithResultKeyRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, @@ -501,9 +557,15 @@ public PaginatedOperationWithoutResultKeyResponse paginatedOperationWithoutResul HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, PaginatedOperationWithoutResultKeyResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(paginatedOperationWithoutResultKeyRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, @@ -561,9 +623,15 @@ public StreamingInputOperationResponse streamingInputOperation(StreamingInputOpe HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, StreamingInputOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingInputOperationRequest @@ -637,9 +705,15 @@ public ReturnT streamingInputOutputOperation( HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, StreamingInputOutputOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOutputOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, @@ -703,9 +777,15 @@ public ReturnT streamingOutputOperation(StreamingOutputOperationReques HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, StreamingOutputOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingOutputOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingOutputOperationRequest @@ -757,8 +837,8 @@ private static List resolveMetricPublishers(SdkClientConfigurat } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, - JsonOperationMetadata operationMetadata) { - return protocolFactory.createErrorResponseHandler(operationMetadata); + JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { + return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); } private void updateRetryStrategyClientConfiguration(SdkClientConfiguration.Builder configuration) { @@ -799,17 +879,8 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, } private > T init(T builder) { - return builder - .clientConfiguration(clientConfiguration) - .defaultServiceExceptionSupplier(JsonException::builder) - .protocol(AwsJsonProtocol.AWS_JSON) - .protocolVersion("1.1") - .registerModeledException( - ExceptionMetadata.builder().errorCode("InvalidInputException") - .exceptionBuilderSupplier(InvalidInputException::builder).httpStatusCode(400).build()) - .registerModeledException( - ExceptionMetadata.builder().errorCode("ServiceFaultException") - .exceptionBuilderSupplier(ServiceFaultException::builder).httpStatusCode(500).build()); + return builder.clientConfiguration(clientConfiguration).defaultServiceExceptionSupplier(JsonException::builder) + .protocol(AwsJsonProtocol.AWS_JSON).protocolVersion("1.1"); } @Override diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-custompackage-async.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-custompackage-async.java index d3fa60fddd28..94898e8950ca 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-custompackage-async.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-custompackage-async.java @@ -104,9 +104,15 @@ public CompletableFuture oneOperation(OneOperationRequest HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, OneOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -196,11 +202,6 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, return configuration.build(); } - private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, - JsonOperationMetadata operationMetadata) { - return protocolFactory.createErrorResponseHandler(operationMetadata); - } - private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); @@ -210,4 +211,4 @@ private HttpResponseHandler createErrorResponseHandler(Base public void close() { clientHandler.close(); } -} +} \ No newline at end of file diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-custompackage-sync.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-custompackage-sync.java index de640533ca5a..455c357cdd30 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-custompackage-sync.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-custompackage-sync.java @@ -7,7 +7,9 @@ import foo.bar.helloworld.transform.OneOperationRequestMarshaller; import java.util.Collections; import java.util.List; +import java.util.Optional; import java.util.function.Consumer; +import java.util.function.Function; import software.amazon.awssdk.annotations.Generated; import software.amazon.awssdk.annotations.SdkInternalApi; import software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler; @@ -30,6 +32,7 @@ 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.AwsJsonProtocolFactory; import software.amazon.awssdk.protocols.json.BaseAwsJsonProtocolFactory; @@ -48,7 +51,7 @@ final class DefaultProtocolRestJsonWithCustomPackageClient implements ProtocolRe private static final Logger log = Logger.loggerFor(DefaultProtocolRestJsonWithCustomPackageClient.class); private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder() - .serviceProtocol(AwsServiceProtocol.REST_JSON).build(); + .serviceProtocol(AwsServiceProtocol.REST_JSON).build(); private final SyncClientHandler clientHandler; @@ -80,30 +83,36 @@ protected DefaultProtocolRestJsonWithCustomPackageClient(SdkClientConfiguration */ @Override public OneOperationResponse oneOperation(OneOperationRequest oneOperationRequest) throws AwsServiceException, - SdkClientException, ProtocolRestJsonWithCustomPackageException { + SdkClientException, ProtocolRestJsonWithCustomPackageException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, - OneOperationResponse::builder); + OneOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(oneOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, oneOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AmazonProtocolRestJsonWithCustomPackage"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OneOperation"); return clientHandler.execute(new ClientExecutionParams() - .withOperationName("OneOperation").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(oneOperationRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new OneOperationRequestMarshaller(protocolFactory))); + .withOperationName("OneOperation").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(oneOperationRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new OneOperationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -115,7 +124,7 @@ public final String serviceName() { } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, - RequestOverrideConfiguration requestOverrideConfiguration) { + RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); @@ -130,8 +139,8 @@ private static List resolveMetricPublishers(SdkClientConfigurat } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, - JsonOperationMetadata operationMetadata) { - return protocolFactory.createErrorResponseHandler(operationMetadata); + JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { + return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); } private void updateRetryStrategyClientConfiguration(SdkClientConfiguration.Builder configuration) { @@ -164,7 +173,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, return configuration.build(); } ProtocolRestJsonWithCustomPackageServiceClientConfigurationBuilder serviceConfigBuilder = new ProtocolRestJsonWithCustomPackageServiceClientConfigurationBuilder( - configuration); + configuration); for (SdkPlugin plugin : plugins) { plugin.configureClient(serviceConfigBuilder); } @@ -174,14 +183,14 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, private > T init(T builder) { return builder.clientConfiguration(clientConfiguration) - .defaultServiceExceptionSupplier(ProtocolRestJsonWithCustomPackageException::builder) - .protocol(AwsJsonProtocol.REST_JSON).protocolVersion("1.1"); + .defaultServiceExceptionSupplier(ProtocolRestJsonWithCustomPackageException::builder) + .protocol(AwsJsonProtocol.REST_JSON).protocolVersion("1.1"); } @Override public final ProtocolRestJsonWithCustomPackageServiceClientConfiguration serviceClientConfiguration() { return new ProtocolRestJsonWithCustomPackageServiceClientConfigurationBuilder(this.clientConfiguration.toBuilder()) - .build(); + .build(); } @Override diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-customservicemetadata-async.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-customservicemetadata-async.java index 7804faabf8e8..ef90eb6fafc8 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-customservicemetadata-async.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-customservicemetadata-async.java @@ -104,9 +104,15 @@ public CompletableFuture oneOperation(OneOperationRequest HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, OneOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -196,11 +202,6 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, return configuration.build(); } - private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, - JsonOperationMetadata operationMetadata) { - return protocolFactory.createErrorResponseHandler(operationMetadata); - } - private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); @@ -210,4 +211,4 @@ private HttpResponseHandler createErrorResponseHandler(Base public void close() { clientHandler.close(); } -} +} \ No newline at end of file diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-customservicemetadata-sync.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-customservicemetadata-sync.java index 9f134914f49f..0a1e74cdcc0a 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-customservicemetadata-sync.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-customservicemetadata-sync.java @@ -2,7 +2,9 @@ import java.util.Collections; import java.util.List; +import java.util.Optional; import java.util.function.Consumer; +import java.util.function.Function; import software.amazon.awssdk.annotations.Generated; import software.amazon.awssdk.annotations.SdkInternalApi; import software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler; @@ -25,6 +27,7 @@ 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.AwsJsonProtocolFactory; import software.amazon.awssdk.protocols.json.BaseAwsJsonProtocolFactory; @@ -48,7 +51,7 @@ final class DefaultProtocolRestJsonWithCustomContentTypeClient implements Protoc private static final Logger log = Logger.loggerFor(DefaultProtocolRestJsonWithCustomContentTypeClient.class); private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder() - .serviceProtocol(AwsServiceProtocol.REST_JSON).build(); + .serviceProtocol(AwsServiceProtocol.REST_JSON).build(); private final SyncClientHandler clientHandler; @@ -80,30 +83,36 @@ protected DefaultProtocolRestJsonWithCustomContentTypeClient(SdkClientConfigurat */ @Override public OneOperationResponse oneOperation(OneOperationRequest oneOperationRequest) throws AwsServiceException, - SdkClientException, ProtocolRestJsonWithCustomContentTypeException { + SdkClientException, ProtocolRestJsonWithCustomContentTypeException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, - OneOperationResponse::builder); + OneOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(oneOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, oneOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AmazonProtocolRestJsonWithCustomContentType"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OneOperation"); return clientHandler.execute(new ClientExecutionParams() - .withOperationName("OneOperation").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(oneOperationRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new OneOperationRequestMarshaller(protocolFactory))); + .withOperationName("OneOperation").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(oneOperationRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new OneOperationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -115,7 +124,7 @@ public final String serviceName() { } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, - RequestOverrideConfiguration requestOverrideConfiguration) { + RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); @@ -130,8 +139,8 @@ private static List resolveMetricPublishers(SdkClientConfigurat } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, - JsonOperationMetadata operationMetadata) { - return protocolFactory.createErrorResponseHandler(operationMetadata); + JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { + return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); } private void updateRetryStrategyClientConfiguration(SdkClientConfiguration.Builder configuration) { @@ -164,7 +173,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, return configuration.build(); } ProtocolRestJsonWithCustomContentTypeServiceClientConfigurationBuilder serviceConfigBuilder = new ProtocolRestJsonWithCustomContentTypeServiceClientConfigurationBuilder( - configuration); + configuration); for (SdkPlugin plugin : plugins) { plugin.configureClient(serviceConfigBuilder); } @@ -174,14 +183,14 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, private > T init(T builder) { return builder.clientConfiguration(clientConfiguration) - .defaultServiceExceptionSupplier(ProtocolRestJsonWithCustomContentTypeException::builder) - .protocol(AwsJsonProtocol.REST_JSON).protocolVersion("1.1").contentType("application/json"); + .defaultServiceExceptionSupplier(ProtocolRestJsonWithCustomContentTypeException::builder) + .protocol(AwsJsonProtocol.REST_JSON).protocolVersion("1.1").contentType("application/json"); } @Override public final ProtocolRestJsonWithCustomContentTypeServiceClientConfiguration serviceClientConfiguration() { return new ProtocolRestJsonWithCustomContentTypeServiceClientConfigurationBuilder(this.clientConfiguration.toBuilder()) - .build(); + .build(); } @Override diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-endpoint-discovery-async.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-endpoint-discovery-async.java index 2857ce0fa9d1..bac2237163fd 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-endpoint-discovery-async.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-endpoint-discovery-async.java @@ -124,9 +124,15 @@ public CompletableFuture describeEndpoints(DescribeEn HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeEndpointsResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -182,9 +188,15 @@ public CompletableFuture testDiscovery HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(operationMetadata, TestDiscoveryIdentifiersRequiredResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); boolean endpointDiscoveryEnabled = clientConfiguration.option(SdkClientOption.ENDPOINT_DISCOVERY_ENABLED); boolean endpointOverridden = clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER) .isEndpointOverridden(); @@ -268,9 +280,15 @@ public CompletableFuture testDiscoveryOptional( HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, TestDiscoveryOptionalResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); boolean endpointDiscoveryEnabled = clientConfiguration.option(SdkClientOption.ENDPOINT_DISCOVERY_ENABLED); boolean endpointOverridden = clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER) .isEndpointOverridden(); @@ -345,9 +363,15 @@ public CompletableFuture testDiscoveryRequired( HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, TestDiscoveryRequiredResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); boolean endpointDiscoveryEnabled = clientConfiguration.option(SdkClientOption.ENDPOINT_DISCOVERY_ENABLED); boolean endpointOverridden = clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER) .isEndpointOverridden(); @@ -464,11 +488,6 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, return configuration.build(); } - private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, - JsonOperationMetadata operationMetadata) { - return protocolFactory.createErrorResponseHandler(operationMetadata); - } - private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); @@ -478,4 +497,4 @@ private HttpResponseHandler createErrorResponseHandler(Base public void close() { clientHandler.close(); } -} +} \ No newline at end of file diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-endpoint-discovery-sync.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-endpoint-discovery-sync.java index ba55ae6d349f..d33e11aeb6d4 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-endpoint-discovery-sync.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-endpoint-discovery-sync.java @@ -3,8 +3,10 @@ import java.net.URI; import java.util.Collections; import java.util.List; +import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.function.Consumer; +import java.util.function.Function; import software.amazon.awssdk.annotations.Generated; import software.amazon.awssdk.annotations.SdkInternalApi; import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration; @@ -32,6 +34,7 @@ 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.AwsJsonProtocolFactory; import software.amazon.awssdk.protocols.json.BaseAwsJsonProtocolFactory; @@ -107,9 +110,15 @@ public DescribeEndpointsResponse describeEndpoints(DescribeEndpointsRequest desc HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, DescribeEndpointsResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeEndpointsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeEndpointsRequest @@ -154,9 +163,15 @@ public TestDiscoveryIdentifiersRequiredResponse testDiscoveryIdentifiersRequired HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, TestDiscoveryIdentifiersRequiredResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); boolean endpointDiscoveryEnabled = clientConfiguration.option(SdkClientOption.ENDPOINT_DISCOVERY_ENABLED); boolean endpointOverridden = clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER).isEndpointOverridden(); if (endpointOverridden) { @@ -222,9 +237,15 @@ public TestDiscoveryOptionalResponse testDiscoveryOptional(TestDiscoveryOptional HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, TestDiscoveryOptionalResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); boolean endpointDiscoveryEnabled = clientConfiguration.option(SdkClientOption.ENDPOINT_DISCOVERY_ENABLED); boolean endpointOverridden = clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER).isEndpointOverridden(); URI cachedEndpoint = null; @@ -281,9 +302,15 @@ public TestDiscoveryRequiredResponse testDiscoveryRequired(TestDiscoveryRequired HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, TestDiscoveryRequiredResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); boolean endpointDiscoveryEnabled = clientConfiguration.option(SdkClientOption.ENDPOINT_DISCOVERY_ENABLED); boolean endpointOverridden = clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER).isEndpointOverridden(); if (endpointOverridden) { @@ -347,8 +374,8 @@ private static List resolveMetricPublishers(SdkClientConfigurat } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, - JsonOperationMetadata operationMetadata) { - return protocolFactory.createErrorResponseHandler(operationMetadata); + JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { + return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); } private void updateRetryStrategyClientConfiguration(SdkClientConfiguration.Builder configuration) { diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-async-client-class.java index 1dfb81af4d68..7933d458a770 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-async-client-class.java @@ -210,9 +210,18 @@ public CompletableFuture aPostOperation(APostOperationRe HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, APostOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); String hostPrefix = "{StringMember}-foo."; HostnameValidator.validateHostnameCompliant(aPostOperationRequest.stringMember(), "StringMember", "aPostOperationRequest"); @@ -277,9 +286,18 @@ public CompletableFuture aPostOperationWithOut HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, APostOperationWithOutputResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -337,9 +355,15 @@ public CompletableFuture bearerAuthOperation( HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, BearerAuthOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -425,8 +449,15 @@ public CompletableFuture eventStreamOperation(EventStreamOperationRequest HttpResponseHandler errorEventResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, eventstreamExceptionMetadataMapper); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); EventStreamTaggedUnionJsonMarshaller eventMarshaller = EventStreamTaggedUnionJsonMarshaller.builder() .putMarshaller(DefaultInputEvent.class, new InputEventMarshaller(protocolFactory)).build(); SdkPublisher eventPublisher = SdkPublisher.adapt(requestStream); @@ -512,9 +543,15 @@ public CompletableFuture eventStreamO HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(operationMetadata, EventStreamOperationWithOnlyInputResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); EventStreamTaggedUnionJsonMarshaller eventMarshaller = EventStreamTaggedUnionJsonMarshaller.builder() .putMarshaller(DefaultInputEventOne.class, new InputEventMarshaller(protocolFactory)) .putMarshaller(DefaultInputEventTwo.class, new InputEventTwoMarshaller(protocolFactory)).build(); @@ -607,8 +644,15 @@ public CompletableFuture eventStreamOperationWithOnlyOutput( HttpResponseHandler errorEventResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, eventstreamExceptionMetadataMapper); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture future = new CompletableFuture<>(); EventStreamAsyncResponseTransformer asyncResponseTransformer = EventStreamAsyncResponseTransformer . builder() @@ -686,9 +730,15 @@ public CompletableFuture getOperationWithCheck HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetOperationWithChecksumResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -757,9 +807,18 @@ public CompletableFuture getWithoutRequiredMe HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetWithoutRequiredMembersResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -817,9 +876,15 @@ public CompletableFuture operationWithChe HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, OperationWithChecksumRequiredResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -881,9 +946,15 @@ public CompletableFuture operationWithR HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, OperationWithRequestCompressionResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -946,9 +1017,15 @@ public CompletableFuture paginatedOpera HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, PaginatedOperationWithResultKeyResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -1006,9 +1083,15 @@ public CompletableFuture paginatedOp HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(operationMetadata, PaginatedOperationWithoutResultKeyResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -1091,9 +1174,15 @@ public CompletableFuture putOperationWithChecksum( HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, PutOperationWithChecksumResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler.execute( new ClientExecutionParams() @@ -1185,9 +1274,15 @@ public CompletableFuture streamingInputOperatio HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, StreamingInputOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -1265,9 +1360,15 @@ public CompletableFuture streamingInputOutputOperation( HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, StreamingInputOutputOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler.execute( new ClientExecutionParams() @@ -1351,9 +1452,15 @@ public CompletableFuture streamingOutputOperation( HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, StreamingOutputOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler.execute( new ClientExecutionParams() @@ -1399,14 +1506,8 @@ public final String serviceName() { } private > T init(T builder) { - return builder - .clientConfiguration(clientConfiguration) - .defaultServiceExceptionSupplier(JsonException::builder) - .protocol(AwsJsonProtocol.REST_JSON) - .protocolVersion("1.1") - .registerModeledException( - ExceptionMetadata.builder().errorCode("InvalidInput") - .exceptionBuilderSupplier(InvalidInputException::builder).httpStatusCode(400).build()); + return builder.clientConfiguration(clientConfiguration).defaultServiceExceptionSupplier(JsonException::builder) + .protocol(AwsJsonProtocol.REST_JSON).protocolVersion("1.1"); } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, @@ -1476,11 +1577,6 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, return configuration.build(); } - private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, - JsonOperationMetadata operationMetadata) { - return protocolFactory.createErrorResponseHandler(operationMetadata); - } - private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-client-class.java index 8b32410d4bb9..a4f91b0462d6 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-client-class.java @@ -2,7 +2,9 @@ import java.util.Collections; import java.util.List; +import java.util.Optional; import java.util.function.Consumer; +import java.util.function.Function; import software.amazon.awssdk.annotations.Generated; import software.amazon.awssdk.annotations.SdkInternalApi; import software.amazon.awssdk.auth.signer.Aws4UnsignedPayloadSigner; @@ -101,7 +103,7 @@ final class DefaultJsonClient implements JsonClient { private static final Logger log = Logger.loggerFor(DefaultJsonClient.class); private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder() - .serviceProtocol(AwsServiceProtocol.REST_JSON).build(); + .serviceProtocol(AwsServiceProtocol.REST_JSON).build(); private final SyncClientHandler clientHandler; @@ -137,34 +139,43 @@ protected DefaultJsonClient(SdkClientConfiguration clientConfiguration) { */ @Override public APostOperationResponse aPostOperation(APostOperationRequest aPostOperationRequest) throws InvalidInputException, - AwsServiceException, SdkClientException, JsonException { + AwsServiceException, SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, - APostOperationResponse::builder); + APostOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "APostOperation"); String hostPrefix = "{StringMember}-foo."; HostnameValidator.validateHostnameCompliant(aPostOperationRequest.stringMember(), "StringMember", - "aPostOperationRequest"); + "aPostOperationRequest"); String resolvedHostExpression = String.format("%s-foo.", aPostOperationRequest.stringMember()); return clientHandler.execute(new ClientExecutionParams() - .withOperationName("APostOperation").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .hostPrefixExpression(resolvedHostExpression).withRequestConfiguration(clientConfiguration) - .withInput(aPostOperationRequest).withMetricCollector(apiCallMetricCollector) - .withMarshaller(new APostOperationRequestMarshaller(protocolFactory))); + .withOperationName("APostOperation").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .hostPrefixExpression(resolvedHostExpression).withRequestConfiguration(clientConfiguration) + .withInput(aPostOperationRequest).withMetricCollector(apiCallMetricCollector) + .withMarshaller(new APostOperationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -192,33 +203,42 @@ public APostOperationResponse aPostOperation(APostOperationRequest aPostOperatio */ @Override public APostOperationWithOutputResponse aPostOperationWithOutput( - APostOperationWithOutputRequest aPostOperationWithOutputRequest) throws InvalidInputException, AwsServiceException, - SdkClientException, JsonException { + APostOperationWithOutputRequest aPostOperationWithOutputRequest) throws InvalidInputException, AwsServiceException, + SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, APostOperationWithOutputResponse::builder); + operationMetadata, APostOperationWithOutputResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationWithOutputRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationWithOutputRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "APostOperationWithOutput"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("APostOperationWithOutput").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(aPostOperationWithOutputRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new APostOperationWithOutputRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("APostOperationWithOutput").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(aPostOperationWithOutputRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new APostOperationWithOutputRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -242,32 +262,38 @@ public APostOperationWithOutputResponse aPostOperationWithOutput( */ @Override public BearerAuthOperationResponse bearerAuthOperation(BearerAuthOperationRequest bearerAuthOperationRequest) - throws AwsServiceException, SdkClientException, JsonException { + throws AwsServiceException, SdkClientException, JsonException { bearerAuthOperationRequest = applySignerOverride(bearerAuthOperationRequest, BearerTokenSigner.create()); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, BearerAuthOperationResponse::builder); + operationMetadata, BearerAuthOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(bearerAuthOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, bearerAuthOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "BearerAuthOperation"); return clientHandler.execute(new ClientExecutionParams() - .withOperationName("BearerAuthOperation").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .credentialType(CredentialType.TOKEN).withRequestConfiguration(clientConfiguration) - .withInput(bearerAuthOperationRequest).withMetricCollector(apiCallMetricCollector) - .withMarshaller(new BearerAuthOperationRequestMarshaller(protocolFactory))); + .withOperationName("BearerAuthOperation").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .credentialType(CredentialType.TOKEN).withRequestConfiguration(clientConfiguration) + .withInput(bearerAuthOperationRequest).withMetricCollector(apiCallMetricCollector) + .withMarshaller(new BearerAuthOperationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -291,41 +317,47 @@ public BearerAuthOperationResponse bearerAuthOperation(BearerAuthOperationReques */ @Override public GetOperationWithChecksumResponse getOperationWithChecksum( - GetOperationWithChecksumRequest getOperationWithChecksumRequest) throws AwsServiceException, SdkClientException, - JsonException { + GetOperationWithChecksumRequest getOperationWithChecksumRequest) throws AwsServiceException, SdkClientException, + JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(false).build(); + .isPayloadJson(false).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, GetOperationWithChecksumResponse::builder); + operationMetadata, GetOperationWithChecksumResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getOperationWithChecksumRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getOperationWithChecksumRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetOperationWithChecksum"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("GetOperationWithChecksum") - .withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withInput(getOperationWithChecksumRequest) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute( - SdkInternalExecutionAttribute.HTTP_CHECKSUM, - HttpChecksum.builder().requestChecksumRequired(true).isRequestStreaming(false) - .requestAlgorithm(getOperationWithChecksumRequest.checksumAlgorithmAsString()) - .requestAlgorithmHeader("x-amz-sdk-checksum-algorithm").build()) - .withMarshaller(new GetOperationWithChecksumRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("GetOperationWithChecksum") + .withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withInput(getOperationWithChecksumRequest) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute( + SdkInternalExecutionAttribute.HTTP_CHECKSUM, + HttpChecksum.builder().requestChecksumRequired(true).isRequestStreaming(false) + .requestAlgorithm(getOperationWithChecksumRequest.checksumAlgorithmAsString()) + .requestAlgorithmHeader("x-amz-sdk-checksum-algorithm").build()) + .withMarshaller(new GetOperationWithChecksumRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -353,33 +385,42 @@ public GetOperationWithChecksumResponse getOperationWithChecksum( */ @Override public GetWithoutRequiredMembersResponse getWithoutRequiredMembers( - GetWithoutRequiredMembersRequest getWithoutRequiredMembersRequest) throws InvalidInputException, AwsServiceException, - SdkClientException, JsonException { + GetWithoutRequiredMembersRequest getWithoutRequiredMembersRequest) throws InvalidInputException, AwsServiceException, + SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, GetWithoutRequiredMembersResponse::builder); + operationMetadata, GetWithoutRequiredMembersResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getWithoutRequiredMembersRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getWithoutRequiredMembersRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetWithoutRequiredMembers"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("GetWithoutRequiredMembers").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(getWithoutRequiredMembersRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new GetWithoutRequiredMembersRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("GetWithoutRequiredMembers").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(getWithoutRequiredMembersRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new GetWithoutRequiredMembersRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -403,38 +444,44 @@ public GetWithoutRequiredMembersResponse getWithoutRequiredMembers( */ @Override public OperationWithChecksumRequiredResponse operationWithChecksumRequired( - OperationWithChecksumRequiredRequest operationWithChecksumRequiredRequest) throws AwsServiceException, - SdkClientException, JsonException { + OperationWithChecksumRequiredRequest operationWithChecksumRequiredRequest) throws AwsServiceException, + SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, OperationWithChecksumRequiredResponse::builder); + operationMetadata, OperationWithChecksumRequiredResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithChecksumRequiredRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithChecksumRequiredRequest.overrideConfiguration().orElse(null)); + operationWithChecksumRequiredRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithChecksumRequired"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithChecksumRequired") - .withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withInput(operationWithChecksumRequiredRequest) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute(SdkInternalExecutionAttribute.HTTP_CHECKSUM_REQUIRED, - HttpChecksumRequired.create()) - .withMarshaller(new OperationWithChecksumRequiredRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithChecksumRequired") + .withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withInput(operationWithChecksumRequiredRequest) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute(SdkInternalExecutionAttribute.HTTP_CHECKSUM_REQUIRED, + HttpChecksumRequired.create()) + .withMarshaller(new OperationWithChecksumRequiredRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -458,38 +505,44 @@ public OperationWithChecksumRequiredResponse operationWithChecksumRequired( */ @Override public OperationWithRequestCompressionResponse operationWithRequestCompression( - OperationWithRequestCompressionRequest operationWithRequestCompressionRequest) throws AwsServiceException, - SdkClientException, JsonException { + OperationWithRequestCompressionRequest operationWithRequestCompressionRequest) throws AwsServiceException, + SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, OperationWithRequestCompressionResponse::builder); + operationMetadata, OperationWithRequestCompressionResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithRequestCompressionRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithRequestCompressionRequest.overrideConfiguration().orElse(null)); + operationWithRequestCompressionRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithRequestCompression"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithRequestCompression") - .withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withInput(operationWithRequestCompressionRequest) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute(SdkInternalExecutionAttribute.REQUEST_COMPRESSION, - RequestCompression.builder().encodings("gzip").isStreaming(false).build()) - .withMarshaller(new OperationWithRequestCompressionRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithRequestCompression") + .withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withInput(operationWithRequestCompressionRequest) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute(SdkInternalExecutionAttribute.REQUEST_COMPRESSION, + RequestCompression.builder().encodings("gzip").isStreaming(false).build()) + .withMarshaller(new OperationWithRequestCompressionRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -513,33 +566,39 @@ public OperationWithRequestCompressionResponse operationWithRequestCompression( */ @Override public PaginatedOperationWithResultKeyResponse paginatedOperationWithResultKey( - PaginatedOperationWithResultKeyRequest paginatedOperationWithResultKeyRequest) throws AwsServiceException, - SdkClientException, JsonException { + PaginatedOperationWithResultKeyRequest paginatedOperationWithResultKeyRequest) throws AwsServiceException, + SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, PaginatedOperationWithResultKeyResponse::builder); + operationMetadata, PaginatedOperationWithResultKeyResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(paginatedOperationWithResultKeyRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - paginatedOperationWithResultKeyRequest.overrideConfiguration().orElse(null)); + paginatedOperationWithResultKeyRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PaginatedOperationWithResultKey"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("PaginatedOperationWithResultKey").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(paginatedOperationWithResultKeyRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new PaginatedOperationWithResultKeyRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("PaginatedOperationWithResultKey").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(paginatedOperationWithResultKeyRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new PaginatedOperationWithResultKeyRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -563,33 +622,39 @@ public PaginatedOperationWithResultKeyResponse paginatedOperationWithResultKey( */ @Override public PaginatedOperationWithoutResultKeyResponse paginatedOperationWithoutResultKey( - PaginatedOperationWithoutResultKeyRequest paginatedOperationWithoutResultKeyRequest) throws AwsServiceException, - SdkClientException, JsonException { + PaginatedOperationWithoutResultKeyRequest paginatedOperationWithoutResultKeyRequest) throws AwsServiceException, + SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, PaginatedOperationWithoutResultKeyResponse::builder); + operationMetadata, PaginatedOperationWithoutResultKeyResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(paginatedOperationWithoutResultKeyRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - paginatedOperationWithoutResultKeyRequest.overrideConfiguration().orElse(null)); + paginatedOperationWithoutResultKeyRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PaginatedOperationWithoutResultKey"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("PaginatedOperationWithoutResultKey").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(paginatedOperationWithoutResultKeyRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new PaginatedOperationWithoutResultKeyRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("PaginatedOperationWithoutResultKey").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(paginatedOperationWithoutResultKeyRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new PaginatedOperationWithoutResultKeyRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -639,50 +704,56 @@ public PaginatedOperationWithoutResultKeyResponse paginatedOperationWithoutResul */ @Override public ReturnT putOperationWithChecksum(PutOperationWithChecksumRequest putOperationWithChecksumRequest, - RequestBody requestBody, ResponseTransformer responseTransformer) - throws AwsServiceException, SdkClientException, JsonException { + RequestBody requestBody, ResponseTransformer responseTransformer) + throws AwsServiceException, SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(true) - .isPayloadJson(false).build(); + .isPayloadJson(false).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, PutOperationWithChecksumResponse::builder); + operationMetadata, PutOperationWithChecksumResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putOperationWithChecksumRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, putOperationWithChecksumRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PutOperationWithChecksum"); return clientHandler.execute( - new ClientExecutionParams() - .withOperationName("PutOperationWithChecksum") - .withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withInput(putOperationWithChecksumRequest) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute( - SdkInternalExecutionAttribute.HTTP_CHECKSUM, - HttpChecksum - .builder() - .requestChecksumRequired(false) - .isRequestStreaming(true) - .requestValidationMode(putOperationWithChecksumRequest.checksumModeAsString()) - .responseAlgorithmsV2(DefaultChecksumAlgorithm.CRC32C, - DefaultChecksumAlgorithm.CRC32, DefaultChecksumAlgorithm.SHA1, - DefaultChecksumAlgorithm.SHA256).build()) - .withRequestBody(requestBody) - .withMarshaller( - StreamingRequestMarshaller.builder() - .delegateMarshaller(new PutOperationWithChecksumRequestMarshaller(protocolFactory)) - .requestBody(requestBody).build()), responseTransformer); + new ClientExecutionParams() + .withOperationName("PutOperationWithChecksum") + .withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withInput(putOperationWithChecksumRequest) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute( + SdkInternalExecutionAttribute.HTTP_CHECKSUM, + HttpChecksum + .builder() + .requestChecksumRequired(false) + .isRequestStreaming(true) + .requestValidationMode(putOperationWithChecksumRequest.checksumModeAsString()) + .responseAlgorithmsV2(DefaultChecksumAlgorithm.CRC32C, + DefaultChecksumAlgorithm.CRC32, DefaultChecksumAlgorithm.SHA1, + DefaultChecksumAlgorithm.SHA256).build()) + .withRequestBody(requestBody) + .withMarshaller( + StreamingRequestMarshaller.builder() + .delegateMarshaller(new PutOperationWithChecksumRequestMarshaller(protocolFactory)) + .requestBody(requestBody).build()), responseTransformer); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -696,11 +767,11 @@ public ReturnT putOperationWithChecksum(PutOperationWithChecksumReques * The content to send to the service. A {@link RequestBody} can be created using one of several factory * methods for various sources of data. For example, to create a request body from a file you can do the * following. - * + * *
      * {@code RequestBody.fromFile(new File("myfile.txt"))}
      * 
- * + * * See documentation in {@link RequestBody} for additional details and which sources of data are supported. * The service documentation for the request content is as follows 'This be a stream' * @return Result of the StreamingInputOperation operation returned by the service. @@ -717,39 +788,45 @@ public ReturnT putOperationWithChecksum(PutOperationWithChecksumReques */ @Override public StreamingInputOperationResponse streamingInputOperation(StreamingInputOperationRequest streamingInputOperationRequest, - RequestBody requestBody) throws AwsServiceException, SdkClientException, JsonException { + RequestBody requestBody) throws AwsServiceException, SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, StreamingInputOperationResponse::builder); + operationMetadata, StreamingInputOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingInputOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingInputOperation"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("StreamingInputOperation") - .withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withInput(streamingInputOperationRequest) - .withMetricCollector(apiCallMetricCollector) - .withRequestBody(requestBody) - .withMarshaller( - StreamingRequestMarshaller.builder() - .delegateMarshaller(new StreamingInputOperationRequestMarshaller(protocolFactory)) - .requestBody(requestBody).build())); + .execute(new ClientExecutionParams() + .withOperationName("StreamingInputOperation") + .withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withInput(streamingInputOperationRequest) + .withMetricCollector(apiCallMetricCollector) + .withRequestBody(requestBody) + .withMarshaller( + StreamingRequestMarshaller.builder() + .delegateMarshaller(new StreamingInputOperationRequestMarshaller(protocolFactory)) + .requestBody(requestBody).build())); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -763,11 +840,11 @@ public StreamingInputOperationResponse streamingInputOperation(StreamingInputOpe * The content to send to the service. A {@link RequestBody} can be created using one of several factory * methods for various sources of data. For example, to create a request body from a file you can do the * following. - * + * *
      * {@code RequestBody.fromFile(new File("myfile.txt"))}
      * 
- * + * * See documentation in {@link RequestBody} for additional details and which sources of data are supported. * The service documentation for the request content is as follows 'This be a stream' * @param responseTransformer @@ -791,45 +868,51 @@ public StreamingInputOperationResponse streamingInputOperation(StreamingInputOpe */ @Override public ReturnT streamingInputOutputOperation( - StreamingInputOutputOperationRequest streamingInputOutputOperationRequest, RequestBody requestBody, - ResponseTransformer responseTransformer) throws AwsServiceException, - SdkClientException, JsonException { + StreamingInputOutputOperationRequest streamingInputOutputOperationRequest, RequestBody requestBody, + ResponseTransformer responseTransformer) throws AwsServiceException, + SdkClientException, JsonException { streamingInputOutputOperationRequest = applySignerOverride(streamingInputOutputOperationRequest, - Aws4UnsignedPayloadSigner.create()); + Aws4UnsignedPayloadSigner.create()); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(true) - .isPayloadJson(false).build(); + .isPayloadJson(false).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, StreamingInputOutputOperationResponse::builder); + operationMetadata, StreamingInputOutputOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOutputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - streamingInputOutputOperationRequest.overrideConfiguration().orElse(null)); + streamingInputOutputOperationRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingInputOutputOperation"); return clientHandler.execute( - new ClientExecutionParams() - .withOperationName("StreamingInputOutputOperation") - .withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withInput(streamingInputOutputOperationRequest) - .withMetricCollector(apiCallMetricCollector) - .withRequestBody(requestBody) - .withMarshaller( - StreamingRequestMarshaller - .builder() - .delegateMarshaller( - new StreamingInputOutputOperationRequestMarshaller(protocolFactory)) - .requestBody(requestBody).transferEncoding(true).build()), responseTransformer); + new ClientExecutionParams() + .withOperationName("StreamingInputOutputOperation") + .withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withInput(streamingInputOutputOperationRequest) + .withMetricCollector(apiCallMetricCollector) + .withRequestBody(requestBody) + .withMarshaller( + StreamingRequestMarshaller + .builder() + .delegateMarshaller( + new StreamingInputOutputOperationRequestMarshaller(protocolFactory)) + .requestBody(requestBody).transferEncoding(true).build()), responseTransformer); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -860,33 +943,39 @@ public ReturnT streamingInputOutputOperation( */ @Override public ReturnT streamingOutputOperation(StreamingOutputOperationRequest streamingOutputOperationRequest, - ResponseTransformer responseTransformer) throws AwsServiceException, - SdkClientException, JsonException { + ResponseTransformer responseTransformer) throws AwsServiceException, + SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(true) - .isPayloadJson(false).build(); + .isPayloadJson(false).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, StreamingOutputOperationResponse::builder); + operationMetadata, StreamingOutputOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingOutputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingOutputOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingOutputOperation"); return clientHandler.execute( - new ClientExecutionParams() - .withOperationName("StreamingOutputOperation").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(streamingOutputOperationRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new StreamingOutputOperationRequestMarshaller(protocolFactory)), responseTransformer); + new ClientExecutionParams() + .withOperationName("StreamingOutputOperation").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(streamingOutputOperationRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new StreamingOutputOperationRequestMarshaller(protocolFactory)), responseTransformer); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -906,8 +995,8 @@ private T applySignerOverride(T request, Signer signer) } Consumer signerOverride = b -> b.signer(signer).build(); AwsRequestOverrideConfiguration overrideConfiguration = request.overrideConfiguration() - .map(c -> c.toBuilder().applyMutation(signerOverride).build()) - .orElse((AwsRequestOverrideConfiguration.builder().applyMutation(signerOverride).build())); + .map(c -> c.toBuilder().applyMutation(signerOverride).build()) + .orElse((AwsRequestOverrideConfiguration.builder().applyMutation(signerOverride).build())); return (T) request.toBuilder().overrideConfiguration(overrideConfiguration).build(); } @@ -917,7 +1006,7 @@ public final String serviceName() { } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, - RequestOverrideConfiguration requestOverrideConfiguration) { + RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); @@ -932,8 +1021,8 @@ private static List resolveMetricPublishers(SdkClientConfigurat } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, - JsonOperationMetadata operationMetadata) { - return protocolFactory.createErrorResponseHandler(operationMetadata); + JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { + return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); } private void updateRetryStrategyClientConfiguration(SdkClientConfiguration.Builder configuration) { @@ -974,14 +1063,8 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, } private > T init(T builder) { - return builder - .clientConfiguration(clientConfiguration) - .defaultServiceExceptionSupplier(JsonException::builder) - .protocol(AwsJsonProtocol.REST_JSON) - .protocolVersion("1.1") - .registerModeledException( - ExceptionMetadata.builder().errorCode("InvalidInput") - .exceptionBuilderSupplier(InvalidInputException::builder).httpStatusCode(400).build()); + return builder.clientConfiguration(clientConfiguration).defaultServiceExceptionSupplier(JsonException::builder) + .protocol(AwsJsonProtocol.REST_JSON).protocolVersion("1.1"); } @Override diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-async-client-class.java index 3878372becba..ec394fa575ed 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-async-client-class.java @@ -45,7 +45,6 @@ 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.query.AwsQueryProtocolFactory; import software.amazon.awssdk.retries.api.RetryStrategy; import software.amazon.awssdk.services.query.internal.QueryServiceClientConfigurationBuilder; @@ -57,7 +56,6 @@ import software.amazon.awssdk.services.query.model.BearerAuthOperationResponse; import software.amazon.awssdk.services.query.model.GetOperationWithChecksumRequest; import software.amazon.awssdk.services.query.model.GetOperationWithChecksumResponse; -import software.amazon.awssdk.services.query.model.InvalidInputException; import software.amazon.awssdk.services.query.model.OperationWithChecksumRequiredRequest; import software.amazon.awssdk.services.query.model.OperationWithChecksumRequiredResponse; import software.amazon.awssdk.services.query.model.OperationWithContextParamRequest; @@ -115,7 +113,7 @@ final class DefaultQueryAsyncClient implements QueryAsyncClient { private static final Logger log = LoggerFactory.getLogger(DefaultQueryAsyncClient.class); private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder() - .serviceProtocol(AwsServiceProtocol.QUERY).build(); + .serviceProtocol(AwsServiceProtocol.QUERY).build(); private final AsyncClientHandler clientHandler; @@ -160,27 +158,27 @@ protected DefaultQueryAsyncClient(SdkClientConfiguration clientConfiguration) { public CompletableFuture aPostOperation(APostOperationRequest aPostOperationRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "APostOperation"); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(APostOperationResponse::builder); + .createResponseHandler(APostOperationResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); String hostPrefix = "foo-"; String resolvedHostExpression = "foo-"; CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("APostOperation").withProtocolMetadata(protocolMetadata) - .withMarshaller(new APostOperationRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .hostPrefixExpression(resolvedHostExpression).withInput(aPostOperationRequest)); + .execute(new ClientExecutionParams() + .withOperationName("APostOperation").withProtocolMetadata(protocolMetadata) + .withMarshaller(new APostOperationRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .hostPrefixExpression(resolvedHostExpression).withInput(aPostOperationRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -218,29 +216,29 @@ public CompletableFuture aPostOperation(APostOperationRe */ @Override public CompletableFuture aPostOperationWithOutput( - APostOperationWithOutputRequest aPostOperationWithOutputRequest) { + APostOperationWithOutputRequest aPostOperationWithOutputRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationWithOutputRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationWithOutputRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "APostOperationWithOutput"); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(APostOperationWithOutputResponse::builder); + .createResponseHandler(APostOperationWithOutputResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("APostOperationWithOutput").withProtocolMetadata(protocolMetadata) - .withMarshaller(new APostOperationWithOutputRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(aPostOperationWithOutputRequest)); + .execute(new ClientExecutionParams() + .withOperationName("APostOperationWithOutput").withProtocolMetadata(protocolMetadata) + .withMarshaller(new APostOperationWithOutputRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(aPostOperationWithOutputRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -274,30 +272,30 @@ public CompletableFuture aPostOperationWithOut */ @Override public CompletableFuture bearerAuthOperation( - BearerAuthOperationRequest bearerAuthOperationRequest) { + BearerAuthOperationRequest bearerAuthOperationRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(bearerAuthOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, bearerAuthOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "BearerAuthOperation"); bearerAuthOperationRequest = applySignerOverride(bearerAuthOperationRequest, BearerTokenSigner.create()); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(BearerAuthOperationResponse::builder); + .createResponseHandler(BearerAuthOperationResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("BearerAuthOperation").withProtocolMetadata(protocolMetadata) - .withMarshaller(new BearerAuthOperationRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .credentialType(CredentialType.TOKEN).withRequestConfiguration(clientConfiguration) - .withMetricCollector(apiCallMetricCollector).withInput(bearerAuthOperationRequest)); + .execute(new ClientExecutionParams() + .withOperationName("BearerAuthOperation").withProtocolMetadata(protocolMetadata) + .withMarshaller(new BearerAuthOperationRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .credentialType(CredentialType.TOKEN).withRequestConfiguration(clientConfiguration) + .withMetricCollector(apiCallMetricCollector).withInput(bearerAuthOperationRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -331,37 +329,37 @@ public CompletableFuture bearerAuthOperation( */ @Override public CompletableFuture getOperationWithChecksum( - GetOperationWithChecksumRequest getOperationWithChecksumRequest) { + GetOperationWithChecksumRequest getOperationWithChecksumRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getOperationWithChecksumRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getOperationWithChecksumRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetOperationWithChecksum"); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(GetOperationWithChecksumResponse::builder); + .createResponseHandler(GetOperationWithChecksumResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("GetOperationWithChecksum") - .withProtocolMetadata(protocolMetadata) - .withMarshaller(new GetOperationWithChecksumRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute( - SdkInternalExecutionAttribute.HTTP_CHECKSUM, - HttpChecksum.builder().requestChecksumRequired(true).isRequestStreaming(false) - .requestAlgorithm(getOperationWithChecksumRequest.checksumAlgorithmAsString()) - .requestAlgorithmHeader("x-amz-sdk-checksum-algorithm").build()) - .withInput(getOperationWithChecksumRequest)); + .execute(new ClientExecutionParams() + .withOperationName("GetOperationWithChecksum") + .withProtocolMetadata(protocolMetadata) + .withMarshaller(new GetOperationWithChecksumRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute( + SdkInternalExecutionAttribute.HTTP_CHECKSUM, + HttpChecksum.builder().requestChecksumRequired(true).isRequestStreaming(false) + .requestAlgorithm(getOperationWithChecksumRequest.checksumAlgorithmAsString()) + .requestAlgorithmHeader("x-amz-sdk-checksum-algorithm").build()) + .withInput(getOperationWithChecksumRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -396,33 +394,33 @@ public CompletableFuture getOperationWithCheck */ @Override public CompletableFuture operationWithChecksumRequired( - OperationWithChecksumRequiredRequest operationWithChecksumRequiredRequest) { + OperationWithChecksumRequiredRequest operationWithChecksumRequiredRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithChecksumRequiredRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithChecksumRequiredRequest.overrideConfiguration().orElse(null)); + operationWithChecksumRequiredRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithChecksumRequired"); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(OperationWithChecksumRequiredResponse::builder); + .createResponseHandler(OperationWithChecksumRequiredResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithChecksumRequired") - .withProtocolMetadata(protocolMetadata) - .withMarshaller(new OperationWithChecksumRequiredRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute(SdkInternalExecutionAttribute.HTTP_CHECKSUM_REQUIRED, - HttpChecksumRequired.create()).withInput(operationWithChecksumRequiredRequest)); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithChecksumRequired") + .withProtocolMetadata(protocolMetadata) + .withMarshaller(new OperationWithChecksumRequiredRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute(SdkInternalExecutionAttribute.HTTP_CHECKSUM_REQUIRED, + HttpChecksumRequired.create()).withInput(operationWithChecksumRequiredRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -456,29 +454,29 @@ public CompletableFuture operationWithChe */ @Override public CompletableFuture operationWithContextParam( - OperationWithContextParamRequest operationWithContextParamRequest) { + OperationWithContextParamRequest operationWithContextParamRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithContextParamRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithContextParamRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithContextParam"); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(OperationWithContextParamResponse::builder); + .createResponseHandler(OperationWithContextParamResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithContextParam").withProtocolMetadata(protocolMetadata) - .withMarshaller(new OperationWithContextParamRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(operationWithContextParamRequest)); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithContextParam").withProtocolMetadata(protocolMetadata) + .withMarshaller(new OperationWithContextParamRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(operationWithContextParamRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -512,30 +510,30 @@ public CompletableFuture operationWithContext */ @Override public CompletableFuture operationWithCustomMember( - OperationWithCustomMemberRequest operationWithCustomMemberRequest) { + OperationWithCustomMemberRequest operationWithCustomMemberRequest) { operationWithCustomMemberRequest = UtilsTest.dummyRequestModifier(operationWithCustomMemberRequest); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithCustomMemberRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithCustomMemberRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithCustomMember"); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(OperationWithCustomMemberResponse::builder); + .createResponseHandler(OperationWithCustomMemberResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithCustomMember").withProtocolMetadata(protocolMetadata) - .withMarshaller(new OperationWithCustomMemberRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(operationWithCustomMemberRequest)); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithCustomMember").withProtocolMetadata(protocolMetadata) + .withMarshaller(new OperationWithCustomMemberRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(operationWithCustomMemberRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -571,30 +569,30 @@ public CompletableFuture operationWithCustomM */ @Override public CompletableFuture operationWithCustomizedOperationContextParam( - OperationWithCustomizedOperationContextParamRequest operationWithCustomizedOperationContextParamRequest) { + OperationWithCustomizedOperationContextParamRequest operationWithCustomizedOperationContextParamRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration( - operationWithCustomizedOperationContextParamRequest, this.clientConfiguration); + operationWithCustomizedOperationContextParamRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithCustomizedOperationContextParamRequest.overrideConfiguration().orElse(null)); + operationWithCustomizedOperationContextParamRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithCustomizedOperationContextParam"); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(OperationWithCustomizedOperationContextParamResponse::builder); + .createResponseHandler(OperationWithCustomizedOperationContextParamResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithCustomizedOperationContextParam") - .withProtocolMetadata(protocolMetadata) - .withMarshaller(new OperationWithCustomizedOperationContextParamRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(operationWithCustomizedOperationContextParamRequest)); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithCustomizedOperationContextParam") + .withProtocolMetadata(protocolMetadata) + .withMarshaller(new OperationWithCustomizedOperationContextParamRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(operationWithCustomizedOperationContextParamRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -630,29 +628,29 @@ public CompletableFuture o */ @Override public CompletableFuture operationWithMapOperationContextParam( - OperationWithMapOperationContextParamRequest operationWithMapOperationContextParamRequest) { + OperationWithMapOperationContextParamRequest operationWithMapOperationContextParamRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithMapOperationContextParamRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithMapOperationContextParamRequest.overrideConfiguration().orElse(null)); + operationWithMapOperationContextParamRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithMapOperationContextParam"); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(OperationWithMapOperationContextParamResponse::builder); + .createResponseHandler(OperationWithMapOperationContextParamResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithMapOperationContextParam").withProtocolMetadata(protocolMetadata) - .withMarshaller(new OperationWithMapOperationContextParamRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(operationWithMapOperationContextParamRequest)); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithMapOperationContextParam").withProtocolMetadata(protocolMetadata) + .withMarshaller(new OperationWithMapOperationContextParamRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(operationWithMapOperationContextParamRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -686,30 +684,30 @@ public CompletableFuture operatio */ @Override public CompletableFuture operationWithNoneAuthType( - OperationWithNoneAuthTypeRequest operationWithNoneAuthTypeRequest) { + OperationWithNoneAuthTypeRequest operationWithNoneAuthTypeRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithNoneAuthTypeRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithNoneAuthTypeRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithNoneAuthType"); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(OperationWithNoneAuthTypeResponse::builder); + .createResponseHandler(OperationWithNoneAuthTypeResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithNoneAuthType").withProtocolMetadata(protocolMetadata) - .withMarshaller(new OperationWithNoneAuthTypeRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute(SdkInternalExecutionAttribute.IS_NONE_AUTH_TYPE_REQUEST, false) - .withInput(operationWithNoneAuthTypeRequest)); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithNoneAuthType").withProtocolMetadata(protocolMetadata) + .withMarshaller(new OperationWithNoneAuthTypeRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute(SdkInternalExecutionAttribute.IS_NONE_AUTH_TYPE_REQUEST, false) + .withInput(operationWithNoneAuthTypeRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -745,29 +743,29 @@ public CompletableFuture operationWithNoneAut */ @Override public CompletableFuture operationWithOperationContextParam( - OperationWithOperationContextParamRequest operationWithOperationContextParamRequest) { + OperationWithOperationContextParamRequest operationWithOperationContextParamRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithOperationContextParamRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithOperationContextParamRequest.overrideConfiguration().orElse(null)); + operationWithOperationContextParamRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithOperationContextParam"); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(OperationWithOperationContextParamResponse::builder); + .createResponseHandler(OperationWithOperationContextParamResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithOperationContextParam").withProtocolMetadata(protocolMetadata) - .withMarshaller(new OperationWithOperationContextParamRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(operationWithOperationContextParamRequest)); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithOperationContextParam").withProtocolMetadata(protocolMetadata) + .withMarshaller(new OperationWithOperationContextParamRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(operationWithOperationContextParamRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -802,34 +800,34 @@ public CompletableFuture operationWi */ @Override public CompletableFuture operationWithRequestCompression( - OperationWithRequestCompressionRequest operationWithRequestCompressionRequest) { + OperationWithRequestCompressionRequest operationWithRequestCompressionRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithRequestCompressionRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithRequestCompressionRequest.overrideConfiguration().orElse(null)); + operationWithRequestCompressionRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithRequestCompression"); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(OperationWithRequestCompressionResponse::builder); + .createResponseHandler(OperationWithRequestCompressionResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithRequestCompression") - .withProtocolMetadata(protocolMetadata) - .withMarshaller(new OperationWithRequestCompressionRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute(SdkInternalExecutionAttribute.REQUEST_COMPRESSION, - RequestCompression.builder().encodings("gzip").isStreaming(false).build()) - .withInput(operationWithRequestCompressionRequest)); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithRequestCompression") + .withProtocolMetadata(protocolMetadata) + .withMarshaller(new OperationWithRequestCompressionRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute(SdkInternalExecutionAttribute.REQUEST_COMPRESSION, + RequestCompression.builder().encodings("gzip").isStreaming(false).build()) + .withInput(operationWithRequestCompressionRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -864,29 +862,29 @@ public CompletableFuture operationWithR */ @Override public CompletableFuture operationWithStaticContextParams( - OperationWithStaticContextParamsRequest operationWithStaticContextParamsRequest) { + OperationWithStaticContextParamsRequest operationWithStaticContextParamsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithStaticContextParamsRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithStaticContextParamsRequest.overrideConfiguration().orElse(null)); + operationWithStaticContextParamsRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithStaticContextParams"); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(OperationWithStaticContextParamsResponse::builder); + .createResponseHandler(OperationWithStaticContextParamsResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithStaticContextParams").withProtocolMetadata(protocolMetadata) - .withMarshaller(new OperationWithStaticContextParamsRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(operationWithStaticContextParamsRequest)); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithStaticContextParams").withProtocolMetadata(protocolMetadata) + .withMarshaller(new OperationWithStaticContextParamsRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(operationWithStaticContextParamsRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -938,19 +936,19 @@ public CompletableFuture operationWith */ @Override public CompletableFuture putOperationWithChecksum( - PutOperationWithChecksumRequest putOperationWithChecksumRequest, AsyncRequestBody requestBody, - AsyncResponseTransformer asyncResponseTransformer) { + PutOperationWithChecksumRequest putOperationWithChecksumRequest, AsyncRequestBody requestBody, + AsyncResponseTransformer asyncResponseTransformer) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putOperationWithChecksumRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, putOperationWithChecksumRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PutOperationWithChecksum"); Pair, CompletableFuture> pair = AsyncResponseTransformerUtils - .wrapWithEndOfStreamFuture(asyncResponseTransformer); + .wrapWithEndOfStreamFuture(asyncResponseTransformer); asyncResponseTransformer = pair.left(); CompletableFuture endOfStreamFuture = pair.right(); if (!isSignerOverridden(clientConfiguration)) { @@ -958,39 +956,39 @@ public CompletableFuture putOperationWithChecksum( } HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(PutOperationWithChecksumResponse::builder); + .createResponseHandler(PutOperationWithChecksumResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler.execute( - new ClientExecutionParams() - .withOperationName("PutOperationWithChecksum") - .withProtocolMetadata(protocolMetadata) - .withMarshaller( - AsyncStreamingRequestMarshaller.builder() - .delegateMarshaller(new PutOperationWithChecksumRequestMarshaller(protocolFactory)) - .asyncRequestBody(requestBody).build()) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute( - SdkInternalExecutionAttribute.HTTP_CHECKSUM, - HttpChecksum - .builder() - .requestChecksumRequired(false) - .isRequestStreaming(true) - .requestValidationMode(putOperationWithChecksumRequest.checksumModeAsString()) - .responseAlgorithmsV2(DefaultChecksumAlgorithm.CRC32C, - DefaultChecksumAlgorithm.CRC32, DefaultChecksumAlgorithm.SHA1, - DefaultChecksumAlgorithm.SHA256).build()).withAsyncRequestBody(requestBody) - .withInput(putOperationWithChecksumRequest), asyncResponseTransformer); + new ClientExecutionParams() + .withOperationName("PutOperationWithChecksum") + .withProtocolMetadata(protocolMetadata) + .withMarshaller( + AsyncStreamingRequestMarshaller.builder() + .delegateMarshaller(new PutOperationWithChecksumRequestMarshaller(protocolFactory)) + .asyncRequestBody(requestBody).build()) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute( + SdkInternalExecutionAttribute.HTTP_CHECKSUM, + HttpChecksum + .builder() + .requestChecksumRequired(false) + .isRequestStreaming(true) + .requestValidationMode(putOperationWithChecksumRequest.checksumModeAsString()) + .responseAlgorithmsV2(DefaultChecksumAlgorithm.CRC32C, + DefaultChecksumAlgorithm.CRC32, DefaultChecksumAlgorithm.SHA1, + DefaultChecksumAlgorithm.SHA256).build()).withAsyncRequestBody(requestBody) + .withInput(putOperationWithChecksumRequest), asyncResponseTransformer); CompletableFuture whenCompleteFuture = null; AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { if (e != null) { runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> finalAsyncResponseTransformer.exceptionOccurred(e)); + () -> finalAsyncResponseTransformer.exceptionOccurred(e)); } endOfStreamFuture.whenComplete((r2, e2) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -1000,7 +998,7 @@ public CompletableFuture putOperationWithChecksum( } catch (Throwable t) { AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> finalAsyncResponseTransformer.exceptionOccurred(t)); + () -> finalAsyncResponseTransformer.exceptionOccurred(t)); metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } @@ -1033,13 +1031,13 @@ public CompletableFuture putOperationWithChecksum( */ @Override public CompletableFuture streamingInputOperation( - StreamingInputOperationRequest streamingInputOperationRequest, AsyncRequestBody requestBody) { + StreamingInputOperationRequest streamingInputOperationRequest, AsyncRequestBody requestBody) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingInputOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingInputOperation"); @@ -1048,21 +1046,21 @@ public CompletableFuture streamingInputOperatio } HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(StreamingInputOperationResponse::builder); + .createResponseHandler(StreamingInputOperationResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("StreamingInputOperation") - .withProtocolMetadata(protocolMetadata) - .withMarshaller( - AsyncStreamingRequestMarshaller.builder() - .delegateMarshaller(new StreamingInputOperationRequestMarshaller(protocolFactory)) - .asyncRequestBody(requestBody).build()).withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) - .withMetricCollector(apiCallMetricCollector).withAsyncRequestBody(requestBody) - .withInput(streamingInputOperationRequest)); + .execute(new ClientExecutionParams() + .withOperationName("StreamingInputOperation") + .withProtocolMetadata(protocolMetadata) + .withMarshaller( + AsyncStreamingRequestMarshaller.builder() + .delegateMarshaller(new StreamingInputOperationRequestMarshaller(protocolFactory)) + .asyncRequestBody(requestBody).build()).withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) + .withMetricCollector(apiCallMetricCollector).withAsyncRequestBody(requestBody) + .withInput(streamingInputOperationRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -1101,40 +1099,40 @@ public CompletableFuture streamingInputOperatio */ @Override public CompletableFuture streamingOutputOperation( - StreamingOutputOperationRequest streamingOutputOperationRequest, - AsyncResponseTransformer asyncResponseTransformer) { + StreamingOutputOperationRequest streamingOutputOperationRequest, + AsyncResponseTransformer asyncResponseTransformer) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingOutputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingOutputOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingOutputOperation"); Pair, CompletableFuture> pair = AsyncResponseTransformerUtils - .wrapWithEndOfStreamFuture(asyncResponseTransformer); + .wrapWithEndOfStreamFuture(asyncResponseTransformer); asyncResponseTransformer = pair.left(); CompletableFuture endOfStreamFuture = pair.right(); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(StreamingOutputOperationResponse::builder); + .createResponseHandler(StreamingOutputOperationResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler.execute( - new ClientExecutionParams() - .withOperationName("StreamingOutputOperation").withProtocolMetadata(protocolMetadata) - .withMarshaller(new StreamingOutputOperationRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(streamingOutputOperationRequest), asyncResponseTransformer); + new ClientExecutionParams() + .withOperationName("StreamingOutputOperation").withProtocolMetadata(protocolMetadata) + .withMarshaller(new StreamingOutputOperationRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(streamingOutputOperationRequest), asyncResponseTransformer); CompletableFuture whenCompleteFuture = null; AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { if (e != null) { runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> finalAsyncResponseTransformer.exceptionOccurred(e)); + () -> finalAsyncResponseTransformer.exceptionOccurred(e)); } endOfStreamFuture.whenComplete((r2, e2) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -1144,7 +1142,7 @@ public CompletableFuture streamingOutputOperation( } catch (Throwable t) { AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> finalAsyncResponseTransformer.exceptionOccurred(t)); + () -> finalAsyncResponseTransformer.exceptionOccurred(t)); metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } @@ -1166,16 +1164,12 @@ public final String serviceName() { } private AwsQueryProtocolFactory init() { - return AwsQueryProtocolFactory - .builder() - .registerModeledException( - ExceptionMetadata.builder().errorCode("InvalidInput") - .exceptionBuilderSupplier(InvalidInputException::builder).httpStatusCode(400).build()) - .clientConfiguration(clientConfiguration).defaultServiceExceptionSupplier(QueryException::builder).build(); + return AwsQueryProtocolFactory.builder().clientConfiguration(clientConfiguration) + .defaultServiceExceptionSupplier(QueryException::builder).build(); } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, - RequestOverrideConfiguration requestOverrideConfiguration) { + RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); @@ -1195,8 +1189,8 @@ private T applySignerOverride(T request, Signer signer) } Consumer signerOverride = b -> b.signer(signer).build(); AwsRequestOverrideConfiguration overrideConfiguration = request.overrideConfiguration() - .map(c -> c.toBuilder().applyMutation(signerOverride).build()) - .orElse((AwsRequestOverrideConfiguration.builder().applyMutation(signerOverride).build())); + .map(c -> c.toBuilder().applyMutation(signerOverride).build()) + .orElse((AwsRequestOverrideConfiguration.builder().applyMutation(signerOverride).build())); return (T) request.toBuilder().overrideConfiguration(overrideConfiguration).build(); } @@ -1245,4 +1239,4 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, public void close() { clientHandler.close(); } -} +} \ No newline at end of file diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-client-class.java index 5f013b28da68..934116aa446e 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-client-class.java @@ -38,7 +38,6 @@ 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.query.AwsQueryProtocolFactory; import software.amazon.awssdk.retries.api.RetryStrategy; import software.amazon.awssdk.services.query.internal.QueryServiceClientConfigurationBuilder; @@ -107,7 +106,7 @@ final class DefaultQueryClient implements QueryClient { private static final Logger log = Logger.loggerFor(DefaultQueryClient.class); private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder() - .serviceProtocol(AwsServiceProtocol.QUERY).build(); + .serviceProtocol(AwsServiceProtocol.QUERY).build(); private final SyncClientHandler clientHandler; @@ -143,17 +142,17 @@ protected DefaultQueryClient(SdkClientConfiguration clientConfiguration) { */ @Override public APostOperationResponse aPostOperation(APostOperationRequest aPostOperationRequest) throws InvalidInputException, - AwsServiceException, SdkClientException, QueryException { + AwsServiceException, SdkClientException, QueryException { HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(APostOperationResponse::builder); + .createResponseHandler(APostOperationResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "APostOperation"); @@ -161,11 +160,11 @@ public APostOperationResponse aPostOperation(APostOperationRequest aPostOperatio String resolvedHostExpression = "foo-"; return clientHandler.execute(new ClientExecutionParams() - .withOperationName("APostOperation").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .hostPrefixExpression(resolvedHostExpression).withRequestConfiguration(clientConfiguration) - .withInput(aPostOperationRequest).withMetricCollector(apiCallMetricCollector) - .withMarshaller(new APostOperationRequestMarshaller(protocolFactory))); + .withOperationName("APostOperation").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .hostPrefixExpression(resolvedHostExpression).withRequestConfiguration(clientConfiguration) + .withInput(aPostOperationRequest).withMetricCollector(apiCallMetricCollector) + .withMarshaller(new APostOperationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -193,30 +192,30 @@ public APostOperationResponse aPostOperation(APostOperationRequest aPostOperatio */ @Override public APostOperationWithOutputResponse aPostOperationWithOutput( - APostOperationWithOutputRequest aPostOperationWithOutputRequest) throws InvalidInputException, AwsServiceException, - SdkClientException, QueryException { + APostOperationWithOutputRequest aPostOperationWithOutputRequest) throws InvalidInputException, AwsServiceException, + SdkClientException, QueryException { HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(APostOperationWithOutputResponse::builder); + .createResponseHandler(APostOperationWithOutputResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationWithOutputRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationWithOutputRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "APostOperationWithOutput"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("APostOperationWithOutput").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(aPostOperationWithOutputRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new APostOperationWithOutputRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("APostOperationWithOutput").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(aPostOperationWithOutputRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new APostOperationWithOutputRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -240,29 +239,29 @@ public APostOperationWithOutputResponse aPostOperationWithOutput( */ @Override public BearerAuthOperationResponse bearerAuthOperation(BearerAuthOperationRequest bearerAuthOperationRequest) - throws AwsServiceException, SdkClientException, QueryException { + throws AwsServiceException, SdkClientException, QueryException { bearerAuthOperationRequest = applySignerOverride(bearerAuthOperationRequest, BearerTokenSigner.create()); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(BearerAuthOperationResponse::builder); + .createResponseHandler(BearerAuthOperationResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(bearerAuthOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, bearerAuthOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "BearerAuthOperation"); return clientHandler.execute(new ClientExecutionParams() - .withOperationName("BearerAuthOperation").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .credentialType(CredentialType.TOKEN).withRequestConfiguration(clientConfiguration) - .withInput(bearerAuthOperationRequest).withMetricCollector(apiCallMetricCollector) - .withMarshaller(new BearerAuthOperationRequestMarshaller(protocolFactory))); + .withOperationName("BearerAuthOperation").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .credentialType(CredentialType.TOKEN).withRequestConfiguration(clientConfiguration) + .withInput(bearerAuthOperationRequest).withMetricCollector(apiCallMetricCollector) + .withMarshaller(new BearerAuthOperationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -286,38 +285,38 @@ public BearerAuthOperationResponse bearerAuthOperation(BearerAuthOperationReques */ @Override public GetOperationWithChecksumResponse getOperationWithChecksum( - GetOperationWithChecksumRequest getOperationWithChecksumRequest) throws AwsServiceException, SdkClientException, - QueryException { + GetOperationWithChecksumRequest getOperationWithChecksumRequest) throws AwsServiceException, SdkClientException, + QueryException { HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(GetOperationWithChecksumResponse::builder); + .createResponseHandler(GetOperationWithChecksumResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getOperationWithChecksumRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getOperationWithChecksumRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetOperationWithChecksum"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("GetOperationWithChecksum") - .withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withInput(getOperationWithChecksumRequest) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute( - SdkInternalExecutionAttribute.HTTP_CHECKSUM, - HttpChecksum.builder().requestChecksumRequired(true).isRequestStreaming(false) - .requestAlgorithm(getOperationWithChecksumRequest.checksumAlgorithmAsString()) - .requestAlgorithmHeader("x-amz-sdk-checksum-algorithm").build()) - .withMarshaller(new GetOperationWithChecksumRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("GetOperationWithChecksum") + .withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withInput(getOperationWithChecksumRequest) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute( + SdkInternalExecutionAttribute.HTTP_CHECKSUM, + HttpChecksum.builder().requestChecksumRequired(true).isRequestStreaming(false) + .requestAlgorithm(getOperationWithChecksumRequest.checksumAlgorithmAsString()) + .requestAlgorithmHeader("x-amz-sdk-checksum-algorithm").build()) + .withMarshaller(new GetOperationWithChecksumRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -341,35 +340,35 @@ public GetOperationWithChecksumResponse getOperationWithChecksum( */ @Override public OperationWithChecksumRequiredResponse operationWithChecksumRequired( - OperationWithChecksumRequiredRequest operationWithChecksumRequiredRequest) throws AwsServiceException, - SdkClientException, QueryException { + OperationWithChecksumRequiredRequest operationWithChecksumRequiredRequest) throws AwsServiceException, + SdkClientException, QueryException { HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(OperationWithChecksumRequiredResponse::builder); + .createResponseHandler(OperationWithChecksumRequiredResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithChecksumRequiredRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithChecksumRequiredRequest.overrideConfiguration().orElse(null)); + operationWithChecksumRequiredRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithChecksumRequired"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithChecksumRequired") - .withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withInput(operationWithChecksumRequiredRequest) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute(SdkInternalExecutionAttribute.HTTP_CHECKSUM_REQUIRED, - HttpChecksumRequired.create()) - .withMarshaller(new OperationWithChecksumRequiredRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithChecksumRequired") + .withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withInput(operationWithChecksumRequiredRequest) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute(SdkInternalExecutionAttribute.HTTP_CHECKSUM_REQUIRED, + HttpChecksumRequired.create()) + .withMarshaller(new OperationWithChecksumRequiredRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -393,30 +392,30 @@ public OperationWithChecksumRequiredResponse operationWithChecksumRequired( */ @Override public OperationWithContextParamResponse operationWithContextParam( - OperationWithContextParamRequest operationWithContextParamRequest) throws AwsServiceException, SdkClientException, - QueryException { + OperationWithContextParamRequest operationWithContextParamRequest) throws AwsServiceException, SdkClientException, + QueryException { HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(OperationWithContextParamResponse::builder); + .createResponseHandler(OperationWithContextParamResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithContextParamRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithContextParamRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithContextParam"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithContextParam").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(operationWithContextParamRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new OperationWithContextParamRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithContextParam").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(operationWithContextParamRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new OperationWithContextParamRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -440,31 +439,31 @@ public OperationWithContextParamResponse operationWithContextParam( */ @Override public OperationWithCustomMemberResponse operationWithCustomMember( - OperationWithCustomMemberRequest operationWithCustomMemberRequest) throws AwsServiceException, SdkClientException, - QueryException { + OperationWithCustomMemberRequest operationWithCustomMemberRequest) throws AwsServiceException, SdkClientException, + QueryException { operationWithCustomMemberRequest = UtilsTest.dummyRequestModifier(operationWithCustomMemberRequest); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(OperationWithCustomMemberResponse::builder); + .createResponseHandler(OperationWithCustomMemberResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithCustomMemberRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithCustomMemberRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithCustomMember"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithCustomMember").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(operationWithCustomMemberRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new OperationWithCustomMemberRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithCustomMember").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(operationWithCustomMemberRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new OperationWithCustomMemberRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -489,31 +488,31 @@ public OperationWithCustomMemberResponse operationWithCustomMember( */ @Override public OperationWithCustomizedOperationContextParamResponse operationWithCustomizedOperationContextParam( - OperationWithCustomizedOperationContextParamRequest operationWithCustomizedOperationContextParamRequest) - throws AwsServiceException, SdkClientException, QueryException { + OperationWithCustomizedOperationContextParamRequest operationWithCustomizedOperationContextParamRequest) + throws AwsServiceException, SdkClientException, QueryException { HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(OperationWithCustomizedOperationContextParamResponse::builder); + .createResponseHandler(OperationWithCustomizedOperationContextParamResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration( - operationWithCustomizedOperationContextParamRequest, this.clientConfiguration); + operationWithCustomizedOperationContextParamRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithCustomizedOperationContextParamRequest.overrideConfiguration().orElse(null)); + operationWithCustomizedOperationContextParamRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithCustomizedOperationContextParam"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithCustomizedOperationContextParam") - .withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) - .withInput(operationWithCustomizedOperationContextParamRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new OperationWithCustomizedOperationContextParamRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithCustomizedOperationContextParam") + .withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) + .withInput(operationWithCustomizedOperationContextParamRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new OperationWithCustomizedOperationContextParamRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -538,30 +537,30 @@ public OperationWithCustomizedOperationContextParamResponse operationWithCustomi */ @Override public OperationWithMapOperationContextParamResponse operationWithMapOperationContextParam( - OperationWithMapOperationContextParamRequest operationWithMapOperationContextParamRequest) - throws AwsServiceException, SdkClientException, QueryException { + OperationWithMapOperationContextParamRequest operationWithMapOperationContextParamRequest) + throws AwsServiceException, SdkClientException, QueryException { HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(OperationWithMapOperationContextParamResponse::builder); + .createResponseHandler(OperationWithMapOperationContextParamResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithMapOperationContextParamRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithMapOperationContextParamRequest.overrideConfiguration().orElse(null)); + operationWithMapOperationContextParamRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithMapOperationContextParam"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithMapOperationContextParam").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withInput(operationWithMapOperationContextParamRequest).withMetricCollector(apiCallMetricCollector) - .withMarshaller(new OperationWithMapOperationContextParamRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithMapOperationContextParam").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withInput(operationWithMapOperationContextParamRequest).withMetricCollector(apiCallMetricCollector) + .withMarshaller(new OperationWithMapOperationContextParamRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -585,31 +584,31 @@ public OperationWithMapOperationContextParamResponse operationWithMapOperationCo */ @Override public OperationWithNoneAuthTypeResponse operationWithNoneAuthType( - OperationWithNoneAuthTypeRequest operationWithNoneAuthTypeRequest) throws AwsServiceException, SdkClientException, - QueryException { + OperationWithNoneAuthTypeRequest operationWithNoneAuthTypeRequest) throws AwsServiceException, SdkClientException, + QueryException { HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(OperationWithNoneAuthTypeResponse::builder); + .createResponseHandler(OperationWithNoneAuthTypeResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithNoneAuthTypeRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithNoneAuthTypeRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithNoneAuthType"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithNoneAuthType").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(operationWithNoneAuthTypeRequest) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute(SdkInternalExecutionAttribute.IS_NONE_AUTH_TYPE_REQUEST, false) - .withMarshaller(new OperationWithNoneAuthTypeRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithNoneAuthType").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(operationWithNoneAuthTypeRequest) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute(SdkInternalExecutionAttribute.IS_NONE_AUTH_TYPE_REQUEST, false) + .withMarshaller(new OperationWithNoneAuthTypeRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -634,30 +633,30 @@ public OperationWithNoneAuthTypeResponse operationWithNoneAuthType( */ @Override public OperationWithOperationContextParamResponse operationWithOperationContextParam( - OperationWithOperationContextParamRequest operationWithOperationContextParamRequest) throws AwsServiceException, - SdkClientException, QueryException { + OperationWithOperationContextParamRequest operationWithOperationContextParamRequest) throws AwsServiceException, + SdkClientException, QueryException { HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(OperationWithOperationContextParamResponse::builder); + .createResponseHandler(OperationWithOperationContextParamResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithOperationContextParamRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithOperationContextParamRequest.overrideConfiguration().orElse(null)); + operationWithOperationContextParamRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithOperationContextParam"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithOperationContextParam").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(operationWithOperationContextParamRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new OperationWithOperationContextParamRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithOperationContextParam").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(operationWithOperationContextParamRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new OperationWithOperationContextParamRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -681,35 +680,35 @@ public OperationWithOperationContextParamResponse operationWithOperationContextP */ @Override public OperationWithRequestCompressionResponse operationWithRequestCompression( - OperationWithRequestCompressionRequest operationWithRequestCompressionRequest) throws AwsServiceException, - SdkClientException, QueryException { + OperationWithRequestCompressionRequest operationWithRequestCompressionRequest) throws AwsServiceException, + SdkClientException, QueryException { HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(OperationWithRequestCompressionResponse::builder); + .createResponseHandler(OperationWithRequestCompressionResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithRequestCompressionRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithRequestCompressionRequest.overrideConfiguration().orElse(null)); + operationWithRequestCompressionRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithRequestCompression"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithRequestCompression") - .withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withInput(operationWithRequestCompressionRequest) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute(SdkInternalExecutionAttribute.REQUEST_COMPRESSION, - RequestCompression.builder().encodings("gzip").isStreaming(false).build()) - .withMarshaller(new OperationWithRequestCompressionRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithRequestCompression") + .withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withInput(operationWithRequestCompressionRequest) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute(SdkInternalExecutionAttribute.REQUEST_COMPRESSION, + RequestCompression.builder().encodings("gzip").isStreaming(false).build()) + .withMarshaller(new OperationWithRequestCompressionRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -733,30 +732,30 @@ public OperationWithRequestCompressionResponse operationWithRequestCompression( */ @Override public OperationWithStaticContextParamsResponse operationWithStaticContextParams( - OperationWithStaticContextParamsRequest operationWithStaticContextParamsRequest) throws AwsServiceException, - SdkClientException, QueryException { + OperationWithStaticContextParamsRequest operationWithStaticContextParamsRequest) throws AwsServiceException, + SdkClientException, QueryException { HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(OperationWithStaticContextParamsResponse::builder); + .createResponseHandler(OperationWithStaticContextParamsResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithStaticContextParamsRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithStaticContextParamsRequest.overrideConfiguration().orElse(null)); + operationWithStaticContextParamsRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithStaticContextParams"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithStaticContextParams").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(operationWithStaticContextParamsRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new OperationWithStaticContextParamsRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithStaticContextParams").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(operationWithStaticContextParamsRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new OperationWithStaticContextParamsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -806,47 +805,47 @@ public OperationWithStaticContextParamsResponse operationWithStaticContextParams */ @Override public ReturnT putOperationWithChecksum(PutOperationWithChecksumRequest putOperationWithChecksumRequest, - RequestBody requestBody, ResponseTransformer responseTransformer) - throws AwsServiceException, SdkClientException, QueryException { + RequestBody requestBody, ResponseTransformer responseTransformer) + throws AwsServiceException, SdkClientException, QueryException { HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(PutOperationWithChecksumResponse::builder); + .createResponseHandler(PutOperationWithChecksumResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putOperationWithChecksumRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, putOperationWithChecksumRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PutOperationWithChecksum"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("PutOperationWithChecksum") - .withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withInput(putOperationWithChecksumRequest) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute( - SdkInternalExecutionAttribute.HTTP_CHECKSUM, - HttpChecksum - .builder() - .requestChecksumRequired(false) - .isRequestStreaming(true) - .requestValidationMode(putOperationWithChecksumRequest.checksumModeAsString()) - .responseAlgorithmsV2(DefaultChecksumAlgorithm.CRC32C, - DefaultChecksumAlgorithm.CRC32, DefaultChecksumAlgorithm.SHA1, - DefaultChecksumAlgorithm.SHA256).build()) - .withRequestBody(requestBody) - .withMarshaller( - StreamingRequestMarshaller.builder() - .delegateMarshaller(new PutOperationWithChecksumRequestMarshaller(protocolFactory)) - .requestBody(requestBody).build())); + .execute(new ClientExecutionParams() + .withOperationName("PutOperationWithChecksum") + .withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withInput(putOperationWithChecksumRequest) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute( + SdkInternalExecutionAttribute.HTTP_CHECKSUM, + HttpChecksum + .builder() + .requestChecksumRequired(false) + .isRequestStreaming(true) + .requestValidationMode(putOperationWithChecksumRequest.checksumModeAsString()) + .responseAlgorithmsV2(DefaultChecksumAlgorithm.CRC32C, + DefaultChecksumAlgorithm.CRC32, DefaultChecksumAlgorithm.SHA1, + DefaultChecksumAlgorithm.SHA256).build()) + .withRequestBody(requestBody) + .withMarshaller( + StreamingRequestMarshaller.builder() + .delegateMarshaller(new PutOperationWithChecksumRequestMarshaller(protocolFactory)) + .requestBody(requestBody).build())); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -881,36 +880,36 @@ public ReturnT putOperationWithChecksum(PutOperationWithChecksumReques */ @Override public StreamingInputOperationResponse streamingInputOperation(StreamingInputOperationRequest streamingInputOperationRequest, - RequestBody requestBody) throws AwsServiceException, SdkClientException, QueryException { + RequestBody requestBody) throws AwsServiceException, SdkClientException, QueryException { HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(StreamingInputOperationResponse::builder); + .createResponseHandler(StreamingInputOperationResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingInputOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingInputOperation"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("StreamingInputOperation") - .withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withInput(streamingInputOperationRequest) - .withMetricCollector(apiCallMetricCollector) - .withRequestBody(requestBody) - .withMarshaller( - StreamingRequestMarshaller.builder() - .delegateMarshaller(new StreamingInputOperationRequestMarshaller(protocolFactory)) - .requestBody(requestBody).build())); + .execute(new ClientExecutionParams() + .withOperationName("StreamingInputOperation") + .withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withInput(streamingInputOperationRequest) + .withMetricCollector(apiCallMetricCollector) + .withRequestBody(requestBody) + .withMarshaller( + StreamingRequestMarshaller.builder() + .delegateMarshaller(new StreamingInputOperationRequestMarshaller(protocolFactory)) + .requestBody(requestBody).build())); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -941,30 +940,30 @@ public StreamingInputOperationResponse streamingInputOperation(StreamingInputOpe */ @Override public ReturnT streamingOutputOperation(StreamingOutputOperationRequest streamingOutputOperationRequest, - ResponseTransformer responseTransformer) throws AwsServiceException, - SdkClientException, QueryException { + ResponseTransformer responseTransformer) throws AwsServiceException, + SdkClientException, QueryException { HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(StreamingOutputOperationResponse::builder); + .createResponseHandler(StreamingOutputOperationResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingOutputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingOutputOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingOutputOperation"); return clientHandler.execute( - new ClientExecutionParams() - .withOperationName("StreamingOutputOperation").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(streamingOutputOperationRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new StreamingOutputOperationRequestMarshaller(protocolFactory)), responseTransformer); + new ClientExecutionParams() + .withOperationName("StreamingOutputOperation").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(streamingOutputOperationRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new StreamingOutputOperationRequestMarshaller(protocolFactory)), responseTransformer); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -989,8 +988,8 @@ private T applySignerOverride(T request, Signer signer) } Consumer signerOverride = b -> b.signer(signer).build(); AwsRequestOverrideConfiguration overrideConfiguration = request.overrideConfiguration() - .map(c -> c.toBuilder().applyMutation(signerOverride).build()) - .orElse((AwsRequestOverrideConfiguration.builder().applyMutation(signerOverride).build())); + .map(c -> c.toBuilder().applyMutation(signerOverride).build()) + .orElse((AwsRequestOverrideConfiguration.builder().applyMutation(signerOverride).build())); return (T) request.toBuilder().overrideConfiguration(overrideConfiguration).build(); } @@ -1000,7 +999,7 @@ public final String serviceName() { } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, - RequestOverrideConfiguration requestOverrideConfiguration) { + RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); @@ -1052,12 +1051,8 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, } private AwsQueryProtocolFactory init() { - return AwsQueryProtocolFactory - .builder() - .registerModeledException( - ExceptionMetadata.builder().errorCode("InvalidInput") - .exceptionBuilderSupplier(InvalidInputException::builder).httpStatusCode(400).build()) - .clientConfiguration(clientConfiguration).defaultServiceExceptionSupplier(QueryException::builder).build(); + return AwsQueryProtocolFactory.builder().clientConfiguration(clientConfiguration) + .defaultServiceExceptionSupplier(QueryException::builder).build(); } @Override 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 index f2530d02c873..867bd64bf7b8 100644 --- 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 @@ -144,9 +144,15 @@ public CompletableFuture emptyInputOutput(EmptyInputOu HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, EmptyInputOutputResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -201,9 +207,15 @@ public CompletableFuture float16(Float16Request float16Request) HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, Float16Response::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams().withOperationName("Float16") @@ -258,9 +270,15 @@ public CompletableFuture fractionalSeconds(Fractional HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, FractionalSecondsResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -318,9 +336,21 @@ public CompletableFuture greetingWithErrors(Greeting HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GreetingWithErrorsResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "ComplexErrorException": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexErrorException") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); + case "InvalidGreetingException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreetingException") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -375,9 +405,15 @@ public CompletableFuture noInputOutput(NoInputOutputReque HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, NoInputOutputResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -435,9 +471,18 @@ public CompletableFuture operationWithDefaults( HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, OperationWithDefaultsResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -494,9 +539,15 @@ public CompletableFuture optionalInputOutput( HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, OptionalInputOutputResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -552,9 +603,15 @@ public CompletableFuture recursiveShapes(RecursiveShape HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, RecursiveShapesResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -611,9 +668,18 @@ public CompletableFuture rpcV2CborDenseMaps(RpcV2Cbo HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, RpcV2CborDenseMapsResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -669,9 +735,18 @@ public CompletableFuture rpcV2CborLists(RpcV2CborListsRe HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, RpcV2CborListsResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -729,9 +804,18 @@ public CompletableFuture rpcV2CborSparseMaps( HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, RpcV2CborSparseMapsResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -788,9 +872,15 @@ public CompletableFuture simpleScalarProperties( HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, SimpleScalarPropertiesResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -847,9 +937,15 @@ public CompletableFuture sparseNullsOperation( HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, SparseNullsOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -880,20 +976,9 @@ public final String serviceName() { } 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()); + return builder.clientConfiguration(clientConfiguration) + .defaultServiceExceptionSupplier(SmithyRpcV2ProtocolException::builder) + .protocol(AwsJsonProtocol.SMITHY_RPC_V2_CBOR).protocolVersion("1.1"); } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, @@ -949,11 +1034,6 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, return configuration.build(); } - private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, - JsonOperationMetadata operationMetadata) { - return protocolFactory.createErrorResponseHandler(operationMetadata); - } - private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); @@ -963,4 +1043,4 @@ private HttpResponseHandler createErrorResponseHandler(Base public void close() { clientHandler.close(); } -} +} \ No newline at end of file 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 index c02466218908..2c05002e066f 100644 --- 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 @@ -2,7 +2,9 @@ import java.util.Collections; import java.util.List; +import java.util.Optional; import java.util.function.Consumer; +import java.util.function.Function; import software.amazon.awssdk.annotations.Generated; import software.amazon.awssdk.annotations.SdkInternalApi; import software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler; @@ -88,7 +90,7 @@ final class DefaultSmithyRpcV2ProtocolClient implements SmithyRpcV2ProtocolClien private static final Logger log = Logger.loggerFor(DefaultSmithyRpcV2ProtocolClient.class); private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder() - .serviceProtocol(AwsServiceProtocol.SMITHY_RPC_V2_CBOR).build(); + .serviceProtocol(AwsServiceProtocol.SMITHY_RPC_V2_CBOR).build(); private final SyncClientHandler clientHandler; @@ -120,31 +122,37 @@ protected DefaultSmithyRpcV2ProtocolClient(SdkClientConfiguration clientConfigur */ @Override public EmptyInputOutputResponse emptyInputOutput(EmptyInputOutputRequest emptyInputOutputRequest) throws AwsServiceException, - SdkClientException, SmithyRpcV2ProtocolException { + SdkClientException, SmithyRpcV2ProtocolException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, - EmptyInputOutputResponse::builder); + EmptyInputOutputResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(emptyInputOutputRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, emptyInputOutputRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .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))); + .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())); } @@ -168,29 +176,35 @@ public EmptyInputOutputResponse emptyInputOutput(EmptyInputOutputRequest emptyIn */ @Override public Float16Response float16(Float16Request float16Request) throws AwsServiceException, SdkClientException, - SmithyRpcV2ProtocolException { + SmithyRpcV2ProtocolException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, - Float16Response::builder); + Float16Response::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(float16Request, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, float16Request - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .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))); + .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())); } @@ -214,31 +228,37 @@ public Float16Response float16(Float16Request float16Request) throws AwsServiceE */ @Override public FractionalSecondsResponse fractionalSeconds(FractionalSecondsRequest fractionalSecondsRequest) - throws AwsServiceException, SdkClientException, SmithyRpcV2ProtocolException { + throws AwsServiceException, SdkClientException, SmithyRpcV2ProtocolException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, - FractionalSecondsResponse::builder); + FractionalSecondsResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(fractionalSecondsRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, fractionalSecondsRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .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))); + .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())); } @@ -264,32 +284,44 @@ public FractionalSecondsResponse fractionalSeconds(FractionalSecondsRequest frac */ @Override public GreetingWithErrorsResponse greetingWithErrors(GreetingWithErrorsRequest greetingWithErrorsRequest) - throws ComplexErrorException, InvalidGreetingException, AwsServiceException, SdkClientException, - SmithyRpcV2ProtocolException { + throws ComplexErrorException, InvalidGreetingException, AwsServiceException, SdkClientException, + SmithyRpcV2ProtocolException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, GreetingWithErrorsResponse::builder); + operationMetadata, GreetingWithErrorsResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "ComplexErrorException": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexErrorException") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); + case "InvalidGreetingException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreetingException") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(greetingWithErrorsRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, greetingWithErrorsRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .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))); + .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())); } @@ -313,30 +345,36 @@ public GreetingWithErrorsResponse greetingWithErrors(GreetingWithErrorsRequest g */ @Override public NoInputOutputResponse noInputOutput(NoInputOutputRequest noInputOutputRequest) throws AwsServiceException, - SdkClientException, SmithyRpcV2ProtocolException { + SdkClientException, SmithyRpcV2ProtocolException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, - NoInputOutputResponse::builder); + NoInputOutputResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(noInputOutputRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, noInputOutputRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .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))); + .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())); } @@ -361,31 +399,40 @@ public NoInputOutputResponse noInputOutput(NoInputOutputRequest noInputOutputReq */ @Override public OperationWithDefaultsResponse operationWithDefaults(OperationWithDefaultsRequest operationWithDefaultsRequest) - throws ValidationException, AwsServiceException, SdkClientException, SmithyRpcV2ProtocolException { + throws ValidationException, AwsServiceException, SdkClientException, SmithyRpcV2ProtocolException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, OperationWithDefaultsResponse::builder); + operationMetadata, OperationWithDefaultsResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithDefaultsRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithDefaultsRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .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))); + .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())); } @@ -409,31 +456,37 @@ public OperationWithDefaultsResponse operationWithDefaults(OperationWithDefaults */ @Override public OptionalInputOutputResponse optionalInputOutput(OptionalInputOutputRequest optionalInputOutputRequest) - throws AwsServiceException, SdkClientException, SmithyRpcV2ProtocolException { + throws AwsServiceException, SdkClientException, SmithyRpcV2ProtocolException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, OptionalInputOutputResponse::builder); + operationMetadata, OptionalInputOutputResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(optionalInputOutputRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, optionalInputOutputRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .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))); + .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())); } @@ -457,31 +510,37 @@ public OptionalInputOutputResponse optionalInputOutput(OptionalInputOutputReques */ @Override public RecursiveShapesResponse recursiveShapes(RecursiveShapesRequest recursiveShapesRequest) throws AwsServiceException, - SdkClientException, SmithyRpcV2ProtocolException { + SdkClientException, SmithyRpcV2ProtocolException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, - RecursiveShapesResponse::builder); + RecursiveShapesResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(recursiveShapesRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, recursiveShapesRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .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))); + .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())); } @@ -506,31 +565,40 @@ public RecursiveShapesResponse recursiveShapes(RecursiveShapesRequest recursiveS */ @Override public RpcV2CborDenseMapsResponse rpcV2CborDenseMaps(RpcV2CborDenseMapsRequest rpcV2CborDenseMapsRequest) - throws ValidationException, AwsServiceException, SdkClientException, SmithyRpcV2ProtocolException { + throws ValidationException, AwsServiceException, SdkClientException, SmithyRpcV2ProtocolException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, RpcV2CborDenseMapsResponse::builder); + operationMetadata, RpcV2CborDenseMapsResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(rpcV2CborDenseMapsRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, rpcV2CborDenseMapsRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .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))); + .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())); } @@ -555,30 +623,39 @@ public RpcV2CborDenseMapsResponse rpcV2CborDenseMaps(RpcV2CborDenseMapsRequest r */ @Override public RpcV2CborListsResponse rpcV2CborLists(RpcV2CborListsRequest rpcV2CborListsRequest) throws ValidationException, - AwsServiceException, SdkClientException, SmithyRpcV2ProtocolException { + AwsServiceException, SdkClientException, SmithyRpcV2ProtocolException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, - RpcV2CborListsResponse::builder); + RpcV2CborListsResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(rpcV2CborListsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, rpcV2CborListsRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .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))); + .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())); } @@ -603,31 +680,40 @@ public RpcV2CborListsResponse rpcV2CborLists(RpcV2CborListsRequest rpcV2CborList */ @Override public RpcV2CborSparseMapsResponse rpcV2CborSparseMaps(RpcV2CborSparseMapsRequest rpcV2CborSparseMapsRequest) - throws ValidationException, AwsServiceException, SdkClientException, SmithyRpcV2ProtocolException { + throws ValidationException, AwsServiceException, SdkClientException, SmithyRpcV2ProtocolException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, RpcV2CborSparseMapsResponse::builder); + operationMetadata, RpcV2CborSparseMapsResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(rpcV2CborSparseMapsRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, rpcV2CborSparseMapsRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .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))); + .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())); } @@ -651,32 +737,38 @@ public RpcV2CborSparseMapsResponse rpcV2CborSparseMaps(RpcV2CborSparseMapsReques */ @Override public SimpleScalarPropertiesResponse simpleScalarProperties(SimpleScalarPropertiesRequest simpleScalarPropertiesRequest) - throws AwsServiceException, SdkClientException, SmithyRpcV2ProtocolException { + throws AwsServiceException, SdkClientException, SmithyRpcV2ProtocolException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, SimpleScalarPropertiesResponse::builder); + operationMetadata, SimpleScalarPropertiesResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(simpleScalarPropertiesRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, simpleScalarPropertiesRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .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))); + .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())); } @@ -700,31 +792,37 @@ public SimpleScalarPropertiesResponse simpleScalarProperties(SimpleScalarPropert */ @Override public SparseNullsOperationResponse sparseNullsOperation(SparseNullsOperationRequest sparseNullsOperationRequest) - throws AwsServiceException, SdkClientException, SmithyRpcV2ProtocolException { + throws AwsServiceException, SdkClientException, SmithyRpcV2ProtocolException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, SparseNullsOperationResponse::builder); + operationMetadata, SparseNullsOperationResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(sparseNullsOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, sparseNullsOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .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))); + .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())); } @@ -736,7 +834,7 @@ public final String serviceName() { } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, - RequestOverrideConfiguration requestOverrideConfiguration) { + RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); @@ -751,8 +849,8 @@ private static List resolveMetricPublishers(SdkClientConfigurat } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, - JsonOperationMetadata operationMetadata) { - return protocolFactory.createErrorResponseHandler(operationMetadata); + JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { + return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); } private void updateRetryStrategyClientConfiguration(SdkClientConfiguration.Builder configuration) { @@ -785,7 +883,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, return configuration.build(); } SmithyRpcV2ProtocolServiceClientConfigurationBuilder serviceConfigBuilder = new SmithyRpcV2ProtocolServiceClientConfigurationBuilder( - configuration); + configuration); for (SdkPlugin plugin : plugins) { plugin.configureClient(serviceConfigBuilder); } @@ -794,20 +892,9 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, } 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()); + return builder.clientConfiguration(clientConfiguration) + .defaultServiceExceptionSupplier(SmithyRpcV2ProtocolException::builder) + .protocol(AwsJsonProtocol.SMITHY_RPC_V2_CBOR).protocolVersion("1.1"); } @Override diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-async-client-class.java index 4a8589dead07..64c1946d1d63 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-async-client-class.java @@ -145,9 +145,18 @@ public CompletableFuture deleteRow(DeleteRowRequest deleteRow HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, DeleteRowResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams().withOperationName("DeleteRow") @@ -205,9 +214,18 @@ public CompletableFuture getRow(GetRowRequest getRowRequest) { HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, GetRowResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams().withOperationName("GetRow") @@ -269,9 +287,18 @@ public CompletableFuture opWithSigv HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(operationMetadata, OpWithSigv4AndSigv4AUnSignedPayloadResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -332,9 +359,18 @@ public CompletableFuture opWithSigv4SignedPayl HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, OpWithSigv4SignedPayloadResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -395,9 +431,18 @@ public CompletableFuture opWithSigv4UnSigned HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, OpWithSigv4UnSignedPayloadResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -470,9 +515,18 @@ public CompletableFuture opWithS HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(operationMetadata, OpWithSigv4UnSignedPayloadAndStreamingResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -483,10 +537,10 @@ public CompletableFuture opWithS .builder() .delegateMarshaller( new OpWithSigv4UnSignedPayloadAndStreamingRequestMarshaller(protocolFactory)) - .asyncRequestBody(requestBody).transferEncoding(true).build()).withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) - .withMetricCollector(apiCallMetricCollector).withAsyncRequestBody(requestBody) - .withInput(opWithSigv4UnSignedPayloadAndStreamingRequest)); + .asyncRequestBody(requestBody).transferEncoding(true).build()) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withAsyncRequestBody(requestBody).withInput(opWithSigv4UnSignedPayloadAndStreamingRequest)); CompletableFuture whenCompleted = executeFuture .whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -540,9 +594,18 @@ public CompletableFuture opWithSigv4aSignedPa HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, OpWithSigv4ASignedPayloadResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -603,9 +666,18 @@ public CompletableFuture opWithSigv4aUnSign HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, OpWithSigv4AUnSignedPayloadResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -668,9 +740,18 @@ public CompletableFuture opsWithSigv HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(operationMetadata, OpsWithSigv4AndSigv4ASignedPayloadResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -729,9 +810,18 @@ public CompletableFuture putRow(PutRowRequest putRowRequest) { HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, PutRowResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams().withOperationName("PutRow") @@ -793,9 +883,18 @@ public CompletableFuture secon HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(operationMetadata, SecondOpsWithSigv4AndSigv4ASignedPayloadResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -827,14 +926,8 @@ public final String serviceName() { } private > T init(T builder) { - return builder - .clientConfiguration(clientConfiguration) - .defaultServiceExceptionSupplier(DatabaseException::builder) - .protocol(AwsJsonProtocol.REST_JSON) - .protocolVersion("1.1") - .registerModeledException( - ExceptionMetadata.builder().errorCode("InvalidInput") - .exceptionBuilderSupplier(InvalidInputException::builder).httpStatusCode(400).build()); + return builder.clientConfiguration(clientConfiguration).defaultServiceExceptionSupplier(DatabaseException::builder) + .protocol(AwsJsonProtocol.REST_JSON).protocolVersion("1.1"); } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, @@ -905,11 +998,6 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, return configuration.build(); } - private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, - JsonOperationMetadata operationMetadata) { - return protocolFactory.createErrorResponseHandler(operationMetadata); - } - private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); @@ -919,4 +1007,4 @@ private HttpResponseHandler createErrorResponseHandler(Base public void close() { clientHandler.close(); } -} +} \ No newline at end of file diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-sync-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-sync-client-class.java index 2fa866188c5f..a5641d7c1e7b 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-sync-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-sync-client-class.java @@ -2,7 +2,9 @@ import java.util.Collections; import java.util.List; +import java.util.Optional; import java.util.function.Consumer; +import java.util.function.Function; import software.amazon.awssdk.annotations.Generated; import software.amazon.awssdk.annotations.SdkInternalApi; import software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler; @@ -124,9 +126,18 @@ public DeleteRowResponse deleteRow(DeleteRowRequest deleteRowRequest) throws Inv HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, DeleteRowResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteRowRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteRowRequest .overrideConfiguration().orElse(null)); @@ -174,9 +185,18 @@ public GetRowResponse getRow(GetRowRequest getRowRequest) throws InvalidInputExc HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, GetRowResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getRowRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getRowRequest .overrideConfiguration().orElse(null)); @@ -224,9 +244,18 @@ public PutRowResponse putRow(PutRowRequest putRowRequest) throws InvalidInputExc HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, PutRowResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putRowRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, putRowRequest .overrideConfiguration().orElse(null)); @@ -276,9 +305,18 @@ public OpWithSigv4AndSigv4AUnSignedPayloadResponse opWithSigv4AndSigv4aUnSignedP HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, OpWithSigv4AndSigv4AUnSignedPayloadResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(opWithSigv4AndSigv4AUnSignedPayloadRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, @@ -330,9 +368,18 @@ public OpWithSigv4SignedPayloadResponse opWithSigv4SignedPayload( HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, OpWithSigv4SignedPayloadResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(opWithSigv4SignedPayloadRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, opWithSigv4SignedPayloadRequest @@ -384,9 +431,18 @@ public OpWithSigv4UnSignedPayloadResponse opWithSigv4UnSignedPayload( HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, OpWithSigv4UnSignedPayloadResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(opWithSigv4UnSignedPayloadRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, opWithSigv4UnSignedPayloadRequest @@ -450,9 +506,18 @@ public OpWithSigv4UnSignedPayloadAndStreamingResponse opWithSigv4UnSignedPayload HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(operationMetadata, OpWithSigv4UnSignedPayloadAndStreamingResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(opWithSigv4UnSignedPayloadAndStreamingRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, @@ -513,9 +578,18 @@ public OpWithSigv4ASignedPayloadResponse opWithSigv4aSignedPayload( HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, OpWithSigv4ASignedPayloadResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(opWithSigv4ASignedPayloadRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, opWithSigv4ASignedPayloadRequest @@ -567,9 +641,18 @@ public OpWithSigv4AUnSignedPayloadResponse opWithSigv4aUnSignedPayload( HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, OpWithSigv4AUnSignedPayloadResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(opWithSigv4AUnSignedPayloadRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, opWithSigv4AUnSignedPayloadRequest @@ -622,9 +705,18 @@ public OpsWithSigv4AndSigv4ASignedPayloadResponse opsWithSigv4andSigv4aSignedPay HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, OpsWithSigv4AndSigv4ASignedPayloadResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(opsWithSigv4AndSigv4ASignedPayloadRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, @@ -677,9 +769,18 @@ public SecondOpsWithSigv4AndSigv4ASignedPayloadResponse secondOpsWithSigv4andSig HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(operationMetadata, SecondOpsWithSigv4AndSigv4ASignedPayloadResponse::builder); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration( secondOpsWithSigv4AndSigv4ASignedPayloadRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, @@ -724,8 +825,8 @@ private static List resolveMetricPublishers(SdkClientConfigurat } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, - JsonOperationMetadata operationMetadata) { - return protocolFactory.createErrorResponseHandler(operationMetadata); + JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { + return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); } private void updateRetryStrategyClientConfiguration(SdkClientConfiguration.Builder configuration) { @@ -767,14 +868,8 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, } private > T init(T builder) { - return builder - .clientConfiguration(clientConfiguration) - .defaultServiceExceptionSupplier(DatabaseException::builder) - .protocol(AwsJsonProtocol.REST_JSON) - .protocolVersion("1.1") - .registerModeledException( - ExceptionMetadata.builder().errorCode("InvalidInput") - .exceptionBuilderSupplier(InvalidInputException::builder).httpStatusCode(400).build()); + return builder.clientConfiguration(clientConfiguration).defaultServiceExceptionSupplier(DatabaseException::builder) + .protocol(AwsJsonProtocol.REST_JSON).protocolVersion("1.1"); } @Override diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-xml-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-xml-async-client-class.java index 4f777ed50154..d9ffca9dda44 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-xml-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-xml-async-client-class.java @@ -50,7 +50,6 @@ 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.xml.AwsXmlProtocolFactory; import software.amazon.awssdk.protocols.xml.XmlOperationMetadata; import software.amazon.awssdk.retries.api.RetryStrategy; @@ -67,7 +66,6 @@ import software.amazon.awssdk.services.xml.model.EventStreamOperationResponseHandler; import software.amazon.awssdk.services.xml.model.GetOperationWithChecksumRequest; import software.amazon.awssdk.services.xml.model.GetOperationWithChecksumResponse; -import software.amazon.awssdk.services.xml.model.InvalidInputException; import software.amazon.awssdk.services.xml.model.OperationWithChecksumRequiredRequest; import software.amazon.awssdk.services.xml.model.OperationWithChecksumRequiredResponse; import software.amazon.awssdk.services.xml.model.OperationWithNoneAuthTypeRequest; @@ -107,7 +105,7 @@ final class DefaultXmlAsyncClient implements XmlAsyncClient { private static final Logger log = LoggerFactory.getLogger(DefaultXmlAsyncClient.class); private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder() - .serviceProtocol(AwsServiceProtocol.REST_XML).build(); + .serviceProtocol(AwsServiceProtocol.REST_XML).build(); private final AsyncClientHandler clientHandler; @@ -152,26 +150,26 @@ protected DefaultXmlAsyncClient(SdkClientConfiguration clientConfiguration) { public CompletableFuture aPostOperation(APostOperationRequest aPostOperationRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "APostOperation"); HttpResponseHandler> responseHandler = protocolFactory - .createCombinedResponseHandler(APostOperationResponse::builder, - new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + .createCombinedResponseHandler(APostOperationResponse::builder, + new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); String hostPrefix = "foo-"; String resolvedHostExpression = "foo-"; CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("APostOperation").withRequestConfiguration(clientConfiguration) - .withProtocolMetadata(protocolMetadata) - .withMarshaller(new APostOperationRequestMarshaller(protocolFactory)) - .withCombinedResponseHandler(responseHandler).hostPrefixExpression(resolvedHostExpression) - .withMetricCollector(apiCallMetricCollector).withInput(aPostOperationRequest)); + .execute(new ClientExecutionParams() + .withOperationName("APostOperation").withRequestConfiguration(clientConfiguration) + .withProtocolMetadata(protocolMetadata) + .withMarshaller(new APostOperationRequestMarshaller(protocolFactory)) + .withCombinedResponseHandler(responseHandler).hostPrefixExpression(resolvedHostExpression) + .withMetricCollector(apiCallMetricCollector).withInput(aPostOperationRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -210,28 +208,28 @@ public CompletableFuture aPostOperation(APostOperationRe */ @Override public CompletableFuture aPostOperationWithOutput( - APostOperationWithOutputRequest aPostOperationWithOutputRequest) { + APostOperationWithOutputRequest aPostOperationWithOutputRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationWithOutputRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationWithOutputRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "APostOperationWithOutput"); HttpResponseHandler> responseHandler = protocolFactory - .createCombinedResponseHandler(APostOperationWithOutputResponse::builder, - new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + .createCombinedResponseHandler(APostOperationWithOutputResponse::builder, + new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("APostOperationWithOutput").withRequestConfiguration(clientConfiguration) - .withProtocolMetadata(protocolMetadata) - .withMarshaller(new APostOperationWithOutputRequestMarshaller(protocolFactory)) - .withCombinedResponseHandler(responseHandler).withMetricCollector(apiCallMetricCollector) - .withInput(aPostOperationWithOutputRequest)); + .execute(new ClientExecutionParams() + .withOperationName("APostOperationWithOutput").withRequestConfiguration(clientConfiguration) + .withProtocolMetadata(protocolMetadata) + .withMarshaller(new APostOperationWithOutputRequestMarshaller(protocolFactory)) + .withCombinedResponseHandler(responseHandler).withMetricCollector(apiCallMetricCollector) + .withInput(aPostOperationWithOutputRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -266,29 +264,29 @@ public CompletableFuture aPostOperationWithOut */ @Override public CompletableFuture bearerAuthOperation( - BearerAuthOperationRequest bearerAuthOperationRequest) { + BearerAuthOperationRequest bearerAuthOperationRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(bearerAuthOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, bearerAuthOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "BearerAuthOperation"); bearerAuthOperationRequest = applySignerOverride(bearerAuthOperationRequest, BearerTokenSigner.create()); HttpResponseHandler> responseHandler = protocolFactory - .createCombinedResponseHandler(BearerAuthOperationResponse::builder, - new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + .createCombinedResponseHandler(BearerAuthOperationResponse::builder, + new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("BearerAuthOperation").withRequestConfiguration(clientConfiguration) - .withProtocolMetadata(protocolMetadata) - .withMarshaller(new BearerAuthOperationRequestMarshaller(protocolFactory)) - .withCombinedResponseHandler(responseHandler).credentialType(CredentialType.TOKEN) - .withMetricCollector(apiCallMetricCollector).withInput(bearerAuthOperationRequest)); + .execute(new ClientExecutionParams() + .withOperationName("BearerAuthOperation").withRequestConfiguration(clientConfiguration) + .withProtocolMetadata(protocolMetadata) + .withMarshaller(new BearerAuthOperationRequestMarshaller(protocolFactory)) + .withCombinedResponseHandler(responseHandler).credentialType(CredentialType.TOKEN) + .withMetricCollector(apiCallMetricCollector).withInput(bearerAuthOperationRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -323,51 +321,51 @@ public CompletableFuture bearerAuthOperation( */ @Override public CompletableFuture eventStreamOperation(EventStreamOperationRequest eventStreamOperationRequest, - EventStreamOperationResponseHandler asyncResponseHandler) { + EventStreamOperationResponseHandler asyncResponseHandler) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(eventStreamOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, eventStreamOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "EventStreamOperation"); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - EventStreamOperationResponse::builder, XmlOperationMetadata.builder().hasStreamingSuccessResponse(true) - .build()); + EventStreamOperationResponse::builder, XmlOperationMetadata.builder().hasStreamingSuccessResponse(true) + .build()); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); HttpResponseHandler eventResponseHandler = protocolFactory.createResponseHandler( - EventStreamTaggedUnionPojoSupplier.builder() - .putSdkPojoSupplier("EventPayloadEvent", EventStream::eventPayloadEventBuilder) - .putSdkPojoSupplier("NonEventPayloadEvent", EventStream::nonEventPayloadEventBuilder) - .putSdkPojoSupplier("SecondEventPayloadEvent", EventStream::secondEventPayloadEventBuilder) - .defaultSdkPojoSupplier(() -> new SdkPojoBuilder(EventStream.UNKNOWN)).build(), XmlOperationMetadata - .builder().hasStreamingSuccessResponse(false).build()); + EventStreamTaggedUnionPojoSupplier.builder() + .putSdkPojoSupplier("EventPayloadEvent", EventStream::eventPayloadEventBuilder) + .putSdkPojoSupplier("NonEventPayloadEvent", EventStream::nonEventPayloadEventBuilder) + .putSdkPojoSupplier("SecondEventPayloadEvent", EventStream::secondEventPayloadEventBuilder) + .defaultSdkPojoSupplier(() -> new SdkPojoBuilder(EventStream.UNKNOWN)).build(), XmlOperationMetadata + .builder().hasStreamingSuccessResponse(false).build()); CompletableFuture eventStreamTransformFuture = new CompletableFuture<>(); EventStreamAsyncResponseTransformer asyncResponseTransformer = EventStreamAsyncResponseTransformer - . builder().eventStreamResponseHandler(asyncResponseHandler) - .eventResponseHandler(eventResponseHandler).initialResponseHandler(responseHandler) - .exceptionResponseHandler(errorResponseHandler).future(eventStreamTransformFuture).executor(executor) - .serviceName(serviceName()).build(); + . builder().eventStreamResponseHandler(asyncResponseHandler) + .eventResponseHandler(eventResponseHandler).initialResponseHandler(responseHandler) + .exceptionResponseHandler(errorResponseHandler).future(eventStreamTransformFuture).executor(executor) + .serviceName(serviceName()).build(); RestEventStreamAsyncResponseTransformer restAsyncResponseTransformer = RestEventStreamAsyncResponseTransformer - . builder() - .eventStreamAsyncResponseTransformer(asyncResponseTransformer) - .eventStreamResponseHandler(asyncResponseHandler).build(); + . builder() + .eventStreamAsyncResponseTransformer(asyncResponseTransformer) + .eventStreamResponseHandler(asyncResponseHandler).build(); CompletableFuture executeFuture = clientHandler.execute( - new ClientExecutionParams() - .withOperationName("EventStreamOperation").withRequestConfiguration(clientConfiguration) - .withProtocolMetadata(protocolMetadata) - .withMarshaller(new EventStreamOperationRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withMetricCollector(apiCallMetricCollector).withInput(eventStreamOperationRequest), - restAsyncResponseTransformer); + new ClientExecutionParams() + .withOperationName("EventStreamOperation").withRequestConfiguration(clientConfiguration) + .withProtocolMetadata(protocolMetadata) + .withMarshaller(new EventStreamOperationRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withMetricCollector(apiCallMetricCollector).withInput(eventStreamOperationRequest), + restAsyncResponseTransformer); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { if (e != null) { runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> asyncResponseHandler.exceptionOccurred(e)); + () -> asyncResponseHandler.exceptionOccurred(e)); eventStreamTransformFuture.completeExceptionally(e); } metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -376,7 +374,7 @@ public CompletableFuture eventStreamOperation(EventStreamOperationRequest return CompletableFutureUtils.forwardExceptionTo(eventStreamTransformFuture, executeFuture); } catch (Throwable t) { runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> asyncResponseHandler.exceptionOccurred(t)); + () -> asyncResponseHandler.exceptionOccurred(t)); metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } @@ -404,35 +402,35 @@ public CompletableFuture eventStreamOperation(EventStreamOperationRequest */ @Override public CompletableFuture getOperationWithChecksum( - GetOperationWithChecksumRequest getOperationWithChecksumRequest) { + GetOperationWithChecksumRequest getOperationWithChecksumRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getOperationWithChecksumRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getOperationWithChecksumRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetOperationWithChecksum"); HttpResponseHandler> responseHandler = protocolFactory - .createCombinedResponseHandler(GetOperationWithChecksumResponse::builder, - new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + .createCombinedResponseHandler(GetOperationWithChecksumResponse::builder, + new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("GetOperationWithChecksum") - .withRequestConfiguration(clientConfiguration) - .withProtocolMetadata(protocolMetadata) - .withMarshaller(new GetOperationWithChecksumRequestMarshaller(protocolFactory)) - .withCombinedResponseHandler(responseHandler) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute( - SdkInternalExecutionAttribute.HTTP_CHECKSUM, - HttpChecksum.builder().requestChecksumRequired(true).isRequestStreaming(false) - .requestAlgorithm(getOperationWithChecksumRequest.checksumAlgorithmAsString()) - .requestAlgorithmHeader("x-amz-sdk-checksum-algorithm").build()) - .withInput(getOperationWithChecksumRequest)); + .execute(new ClientExecutionParams() + .withOperationName("GetOperationWithChecksum") + .withRequestConfiguration(clientConfiguration) + .withProtocolMetadata(protocolMetadata) + .withMarshaller(new GetOperationWithChecksumRequestMarshaller(protocolFactory)) + .withCombinedResponseHandler(responseHandler) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute( + SdkInternalExecutionAttribute.HTTP_CHECKSUM, + HttpChecksum.builder().requestChecksumRequired(true).isRequestStreaming(false) + .requestAlgorithm(getOperationWithChecksumRequest.checksumAlgorithmAsString()) + .requestAlgorithmHeader("x-amz-sdk-checksum-algorithm").build()) + .withInput(getOperationWithChecksumRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -468,31 +466,31 @@ public CompletableFuture getOperationWithCheck */ @Override public CompletableFuture operationWithChecksumRequired( - OperationWithChecksumRequiredRequest operationWithChecksumRequiredRequest) { + OperationWithChecksumRequiredRequest operationWithChecksumRequiredRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithChecksumRequiredRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithChecksumRequiredRequest.overrideConfiguration().orElse(null)); + operationWithChecksumRequiredRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithChecksumRequired"); HttpResponseHandler> responseHandler = protocolFactory - .createCombinedResponseHandler(OperationWithChecksumRequiredResponse::builder, - new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + .createCombinedResponseHandler(OperationWithChecksumRequiredResponse::builder, + new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithChecksumRequired") - .withRequestConfiguration(clientConfiguration) - .withProtocolMetadata(protocolMetadata) - .withMarshaller(new OperationWithChecksumRequiredRequestMarshaller(protocolFactory)) - .withCombinedResponseHandler(responseHandler) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute(SdkInternalExecutionAttribute.HTTP_CHECKSUM_REQUIRED, - HttpChecksumRequired.create()).withInput(operationWithChecksumRequiredRequest)); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithChecksumRequired") + .withRequestConfiguration(clientConfiguration) + .withProtocolMetadata(protocolMetadata) + .withMarshaller(new OperationWithChecksumRequiredRequestMarshaller(protocolFactory)) + .withCombinedResponseHandler(responseHandler) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute(SdkInternalExecutionAttribute.HTTP_CHECKSUM_REQUIRED, + HttpChecksumRequired.create()).withInput(operationWithChecksumRequiredRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -527,29 +525,29 @@ public CompletableFuture operationWithChe */ @Override public CompletableFuture operationWithNoneAuthType( - OperationWithNoneAuthTypeRequest operationWithNoneAuthTypeRequest) { + OperationWithNoneAuthTypeRequest operationWithNoneAuthTypeRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithNoneAuthTypeRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithNoneAuthTypeRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithNoneAuthType"); HttpResponseHandler> responseHandler = protocolFactory - .createCombinedResponseHandler(OperationWithNoneAuthTypeResponse::builder, - new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + .createCombinedResponseHandler(OperationWithNoneAuthTypeResponse::builder, + new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithNoneAuthType").withRequestConfiguration(clientConfiguration) - .withProtocolMetadata(protocolMetadata) - .withMarshaller(new OperationWithNoneAuthTypeRequestMarshaller(protocolFactory)) - .withCombinedResponseHandler(responseHandler).withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute(SdkInternalExecutionAttribute.IS_NONE_AUTH_TYPE_REQUEST, false) - .withInput(operationWithNoneAuthTypeRequest)); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithNoneAuthType").withRequestConfiguration(clientConfiguration) + .withProtocolMetadata(protocolMetadata) + .withMarshaller(new OperationWithNoneAuthTypeRequestMarshaller(protocolFactory)) + .withCombinedResponseHandler(responseHandler).withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute(SdkInternalExecutionAttribute.IS_NONE_AUTH_TYPE_REQUEST, false) + .withInput(operationWithNoneAuthTypeRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -585,32 +583,32 @@ public CompletableFuture operationWithNoneAut */ @Override public CompletableFuture operationWithRequestCompression( - OperationWithRequestCompressionRequest operationWithRequestCompressionRequest) { + OperationWithRequestCompressionRequest operationWithRequestCompressionRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithRequestCompressionRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithRequestCompressionRequest.overrideConfiguration().orElse(null)); + operationWithRequestCompressionRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithRequestCompression"); HttpResponseHandler> responseHandler = protocolFactory - .createCombinedResponseHandler(OperationWithRequestCompressionResponse::builder, - new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + .createCombinedResponseHandler(OperationWithRequestCompressionResponse::builder, + new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithRequestCompression") - .withRequestConfiguration(clientConfiguration) - .withProtocolMetadata(protocolMetadata) - .withMarshaller(new OperationWithRequestCompressionRequestMarshaller(protocolFactory)) - .withCombinedResponseHandler(responseHandler) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute(SdkInternalExecutionAttribute.REQUEST_COMPRESSION, - RequestCompression.builder().encodings("gzip").isStreaming(false).build()) - .withInput(operationWithRequestCompressionRequest)); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithRequestCompression") + .withRequestConfiguration(clientConfiguration) + .withProtocolMetadata(protocolMetadata) + .withMarshaller(new OperationWithRequestCompressionRequestMarshaller(protocolFactory)) + .withCombinedResponseHandler(responseHandler) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute(SdkInternalExecutionAttribute.REQUEST_COMPRESSION, + RequestCompression.builder().encodings("gzip").isStreaming(false).build()) + .withInput(operationWithRequestCompressionRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -663,19 +661,19 @@ public CompletableFuture operationWithR */ @Override public CompletableFuture putOperationWithChecksum( - PutOperationWithChecksumRequest putOperationWithChecksumRequest, AsyncRequestBody requestBody, - AsyncResponseTransformer asyncResponseTransformer) { + PutOperationWithChecksumRequest putOperationWithChecksumRequest, AsyncRequestBody requestBody, + AsyncResponseTransformer asyncResponseTransformer) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putOperationWithChecksumRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, putOperationWithChecksumRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PutOperationWithChecksum"); Pair, CompletableFuture> pair = AsyncResponseTransformerUtils - .wrapWithEndOfStreamFuture(asyncResponseTransformer); + .wrapWithEndOfStreamFuture(asyncResponseTransformer); asyncResponseTransformer = pair.left(); CompletableFuture endOfStreamFuture = pair.right(); if (!isSignerOverridden(clientConfiguration)) { @@ -683,39 +681,39 @@ public CompletableFuture putOperationWithChecksum( } HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - PutOperationWithChecksumResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(true)); + PutOperationWithChecksumResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(true)); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler.execute( - new ClientExecutionParams() - .withOperationName("PutOperationWithChecksum") - .withProtocolMetadata(protocolMetadata) - .withMarshaller( - AsyncStreamingRequestMarshaller.builder() - .delegateMarshaller(new PutOperationWithChecksumRequestMarshaller(protocolFactory)) - .asyncRequestBody(requestBody).build()) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute( - SdkInternalExecutionAttribute.HTTP_CHECKSUM, - HttpChecksum - .builder() - .requestChecksumRequired(false) - .isRequestStreaming(true) - .requestValidationMode(putOperationWithChecksumRequest.checksumModeAsString()) - .responseAlgorithmsV2(DefaultChecksumAlgorithm.CRC32C, - DefaultChecksumAlgorithm.CRC32, DefaultChecksumAlgorithm.SHA1, - DefaultChecksumAlgorithm.SHA256).build()).withAsyncRequestBody(requestBody) - .withInput(putOperationWithChecksumRequest), asyncResponseTransformer); + new ClientExecutionParams() + .withOperationName("PutOperationWithChecksum") + .withProtocolMetadata(protocolMetadata) + .withMarshaller( + AsyncStreamingRequestMarshaller.builder() + .delegateMarshaller(new PutOperationWithChecksumRequestMarshaller(protocolFactory)) + .asyncRequestBody(requestBody).build()) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute( + SdkInternalExecutionAttribute.HTTP_CHECKSUM, + HttpChecksum + .builder() + .requestChecksumRequired(false) + .isRequestStreaming(true) + .requestValidationMode(putOperationWithChecksumRequest.checksumModeAsString()) + .responseAlgorithmsV2(DefaultChecksumAlgorithm.CRC32C, + DefaultChecksumAlgorithm.CRC32, DefaultChecksumAlgorithm.SHA1, + DefaultChecksumAlgorithm.SHA256).build()).withAsyncRequestBody(requestBody) + .withInput(putOperationWithChecksumRequest), asyncResponseTransformer); CompletableFuture whenCompleteFuture = null; AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { if (e != null) { runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> finalAsyncResponseTransformer.exceptionOccurred(e)); + () -> finalAsyncResponseTransformer.exceptionOccurred(e)); } endOfStreamFuture.whenComplete((r2, e2) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -725,7 +723,7 @@ public CompletableFuture putOperationWithChecksum( } catch (Throwable t) { AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> finalAsyncResponseTransformer.exceptionOccurred(t)); + () -> finalAsyncResponseTransformer.exceptionOccurred(t)); metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } @@ -758,13 +756,13 @@ public CompletableFuture putOperationWithChecksum( */ @Override public CompletableFuture streamingInputOperation( - StreamingInputOperationRequest streamingInputOperationRequest, AsyncRequestBody requestBody) { + StreamingInputOperationRequest streamingInputOperationRequest, AsyncRequestBody requestBody) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingInputOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingInputOperation"); @@ -773,20 +771,20 @@ public CompletableFuture streamingInputOperatio } HttpResponseHandler> responseHandler = protocolFactory - .createCombinedResponseHandler(StreamingInputOperationResponse::builder, - new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + .createCombinedResponseHandler(StreamingInputOperationResponse::builder, + new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("StreamingInputOperation") - .withRequestConfiguration(clientConfiguration) - .withProtocolMetadata(protocolMetadata) - .withMarshaller( - AsyncStreamingRequestMarshaller.builder() - .delegateMarshaller(new StreamingInputOperationRequestMarshaller(protocolFactory)) - .asyncRequestBody(requestBody).build()).withCombinedResponseHandler(responseHandler) - .withMetricCollector(apiCallMetricCollector).withAsyncRequestBody(requestBody) - .withInput(streamingInputOperationRequest)); + .execute(new ClientExecutionParams() + .withOperationName("StreamingInputOperation") + .withRequestConfiguration(clientConfiguration) + .withProtocolMetadata(protocolMetadata) + .withMarshaller( + AsyncStreamingRequestMarshaller.builder() + .delegateMarshaller(new StreamingInputOperationRequestMarshaller(protocolFactory)) + .asyncRequestBody(requestBody).build()).withCombinedResponseHandler(responseHandler) + .withMetricCollector(apiCallMetricCollector).withAsyncRequestBody(requestBody) + .withInput(streamingInputOperationRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -826,40 +824,40 @@ public CompletableFuture streamingInputOperatio */ @Override public CompletableFuture streamingOutputOperation( - StreamingOutputOperationRequest streamingOutputOperationRequest, - AsyncResponseTransformer asyncResponseTransformer) { + StreamingOutputOperationRequest streamingOutputOperationRequest, + AsyncResponseTransformer asyncResponseTransformer) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingOutputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingOutputOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingOutputOperation"); Pair, CompletableFuture> pair = AsyncResponseTransformerUtils - .wrapWithEndOfStreamFuture(asyncResponseTransformer); + .wrapWithEndOfStreamFuture(asyncResponseTransformer); asyncResponseTransformer = pair.left(); CompletableFuture endOfStreamFuture = pair.right(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - StreamingOutputOperationResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(true)); + StreamingOutputOperationResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(true)); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler.execute( - new ClientExecutionParams() - .withOperationName("StreamingOutputOperation").withProtocolMetadata(protocolMetadata) - .withMarshaller(new StreamingOutputOperationRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(streamingOutputOperationRequest), asyncResponseTransformer); + new ClientExecutionParams() + .withOperationName("StreamingOutputOperation").withProtocolMetadata(protocolMetadata) + .withMarshaller(new StreamingOutputOperationRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(streamingOutputOperationRequest), asyncResponseTransformer); CompletableFuture whenCompleteFuture = null; AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { if (e != null) { runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> finalAsyncResponseTransformer.exceptionOccurred(e)); + () -> finalAsyncResponseTransformer.exceptionOccurred(e)); } endOfStreamFuture.whenComplete((r2, e2) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -869,7 +867,7 @@ public CompletableFuture streamingOutputOperation( } catch (Throwable t) { AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> finalAsyncResponseTransformer.exceptionOccurred(t)); + () -> finalAsyncResponseTransformer.exceptionOccurred(t)); metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } @@ -886,16 +884,12 @@ public final String serviceName() { } private AwsXmlProtocolFactory init() { - return AwsXmlProtocolFactory - .builder() - .registerModeledException( - ExceptionMetadata.builder().errorCode("InvalidInput") - .exceptionBuilderSupplier(InvalidInputException::builder).httpStatusCode(400).build()) - .clientConfiguration(clientConfiguration).defaultServiceExceptionSupplier(XmlException::builder).build(); + return AwsXmlProtocolFactory.builder().clientConfiguration(clientConfiguration) + .defaultServiceExceptionSupplier(XmlException::builder).build(); } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, - RequestOverrideConfiguration requestOverrideConfiguration) { + RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); @@ -915,8 +909,8 @@ private T applySignerOverride(T request, Signer signer) { } Consumer signerOverride = b -> b.signer(signer).build(); AwsRequestOverrideConfiguration overrideConfiguration = request.overrideConfiguration() - .map(c -> c.toBuilder().applyMutation(signerOverride).build()) - .orElse((AwsRequestOverrideConfiguration.builder().applyMutation(signerOverride).build())); + .map(c -> c.toBuilder().applyMutation(signerOverride).build()) + .orElse((AwsRequestOverrideConfiguration.builder().applyMutation(signerOverride).build())); return (T) request.toBuilder().overrideConfiguration(overrideConfiguration).build(); } @@ -965,4 +959,4 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, public void close() { clientHandler.close(); } -} +} \ No newline at end of file diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-xml-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-xml-client-class.java index 9bad15fd6e47..fc925fc798f1 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-xml-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-xml-client-class.java @@ -38,7 +38,6 @@ 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.xml.AwsXmlProtocolFactory; import software.amazon.awssdk.protocols.xml.XmlOperationMetadata; import software.amazon.awssdk.retries.api.RetryStrategy; @@ -89,7 +88,7 @@ final class DefaultXmlClient implements XmlClient { private static final Logger log = Logger.loggerFor(DefaultXmlClient.class); private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder() - .serviceProtocol(AwsServiceProtocol.REST_XML).build(); + .serviceProtocol(AwsServiceProtocol.REST_XML).build(); private final SyncClientHandler clientHandler; @@ -125,15 +124,15 @@ protected DefaultXmlClient(SdkClientConfiguration clientConfiguration) { */ @Override public APostOperationResponse aPostOperation(APostOperationRequest aPostOperationRequest) throws InvalidInputException, - AwsServiceException, SdkClientException, XmlException { + AwsServiceException, SdkClientException, XmlException { HttpResponseHandler> responseHandler = protocolFactory.createCombinedResponseHandler( - APostOperationResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + APostOperationResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "APostOperation"); @@ -141,10 +140,10 @@ public APostOperationResponse aPostOperation(APostOperationRequest aPostOperatio String resolvedHostExpression = "foo-"; return clientHandler.execute(new ClientExecutionParams() - .withOperationName("APostOperation").withProtocolMetadata(protocolMetadata) - .withCombinedResponseHandler(responseHandler).withMetricCollector(apiCallMetricCollector) - .hostPrefixExpression(resolvedHostExpression).withRequestConfiguration(clientConfiguration) - .withInput(aPostOperationRequest).withMarshaller(new APostOperationRequestMarshaller(protocolFactory))); + .withOperationName("APostOperation").withProtocolMetadata(protocolMetadata) + .withCombinedResponseHandler(responseHandler).withMetricCollector(apiCallMetricCollector) + .hostPrefixExpression(resolvedHostExpression).withRequestConfiguration(clientConfiguration) + .withInput(aPostOperationRequest).withMarshaller(new APostOperationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -172,28 +171,28 @@ public APostOperationResponse aPostOperation(APostOperationRequest aPostOperatio */ @Override public APostOperationWithOutputResponse aPostOperationWithOutput( - APostOperationWithOutputRequest aPostOperationWithOutputRequest) throws InvalidInputException, AwsServiceException, - SdkClientException, XmlException { + APostOperationWithOutputRequest aPostOperationWithOutputRequest) throws InvalidInputException, AwsServiceException, + SdkClientException, XmlException { HttpResponseHandler> responseHandler = protocolFactory - .createCombinedResponseHandler(APostOperationWithOutputResponse::builder, - new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + .createCombinedResponseHandler(APostOperationWithOutputResponse::builder, + new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationWithOutputRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationWithOutputRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "APostOperationWithOutput"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("APostOperationWithOutput").withProtocolMetadata(protocolMetadata) - .withCombinedResponseHandler(responseHandler).withMetricCollector(apiCallMetricCollector) - .withRequestConfiguration(clientConfiguration).withInput(aPostOperationWithOutputRequest) - .withMarshaller(new APostOperationWithOutputRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("APostOperationWithOutput").withProtocolMetadata(protocolMetadata) + .withCombinedResponseHandler(responseHandler).withMetricCollector(apiCallMetricCollector) + .withRequestConfiguration(clientConfiguration).withInput(aPostOperationWithOutputRequest) + .withMarshaller(new APostOperationWithOutputRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -217,28 +216,28 @@ public APostOperationWithOutputResponse aPostOperationWithOutput( */ @Override public BearerAuthOperationResponse bearerAuthOperation(BearerAuthOperationRequest bearerAuthOperationRequest) - throws AwsServiceException, SdkClientException, XmlException { + throws AwsServiceException, SdkClientException, XmlException { bearerAuthOperationRequest = applySignerOverride(bearerAuthOperationRequest, BearerTokenSigner.create()); HttpResponseHandler> responseHandler = protocolFactory - .createCombinedResponseHandler(BearerAuthOperationResponse::builder, - new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + .createCombinedResponseHandler(BearerAuthOperationResponse::builder, + new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(bearerAuthOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, bearerAuthOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "BearerAuthOperation"); return clientHandler.execute(new ClientExecutionParams() - .withOperationName("BearerAuthOperation").withProtocolMetadata(protocolMetadata) - .withCombinedResponseHandler(responseHandler).withMetricCollector(apiCallMetricCollector) - .credentialType(CredentialType.TOKEN).withRequestConfiguration(clientConfiguration) - .withInput(bearerAuthOperationRequest) - .withMarshaller(new BearerAuthOperationRequestMarshaller(protocolFactory))); + .withOperationName("BearerAuthOperation").withProtocolMetadata(protocolMetadata) + .withCombinedResponseHandler(responseHandler).withMetricCollector(apiCallMetricCollector) + .credentialType(CredentialType.TOKEN).withRequestConfiguration(clientConfiguration) + .withInput(bearerAuthOperationRequest) + .withMarshaller(new BearerAuthOperationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -262,36 +261,36 @@ public BearerAuthOperationResponse bearerAuthOperation(BearerAuthOperationReques */ @Override public GetOperationWithChecksumResponse getOperationWithChecksum( - GetOperationWithChecksumRequest getOperationWithChecksumRequest) throws AwsServiceException, SdkClientException, - XmlException { + GetOperationWithChecksumRequest getOperationWithChecksumRequest) throws AwsServiceException, SdkClientException, + XmlException { HttpResponseHandler> responseHandler = protocolFactory - .createCombinedResponseHandler(GetOperationWithChecksumResponse::builder, - new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + .createCombinedResponseHandler(GetOperationWithChecksumResponse::builder, + new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getOperationWithChecksumRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getOperationWithChecksumRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetOperationWithChecksum"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("GetOperationWithChecksum") - .withProtocolMetadata(protocolMetadata) - .withCombinedResponseHandler(responseHandler) - .withMetricCollector(apiCallMetricCollector) - .withRequestConfiguration(clientConfiguration) - .withInput(getOperationWithChecksumRequest) - .putExecutionAttribute( - SdkInternalExecutionAttribute.HTTP_CHECKSUM, - HttpChecksum.builder().requestChecksumRequired(true).isRequestStreaming(false) - .requestAlgorithm(getOperationWithChecksumRequest.checksumAlgorithmAsString()) - .requestAlgorithmHeader("x-amz-sdk-checksum-algorithm").build()) - .withMarshaller(new GetOperationWithChecksumRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("GetOperationWithChecksum") + .withProtocolMetadata(protocolMetadata) + .withCombinedResponseHandler(responseHandler) + .withMetricCollector(apiCallMetricCollector) + .withRequestConfiguration(clientConfiguration) + .withInput(getOperationWithChecksumRequest) + .putExecutionAttribute( + SdkInternalExecutionAttribute.HTTP_CHECKSUM, + HttpChecksum.builder().requestChecksumRequired(true).isRequestStreaming(false) + .requestAlgorithm(getOperationWithChecksumRequest.checksumAlgorithmAsString()) + .requestAlgorithmHeader("x-amz-sdk-checksum-algorithm").build()) + .withMarshaller(new GetOperationWithChecksumRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -315,33 +314,33 @@ public GetOperationWithChecksumResponse getOperationWithChecksum( */ @Override public OperationWithChecksumRequiredResponse operationWithChecksumRequired( - OperationWithChecksumRequiredRequest operationWithChecksumRequiredRequest) throws AwsServiceException, - SdkClientException, XmlException { + OperationWithChecksumRequiredRequest operationWithChecksumRequiredRequest) throws AwsServiceException, + SdkClientException, XmlException { HttpResponseHandler> responseHandler = protocolFactory - .createCombinedResponseHandler(OperationWithChecksumRequiredResponse::builder, - new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + .createCombinedResponseHandler(OperationWithChecksumRequiredResponse::builder, + new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithChecksumRequiredRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithChecksumRequiredRequest.overrideConfiguration().orElse(null)); + operationWithChecksumRequiredRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithChecksumRequired"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithChecksumRequired") - .withProtocolMetadata(protocolMetadata) - .withCombinedResponseHandler(responseHandler) - .withMetricCollector(apiCallMetricCollector) - .withRequestConfiguration(clientConfiguration) - .withInput(operationWithChecksumRequiredRequest) - .putExecutionAttribute(SdkInternalExecutionAttribute.HTTP_CHECKSUM_REQUIRED, - HttpChecksumRequired.create()) - .withMarshaller(new OperationWithChecksumRequiredRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithChecksumRequired") + .withProtocolMetadata(protocolMetadata) + .withCombinedResponseHandler(responseHandler) + .withMetricCollector(apiCallMetricCollector) + .withRequestConfiguration(clientConfiguration) + .withInput(operationWithChecksumRequiredRequest) + .putExecutionAttribute(SdkInternalExecutionAttribute.HTTP_CHECKSUM_REQUIRED, + HttpChecksumRequired.create()) + .withMarshaller(new OperationWithChecksumRequiredRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -365,29 +364,29 @@ public OperationWithChecksumRequiredResponse operationWithChecksumRequired( */ @Override public OperationWithNoneAuthTypeResponse operationWithNoneAuthType( - OperationWithNoneAuthTypeRequest operationWithNoneAuthTypeRequest) throws AwsServiceException, SdkClientException, - XmlException { + OperationWithNoneAuthTypeRequest operationWithNoneAuthTypeRequest) throws AwsServiceException, SdkClientException, + XmlException { HttpResponseHandler> responseHandler = protocolFactory - .createCombinedResponseHandler(OperationWithNoneAuthTypeResponse::builder, - new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + .createCombinedResponseHandler(OperationWithNoneAuthTypeResponse::builder, + new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithNoneAuthTypeRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithNoneAuthTypeRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithNoneAuthType"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithNoneAuthType").withProtocolMetadata(protocolMetadata) - .withCombinedResponseHandler(responseHandler).withMetricCollector(apiCallMetricCollector) - .withRequestConfiguration(clientConfiguration).withInput(operationWithNoneAuthTypeRequest) - .putExecutionAttribute(SdkInternalExecutionAttribute.IS_NONE_AUTH_TYPE_REQUEST, false) - .withMarshaller(new OperationWithNoneAuthTypeRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithNoneAuthType").withProtocolMetadata(protocolMetadata) + .withCombinedResponseHandler(responseHandler).withMetricCollector(apiCallMetricCollector) + .withRequestConfiguration(clientConfiguration).withInput(operationWithNoneAuthTypeRequest) + .putExecutionAttribute(SdkInternalExecutionAttribute.IS_NONE_AUTH_TYPE_REQUEST, false) + .withMarshaller(new OperationWithNoneAuthTypeRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -411,33 +410,33 @@ public OperationWithNoneAuthTypeResponse operationWithNoneAuthType( */ @Override public OperationWithRequestCompressionResponse operationWithRequestCompression( - OperationWithRequestCompressionRequest operationWithRequestCompressionRequest) throws AwsServiceException, - SdkClientException, XmlException { + OperationWithRequestCompressionRequest operationWithRequestCompressionRequest) throws AwsServiceException, + SdkClientException, XmlException { HttpResponseHandler> responseHandler = protocolFactory - .createCombinedResponseHandler(OperationWithRequestCompressionResponse::builder, - new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + .createCombinedResponseHandler(OperationWithRequestCompressionResponse::builder, + new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithRequestCompressionRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithRequestCompressionRequest.overrideConfiguration().orElse(null)); + operationWithRequestCompressionRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithRequestCompression"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithRequestCompression") - .withProtocolMetadata(protocolMetadata) - .withCombinedResponseHandler(responseHandler) - .withMetricCollector(apiCallMetricCollector) - .withRequestConfiguration(clientConfiguration) - .withInput(operationWithRequestCompressionRequest) - .putExecutionAttribute(SdkInternalExecutionAttribute.REQUEST_COMPRESSION, - RequestCompression.builder().encodings("gzip").isStreaming(false).build()) - .withMarshaller(new OperationWithRequestCompressionRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithRequestCompression") + .withProtocolMetadata(protocolMetadata) + .withCombinedResponseHandler(responseHandler) + .withMetricCollector(apiCallMetricCollector) + .withRequestConfiguration(clientConfiguration) + .withInput(operationWithRequestCompressionRequest) + .putExecutionAttribute(SdkInternalExecutionAttribute.REQUEST_COMPRESSION, + RequestCompression.builder().encodings("gzip").isStreaming(false).build()) + .withMarshaller(new OperationWithRequestCompressionRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -487,47 +486,47 @@ public OperationWithRequestCompressionResponse operationWithRequestCompression( */ @Override public ReturnT putOperationWithChecksum(PutOperationWithChecksumRequest putOperationWithChecksumRequest, - RequestBody requestBody, ResponseTransformer responseTransformer) - throws AwsServiceException, SdkClientException, XmlException { + RequestBody requestBody, ResponseTransformer responseTransformer) + throws AwsServiceException, SdkClientException, XmlException { HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - PutOperationWithChecksumResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(true)); + PutOperationWithChecksumResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(true)); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putOperationWithChecksumRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, putOperationWithChecksumRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PutOperationWithChecksum"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("PutOperationWithChecksum") - .withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withInput(putOperationWithChecksumRequest) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute( - SdkInternalExecutionAttribute.HTTP_CHECKSUM, - HttpChecksum - .builder() - .requestChecksumRequired(false) - .isRequestStreaming(true) - .requestValidationMode(putOperationWithChecksumRequest.checksumModeAsString()) - .responseAlgorithmsV2(DefaultChecksumAlgorithm.CRC32C, - DefaultChecksumAlgorithm.CRC32, DefaultChecksumAlgorithm.SHA1, - DefaultChecksumAlgorithm.SHA256).build()) - .withRequestBody(requestBody) - .withMarshaller( - StreamingRequestMarshaller.builder() - .delegateMarshaller(new PutOperationWithChecksumRequestMarshaller(protocolFactory)) - .requestBody(requestBody).build())); + .execute(new ClientExecutionParams() + .withOperationName("PutOperationWithChecksum") + .withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withInput(putOperationWithChecksumRequest) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute( + SdkInternalExecutionAttribute.HTTP_CHECKSUM, + HttpChecksum + .builder() + .requestChecksumRequired(false) + .isRequestStreaming(true) + .requestValidationMode(putOperationWithChecksumRequest.checksumModeAsString()) + .responseAlgorithmsV2(DefaultChecksumAlgorithm.CRC32C, + DefaultChecksumAlgorithm.CRC32, DefaultChecksumAlgorithm.SHA1, + DefaultChecksumAlgorithm.SHA256).build()) + .withRequestBody(requestBody) + .withMarshaller( + StreamingRequestMarshaller.builder() + .delegateMarshaller(new PutOperationWithChecksumRequestMarshaller(protocolFactory)) + .requestBody(requestBody).build())); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -562,34 +561,34 @@ public ReturnT putOperationWithChecksum(PutOperationWithChecksumReques */ @Override public StreamingInputOperationResponse streamingInputOperation(StreamingInputOperationRequest streamingInputOperationRequest, - RequestBody requestBody) throws AwsServiceException, SdkClientException, XmlException { + RequestBody requestBody) throws AwsServiceException, SdkClientException, XmlException { HttpResponseHandler> responseHandler = protocolFactory - .createCombinedResponseHandler(StreamingInputOperationResponse::builder, - new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + .createCombinedResponseHandler(StreamingInputOperationResponse::builder, + new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingInputOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingInputOperation"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("StreamingInputOperation") - .withProtocolMetadata(protocolMetadata) - .withCombinedResponseHandler(responseHandler) - .withMetricCollector(apiCallMetricCollector) - .withRequestConfiguration(clientConfiguration) - .withInput(streamingInputOperationRequest) - .withRequestBody(requestBody) - .withMarshaller( - StreamingRequestMarshaller.builder() - .delegateMarshaller(new StreamingInputOperationRequestMarshaller(protocolFactory)) - .requestBody(requestBody).build())); + .execute(new ClientExecutionParams() + .withOperationName("StreamingInputOperation") + .withProtocolMetadata(protocolMetadata) + .withCombinedResponseHandler(responseHandler) + .withMetricCollector(apiCallMetricCollector) + .withRequestConfiguration(clientConfiguration) + .withInput(streamingInputOperationRequest) + .withRequestBody(requestBody) + .withMarshaller( + StreamingRequestMarshaller.builder() + .delegateMarshaller(new StreamingInputOperationRequestMarshaller(protocolFactory)) + .requestBody(requestBody).build())); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -620,30 +619,30 @@ public StreamingInputOperationResponse streamingInputOperation(StreamingInputOpe */ @Override public ReturnT streamingOutputOperation(StreamingOutputOperationRequest streamingOutputOperationRequest, - ResponseTransformer responseTransformer) throws AwsServiceException, - SdkClientException, XmlException { + ResponseTransformer responseTransformer) throws AwsServiceException, + SdkClientException, XmlException { HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - StreamingOutputOperationResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(true)); + StreamingOutputOperationResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(true)); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingOutputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingOutputOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingOutputOperation"); return clientHandler.execute( - new ClientExecutionParams() - .withOperationName("StreamingOutputOperation").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(streamingOutputOperationRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new StreamingOutputOperationRequestMarshaller(protocolFactory)), responseTransformer); + new ClientExecutionParams() + .withOperationName("StreamingOutputOperation").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(streamingOutputOperationRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new StreamingOutputOperationRequestMarshaller(protocolFactory)), responseTransformer); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -655,8 +654,8 @@ private T applySignerOverride(T request, Signer signer) { } Consumer signerOverride = b -> b.signer(signer).build(); AwsRequestOverrideConfiguration overrideConfiguration = request.overrideConfiguration() - .map(c -> c.toBuilder().applyMutation(signerOverride).build()) - .orElse((AwsRequestOverrideConfiguration.builder().applyMutation(signerOverride).build())); + .map(c -> c.toBuilder().applyMutation(signerOverride).build()) + .orElse((AwsRequestOverrideConfiguration.builder().applyMutation(signerOverride).build())); return (T) request.toBuilder().overrideConfiguration(overrideConfiguration).build(); } @@ -666,7 +665,7 @@ public final String serviceName() { } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, - RequestOverrideConfiguration requestOverrideConfiguration) { + RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); @@ -718,12 +717,8 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, } private AwsXmlProtocolFactory init() { - return AwsXmlProtocolFactory - .builder() - .registerModeledException( - ExceptionMetadata.builder().errorCode("InvalidInput") - .exceptionBuilderSupplier(InvalidInputException::builder).httpStatusCode(400).build()) - .clientConfiguration(clientConfiguration).defaultServiceExceptionSupplier(XmlException::builder).build(); + return AwsXmlProtocolFactory.builder().clientConfiguration(clientConfiguration) + .defaultServiceExceptionSupplier(XmlException::builder).build(); } @Override diff --git a/services/kinesis/src/it/java/software/amazon/awssdk/services/kinesis/KinesisExceptionTest.java b/services/kinesis/src/it/java/software/amazon/awssdk/services/kinesis/KinesisExceptionTest.java new file mode 100644 index 000000000000..c8d25366d55a --- /dev/null +++ b/services/kinesis/src/it/java/software/amazon/awssdk/services/kinesis/KinesisExceptionTest.java @@ -0,0 +1,80 @@ +/* + * 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.services.kinesis; + +import org.junit.Before; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import software.amazon.awssdk.regions.Region; +import software.amazon.awssdk.services.kinesis.model.*; + +import static org.junit.Assert.assertEquals; + +public class KinesisExceptionTest { + private static final Logger logger = LoggerFactory.getLogger(KinesisExceptionTest.class); + private KinesisClient client; + + @Before + public void setup() { + client = KinesisClient.builder() + .region(Region.US_WEST_2) + .build(); + } + + @Test + public void testInvalidArgumentException() { + try { + GetRecordsRequest request = GetRecordsRequest.builder() + .shardIterator("Invalid-Shard-Iterator") + .build(); + + client.getRecords(request); + + } catch (InvalidArgumentException e) { + logger.info("Caught expected exception: {}", e.getClass().getSimpleName()); + logger.info("Status Code: {}", e.statusCode()); + logger.info("Error Code: {}", e.awsErrorDetails().errorCode()); + logger.info("Error Message: {}", e.awsErrorDetails().errorMessage()); + + assertEquals(400, e.statusCode()); + assertEquals("InvalidArgumentException", e.awsErrorDetails().errorCode()); + } + } + + @Test + public void testResourceNotFoundException() { + String nonExistentStreamName = "non-existent-stream"; + + try { + DescribeStreamRequest request = DescribeStreamRequest.builder() + .streamName(nonExistentStreamName) + .build(); + + client.describeStream(request); + + } catch (ResourceNotFoundException e) { + logger.info("Caught expected exception: {}", e.getClass().getSimpleName()); + logger.info("Status Code: {}", e.statusCode()); + logger.info("Error Code: {}", e.awsErrorDetails().errorCode()); + logger.info("Error Message: {}", e.awsErrorDetails().errorMessage()); + + assertEquals(400, e.statusCode()); + assertEquals("ResourceNotFoundException", e.awsErrorDetails().errorCode()); + } + } + + } From 9ab362ddfb348ed05f6764cca9f151639c1073de Mon Sep 17 00:00:00 2001 From: Saranya Somepalli Date: Wed, 26 Mar 2025 15:05:12 -0700 Subject: [PATCH 02/22] Additional changes for update non-streaming error unmarshaller - Fixing integration test failures --- .../poet/client/specs/JsonProtocolSpec.java | 6 +++-- .../sra/test-json-async-client-class.java | 6 ++--- .../client/sra/test-json-client-class.java | 6 ++--- ...ry-compatible-json-async-client-class.java | 2 +- ...ery-compatible-json-sync-client-class.java | 2 +- .../client/test-json-async-client-class.java | 6 ++--- .../poet/client/test-json-client-class.java | 6 ++--- .../client/test-rpcv2-async-client-class.java | 6 ++--- .../codegen/poet/client/test-rpcv2-sync.java | 4 ++-- ...gned-payload-trait-async-client-class.java | 24 +++++++++---------- ...igned-payload-trait-sync-client-class.java | 22 ++++++++--------- .../kinesis/KinesisExceptionTest.java | 22 ----------------- 12 files changed, 46 insertions(+), 66 deletions(-) diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/JsonProtocolSpec.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/JsonProtocolSpec.java index 9f0adeadf15f..d48ee5c39593 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/JsonProtocolSpec.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/JsonProtocolSpec.java @@ -187,12 +187,14 @@ public Optional errorResponseHandler(OperationModel opModel) { return; } ShapeModel exceptionShape = model.getShapes().get(exceptionName); + String errorCode = exceptionShape.getErrorCode(); + builder.add("case $S:\n", exceptionName); builder.add("return $T.of($T.builder()\n", Optional.class, ExceptionMetadata.class) - .add(".errorCode($S)\n", exceptionName); + .add(".errorCode($S)\n", errorCode); builder.add(populateHttpStatusCode(exceptionShape, model)); builder.add(".exceptionBuilderSupplier($T::builder)\n", - poetExtensions.getModelClass(exceptionName)) + poetExtensions.getModelClassFromShape(exceptionShape)) .add(".build());\n"); }); diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-async-client-class.java index d1e05914bd28..c2c1e453a521 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-async-client-class.java @@ -206,7 +206,7 @@ public CompletableFuture aPostOperation(APostOperationRe Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); @@ -282,7 +282,7 @@ public CompletableFuture aPostOperationWithOut Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); @@ -799,7 +799,7 @@ public CompletableFuture getWithoutRequiredMe Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-client-class.java index d24381b25e30..c5f4f73713e7 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-client-class.java @@ -143,7 +143,7 @@ public APostOperationResponse aPostOperation(APostOperationRequest aPostOperatio Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); @@ -208,7 +208,7 @@ public APostOperationWithOutputResponse aPostOperationWithOutput( Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); @@ -389,7 +389,7 @@ public GetWithoutRequiredMembersResponse getWithoutRequiredMembers( Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-async-client-class.java index 7658437377b5..db35b253ce67 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-async-client-class.java @@ -113,7 +113,7 @@ public CompletableFuture aPostOperation(APostOperationRe Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-sync-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-sync-client-class.java index 67cbc41e5750..c48db32fd182 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-sync-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-sync-client-class.java @@ -98,7 +98,7 @@ public APostOperationResponse aPostOperation(APostOperationRequest aPostOperatio Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-async-client-class.java index 7933d458a770..d536c3eb5445 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-async-client-class.java @@ -213,7 +213,7 @@ public CompletableFuture aPostOperation(APostOperationRe Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); @@ -289,7 +289,7 @@ public CompletableFuture aPostOperationWithOut Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); @@ -810,7 +810,7 @@ public CompletableFuture getWithoutRequiredMe Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-client-class.java index a4f91b0462d6..6d003e2eec2e 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-client-class.java @@ -148,7 +148,7 @@ public APostOperationResponse aPostOperation(APostOperationRequest aPostOperatio Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); @@ -213,7 +213,7 @@ public APostOperationWithOutputResponse aPostOperationWithOutput( Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); @@ -395,7 +395,7 @@ public GetWithoutRequiredMembersResponse getWithoutRequiredMembers( Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); 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 index 867bd64bf7b8..d628a791e15a 100644 --- 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 @@ -339,10 +339,10 @@ public CompletableFuture greetingWithErrors(Greeting Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { case "ComplexErrorException": - return Optional.of(ExceptionMetadata.builder().errorCode("ComplexErrorException") + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") .exceptionBuilderSupplier(ComplexErrorException::builder).build()); case "InvalidGreetingException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreetingException") + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); default: return Optional.empty(); @@ -1043,4 +1043,4 @@ private HttpResponseHandler createErrorResponseHandler(Base public void close() { clientHandler.close(); } -} \ No newline at end of file +} 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 index 2c05002e066f..40b168d1ec02 100644 --- 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 @@ -294,10 +294,10 @@ public GreetingWithErrorsResponse greetingWithErrors(GreetingWithErrorsRequest g Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { case "ComplexErrorException": - return Optional.of(ExceptionMetadata.builder().errorCode("ComplexErrorException") + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") .exceptionBuilderSupplier(ComplexErrorException::builder).build()); case "InvalidGreetingException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreetingException") + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); default: return Optional.empty(); diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-async-client-class.java index 64c1946d1d63..0343b80f329f 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-async-client-class.java @@ -148,7 +148,7 @@ public CompletableFuture deleteRow(DeleteRowRequest deleteRow Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); @@ -217,7 +217,7 @@ public CompletableFuture getRow(GetRowRequest getRowRequest) { Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); @@ -290,7 +290,7 @@ public CompletableFuture opWithSigv Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); @@ -362,7 +362,7 @@ public CompletableFuture opWithSigv4SignedPayl Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); @@ -434,7 +434,7 @@ public CompletableFuture opWithSigv4UnSigned Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); @@ -518,7 +518,7 @@ public CompletableFuture opWithS Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); @@ -597,7 +597,7 @@ public CompletableFuture opWithSigv4aSignedPa Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); @@ -669,7 +669,7 @@ public CompletableFuture opWithSigv4aUnSign Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); @@ -743,7 +743,7 @@ public CompletableFuture opsWithSigv Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); @@ -813,7 +813,7 @@ public CompletableFuture putRow(PutRowRequest putRowRequest) { Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); @@ -886,7 +886,7 @@ public CompletableFuture secon Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); @@ -1007,4 +1007,4 @@ private HttpResponseHandler createErrorResponseHandler(Base public void close() { clientHandler.close(); } -} \ No newline at end of file +} diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-sync-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-sync-client-class.java index a5641d7c1e7b..cde7508b7249 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-sync-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-sync-client-class.java @@ -129,7 +129,7 @@ public DeleteRowResponse deleteRow(DeleteRowRequest deleteRowRequest) throws Inv Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); @@ -188,7 +188,7 @@ public GetRowResponse getRow(GetRowRequest getRowRequest) throws InvalidInputExc Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); @@ -247,7 +247,7 @@ public PutRowResponse putRow(PutRowRequest putRowRequest) throws InvalidInputExc Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); @@ -308,7 +308,7 @@ public OpWithSigv4AndSigv4AUnSignedPayloadResponse opWithSigv4AndSigv4aUnSignedP Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); @@ -371,7 +371,7 @@ public OpWithSigv4SignedPayloadResponse opWithSigv4SignedPayload( Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); @@ -434,7 +434,7 @@ public OpWithSigv4UnSignedPayloadResponse opWithSigv4UnSignedPayload( Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); @@ -509,7 +509,7 @@ public OpWithSigv4UnSignedPayloadAndStreamingResponse opWithSigv4UnSignedPayload Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); @@ -581,7 +581,7 @@ public OpWithSigv4ASignedPayloadResponse opWithSigv4aSignedPayload( Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); @@ -644,7 +644,7 @@ public OpWithSigv4AUnSignedPayloadResponse opWithSigv4aUnSignedPayload( Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); @@ -708,7 +708,7 @@ public OpsWithSigv4AndSigv4ASignedPayloadResponse opsWithSigv4andSigv4aSignedPay Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); @@ -772,7 +772,7 @@ public SecondOpsWithSigv4AndSigv4ASignedPayloadResponse secondOpsWithSigv4andSig Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); diff --git a/services/kinesis/src/it/java/software/amazon/awssdk/services/kinesis/KinesisExceptionTest.java b/services/kinesis/src/it/java/software/amazon/awssdk/services/kinesis/KinesisExceptionTest.java index c8d25366d55a..eb9d1809ee3f 100644 --- a/services/kinesis/src/it/java/software/amazon/awssdk/services/kinesis/KinesisExceptionTest.java +++ b/services/kinesis/src/it/java/software/amazon/awssdk/services/kinesis/KinesisExceptionTest.java @@ -55,26 +55,4 @@ public void testInvalidArgumentException() { } } - @Test - public void testResourceNotFoundException() { - String nonExistentStreamName = "non-existent-stream"; - - try { - DescribeStreamRequest request = DescribeStreamRequest.builder() - .streamName(nonExistentStreamName) - .build(); - - client.describeStream(request); - - } catch (ResourceNotFoundException e) { - logger.info("Caught expected exception: {}", e.getClass().getSimpleName()); - logger.info("Status Code: {}", e.statusCode()); - logger.info("Error Code: {}", e.awsErrorDetails().errorCode()); - logger.info("Error Message: {}", e.awsErrorDetails().errorMessage()); - - assertEquals(400, e.statusCode()); - assertEquals("ResourceNotFoundException", e.awsErrorDetails().errorCode()); - } - } - } From 43642d399661233dd5d5eddd44732d7e6dc1e9e0 Mon Sep 17 00:00:00 2001 From: Saranya Somepalli Date: Wed, 26 Mar 2025 15:22:01 -0700 Subject: [PATCH 03/22] Added changelog --- .changes/next-release/bugfix-AWSSDKforJavav2-e869e94.json | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changes/next-release/bugfix-AWSSDKforJavav2-e869e94.json diff --git a/.changes/next-release/bugfix-AWSSDKforJavav2-e869e94.json b/.changes/next-release/bugfix-AWSSDKforJavav2-e869e94.json new file mode 100644 index 000000000000..8dfd2ca41bb2 --- /dev/null +++ b/.changes/next-release/bugfix-AWSSDKforJavav2-e869e94.json @@ -0,0 +1,6 @@ +{ + "type": "bugfix", + "category": "AWS SDK for Java v2", + "contributor": "", + "description": "Update non-streaming error unmarshalling to use the same mapping function that was previously implemented for streaming operations." +} From e0b6afec7be49e49e6180662a1e5f98dd3d11d7c Mon Sep 17 00:00:00 2001 From: Saranya Somepalli Date: Wed, 26 Mar 2025 16:33:58 -0700 Subject: [PATCH 04/22] Additional changes for update non-streaming error unmarshalling to use new mapping function --- .../poet/client/specs/JsonProtocolSpec.java | 2 +- .../sra/test-json-async-client-class.java | 6 ++--- .../client/sra/test-json-client-class.java | 6 ++--- ...ry-compatible-json-async-client-class.java | 2 +- ...ery-compatible-json-sync-client-class.java | 2 +- .../client/test-json-async-client-class.java | 6 ++--- .../poet/client/test-json-client-class.java | 6 ++--- .../client/test-rpcv2-async-client-class.java | 4 ++-- .../codegen/poet/client/test-rpcv2-sync.java | 4 ++-- ...gned-payload-trait-async-client-class.java | 22 +++++++++---------- ...igned-payload-trait-sync-client-class.java | 22 +++++++++---------- 11 files changed, 41 insertions(+), 41 deletions(-) diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/JsonProtocolSpec.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/JsonProtocolSpec.java index d48ee5c39593..ee2fa96aeb78 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/JsonProtocolSpec.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/JsonProtocolSpec.java @@ -189,7 +189,7 @@ public Optional errorResponseHandler(OperationModel opModel) { ShapeModel exceptionShape = model.getShapes().get(exceptionName); String errorCode = exceptionShape.getErrorCode(); - builder.add("case $S:\n", exceptionName); + builder.add("case $S:\n", errorCode); builder.add("return $T.of($T.builder()\n", Optional.class, ExceptionMetadata.class) .add(".errorCode($S)\n", errorCode); builder.add(populateHttpStatusCode(exceptionShape, model)); diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-async-client-class.java index c2c1e453a521..6d1cc6ed29b4 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-async-client-class.java @@ -205,7 +205,7 @@ public CompletableFuture aPostOperation(APostOperationRe operationMetadata, APostOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -281,7 +281,7 @@ public CompletableFuture aPostOperationWithOut operationMetadata, APostOperationWithOutputResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -798,7 +798,7 @@ public CompletableFuture getWithoutRequiredMe operationMetadata, GetWithoutRequiredMembersResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-client-class.java index c5f4f73713e7..682816737b75 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-client-class.java @@ -142,7 +142,7 @@ public APostOperationResponse aPostOperation(APostOperationRequest aPostOperatio APostOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -207,7 +207,7 @@ public APostOperationWithOutputResponse aPostOperationWithOutput( operationMetadata, APostOperationWithOutputResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -388,7 +388,7 @@ public GetWithoutRequiredMembersResponse getWithoutRequiredMembers( operationMetadata, GetWithoutRequiredMembersResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-async-client-class.java index db35b253ce67..f60395e3be3d 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-async-client-class.java @@ -112,7 +112,7 @@ public CompletableFuture aPostOperation(APostOperationRe operationMetadata, APostOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-sync-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-sync-client-class.java index c48db32fd182..2bf5924b4b2d 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-sync-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-sync-client-class.java @@ -97,7 +97,7 @@ public APostOperationResponse aPostOperation(APostOperationRequest aPostOperatio APostOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-async-client-class.java index d536c3eb5445..24f44f3561c7 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-async-client-class.java @@ -212,7 +212,7 @@ public CompletableFuture aPostOperation(APostOperationRe operationMetadata, APostOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -288,7 +288,7 @@ public CompletableFuture aPostOperationWithOut operationMetadata, APostOperationWithOutputResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -809,7 +809,7 @@ public CompletableFuture getWithoutRequiredMe operationMetadata, GetWithoutRequiredMembersResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-client-class.java index 6d003e2eec2e..cd6c248f6bf8 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-client-class.java @@ -147,7 +147,7 @@ public APostOperationResponse aPostOperation(APostOperationRequest aPostOperatio APostOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -212,7 +212,7 @@ public APostOperationWithOutputResponse aPostOperationWithOutput( operationMetadata, APostOperationWithOutputResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -394,7 +394,7 @@ public GetWithoutRequiredMembersResponse getWithoutRequiredMembers( operationMetadata, GetWithoutRequiredMembersResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: 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 index d628a791e15a..19eaf7b580b8 100644 --- 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 @@ -338,10 +338,10 @@ public CompletableFuture greetingWithErrors(Greeting operationMetadata, GreetingWithErrorsResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "ComplexErrorException": + case "ComplexError": return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") .exceptionBuilderSupplier(ComplexErrorException::builder).build()); - case "InvalidGreetingException": + case "InvalidGreeting": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); default: 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 index 40b168d1ec02..bb027de770b0 100644 --- 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 @@ -293,10 +293,10 @@ public GreetingWithErrorsResponse greetingWithErrors(GreetingWithErrorsRequest g operationMetadata, GreetingWithErrorsResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "ComplexErrorException": + case "ComplexError": return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") .exceptionBuilderSupplier(ComplexErrorException::builder).build()); - case "InvalidGreetingException": + case "InvalidGreeting": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); default: diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-async-client-class.java index 0343b80f329f..1db56c43e67b 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-async-client-class.java @@ -147,7 +147,7 @@ public CompletableFuture deleteRow(DeleteRowRequest deleteRow DeleteRowResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -216,7 +216,7 @@ public CompletableFuture getRow(GetRowRequest getRowRequest) { GetRowResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -289,7 +289,7 @@ public CompletableFuture opWithSigv .createResponseHandler(operationMetadata, OpWithSigv4AndSigv4AUnSignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -361,7 +361,7 @@ public CompletableFuture opWithSigv4SignedPayl operationMetadata, OpWithSigv4SignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -433,7 +433,7 @@ public CompletableFuture opWithSigv4UnSigned operationMetadata, OpWithSigv4UnSignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -517,7 +517,7 @@ public CompletableFuture opWithS .createResponseHandler(operationMetadata, OpWithSigv4UnSignedPayloadAndStreamingResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -596,7 +596,7 @@ public CompletableFuture opWithSigv4aSignedPa operationMetadata, OpWithSigv4ASignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -668,7 +668,7 @@ public CompletableFuture opWithSigv4aUnSign operationMetadata, OpWithSigv4AUnSignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -742,7 +742,7 @@ public CompletableFuture opsWithSigv .createResponseHandler(operationMetadata, OpsWithSigv4AndSigv4ASignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -812,7 +812,7 @@ public CompletableFuture putRow(PutRowRequest putRowRequest) { PutRowResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -885,7 +885,7 @@ public CompletableFuture secon .createResponseHandler(operationMetadata, SecondOpsWithSigv4AndSigv4ASignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-sync-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-sync-client-class.java index cde7508b7249..265edeb3ee00 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-sync-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-sync-client-class.java @@ -128,7 +128,7 @@ public DeleteRowResponse deleteRow(DeleteRowRequest deleteRowRequest) throws Inv DeleteRowResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -187,7 +187,7 @@ public GetRowResponse getRow(GetRowRequest getRowRequest) throws InvalidInputExc GetRowResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -246,7 +246,7 @@ public PutRowResponse putRow(PutRowRequest putRowRequest) throws InvalidInputExc PutRowResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -307,7 +307,7 @@ public OpWithSigv4AndSigv4AUnSignedPayloadResponse opWithSigv4AndSigv4aUnSignedP operationMetadata, OpWithSigv4AndSigv4AUnSignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -370,7 +370,7 @@ public OpWithSigv4SignedPayloadResponse opWithSigv4SignedPayload( operationMetadata, OpWithSigv4SignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -433,7 +433,7 @@ public OpWithSigv4UnSignedPayloadResponse opWithSigv4UnSignedPayload( operationMetadata, OpWithSigv4UnSignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -508,7 +508,7 @@ public OpWithSigv4UnSignedPayloadAndStreamingResponse opWithSigv4UnSignedPayload .createResponseHandler(operationMetadata, OpWithSigv4UnSignedPayloadAndStreamingResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -580,7 +580,7 @@ public OpWithSigv4ASignedPayloadResponse opWithSigv4aSignedPayload( operationMetadata, OpWithSigv4ASignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -643,7 +643,7 @@ public OpWithSigv4AUnSignedPayloadResponse opWithSigv4aUnSignedPayload( operationMetadata, OpWithSigv4AUnSignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -707,7 +707,7 @@ public OpsWithSigv4AndSigv4ASignedPayloadResponse opsWithSigv4andSigv4aSignedPay operationMetadata, OpsWithSigv4AndSigv4ASignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -771,7 +771,7 @@ public SecondOpsWithSigv4AndSigv4ASignedPayloadResponse secondOpsWithSigv4andSig .createResponseHandler(operationMetadata, SecondOpsWithSigv4AndSigv4ASignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: From 583d27e51d166820c54ed98328dcee641b0829bd Mon Sep 17 00:00:00 2001 From: Saranya Somepalli Date: Wed, 26 Mar 2025 20:16:34 -0700 Subject: [PATCH 05/22] Fixing errors --- .../poet/client/specs/JsonProtocolSpec.java | 2 +- .../sra/test-json-async-client-class.java | 6 ++--- .../client/sra/test-json-client-class.java | 6 ++--- ...ry-compatible-json-async-client-class.java | 2 +- ...ery-compatible-json-sync-client-class.java | 2 +- .../client/test-json-async-client-class.java | 6 ++--- .../poet/client/test-json-client-class.java | 6 ++--- ...gned-payload-trait-async-client-class.java | 22 +++++++++---------- ...igned-payload-trait-sync-client-class.java | 22 +++++++++---------- 9 files changed, 37 insertions(+), 37 deletions(-) diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/JsonProtocolSpec.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/JsonProtocolSpec.java index ee2fa96aeb78..7e5e79a90e67 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/JsonProtocolSpec.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/JsonProtocolSpec.java @@ -189,7 +189,7 @@ public Optional errorResponseHandler(OperationModel opModel) { ShapeModel exceptionShape = model.getShapes().get(exceptionName); String errorCode = exceptionShape.getErrorCode(); - builder.add("case $S:\n", errorCode); + builder.add("case $S:\n", exceptionShape.getC2jName()); builder.add("return $T.of($T.builder()\n", Optional.class, ExceptionMetadata.class) .add(".errorCode($S)\n", errorCode); builder.add(populateHttpStatusCode(exceptionShape, model)); diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-async-client-class.java index 6d1cc6ed29b4..c2c1e453a521 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-async-client-class.java @@ -205,7 +205,7 @@ public CompletableFuture aPostOperation(APostOperationRe operationMetadata, APostOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInput": + case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -281,7 +281,7 @@ public CompletableFuture aPostOperationWithOut operationMetadata, APostOperationWithOutputResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInput": + case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -798,7 +798,7 @@ public CompletableFuture getWithoutRequiredMe operationMetadata, GetWithoutRequiredMembersResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInput": + case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-client-class.java index 682816737b75..c5f4f73713e7 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-client-class.java @@ -142,7 +142,7 @@ public APostOperationResponse aPostOperation(APostOperationRequest aPostOperatio APostOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInput": + case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -207,7 +207,7 @@ public APostOperationWithOutputResponse aPostOperationWithOutput( operationMetadata, APostOperationWithOutputResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInput": + case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -388,7 +388,7 @@ public GetWithoutRequiredMembersResponse getWithoutRequiredMembers( operationMetadata, GetWithoutRequiredMembersResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInput": + case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-async-client-class.java index f60395e3be3d..db35b253ce67 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-async-client-class.java @@ -112,7 +112,7 @@ public CompletableFuture aPostOperation(APostOperationRe operationMetadata, APostOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInput": + case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-sync-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-sync-client-class.java index 2bf5924b4b2d..c48db32fd182 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-sync-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-sync-client-class.java @@ -97,7 +97,7 @@ public APostOperationResponse aPostOperation(APostOperationRequest aPostOperatio APostOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInput": + case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-async-client-class.java index 24f44f3561c7..d536c3eb5445 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-async-client-class.java @@ -212,7 +212,7 @@ public CompletableFuture aPostOperation(APostOperationRe operationMetadata, APostOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInput": + case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -288,7 +288,7 @@ public CompletableFuture aPostOperationWithOut operationMetadata, APostOperationWithOutputResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInput": + case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -809,7 +809,7 @@ public CompletableFuture getWithoutRequiredMe operationMetadata, GetWithoutRequiredMembersResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInput": + case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-client-class.java index cd6c248f6bf8..6d003e2eec2e 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-client-class.java @@ -147,7 +147,7 @@ public APostOperationResponse aPostOperation(APostOperationRequest aPostOperatio APostOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInput": + case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -212,7 +212,7 @@ public APostOperationWithOutputResponse aPostOperationWithOutput( operationMetadata, APostOperationWithOutputResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInput": + case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -394,7 +394,7 @@ public GetWithoutRequiredMembersResponse getWithoutRequiredMembers( operationMetadata, GetWithoutRequiredMembersResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInput": + case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-async-client-class.java index 1db56c43e67b..0343b80f329f 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-async-client-class.java @@ -147,7 +147,7 @@ public CompletableFuture deleteRow(DeleteRowRequest deleteRow DeleteRowResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInput": + case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -216,7 +216,7 @@ public CompletableFuture getRow(GetRowRequest getRowRequest) { GetRowResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInput": + case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -289,7 +289,7 @@ public CompletableFuture opWithSigv .createResponseHandler(operationMetadata, OpWithSigv4AndSigv4AUnSignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInput": + case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -361,7 +361,7 @@ public CompletableFuture opWithSigv4SignedPayl operationMetadata, OpWithSigv4SignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInput": + case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -433,7 +433,7 @@ public CompletableFuture opWithSigv4UnSigned operationMetadata, OpWithSigv4UnSignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInput": + case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -517,7 +517,7 @@ public CompletableFuture opWithS .createResponseHandler(operationMetadata, OpWithSigv4UnSignedPayloadAndStreamingResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInput": + case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -596,7 +596,7 @@ public CompletableFuture opWithSigv4aSignedPa operationMetadata, OpWithSigv4ASignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInput": + case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -668,7 +668,7 @@ public CompletableFuture opWithSigv4aUnSign operationMetadata, OpWithSigv4AUnSignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInput": + case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -742,7 +742,7 @@ public CompletableFuture opsWithSigv .createResponseHandler(operationMetadata, OpsWithSigv4AndSigv4ASignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInput": + case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -812,7 +812,7 @@ public CompletableFuture putRow(PutRowRequest putRowRequest) { PutRowResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInput": + case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -885,7 +885,7 @@ public CompletableFuture secon .createResponseHandler(operationMetadata, SecondOpsWithSigv4AndSigv4ASignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInput": + case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-sync-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-sync-client-class.java index 265edeb3ee00..cde7508b7249 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-sync-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-sync-client-class.java @@ -128,7 +128,7 @@ public DeleteRowResponse deleteRow(DeleteRowRequest deleteRowRequest) throws Inv DeleteRowResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInput": + case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -187,7 +187,7 @@ public GetRowResponse getRow(GetRowRequest getRowRequest) throws InvalidInputExc GetRowResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInput": + case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -246,7 +246,7 @@ public PutRowResponse putRow(PutRowRequest putRowRequest) throws InvalidInputExc PutRowResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInput": + case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -307,7 +307,7 @@ public OpWithSigv4AndSigv4AUnSignedPayloadResponse opWithSigv4AndSigv4aUnSignedP operationMetadata, OpWithSigv4AndSigv4AUnSignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInput": + case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -370,7 +370,7 @@ public OpWithSigv4SignedPayloadResponse opWithSigv4SignedPayload( operationMetadata, OpWithSigv4SignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInput": + case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -433,7 +433,7 @@ public OpWithSigv4UnSignedPayloadResponse opWithSigv4UnSignedPayload( operationMetadata, OpWithSigv4UnSignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInput": + case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -508,7 +508,7 @@ public OpWithSigv4UnSignedPayloadAndStreamingResponse opWithSigv4UnSignedPayload .createResponseHandler(operationMetadata, OpWithSigv4UnSignedPayloadAndStreamingResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInput": + case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -580,7 +580,7 @@ public OpWithSigv4ASignedPayloadResponse opWithSigv4aSignedPayload( operationMetadata, OpWithSigv4ASignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInput": + case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -643,7 +643,7 @@ public OpWithSigv4AUnSignedPayloadResponse opWithSigv4aUnSignedPayload( operationMetadata, OpWithSigv4AUnSignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInput": + case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -707,7 +707,7 @@ public OpsWithSigv4AndSigv4ASignedPayloadResponse opsWithSigv4andSigv4aSignedPay operationMetadata, OpsWithSigv4AndSigv4ASignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInput": + case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -771,7 +771,7 @@ public SecondOpsWithSigv4AndSigv4ASignedPayloadResponse secondOpsWithSigv4andSig .createResponseHandler(operationMetadata, SecondOpsWithSigv4AndSigv4ASignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInput": + case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: From df221a2720e6c7d25290d7a2776aa9285237cb37 Mon Sep 17 00:00:00 2001 From: Saranya Somepalli Date: Mon, 31 Mar 2025 12:05:47 -0700 Subject: [PATCH 06/22] Update query protocol error unmarshalling with new mapping function --- .../poet/client/specs/QueryProtocolSpec.java | 59 +++++- .../sra/test-query-async-client-class.java | 175 +++++++++++++++-- .../client/sra/test-query-client-class.java | 174 +++++++++++++++-- .../sra/test-xml-async-client-class.java | 28 ++- .../client/sra/test-xml-client-class.java | 28 ++- .../client/test-query-async-client-class.java | 177 ++++++++++++++++-- .../poet/client/test-query-client-class.java | 174 +++++++++++++++-- .../client/test-xml-async-client-class.java | 30 ++- .../poet/client/test-xml-client-class.java | 28 ++- .../query/AwsQueryProtocolFactory.java | 15 ++ .../unmarshall/AwsXmlErrorUnmarshaller.java | 29 ++- .../AwsXmlErrorProtocolUnmarshaller.java | 11 +- .../protocols/xml/AwsXmlProtocolFactory.java | 25 ++- 13 files changed, 864 insertions(+), 89 deletions(-) diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/QueryProtocolSpec.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/QueryProtocolSpec.java index cf6c331dba6d..b325b7c6089f 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/QueryProtocolSpec.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/QueryProtocolSpec.java @@ -21,12 +21,16 @@ import com.squareup.javapoet.MethodSpec; import com.squareup.javapoet.ParameterizedTypeName; import com.squareup.javapoet.TypeName; +import java.util.HashSet; import java.util.Optional; +import java.util.Set; import java.util.concurrent.CompletableFuture; +import java.util.function.Function; import javax.lang.model.element.Modifier; import software.amazon.awssdk.awscore.exception.AwsServiceException; import software.amazon.awssdk.codegen.model.intermediate.IntermediateModel; import software.amazon.awssdk.codegen.model.intermediate.OperationModel; +import software.amazon.awssdk.codegen.model.intermediate.ShapeModel; import software.amazon.awssdk.codegen.poet.PoetExtension; import software.amazon.awssdk.codegen.poet.auth.scheme.AuthSchemeSpecUtils; import software.amazon.awssdk.codegen.poet.client.traits.HttpChecksumRequiredTrait; @@ -36,6 +40,7 @@ import software.amazon.awssdk.core.async.AsyncResponseTransformer; import software.amazon.awssdk.core.client.handler.ClientExecutionParams; import software.amazon.awssdk.core.http.HttpResponseHandler; +import software.amazon.awssdk.protocols.core.ExceptionMetadata; import software.amazon.awssdk.protocols.query.AwsQueryProtocolFactory; import software.amazon.awssdk.utils.CompletableFutureUtils; @@ -92,11 +97,41 @@ public CodeBlock responseHandler(IntermediateModel model, @Override public Optional errorResponseHandler(OperationModel opModel) { - return Optional.of( - CodeBlock.builder() - .add("\n\n$T errorResponseHandler = protocolFactory.createErrorResponseHandler();", - ParameterizedTypeName.get(HttpResponseHandler.class, AwsServiceException.class)) - .build()); + CodeBlock.Builder builder = CodeBlock.builder(); + ParameterizedTypeName metadataMapperType = ParameterizedTypeName.get( + ClassName.get(Function.class), + ClassName.get(String.class), + ParameterizedTypeName.get(Optional.class, ExceptionMetadata.class)); + + builder.add("\n$T exceptionMetadataMapper = errorCode -> {\n", metadataMapperType); + builder.add("switch (errorCode) {\n"); + Set processedExceptions = new HashSet<>(); + + opModel.getExceptions().forEach(exception -> { + String exceptionName = exception.getExceptionName(); + if (!processedExceptions.add(exceptionName)) { + return; + } + ShapeModel exceptionShape = intermediateModel.getShapes().get(exceptionName); + String errorCode = exceptionShape.getErrorCode(); + builder.add("case $S:\n", exceptionShape.getC2jName()); + builder.add("return $T.of($T.builder()\n", Optional.class, ExceptionMetadata.class) + .add(".errorCode($S)\n", errorCode); + builder.add(populateHttpStatusCode(exceptionShape, intermediateModel)); + builder.add(".exceptionBuilderSupplier($T::builder)\n", + poetExtensions.getModelClassFromShape(exceptionShape)) + .add(".build());\n"); + }); + + builder.add("default: return $T.empty();\n", Optional.class); + builder.add("}\n"); + builder.add("};\n\n"); + + builder.add("$T<$T> errorResponseHandler = protocolFactory.createErrorResponseHandler(exceptionMetadataMapper);", + HttpResponseHandler.class, + AwsServiceException.class); + + return Optional.of(builder.build()); } @Override @@ -191,6 +226,18 @@ public CodeBlock asyncExecutionHandler(IntermediateModel intermediateModel, Oper @Override public Optional createErrorResponseHandler() { - return Optional.empty(); + ParameterizedTypeName mapperType = ParameterizedTypeName.get( + ClassName.get(Function.class), + ClassName.get(String.class), + ParameterizedTypeName.get(Optional.class, ExceptionMetadata.class)); + + return Optional.of(MethodSpec.methodBuilder("createErrorResponseHandler") + .addModifiers(Modifier.PRIVATE) + .returns(ParameterizedTypeName.get(ClassName.get(HttpResponseHandler.class), + ClassName.get(AwsServiceException.class))) + .addParameter(mapperType, "exceptionMetadataMapper") + .addStatement("return protocolFactory.createErrorResponseHandler(exceptionMetadataMapper)") + .build()); } + } diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-async-client-class.java index afefb7739f38..c0586ee87b60 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-async-client-class.java @@ -4,9 +4,11 @@ import java.util.Collections; import java.util.List; +import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ScheduledExecutorService; import java.util.function.Consumer; +import java.util.function.Function; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import software.amazon.awssdk.annotations.Generated; @@ -41,6 +43,7 @@ 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.query.AwsQueryProtocolFactory; import software.amazon.awssdk.retries.api.RetryStrategy; import software.amazon.awssdk.services.query.internal.QueryServiceClientConfigurationBuilder; @@ -52,6 +55,7 @@ import software.amazon.awssdk.services.query.model.BearerAuthOperationResponse; import software.amazon.awssdk.services.query.model.GetOperationWithChecksumRequest; import software.amazon.awssdk.services.query.model.GetOperationWithChecksumResponse; +import software.amazon.awssdk.services.query.model.InvalidInputException; import software.amazon.awssdk.services.query.model.OperationWithChecksumRequiredRequest; import software.amazon.awssdk.services.query.model.OperationWithChecksumRequiredResponse; import software.amazon.awssdk.services.query.model.OperationWithContextParamRequest; @@ -163,7 +167,18 @@ public CompletableFuture aPostOperation(APostOperationRe HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(APostOperationResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); String hostPrefix = "foo-"; String resolvedHostExpression = "foo-"; @@ -225,7 +240,18 @@ public CompletableFuture aPostOperationWithOut HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(APostOperationWithOutputResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -281,7 +307,15 @@ public CompletableFuture bearerAuthOperation( HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(BearerAuthOperationResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -337,7 +371,15 @@ public CompletableFuture getOperationWithCheck HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(GetOperationWithChecksumResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -402,7 +444,15 @@ public CompletableFuture operationWithChe HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithChecksumRequiredResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -462,7 +512,15 @@ public CompletableFuture operationWithContext HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithContextParamResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -519,7 +577,15 @@ public CompletableFuture operationWithCustomM HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithCustomMemberResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -577,7 +643,15 @@ public CompletableFuture o HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithCustomizedOperationContextParamResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -636,7 +710,15 @@ public CompletableFuture operatio HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithMapOperationContextParamResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -692,7 +774,15 @@ public CompletableFuture operationWithNoneAut HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithNoneAuthTypeResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -750,7 +840,15 @@ public CompletableFuture operationWi HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithOperationContextParamResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -807,7 +905,15 @@ public CompletableFuture operationWithR HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithRequestCompressionResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -869,7 +975,15 @@ public CompletableFuture operationWith HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithStaticContextParamsResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -948,7 +1062,15 @@ public CompletableFuture putOperationWithChecksum( HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(PutOperationWithChecksumResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler.execute( new ClientExecutionParams() @@ -1035,7 +1157,15 @@ public CompletableFuture streamingInputOperatio HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(StreamingInputOperationResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -1105,7 +1235,15 @@ public CompletableFuture streamingOutputOperation( HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(StreamingOutputOperationResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler.execute( new ClientExecutionParams() @@ -1207,6 +1345,11 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, return configuration.build(); } + private HttpResponseHandler createErrorResponseHandler( + Function> exceptionMetadataMapper) { + return protocolFactory.createErrorResponseHandler(exceptionMetadataMapper); + } + @Override public void close() { clientHandler.close(); diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-client-class.java index 42dcf987c214..aa66e745444b 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-client-class.java @@ -2,7 +2,9 @@ import java.util.Collections; import java.util.List; +import java.util.Optional; import java.util.function.Consumer; +import java.util.function.Function; import software.amazon.awssdk.annotations.Generated; import software.amazon.awssdk.annotations.SdkInternalApi; import software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler; @@ -35,6 +37,7 @@ 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.query.AwsQueryProtocolFactory; import software.amazon.awssdk.retries.api.RetryStrategy; import software.amazon.awssdk.services.query.internal.QueryServiceClientConfigurationBuilder; @@ -143,7 +146,18 @@ public APostOperationResponse aPostOperation(APostOperationRequest aPostOperatio HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(APostOperationResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationRequest .overrideConfiguration().orElse(null)); @@ -194,7 +208,18 @@ public APostOperationWithOutputResponse aPostOperationWithOutput( HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(APostOperationWithOutputResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationWithOutputRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationWithOutputRequest @@ -240,7 +265,15 @@ public BearerAuthOperationResponse bearerAuthOperation(BearerAuthOperationReques HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(BearerAuthOperationResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(bearerAuthOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, bearerAuthOperationRequest @@ -286,7 +319,15 @@ public GetOperationWithChecksumResponse getOperationWithChecksum( HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(GetOperationWithChecksumResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getOperationWithChecksumRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getOperationWithChecksumRequest @@ -341,7 +382,15 @@ public OperationWithChecksumRequiredResponse operationWithChecksumRequired( HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithChecksumRequiredResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithChecksumRequiredRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, @@ -393,7 +442,15 @@ public OperationWithContextParamResponse operationWithContextParam( HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithContextParamResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithContextParamRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithContextParamRequest @@ -441,7 +498,15 @@ public OperationWithCustomMemberResponse operationWithCustomMember( HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithCustomMemberResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithCustomMemberRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithCustomMemberRequest @@ -489,7 +554,15 @@ public OperationWithCustomizedOperationContextParamResponse operationWithCustomi HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithCustomizedOperationContextParamResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration( operationWithCustomizedOperationContextParamRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, @@ -538,7 +611,15 @@ public OperationWithMapOperationContextParamResponse operationWithMapOperationCo HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithMapOperationContextParamResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithMapOperationContextParamRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, @@ -585,7 +666,15 @@ public OperationWithNoneAuthTypeResponse operationWithNoneAuthType( HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithNoneAuthTypeResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithNoneAuthTypeRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithNoneAuthTypeRequest @@ -633,7 +722,15 @@ public OperationWithOperationContextParamResponse operationWithOperationContextP HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithOperationContextParamResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithOperationContextParamRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, @@ -680,7 +777,15 @@ public OperationWithRequestCompressionResponse operationWithRequestCompression( HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithRequestCompressionResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithRequestCompressionRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, @@ -732,7 +837,15 @@ public OperationWithStaticContextParamsResponse operationWithStaticContextParams HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithStaticContextParamsResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithStaticContextParamsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, @@ -805,7 +918,15 @@ public ReturnT putOperationWithChecksum(PutOperationWithChecksumReques HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(PutOperationWithChecksumResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putOperationWithChecksumRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, putOperationWithChecksumRequest @@ -879,7 +1000,15 @@ public StreamingInputOperationResponse streamingInputOperation(StreamingInputOpe HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(StreamingInputOperationResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingInputOperationRequest @@ -940,7 +1069,15 @@ public ReturnT streamingOutputOperation(StreamingOutputOperationReques HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(StreamingOutputOperationResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingOutputOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingOutputOperationRequest @@ -996,6 +1133,11 @@ private static List resolveMetricPublishers(SdkClientConfigurat return publishers; } + private HttpResponseHandler createErrorResponseHandler( + Function> exceptionMetadataMapper) { + return protocolFactory.createErrorResponseHandler(exceptionMetadataMapper); + } + private void updateRetryStrategyClientConfiguration(SdkClientConfiguration.Builder configuration) { ClientOverrideConfiguration.Builder builder = configuration.asOverrideConfigurationBuilder(); RetryMode retryMode = builder.retryMode(); diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-async-client-class.java index b6e33dd52c20..24da34052f30 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-async-client-class.java @@ -4,9 +4,11 @@ import java.util.Collections; import java.util.List; +import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; import java.util.function.Consumer; +import java.util.function.Function; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import software.amazon.awssdk.annotations.Generated; @@ -46,6 +48,7 @@ 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.xml.AwsXmlProtocolFactory; import software.amazon.awssdk.protocols.xml.XmlOperationMetadata; import software.amazon.awssdk.retries.api.RetryStrategy; @@ -673,7 +676,15 @@ public CompletableFuture putOperationWithChecksum( HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( PutOperationWithChecksumResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(true)); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler.execute( new ClientExecutionParams() @@ -830,7 +841,15 @@ public CompletableFuture streamingOutputOperation( HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( StreamingOutputOperationResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(true)); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler.execute( new ClientExecutionParams() @@ -927,6 +946,11 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, return configuration.build(); } + private HttpResponseHandler createErrorResponseHandler( + Function> exceptionMetadataMapper) { + return protocolFactory.createErrorResponseHandler(exceptionMetadataMapper); + } + @Override public void close() { clientHandler.close(); diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-client-class.java index 3ea1c77e73c0..7effb44d0f04 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-client-class.java @@ -2,7 +2,9 @@ import java.util.Collections; import java.util.List; +import java.util.Optional; import java.util.function.Consumer; +import java.util.function.Function; import software.amazon.awssdk.annotations.Generated; import software.amazon.awssdk.annotations.SdkInternalApi; import software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler; @@ -35,6 +37,7 @@ 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.xml.AwsXmlProtocolFactory; import software.amazon.awssdk.protocols.xml.XmlOperationMetadata; import software.amazon.awssdk.retries.api.RetryStrategy; @@ -486,7 +489,15 @@ public ReturnT putOperationWithChecksum(PutOperationWithChecksumReques HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( PutOperationWithChecksumResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(true)); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putOperationWithChecksumRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, putOperationWithChecksumRequest @@ -619,7 +630,15 @@ public ReturnT streamingOutputOperation(StreamingOutputOperationReques HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( StreamingOutputOperationResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(true)); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingOutputOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingOutputOperationRequest @@ -662,6 +681,11 @@ private static List resolveMetricPublishers(SdkClientConfigurat return publishers; } + private HttpResponseHandler createErrorResponseHandler( + Function> exceptionMetadataMapper) { + return protocolFactory.createErrorResponseHandler(exceptionMetadataMapper); + } + private void updateRetryStrategyClientConfiguration(SdkClientConfiguration.Builder configuration) { ClientOverrideConfiguration.Builder builder = configuration.asOverrideConfigurationBuilder(); RetryMode retryMode = builder.retryMode(); diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-async-client-class.java index ec394fa575ed..2658724dec31 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-async-client-class.java @@ -4,9 +4,11 @@ import java.util.Collections; import java.util.List; +import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ScheduledExecutorService; import java.util.function.Consumer; +import java.util.function.Function; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import software.amazon.awssdk.annotations.Generated; @@ -45,6 +47,7 @@ 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.query.AwsQueryProtocolFactory; import software.amazon.awssdk.retries.api.RetryStrategy; import software.amazon.awssdk.services.query.internal.QueryServiceClientConfigurationBuilder; @@ -56,6 +59,7 @@ import software.amazon.awssdk.services.query.model.BearerAuthOperationResponse; import software.amazon.awssdk.services.query.model.GetOperationWithChecksumRequest; import software.amazon.awssdk.services.query.model.GetOperationWithChecksumResponse; +import software.amazon.awssdk.services.query.model.InvalidInputException; import software.amazon.awssdk.services.query.model.OperationWithChecksumRequiredRequest; import software.amazon.awssdk.services.query.model.OperationWithChecksumRequiredResponse; import software.amazon.awssdk.services.query.model.OperationWithContextParamRequest; @@ -168,7 +172,18 @@ public CompletableFuture aPostOperation(APostOperationRe HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(APostOperationResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); String hostPrefix = "foo-"; String resolvedHostExpression = "foo-"; @@ -230,7 +245,18 @@ public CompletableFuture aPostOperationWithOut HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(APostOperationWithOutputResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -287,7 +313,15 @@ public CompletableFuture bearerAuthOperation( HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(BearerAuthOperationResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -343,7 +377,15 @@ public CompletableFuture getOperationWithCheck HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(GetOperationWithChecksumResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -408,7 +450,15 @@ public CompletableFuture operationWithChe HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithChecksumRequiredResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -468,7 +518,15 @@ public CompletableFuture operationWithContext HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithContextParamResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -525,7 +583,15 @@ public CompletableFuture operationWithCustomM HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithCustomMemberResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -583,7 +649,15 @@ public CompletableFuture o HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithCustomizedOperationContextParamResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -642,7 +716,15 @@ public CompletableFuture operatio HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithMapOperationContextParamResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -698,7 +780,15 @@ public CompletableFuture operationWithNoneAut HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithNoneAuthTypeResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -757,7 +847,15 @@ public CompletableFuture operationWi HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithOperationContextParamResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -814,7 +912,15 @@ public CompletableFuture operationWithR HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithRequestCompressionResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -876,7 +982,15 @@ public CompletableFuture operationWith HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithStaticContextParamsResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -958,7 +1072,15 @@ public CompletableFuture putOperationWithChecksum( HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(PutOperationWithChecksumResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler.execute( new ClientExecutionParams() @@ -1048,7 +1170,15 @@ public CompletableFuture streamingInputOperatio HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(StreamingInputOperationResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -1118,7 +1248,15 @@ public CompletableFuture streamingOutputOperation( HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(StreamingOutputOperationResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler.execute( new ClientExecutionParams() @@ -1235,8 +1373,13 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, return configuration.build(); } + private HttpResponseHandler createErrorResponseHandler( + Function> exceptionMetadataMapper) { + return protocolFactory.createErrorResponseHandler(exceptionMetadataMapper); + } + @Override public void close() { clientHandler.close(); } -} \ No newline at end of file +} diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-client-class.java index 934116aa446e..fce767bfa717 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-client-class.java @@ -2,7 +2,9 @@ import java.util.Collections; import java.util.List; +import java.util.Optional; import java.util.function.Consumer; +import java.util.function.Function; import software.amazon.awssdk.annotations.Generated; import software.amazon.awssdk.annotations.SdkInternalApi; import software.amazon.awssdk.auth.token.signer.aws.BearerTokenSigner; @@ -38,6 +40,7 @@ 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.query.AwsQueryProtocolFactory; import software.amazon.awssdk.retries.api.RetryStrategy; import software.amazon.awssdk.services.query.internal.QueryServiceClientConfigurationBuilder; @@ -147,7 +150,18 @@ public APostOperationResponse aPostOperation(APostOperationRequest aPostOperatio HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(APostOperationResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationRequest .overrideConfiguration().orElse(null)); @@ -198,7 +212,18 @@ public APostOperationWithOutputResponse aPostOperationWithOutput( HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(APostOperationWithOutputResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationWithOutputRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationWithOutputRequest @@ -245,7 +270,15 @@ public BearerAuthOperationResponse bearerAuthOperation(BearerAuthOperationReques HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(BearerAuthOperationResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(bearerAuthOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, bearerAuthOperationRequest @@ -291,7 +324,15 @@ public GetOperationWithChecksumResponse getOperationWithChecksum( HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(GetOperationWithChecksumResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getOperationWithChecksumRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getOperationWithChecksumRequest @@ -346,7 +387,15 @@ public OperationWithChecksumRequiredResponse operationWithChecksumRequired( HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithChecksumRequiredResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithChecksumRequiredRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, @@ -398,7 +447,15 @@ public OperationWithContextParamResponse operationWithContextParam( HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithContextParamResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithContextParamRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithContextParamRequest @@ -446,7 +503,15 @@ public OperationWithCustomMemberResponse operationWithCustomMember( HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithCustomMemberResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithCustomMemberRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithCustomMemberRequest @@ -494,7 +559,15 @@ public OperationWithCustomizedOperationContextParamResponse operationWithCustomi HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithCustomizedOperationContextParamResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration( operationWithCustomizedOperationContextParamRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, @@ -543,7 +616,15 @@ public OperationWithMapOperationContextParamResponse operationWithMapOperationCo HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithMapOperationContextParamResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithMapOperationContextParamRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, @@ -590,7 +671,15 @@ public OperationWithNoneAuthTypeResponse operationWithNoneAuthType( HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithNoneAuthTypeResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithNoneAuthTypeRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithNoneAuthTypeRequest @@ -639,7 +728,15 @@ public OperationWithOperationContextParamResponse operationWithOperationContextP HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithOperationContextParamResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithOperationContextParamRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, @@ -686,7 +783,15 @@ public OperationWithRequestCompressionResponse operationWithRequestCompression( HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithRequestCompressionResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithRequestCompressionRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, @@ -738,7 +843,15 @@ public OperationWithStaticContextParamsResponse operationWithStaticContextParams HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithStaticContextParamsResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithStaticContextParamsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, @@ -811,7 +924,15 @@ public ReturnT putOperationWithChecksum(PutOperationWithChecksumReques HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(PutOperationWithChecksumResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putOperationWithChecksumRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, putOperationWithChecksumRequest @@ -885,7 +1006,15 @@ public StreamingInputOperationResponse streamingInputOperation(StreamingInputOpe HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(StreamingInputOperationResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingInputOperationRequest @@ -946,7 +1075,15 @@ public ReturnT streamingOutputOperation(StreamingOutputOperationReques HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(StreamingOutputOperationResponse::builder); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingOutputOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingOutputOperationRequest @@ -1013,6 +1150,11 @@ private static List resolveMetricPublishers(SdkClientConfigurat return publishers; } + private HttpResponseHandler createErrorResponseHandler( + Function> exceptionMetadataMapper) { + return protocolFactory.createErrorResponseHandler(exceptionMetadataMapper); + } + private void updateRetryStrategyClientConfiguration(SdkClientConfiguration.Builder configuration) { ClientOverrideConfiguration.Builder builder = configuration.asOverrideConfigurationBuilder(); RetryMode retryMode = builder.retryMode(); diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-xml-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-xml-async-client-class.java index d9ffca9dda44..d8a8883acae8 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-xml-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-xml-async-client-class.java @@ -4,9 +4,11 @@ import java.util.Collections; import java.util.List; +import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; import java.util.function.Consumer; +import java.util.function.Function; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import software.amazon.awssdk.annotations.Generated; @@ -50,6 +52,7 @@ 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.xml.AwsXmlProtocolFactory; import software.amazon.awssdk.protocols.xml.XmlOperationMetadata; import software.amazon.awssdk.retries.api.RetryStrategy; @@ -683,7 +686,15 @@ public CompletableFuture putOperationWithChecksum( HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( PutOperationWithChecksumResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(true)); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler.execute( new ClientExecutionParams() @@ -843,7 +854,15 @@ public CompletableFuture streamingOutputOperation( HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( StreamingOutputOperationResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(true)); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler.execute( new ClientExecutionParams() @@ -955,8 +974,13 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, return configuration.build(); } + private HttpResponseHandler createErrorResponseHandler( + Function> exceptionMetadataMapper) { + return protocolFactory.createErrorResponseHandler(exceptionMetadataMapper); + } + @Override public void close() { clientHandler.close(); } -} \ No newline at end of file +} diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-xml-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-xml-client-class.java index fc925fc798f1..51722be96ed5 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-xml-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-xml-client-class.java @@ -2,7 +2,9 @@ import java.util.Collections; import java.util.List; +import java.util.Optional; import java.util.function.Consumer; +import java.util.function.Function; import software.amazon.awssdk.annotations.Generated; import software.amazon.awssdk.annotations.SdkInternalApi; import software.amazon.awssdk.auth.token.signer.aws.BearerTokenSigner; @@ -38,6 +40,7 @@ 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.xml.AwsXmlProtocolFactory; import software.amazon.awssdk.protocols.xml.XmlOperationMetadata; import software.amazon.awssdk.retries.api.RetryStrategy; @@ -492,7 +495,15 @@ public ReturnT putOperationWithChecksum(PutOperationWithChecksumReques HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( PutOperationWithChecksumResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(true)); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putOperationWithChecksumRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, putOperationWithChecksumRequest @@ -625,7 +636,15 @@ public ReturnT streamingOutputOperation(StreamingOutputOperationReques HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( StreamingOutputOperationResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(true)); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingOutputOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingOutputOperationRequest @@ -679,6 +698,11 @@ private static List resolveMetricPublishers(SdkClientConfigurat return publishers; } + private HttpResponseHandler createErrorResponseHandler( + Function> exceptionMetadataMapper) { + return protocolFactory.createErrorResponseHandler(exceptionMetadataMapper); + } + private void updateRetryStrategyClientConfiguration(SdkClientConfiguration.Builder configuration) { ClientOverrideConfiguration.Builder builder = configuration.asOverrideConfigurationBuilder(); RetryMode retryMode = builder.retryMode(); diff --git a/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/AwsQueryProtocolFactory.java b/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/AwsQueryProtocolFactory.java index e23ea4c59cb7..ebc8758ddcf5 100644 --- a/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/AwsQueryProtocolFactory.java +++ b/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/AwsQueryProtocolFactory.java @@ -21,6 +21,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Optional; +import java.util.function.Function; import java.util.function.Supplier; import software.amazon.awssdk.annotations.SdkProtectedApi; import software.amazon.awssdk.awscore.AwsResponse; @@ -109,10 +110,23 @@ public final HttpResponseHandler createResponseHandle * @return A {@link HttpResponseHandler} that will unmarshall the service exceptional response into * a modeled exception or the service base exception. */ + @Deprecated public final HttpResponseHandler createErrorResponseHandler() { return errorUnmarshaller; } + public final HttpResponseHandler createErrorResponseHandler(Function> exceptionMetadataMapper) { + return timeUnmarshalling(AwsXmlErrorProtocolUnmarshaller + .builder() + .defaultExceptionSupplier(defaultServiceExceptionSupplier) + .exceptionMetadataMapper(exceptionMetadataMapper) + // We don't set result wrapper since that's handled by the errorRootExtractor + .errorUnmarshaller(QueryProtocolUnmarshaller.builder().build()) + .errorRootExtractor(this::getErrorRoot) + .build()); + } + private MetricCollectingHttpResponseHandler timeUnmarshalling(HttpResponseHandler delegate) { return MetricCollectingHttpResponseHandler.create(CoreMetric.UNMARSHALLING_DURATION, delegate); } @@ -173,6 +187,7 @@ public final SubclassT clientConfiguration(SdkClientConfiguration clientConfigur * @param errorMetadata metadata for unmarshalling the exceptions * @return This builder for method chaining. */ + @Deprecated public final SubclassT registerModeledException(ExceptionMetadata errorMetadata) { modeledExceptions.add(errorMetadata); return getSubclass(); diff --git a/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/internal/unmarshall/AwsXmlErrorUnmarshaller.java b/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/internal/unmarshall/AwsXmlErrorUnmarshaller.java index 92283fb6fca9..02d65bb0920e 100644 --- a/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/internal/unmarshall/AwsXmlErrorUnmarshaller.java +++ b/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/internal/unmarshall/AwsXmlErrorUnmarshaller.java @@ -20,6 +20,7 @@ import java.time.Duration; import java.util.List; import java.util.Optional; +import java.util.function.Function; import java.util.function.Supplier; import software.amazon.awssdk.annotations.SdkInternalApi; import software.amazon.awssdk.awscore.exception.AwsErrorDetails; @@ -43,6 +44,7 @@ public final class AwsXmlErrorUnmarshaller { private final List exceptions; private final Supplier defaultExceptionSupplier; + private final Function> exceptionMetadataMapper; private final XmlErrorUnmarshaller errorUnmarshaller; @@ -50,6 +52,16 @@ private AwsXmlErrorUnmarshaller(Builder builder) { this.exceptions = builder.exceptions; this.errorUnmarshaller = builder.errorUnmarshaller; this.defaultExceptionSupplier = builder.defaultExceptionSupplier; + this.exceptionMetadataMapper = builder.exceptionMetadataMapper != null + ? builder.exceptionMetadataMapper + : this::defaultMapToExceptionMetadata; + } + + private Optional defaultMapToExceptionMetadata(String errorCode) { + return Optional.ofNullable(exceptions) + .flatMap(exs -> exs.stream() + .filter(e -> e.errorCode().equals(errorCode)) + .findFirst()); } /** @@ -122,12 +134,11 @@ private AwsServiceException.Builder defaultException() { private AwsServiceException.Builder unmarshallFromErrorCode(SdkHttpFullResponse response, XmlElement errorRoot, String errorCode) { - SdkPojo sdkPojo = exceptions.stream() - .filter(e -> e.errorCode().equals(errorCode)) - .map(ExceptionMetadata::exceptionBuilderSupplier) - .findAny() - .orElse(defaultExceptionSupplier) - .get(); + SdkPojo sdkPojo = exceptionMetadataMapper.apply(errorCode) + .map(ExceptionMetadata::exceptionBuilderSupplier) + .orElse(defaultExceptionSupplier) + .get(); + AwsServiceException.Builder builder = ((AwsServiceException) errorUnmarshaller.unmarshall(sdkPojo, errorRoot, response)).toBuilder(); @@ -204,6 +215,7 @@ public static final class Builder { private List exceptions; private Supplier defaultExceptionSupplier; private XmlErrorUnmarshaller errorUnmarshaller; + private Function> exceptionMetadataMapper; private Builder() { } @@ -219,6 +231,11 @@ public Builder exceptions(List exceptions) { return this; } + public Builder exceptionMetadataMapper(Function> exceptionMetadataMapper) { + this.exceptionMetadataMapper = exceptionMetadataMapper; + return this; + } + /** * Default exception type if "error code" does not match any known modeled exception. This is the generated * base exception for the service (i.e. DynamoDbException). diff --git a/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/unmarshall/AwsXmlErrorProtocolUnmarshaller.java b/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/unmarshall/AwsXmlErrorProtocolUnmarshaller.java index 009f6a14195a..fa2c6def0d2f 100644 --- a/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/unmarshall/AwsXmlErrorProtocolUnmarshaller.java +++ b/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/unmarshall/AwsXmlErrorProtocolUnmarshaller.java @@ -84,12 +84,14 @@ public final class AwsXmlErrorProtocolUnmarshaller implements HttpResponseHandle private final AwsXmlErrorUnmarshaller awsXmlErrorUnmarshaller; private final Function> errorRootExtractor; + private final Function> exceptionMetadataMapper; private AwsXmlErrorProtocolUnmarshaller(Builder builder) { this.errorRootExtractor = builder.errorRootExtractor; + this.exceptionMetadataMapper = builder.exceptionMetadataMapper; this.awsXmlErrorUnmarshaller = AwsXmlErrorUnmarshaller.builder() .defaultExceptionSupplier(builder.defaultExceptionSupplier) - .exceptions(builder.exceptions) + .exceptionMetadataMapper(this.exceptionMetadataMapper) .errorUnmarshaller(builder.errorUnmarshaller) .build(); } @@ -161,6 +163,7 @@ public static final class Builder { private Supplier defaultExceptionSupplier; private Function> errorRootExtractor; private XmlErrorUnmarshaller errorUnmarshaller; + private Function> exceptionMetadataMapper; private Builder() { } @@ -171,11 +174,17 @@ private Builder() { * * @return This builder for method chaining. */ + @Deprecated public Builder exceptions(List exceptions) { this.exceptions = exceptions; return this; } + public Builder exceptionMetadataMapper(Function> exceptionMetadataMapper) { + this.exceptionMetadataMapper = exceptionMetadataMapper; + return this; + } + /** * Default exception type if "error code" does not match any known modeled exception. This is the generated * base exception for the service (i.e. DynamoDbException). diff --git a/core/protocols/aws-xml-protocol/src/main/java/software/amazon/awssdk/protocols/xml/AwsXmlProtocolFactory.java b/core/protocols/aws-xml-protocol/src/main/java/software/amazon/awssdk/protocols/xml/AwsXmlProtocolFactory.java index 7a0dc0c64707..58194dbffe65 100644 --- a/core/protocols/aws-xml-protocol/src/main/java/software/amazon/awssdk/protocols/xml/AwsXmlProtocolFactory.java +++ b/core/protocols/aws-xml-protocol/src/main/java/software/amazon/awssdk/protocols/xml/AwsXmlProtocolFactory.java @@ -80,11 +80,13 @@ public class AwsXmlProtocolFactory { private final Supplier defaultServiceExceptionSupplier; private final HttpResponseHandler errorUnmarshaller; private final SdkClientConfiguration clientConfiguration; + private final Function> exceptionMetadataMapper; AwsXmlProtocolFactory(Builder builder) { this.modeledExceptions = unmodifiableList(builder.modeledExceptions); this.defaultServiceExceptionSupplier = builder.defaultServiceExceptionSupplier; this.clientConfiguration = builder.clientConfiguration; + this.exceptionMetadataMapper = builder.exceptionMetadataMapper; this.errorUnmarshaller = timeUnmarshalling( AwsXmlErrorProtocolUnmarshaller.builder() @@ -147,10 +149,22 @@ protected Function createErrorT .build(); } + @Deprecated public HttpResponseHandler createErrorResponseHandler() { return errorUnmarshaller; } + public HttpResponseHandler createErrorResponseHandler( + Function> exceptionMetadataMapper) { + return timeUnmarshalling( + AwsXmlErrorProtocolUnmarshaller.builder() + .defaultExceptionSupplier(defaultServiceExceptionSupplier) + .exceptionMetadataMapper(exceptionMetadataMapper) + .errorUnmarshaller(XML_PROTOCOL_UNMARSHALLER) + .errorRootExtractor(this::getErrorRoot) + .build()); + } + private MetricCollectingHttpResponseHandler timeUnmarshalling(HttpResponseHandler delegate) { return MetricCollectingHttpResponseHandler.create(CoreMetric.UNMARSHALLING_DURATION, delegate); } @@ -158,8 +172,9 @@ private MetricCollectingHttpResponseHandler timeUnmarshalling(HttpRespons public HttpResponseHandler> createCombinedResponseHandler( Supplier pojoSupplier, XmlOperationMetadata staxOperationMetadata) { - return new CombinedResponseHandler<>(createResponseHandler(pojoSupplier, staxOperationMetadata), - createErrorResponseHandler()); + return new CombinedResponseHandler<> + (createResponseHandler(pojoSupplier, staxOperationMetadata), + createErrorResponseHandler(this.exceptionMetadataMapper)); } /** @@ -191,6 +206,7 @@ public static class Builder { private final List modeledExceptions = new ArrayList<>(); private Supplier defaultServiceExceptionSupplier; private SdkClientConfiguration clientConfiguration; + private Function> exceptionMetadataMapper; Builder() { } @@ -206,6 +222,11 @@ public final SubclassT registerModeledException(ExceptionMetadata errorMetadata) return getSubclass(); } + public SubclassT exceptionMetadataMapper(Function> exceptionMetadataMapper) { + this.exceptionMetadataMapper = exceptionMetadataMapper; + return getSubclass(); + } + /** * A supplier for the services base exception builder. This is used when we can't identify any modeled * exception to unmarshall into. From d7c8e751b85150ca22474ebfe9533fab228f0ea5 Mon Sep 17 00:00:00 2001 From: Saranya Somepalli Date: Tue, 1 Apr 2025 18:01:43 -0700 Subject: [PATCH 07/22] Additional changes for updating non-streaming error unmarshaller --- .../poet/client/specs/JsonProtocolSpec.java | 2 +- .../poet/client/specs/ProtocolSpec.java | 20 ++++++++ .../poet/client/specs/QueryProtocolSpec.java | 2 +- .../poet/client/specs/XmlProtocolSpec.java | 51 +++++++++++++++++-- .../unmarshall/AwsXmlErrorUnmarshaller.java | 6 +-- .../AwsXmlErrorProtocolUnmarshaller.java | 1 + .../protocols/xml/AwsXmlProtocolFactory.java | 4 +- 7 files changed, 75 insertions(+), 11 deletions(-) diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/JsonProtocolSpec.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/JsonProtocolSpec.java index 7e5e79a90e67..ee2fa96aeb78 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/JsonProtocolSpec.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/JsonProtocolSpec.java @@ -189,7 +189,7 @@ public Optional errorResponseHandler(OperationModel opModel) { ShapeModel exceptionShape = model.getShapes().get(exceptionName); String errorCode = exceptionShape.getErrorCode(); - builder.add("case $S:\n", exceptionShape.getC2jName()); + builder.add("case $S:\n", errorCode); builder.add("return $T.of($T.builder()\n", Optional.class, ExceptionMetadata.class) .add(".errorCode($S)\n", errorCode); builder.add(populateHttpStatusCode(exceptionShape, model)); diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/ProtocolSpec.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/ProtocolSpec.java index c474e982afe0..37bd6252bc8b 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/ProtocolSpec.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/ProtocolSpec.java @@ -24,11 +24,13 @@ import java.util.ArrayList; import java.util.List; import java.util.Optional; +import java.util.stream.Collectors; import software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler; import software.amazon.awssdk.codegen.model.intermediate.IntermediateModel; import software.amazon.awssdk.codegen.model.intermediate.OperationModel; import software.amazon.awssdk.codegen.model.intermediate.Protocol; import software.amazon.awssdk.codegen.model.intermediate.ShapeModel; +import software.amazon.awssdk.codegen.model.intermediate.ShapeType; import software.amazon.awssdk.codegen.model.service.AuthType; import software.amazon.awssdk.codegen.poet.PoetExtension; import software.amazon.awssdk.codegen.utils.AuthUtils; @@ -36,6 +38,7 @@ import software.amazon.awssdk.core.client.handler.SyncClientHandler; import software.amazon.awssdk.core.runtime.transform.AsyncStreamingRequestMarshaller; import software.amazon.awssdk.core.runtime.transform.StreamingRequestMarshaller; +import software.amazon.awssdk.protocols.core.ExceptionMetadata; import software.amazon.awssdk.utils.StringUtils; public interface ProtocolSpec { @@ -71,6 +74,23 @@ default List additionalMethods() { return new ArrayList<>(); } + default List registerModeledExceptions(IntermediateModel model, PoetExtension poetExtensions) { + return model.getShapes().values().stream() + .filter(s -> s.getShapeType() == ShapeType.Exception) + .map(e -> CodeBlock.builder() + .add(".registerModeledException($T.builder()" + + ".errorCode($S)" + + ".exceptionBuilderSupplier($T::builder)" + + "$L" // populateHttpStatusCode + + ".build())", + ExceptionMetadata.class, + e.getErrorCode(), + poetExtensions.getModelClass(e.getShapeName()), + populateHttpStatusCode(e, model)) + .build()) + .collect(Collectors.toList()); + } + default String populateHttpStatusCode(ShapeModel shapeModel, IntermediateModel model) { Integer statusCode = shapeModel.getHttpStatusCode(); diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/QueryProtocolSpec.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/QueryProtocolSpec.java index b325b7c6089f..30fef4a57740 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/QueryProtocolSpec.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/QueryProtocolSpec.java @@ -114,7 +114,7 @@ public Optional errorResponseHandler(OperationModel opModel) { } ShapeModel exceptionShape = intermediateModel.getShapes().get(exceptionName); String errorCode = exceptionShape.getErrorCode(); - builder.add("case $S:\n", exceptionShape.getC2jName()); + builder.add("case $S:\n", errorCode); builder.add("return $T.of($T.builder()\n", Optional.class, ExceptionMetadata.class) .add(".errorCode($S)\n", errorCode); builder.add(populateHttpStatusCode(exceptionShape, intermediateModel)); diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/XmlProtocolSpec.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/XmlProtocolSpec.java index 1a081497f020..e4ca2d5cec9a 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/XmlProtocolSpec.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/XmlProtocolSpec.java @@ -23,8 +23,11 @@ import com.squareup.javapoet.TypeName; import com.squareup.javapoet.WildcardTypeName; import java.util.Map; +import java.util.HashSet; import java.util.Optional; +import java.util.Set; import java.util.concurrent.CompletableFuture; +import java.util.function.Function; import software.amazon.awssdk.awscore.eventstream.EventStreamAsyncResponseTransformer; import software.amazon.awssdk.awscore.eventstream.EventStreamTaggedUnionPojoSupplier; import software.amazon.awssdk.awscore.eventstream.RestEventStreamAsyncResponseTransformer; @@ -43,6 +46,7 @@ import software.amazon.awssdk.core.SdkPojoBuilder; import software.amazon.awssdk.core.client.handler.ClientExecutionParams; import software.amazon.awssdk.core.http.HttpResponseHandler; +import software.amazon.awssdk.protocols.core.ExceptionMetadata; import software.amazon.awssdk.protocols.xml.AwsXmlProtocolFactory; import software.amazon.awssdk.protocols.xml.XmlOperationMetadata; import software.amazon.awssdk.utils.CompletableFutureUtils; @@ -108,7 +112,46 @@ private CodeBlock streamingResponseHandler(OperationModel opModel) { @Override public Optional errorResponseHandler(OperationModel opModel) { - return opModel.hasStreamingOutput() ? streamingErrorResponseHandler(opModel) : Optional.empty(); + if (opModel.hasStreamingOutput()) { + return streamingErrorResponseHandler(opModel); + } + + CodeBlock.Builder builder = CodeBlock.builder(); + ParameterizedTypeName metadataMapperType = ParameterizedTypeName.get( + ClassName.get(Function.class), + ClassName.get(String.class), + ParameterizedTypeName.get(Optional.class, ExceptionMetadata.class)); + + builder.add("\n$T exceptionMetadataMapper = errorCode -> {\n", metadataMapperType); + builder.add("switch (errorCode) {\n"); + Set processedExceptions = new HashSet<>(); + + opModel.getExceptions().forEach(exception -> { + String exceptionName = exception.getExceptionName(); + if (!processedExceptions.add(exceptionName)) { + return; + } + ShapeModel exceptionShape = model.getShapes().get(exceptionName); + String errorCode = exceptionShape.getErrorCode(); + + builder.add("case $S:\n", errorCode); + builder.add("return $T.of($T.builder()\n", Optional.class, ExceptionMetadata.class) + .add(".errorCode($S)\n", errorCode); + builder.add(populateHttpStatusCode(exceptionShape, model)); + builder.add(".exceptionBuilderSupplier($T::builder)\n", + poetExtensions.getModelClassFromShape(exceptionShape)) + .add(".build());\n"); + }); + + builder.add("default: return $T.empty();\n", Optional.class); + builder.add("}\n"); + builder.add("};\n\n"); + + builder.add("$T<$T> errorResponseHandler = protocolFactory.createErrorResponseHandler(exceptionMetadataMapper);", + HttpResponseHandler.class, + AwsServiceException.class); + + return Optional.of(builder.build()); } private Optional streamingErrorResponseHandler(OperationModel opModel) { @@ -288,9 +331,9 @@ private CodeBlock eventStreamResponseHandlers(OperationModel opModel, TypeName p streamResponseOpMd); // Response handler responsible for errors for the API call itself, as well as errors sent over the event stream - builder.addStatement("$T errorResponseHandler = protocolFactory" - + ".createErrorResponseHandler()", ParameterizedTypeName.get(HttpResponseHandler.class, - AwsServiceException.class)); + // builder.addStatement("$T errorResponseHandler = protocolFactory" + // + ".createErrorResponseHandler()", ParameterizedTypeName.get(HttpResponseHandler.class, + // AwsServiceException.class)); ShapeModel eventStreamShape = EventStreamUtils.getEventStreamInResponse(opModel.getOutputShape()); diff --git a/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/internal/unmarshall/AwsXmlErrorUnmarshaller.java b/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/internal/unmarshall/AwsXmlErrorUnmarshaller.java index 02d65bb0920e..101b3f4bada0 100644 --- a/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/internal/unmarshall/AwsXmlErrorUnmarshaller.java +++ b/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/internal/unmarshall/AwsXmlErrorUnmarshaller.java @@ -58,10 +58,8 @@ private AwsXmlErrorUnmarshaller(Builder builder) { } private Optional defaultMapToExceptionMetadata(String errorCode) { - return Optional.ofNullable(exceptions) - .flatMap(exs -> exs.stream() - .filter(e -> e.errorCode().equals(errorCode)) - .findFirst()); + return exceptions.stream().filter(e -> e.errorCode().equals(errorCode)) + .findAny(); } /** diff --git a/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/unmarshall/AwsXmlErrorProtocolUnmarshaller.java b/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/unmarshall/AwsXmlErrorProtocolUnmarshaller.java index fa2c6def0d2f..46507a06d531 100644 --- a/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/unmarshall/AwsXmlErrorProtocolUnmarshaller.java +++ b/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/unmarshall/AwsXmlErrorProtocolUnmarshaller.java @@ -91,6 +91,7 @@ private AwsXmlErrorProtocolUnmarshaller(Builder builder) { this.exceptionMetadataMapper = builder.exceptionMetadataMapper; this.awsXmlErrorUnmarshaller = AwsXmlErrorUnmarshaller.builder() .defaultExceptionSupplier(builder.defaultExceptionSupplier) + .exceptions(builder.exceptions) .exceptionMetadataMapper(this.exceptionMetadataMapper) .errorUnmarshaller(builder.errorUnmarshaller) .build(); diff --git a/core/protocols/aws-xml-protocol/src/main/java/software/amazon/awssdk/protocols/xml/AwsXmlProtocolFactory.java b/core/protocols/aws-xml-protocol/src/main/java/software/amazon/awssdk/protocols/xml/AwsXmlProtocolFactory.java index 58194dbffe65..b556166cc891 100644 --- a/core/protocols/aws-xml-protocol/src/main/java/software/amazon/awssdk/protocols/xml/AwsXmlProtocolFactory.java +++ b/core/protocols/aws-xml-protocol/src/main/java/software/amazon/awssdk/protocols/xml/AwsXmlProtocolFactory.java @@ -174,7 +174,9 @@ public HttpResponseHandler> createCombinedRe return new CombinedResponseHandler<> (createResponseHandler(pojoSupplier, staxOperationMetadata), - createErrorResponseHandler(this.exceptionMetadataMapper)); + this.exceptionMetadataMapper != null + ? createErrorResponseHandler(this.exceptionMetadataMapper) + : createErrorResponseHandler()); } /** From 6790682d38b4f116a12c3609074f84a999c838ac Mon Sep 17 00:00:00 2001 From: Saranya Somepalli Date: Tue, 1 Apr 2025 18:13:19 -0700 Subject: [PATCH 08/22] Updating tests --- .../poet/client/specs/XmlProtocolSpec.java | 2 +- .../sra/test-json-async-client-class.java | 6 +- .../client/sra/test-json-client-class.java | 6 +- .../sra/test-query-async-client-class.java | 4 +- .../client/sra/test-query-client-class.java | 4 +- .../sra/test-xml-async-client-class.java | 98 ++++++++++++++++++- .../client/sra/test-xml-client-class.java | 86 ++++++++++++++++ ...ry-compatible-json-async-client-class.java | 2 +- ...ery-compatible-json-sync-client-class.java | 2 +- .../client/test-json-async-client-class.java | 6 +- .../poet/client/test-json-client-class.java | 6 +- .../client/test-query-async-client-class.java | 4 +- .../poet/client/test-query-client-class.java | 4 +- ...gned-payload-trait-async-client-class.java | 22 ++--- ...igned-payload-trait-sync-client-class.java | 22 ++--- .../client/test-xml-async-client-class.java | 98 ++++++++++++++++++- .../poet/client/test-xml-client-class.java | 86 ++++++++++++++++ 17 files changed, 411 insertions(+), 47 deletions(-) diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/XmlProtocolSpec.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/XmlProtocolSpec.java index e4ca2d5cec9a..217ba232ff81 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/XmlProtocolSpec.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/XmlProtocolSpec.java @@ -22,8 +22,8 @@ import com.squareup.javapoet.ParameterizedTypeName; import com.squareup.javapoet.TypeName; import com.squareup.javapoet.WildcardTypeName; -import java.util.Map; import java.util.HashSet; +import java.util.Map; import java.util.Optional; import java.util.Set; import java.util.concurrent.CompletableFuture; diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-async-client-class.java index c2c1e453a521..6d1cc6ed29b4 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-async-client-class.java @@ -205,7 +205,7 @@ public CompletableFuture aPostOperation(APostOperationRe operationMetadata, APostOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -281,7 +281,7 @@ public CompletableFuture aPostOperationWithOut operationMetadata, APostOperationWithOutputResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -798,7 +798,7 @@ public CompletableFuture getWithoutRequiredMe operationMetadata, GetWithoutRequiredMembersResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-client-class.java index c5f4f73713e7..682816737b75 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-client-class.java @@ -142,7 +142,7 @@ public APostOperationResponse aPostOperation(APostOperationRequest aPostOperatio APostOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -207,7 +207,7 @@ public APostOperationWithOutputResponse aPostOperationWithOutput( operationMetadata, APostOperationWithOutputResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -388,7 +388,7 @@ public GetWithoutRequiredMembersResponse getWithoutRequiredMembers( operationMetadata, GetWithoutRequiredMembersResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-async-client-class.java index c0586ee87b60..37c1810e43af 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-async-client-class.java @@ -169,7 +169,7 @@ public CompletableFuture aPostOperation(APostOperationRe Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -242,7 +242,7 @@ public CompletableFuture aPostOperationWithOut Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-client-class.java index aa66e745444b..9fd239295c89 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-client-class.java @@ -148,7 +148,7 @@ public APostOperationResponse aPostOperation(APostOperationRequest aPostOperatio Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -210,7 +210,7 @@ public APostOperationWithOutputResponse aPostOperationWithOutput( Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-async-client-class.java index 24da34052f30..bf8a93786c2f 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-async-client-class.java @@ -65,6 +65,7 @@ import software.amazon.awssdk.services.xml.model.EventStreamOperationResponseHandler; import software.amazon.awssdk.services.xml.model.GetOperationWithChecksumRequest; import software.amazon.awssdk.services.xml.model.GetOperationWithChecksumResponse; +import software.amazon.awssdk.services.xml.model.InvalidInputException; import software.amazon.awssdk.services.xml.model.OperationWithChecksumRequiredRequest; import software.amazon.awssdk.services.xml.model.OperationWithChecksumRequiredResponse; import software.amazon.awssdk.services.xml.model.OperationWithNoneAuthTypeRequest; @@ -158,6 +159,19 @@ public CompletableFuture aPostOperation(APostOperationRe HttpResponseHandler> responseHandler = protocolFactory .createCombinedResponseHandler(APostOperationResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); String hostPrefix = "foo-"; String resolvedHostExpression = "foo-"; @@ -221,6 +235,19 @@ public CompletableFuture aPostOperationWithOut .createCombinedResponseHandler(APostOperationWithOutputResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); + CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("APostOperationWithOutput").withRequestConfiguration(clientConfiguration) @@ -277,6 +304,16 @@ public CompletableFuture bearerAuthOperation( .createCombinedResponseHandler(BearerAuthOperationResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); + CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("BearerAuthOperation").withRequestConfiguration(clientConfiguration) @@ -331,7 +368,6 @@ public CompletableFuture eventStreamOperation(EventStreamOperationRequest HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( EventStreamOperationResponse::builder, XmlOperationMetadata.builder().hasStreamingSuccessResponse(true) .build()); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); HttpResponseHandler eventResponseHandler = protocolFactory.createResponseHandler( EventStreamTaggedUnionPojoSupplier.builder() .putSdkPojoSupplier("EventPayloadEvent", EventStream::eventPayloadEventBuilder) @@ -339,6 +375,16 @@ public CompletableFuture eventStreamOperation(EventStreamOperationRequest .putSdkPojoSupplier("SecondEventPayloadEvent", EventStream::secondEventPayloadEventBuilder) .defaultSdkPojoSupplier(() -> new SdkPojoBuilder(EventStream.UNKNOWN)).build(), XmlOperationMetadata .builder().hasStreamingSuccessResponse(false).build()); + + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); CompletableFuture eventStreamTransformFuture = new CompletableFuture<>(); EventStreamAsyncResponseTransformer asyncResponseTransformer = EventStreamAsyncResponseTransformer . builder().eventStreamResponseHandler(asyncResponseHandler) @@ -414,6 +460,16 @@ public CompletableFuture getOperationWithCheck .createCombinedResponseHandler(GetOperationWithChecksumResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); + CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("GetOperationWithChecksum") @@ -478,6 +534,16 @@ public CompletableFuture operationWithChe .createCombinedResponseHandler(OperationWithChecksumRequiredResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); + CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("OperationWithChecksumRequired") @@ -537,6 +603,16 @@ public CompletableFuture operationWithNoneAut .createCombinedResponseHandler(OperationWithNoneAuthTypeResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); + CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("OperationWithNoneAuthType").withRequestConfiguration(clientConfiguration) @@ -594,6 +670,16 @@ public CompletableFuture operationWithR .createCombinedResponseHandler(OperationWithRequestCompressionResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); + CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("OperationWithRequestCompression") @@ -772,6 +858,16 @@ public CompletableFuture streamingInputOperatio .createCombinedResponseHandler(StreamingInputOperationResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); + CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("StreamingInputOperation") diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-client-class.java index 7effb44d0f04..dc66e4490262 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-client-class.java @@ -127,6 +127,19 @@ public APostOperationResponse aPostOperation(APostOperationRequest aPostOperatio HttpResponseHandler> responseHandler = protocolFactory.createCombinedResponseHandler( APostOperationResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationRequest .overrideConfiguration().orElse(null)); @@ -176,6 +189,19 @@ public APostOperationWithOutputResponse aPostOperationWithOutput( HttpResponseHandler> responseHandler = protocolFactory .createCombinedResponseHandler(APostOperationWithOutputResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationWithOutputRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationWithOutputRequest @@ -220,6 +246,16 @@ public BearerAuthOperationResponse bearerAuthOperation(BearerAuthOperationReques HttpResponseHandler> responseHandler = protocolFactory .createCombinedResponseHandler(BearerAuthOperationResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(bearerAuthOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, bearerAuthOperationRequest @@ -265,6 +301,16 @@ public GetOperationWithChecksumResponse getOperationWithChecksum( HttpResponseHandler> responseHandler = protocolFactory .createCombinedResponseHandler(GetOperationWithChecksumResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getOperationWithChecksumRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getOperationWithChecksumRequest @@ -318,6 +364,16 @@ public OperationWithChecksumRequiredResponse operationWithChecksumRequired( HttpResponseHandler> responseHandler = protocolFactory .createCombinedResponseHandler(OperationWithChecksumRequiredResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithChecksumRequiredRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, @@ -368,6 +424,16 @@ public OperationWithNoneAuthTypeResponse operationWithNoneAuthType( HttpResponseHandler> responseHandler = protocolFactory .createCombinedResponseHandler(OperationWithNoneAuthTypeResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithNoneAuthTypeRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithNoneAuthTypeRequest @@ -413,6 +479,16 @@ public OperationWithRequestCompressionResponse operationWithRequestCompression( HttpResponseHandler> responseHandler = protocolFactory .createCombinedResponseHandler(OperationWithRequestCompressionResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithRequestCompressionRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, @@ -571,6 +647,16 @@ public StreamingInputOperationResponse streamingInputOperation(StreamingInputOpe HttpResponseHandler> responseHandler = protocolFactory .createCombinedResponseHandler(StreamingInputOperationResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingInputOperationRequest diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-async-client-class.java index db35b253ce67..f60395e3be3d 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-async-client-class.java @@ -112,7 +112,7 @@ public CompletableFuture aPostOperation(APostOperationRe operationMetadata, APostOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-sync-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-sync-client-class.java index c48db32fd182..2bf5924b4b2d 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-sync-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-sync-client-class.java @@ -97,7 +97,7 @@ public APostOperationResponse aPostOperation(APostOperationRequest aPostOperatio APostOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-async-client-class.java index d536c3eb5445..24f44f3561c7 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-async-client-class.java @@ -212,7 +212,7 @@ public CompletableFuture aPostOperation(APostOperationRe operationMetadata, APostOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -288,7 +288,7 @@ public CompletableFuture aPostOperationWithOut operationMetadata, APostOperationWithOutputResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -809,7 +809,7 @@ public CompletableFuture getWithoutRequiredMe operationMetadata, GetWithoutRequiredMembersResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-client-class.java index 6d003e2eec2e..cd6c248f6bf8 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-client-class.java @@ -147,7 +147,7 @@ public APostOperationResponse aPostOperation(APostOperationRequest aPostOperatio APostOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -212,7 +212,7 @@ public APostOperationWithOutputResponse aPostOperationWithOutput( operationMetadata, APostOperationWithOutputResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -394,7 +394,7 @@ public GetWithoutRequiredMembersResponse getWithoutRequiredMembers( operationMetadata, GetWithoutRequiredMembersResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-async-client-class.java index 2658724dec31..c7bb91454dc1 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-async-client-class.java @@ -174,7 +174,7 @@ public CompletableFuture aPostOperation(APostOperationRe Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -247,7 +247,7 @@ public CompletableFuture aPostOperationWithOut Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-client-class.java index fce767bfa717..5014ccf075f9 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-client-class.java @@ -152,7 +152,7 @@ public APostOperationResponse aPostOperation(APostOperationRequest aPostOperatio Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -214,7 +214,7 @@ public APostOperationWithOutputResponse aPostOperationWithOutput( Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-async-client-class.java index 0343b80f329f..1db56c43e67b 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-async-client-class.java @@ -147,7 +147,7 @@ public CompletableFuture deleteRow(DeleteRowRequest deleteRow DeleteRowResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -216,7 +216,7 @@ public CompletableFuture getRow(GetRowRequest getRowRequest) { GetRowResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -289,7 +289,7 @@ public CompletableFuture opWithSigv .createResponseHandler(operationMetadata, OpWithSigv4AndSigv4AUnSignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -361,7 +361,7 @@ public CompletableFuture opWithSigv4SignedPayl operationMetadata, OpWithSigv4SignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -433,7 +433,7 @@ public CompletableFuture opWithSigv4UnSigned operationMetadata, OpWithSigv4UnSignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -517,7 +517,7 @@ public CompletableFuture opWithS .createResponseHandler(operationMetadata, OpWithSigv4UnSignedPayloadAndStreamingResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -596,7 +596,7 @@ public CompletableFuture opWithSigv4aSignedPa operationMetadata, OpWithSigv4ASignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -668,7 +668,7 @@ public CompletableFuture opWithSigv4aUnSign operationMetadata, OpWithSigv4AUnSignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -742,7 +742,7 @@ public CompletableFuture opsWithSigv .createResponseHandler(operationMetadata, OpsWithSigv4AndSigv4ASignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -812,7 +812,7 @@ public CompletableFuture putRow(PutRowRequest putRowRequest) { PutRowResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -885,7 +885,7 @@ public CompletableFuture secon .createResponseHandler(operationMetadata, SecondOpsWithSigv4AndSigv4ASignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-sync-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-sync-client-class.java index cde7508b7249..265edeb3ee00 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-sync-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-sync-client-class.java @@ -128,7 +128,7 @@ public DeleteRowResponse deleteRow(DeleteRowRequest deleteRowRequest) throws Inv DeleteRowResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -187,7 +187,7 @@ public GetRowResponse getRow(GetRowRequest getRowRequest) throws InvalidInputExc GetRowResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -246,7 +246,7 @@ public PutRowResponse putRow(PutRowRequest putRowRequest) throws InvalidInputExc PutRowResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -307,7 +307,7 @@ public OpWithSigv4AndSigv4AUnSignedPayloadResponse opWithSigv4AndSigv4aUnSignedP operationMetadata, OpWithSigv4AndSigv4AUnSignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -370,7 +370,7 @@ public OpWithSigv4SignedPayloadResponse opWithSigv4SignedPayload( operationMetadata, OpWithSigv4SignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -433,7 +433,7 @@ public OpWithSigv4UnSignedPayloadResponse opWithSigv4UnSignedPayload( operationMetadata, OpWithSigv4UnSignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -508,7 +508,7 @@ public OpWithSigv4UnSignedPayloadAndStreamingResponse opWithSigv4UnSignedPayload .createResponseHandler(operationMetadata, OpWithSigv4UnSignedPayloadAndStreamingResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -580,7 +580,7 @@ public OpWithSigv4ASignedPayloadResponse opWithSigv4aSignedPayload( operationMetadata, OpWithSigv4ASignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -643,7 +643,7 @@ public OpWithSigv4AUnSignedPayloadResponse opWithSigv4aUnSignedPayload( operationMetadata, OpWithSigv4AUnSignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -707,7 +707,7 @@ public OpsWithSigv4AndSigv4ASignedPayloadResponse opsWithSigv4andSigv4aSignedPay operationMetadata, OpsWithSigv4AndSigv4ASignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: @@ -771,7 +771,7 @@ public SecondOpsWithSigv4AndSigv4ASignedPayloadResponse secondOpsWithSigv4andSig .createResponseHandler(operationMetadata, SecondOpsWithSigv4AndSigv4ASignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "InvalidInputException": + case "InvalidInput": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-xml-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-xml-async-client-class.java index d8a8883acae8..2d8fa14da2f7 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-xml-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-xml-async-client-class.java @@ -69,6 +69,7 @@ import software.amazon.awssdk.services.xml.model.EventStreamOperationResponseHandler; import software.amazon.awssdk.services.xml.model.GetOperationWithChecksumRequest; import software.amazon.awssdk.services.xml.model.GetOperationWithChecksumResponse; +import software.amazon.awssdk.services.xml.model.InvalidInputException; import software.amazon.awssdk.services.xml.model.OperationWithChecksumRequiredRequest; import software.amazon.awssdk.services.xml.model.OperationWithChecksumRequiredResponse; import software.amazon.awssdk.services.xml.model.OperationWithNoneAuthTypeRequest; @@ -163,6 +164,19 @@ public CompletableFuture aPostOperation(APostOperationRe HttpResponseHandler> responseHandler = protocolFactory .createCombinedResponseHandler(APostOperationResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); String hostPrefix = "foo-"; String resolvedHostExpression = "foo-"; @@ -226,6 +240,19 @@ public CompletableFuture aPostOperationWithOut .createCombinedResponseHandler(APostOperationWithOutputResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); + CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("APostOperationWithOutput").withRequestConfiguration(clientConfiguration) @@ -283,6 +310,16 @@ public CompletableFuture bearerAuthOperation( .createCombinedResponseHandler(BearerAuthOperationResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); + CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("BearerAuthOperation").withRequestConfiguration(clientConfiguration) @@ -337,7 +374,6 @@ public CompletableFuture eventStreamOperation(EventStreamOperationRequest HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( EventStreamOperationResponse::builder, XmlOperationMetadata.builder().hasStreamingSuccessResponse(true) .build()); - HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); HttpResponseHandler eventResponseHandler = protocolFactory.createResponseHandler( EventStreamTaggedUnionPojoSupplier.builder() .putSdkPojoSupplier("EventPayloadEvent", EventStream::eventPayloadEventBuilder) @@ -345,6 +381,16 @@ public CompletableFuture eventStreamOperation(EventStreamOperationRequest .putSdkPojoSupplier("SecondEventPayloadEvent", EventStream::secondEventPayloadEventBuilder) .defaultSdkPojoSupplier(() -> new SdkPojoBuilder(EventStream.UNKNOWN)).build(), XmlOperationMetadata .builder().hasStreamingSuccessResponse(false).build()); + + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); CompletableFuture eventStreamTransformFuture = new CompletableFuture<>(); EventStreamAsyncResponseTransformer asyncResponseTransformer = EventStreamAsyncResponseTransformer . builder().eventStreamResponseHandler(asyncResponseHandler) @@ -420,6 +466,16 @@ public CompletableFuture getOperationWithCheck .createCombinedResponseHandler(GetOperationWithChecksumResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); + CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("GetOperationWithChecksum") @@ -484,6 +540,16 @@ public CompletableFuture operationWithChe .createCombinedResponseHandler(OperationWithChecksumRequiredResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); + CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("OperationWithChecksumRequired") @@ -543,6 +609,16 @@ public CompletableFuture operationWithNoneAut .createCombinedResponseHandler(OperationWithNoneAuthTypeResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); + CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("OperationWithNoneAuthType").withRequestConfiguration(clientConfiguration) @@ -601,6 +677,16 @@ public CompletableFuture operationWithR .createCombinedResponseHandler(OperationWithRequestCompressionResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); + CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("OperationWithRequestCompression") @@ -785,6 +871,16 @@ public CompletableFuture streamingInputOperatio .createCombinedResponseHandler(StreamingInputOperationResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); + CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("StreamingInputOperation") diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-xml-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-xml-client-class.java index 51722be96ed5..3eda14acf74a 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-xml-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-xml-client-class.java @@ -131,6 +131,19 @@ public APostOperationResponse aPostOperation(APostOperationRequest aPostOperatio HttpResponseHandler> responseHandler = protocolFactory.createCombinedResponseHandler( APostOperationResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationRequest .overrideConfiguration().orElse(null)); @@ -180,6 +193,19 @@ public APostOperationWithOutputResponse aPostOperationWithOutput( HttpResponseHandler> responseHandler = protocolFactory .createCombinedResponseHandler(APostOperationWithOutputResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationWithOutputRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationWithOutputRequest @@ -225,6 +251,16 @@ public BearerAuthOperationResponse bearerAuthOperation(BearerAuthOperationReques HttpResponseHandler> responseHandler = protocolFactory .createCombinedResponseHandler(BearerAuthOperationResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(bearerAuthOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, bearerAuthOperationRequest @@ -270,6 +306,16 @@ public GetOperationWithChecksumResponse getOperationWithChecksum( HttpResponseHandler> responseHandler = protocolFactory .createCombinedResponseHandler(GetOperationWithChecksumResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getOperationWithChecksumRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getOperationWithChecksumRequest @@ -323,6 +369,16 @@ public OperationWithChecksumRequiredResponse operationWithChecksumRequired( HttpResponseHandler> responseHandler = protocolFactory .createCombinedResponseHandler(OperationWithChecksumRequiredResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithChecksumRequiredRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, @@ -373,6 +429,16 @@ public OperationWithNoneAuthTypeResponse operationWithNoneAuthType( HttpResponseHandler> responseHandler = protocolFactory .createCombinedResponseHandler(OperationWithNoneAuthTypeResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithNoneAuthTypeRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithNoneAuthTypeRequest @@ -419,6 +485,16 @@ public OperationWithRequestCompressionResponse operationWithRequestCompression( HttpResponseHandler> responseHandler = protocolFactory .createCombinedResponseHandler(OperationWithRequestCompressionResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithRequestCompressionRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, @@ -577,6 +653,16 @@ public StreamingInputOperationResponse streamingInputOperation(StreamingInputOpe HttpResponseHandler> responseHandler = protocolFactory .createCombinedResponseHandler(StreamingInputOperationResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); + + Function> exceptionMetadataMapper = errorCode -> { + switch (errorCode) { + default: + return Optional.empty(); + } + }; + + HttpResponseHandler errorResponseHandler = protocolFactory + .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingInputOperationRequest From 8c8e75169a03c6bb7ca59f0c02ef4308f54585f7 Mon Sep 17 00:00:00 2001 From: Saranya Somepalli Date: Thu, 3 Apr 2025 16:41:55 -0700 Subject: [PATCH 09/22] Additional changes for updating non-streaming error unmarshaller --- .../poet/client/specs/JsonProtocolSpec.java | 37 ++-- .../poet/client/specs/QueryProtocolSpec.java | 63 +----- .../poet/client/specs/XmlProtocolSpec.java | 55 +----- .../sra/test-aws-json-async-client-class.java | 86 +++++++-- .../sra/test-cbor-async-client-class.java | 86 +++++++-- .../sra/test-json-async-client-class.java | 55 ++++-- .../client/sra/test-json-client-class.java | 43 +++-- .../sra/test-query-async-client-class.java | 181 +++--------------- .../client/sra/test-query-client-class.java | 181 +++--------------- .../sra/test-xml-async-client-class.java | 132 +------------ .../client/sra/test-xml-client-class.java | 121 +----------- .../test-aws-json-async-client-class.java | 88 +++++++-- .../client/test-cbor-async-client-class.java | 88 +++++++-- .../poet/client/test-cbor-client-class.java | 65 +++++-- .../client/test-json-async-client-class.java | 55 ++++-- .../poet/client/test-json-client-class.java | 43 +++-- .../client/test-query-async-client-class.java | 181 +++--------------- .../poet/client/test-query-client-class.java | 181 +++--------------- .../client/test-rpcv2-async-client-class.java | 118 ++++++++++-- .../codegen/poet/client/test-rpcv2-sync.java | 118 ++++++++++-- .../client/test-xml-async-client-class.java | 132 +------------ .../poet/client/test-xml-client-class.java | 121 +----------- .../query/AwsQueryProtocolFactory.java | 31 +-- .../unmarshall/AwsXmlErrorUnmarshaller.java | 29 +-- .../AwsXmlErrorProtocolUnmarshaller.java | 12 +- .../protocols/xml/AwsXmlProtocolFactory.java | 29 +-- 26 files changed, 858 insertions(+), 1473 deletions(-) diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/JsonProtocolSpec.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/JsonProtocolSpec.java index ee2fa96aeb78..7e8b808b5df3 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/JsonProtocolSpec.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/JsonProtocolSpec.java @@ -25,9 +25,7 @@ import com.squareup.javapoet.TypeName; import com.squareup.javapoet.TypeVariableName; import com.squareup.javapoet.WildcardTypeName; -import java.util.HashSet; import java.util.Optional; -import java.util.Set; import java.util.concurrent.CompletableFuture; import java.util.function.Function; import javax.lang.model.element.Modifier; @@ -41,6 +39,7 @@ import software.amazon.awssdk.codegen.model.intermediate.OperationModel; import software.amazon.awssdk.codegen.model.intermediate.Protocol; import software.amazon.awssdk.codegen.model.intermediate.ShapeModel; +import software.amazon.awssdk.codegen.model.intermediate.ShapeType; import software.amazon.awssdk.codegen.poet.PoetExtension; import software.amazon.awssdk.codegen.poet.auth.scheme.AuthSchemeSpecUtils; import software.amazon.awssdk.codegen.poet.client.traits.HttpChecksumRequiredTrait; @@ -179,28 +178,24 @@ public Optional errorResponseHandler(OperationModel opModel) { builder.add("\n$T exceptionMetadataMapper = errorCode -> {\n", metadataMapperType); builder.add("switch (errorCode) {\n"); - Set processedExceptions = new HashSet<>(); - - opModel.getExceptions().forEach(exception -> { - String exceptionName = exception.getExceptionName(); - if (!processedExceptions.add(exceptionName)) { - return; - } - ShapeModel exceptionShape = model.getShapes().get(exceptionName); - String errorCode = exceptionShape.getErrorCode(); - - builder.add("case $S:\n", errorCode); - builder.add("return $T.of($T.builder()\n", Optional.class, ExceptionMetadata.class) - .add(".errorCode($S)\n", errorCode); - builder.add(populateHttpStatusCode(exceptionShape, model)); - builder.add(".exceptionBuilderSupplier($T::builder)\n", - poetExtensions.getModelClassFromShape(exceptionShape)) - .add(".build());\n"); - }); + model.getShapes().values().stream() + .filter(shape -> shape.getShapeType() == ShapeType.Exception) + .forEach(exceptionShape -> { + String exceptionName = exceptionShape.getShapeName(); + String errorCode = exceptionShape.getErrorCode(); + + builder.add("case $S:\n", errorCode); + builder.add("return $T.of($T.builder()\n", Optional.class, ExceptionMetadata.class) + .add(".errorCode($S)\n", errorCode); + builder.add(populateHttpStatusCode(exceptionShape, model)); + builder.add(".exceptionBuilderSupplier($T::builder)\n", + poetExtensions.getModelClassFromShape(exceptionShape)) + .add(".build());\n"); + }); builder.add("default: return $T.empty();\n", Optional.class); builder.add("}\n"); - builder.add("};\n\n"); + builder.add("};\n"); builder.add("$T<$T> errorResponseHandler = createErrorResponseHandler($L, operationMetadata, exceptionMetadataMapper);", HttpResponseHandler.class, AwsServiceException.class, protocolFactory); diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/QueryProtocolSpec.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/QueryProtocolSpec.java index 30fef4a57740..dfe2d40a2f21 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/QueryProtocolSpec.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/QueryProtocolSpec.java @@ -21,16 +21,12 @@ import com.squareup.javapoet.MethodSpec; import com.squareup.javapoet.ParameterizedTypeName; import com.squareup.javapoet.TypeName; -import java.util.HashSet; import java.util.Optional; -import java.util.Set; import java.util.concurrent.CompletableFuture; -import java.util.function.Function; import javax.lang.model.element.Modifier; import software.amazon.awssdk.awscore.exception.AwsServiceException; import software.amazon.awssdk.codegen.model.intermediate.IntermediateModel; import software.amazon.awssdk.codegen.model.intermediate.OperationModel; -import software.amazon.awssdk.codegen.model.intermediate.ShapeModel; import software.amazon.awssdk.codegen.poet.PoetExtension; import software.amazon.awssdk.codegen.poet.auth.scheme.AuthSchemeSpecUtils; import software.amazon.awssdk.codegen.poet.client.traits.HttpChecksumRequiredTrait; @@ -40,7 +36,6 @@ import software.amazon.awssdk.core.async.AsyncResponseTransformer; import software.amazon.awssdk.core.client.handler.ClientExecutionParams; import software.amazon.awssdk.core.http.HttpResponseHandler; -import software.amazon.awssdk.protocols.core.ExceptionMetadata; import software.amazon.awssdk.protocols.query.AwsQueryProtocolFactory; import software.amazon.awssdk.utils.CompletableFutureUtils; @@ -74,6 +69,8 @@ public MethodSpec initProtocolFactory(IntermediateModel model) { methodSpec.addCode("return $T.builder()\n", protocolFactoryClass()); + registerModeledExceptions(model, poetExtensions).forEach(methodSpec::addCode); + methodSpec.addCode(".clientConfiguration(clientConfiguration)\n" + ".defaultServiceExceptionSupplier($T::builder)\n", poetExtensions.getModelClass(model.getSdkModeledExceptionBaseClassName())); @@ -97,41 +94,11 @@ public CodeBlock responseHandler(IntermediateModel model, @Override public Optional errorResponseHandler(OperationModel opModel) { - CodeBlock.Builder builder = CodeBlock.builder(); - ParameterizedTypeName metadataMapperType = ParameterizedTypeName.get( - ClassName.get(Function.class), - ClassName.get(String.class), - ParameterizedTypeName.get(Optional.class, ExceptionMetadata.class)); - - builder.add("\n$T exceptionMetadataMapper = errorCode -> {\n", metadataMapperType); - builder.add("switch (errorCode) {\n"); - Set processedExceptions = new HashSet<>(); - - opModel.getExceptions().forEach(exception -> { - String exceptionName = exception.getExceptionName(); - if (!processedExceptions.add(exceptionName)) { - return; - } - ShapeModel exceptionShape = intermediateModel.getShapes().get(exceptionName); - String errorCode = exceptionShape.getErrorCode(); - builder.add("case $S:\n", errorCode); - builder.add("return $T.of($T.builder()\n", Optional.class, ExceptionMetadata.class) - .add(".errorCode($S)\n", errorCode); - builder.add(populateHttpStatusCode(exceptionShape, intermediateModel)); - builder.add(".exceptionBuilderSupplier($T::builder)\n", - poetExtensions.getModelClassFromShape(exceptionShape)) - .add(".build());\n"); - }); - - builder.add("default: return $T.empty();\n", Optional.class); - builder.add("}\n"); - builder.add("};\n\n"); - - builder.add("$T<$T> errorResponseHandler = protocolFactory.createErrorResponseHandler(exceptionMetadataMapper);", - HttpResponseHandler.class, - AwsServiceException.class); - - return Optional.of(builder.build()); + return Optional.of( + CodeBlock.builder() + .add("\n\n$T errorResponseHandler = protocolFactory.createErrorResponseHandler();", + ParameterizedTypeName.get(HttpResponseHandler.class, AwsServiceException.class)) + .build()); } @Override @@ -226,18 +193,6 @@ public CodeBlock asyncExecutionHandler(IntermediateModel intermediateModel, Oper @Override public Optional createErrorResponseHandler() { - ParameterizedTypeName mapperType = ParameterizedTypeName.get( - ClassName.get(Function.class), - ClassName.get(String.class), - ParameterizedTypeName.get(Optional.class, ExceptionMetadata.class)); - - return Optional.of(MethodSpec.methodBuilder("createErrorResponseHandler") - .addModifiers(Modifier.PRIVATE) - .returns(ParameterizedTypeName.get(ClassName.get(HttpResponseHandler.class), - ClassName.get(AwsServiceException.class))) - .addParameter(mapperType, "exceptionMetadataMapper") - .addStatement("return protocolFactory.createErrorResponseHandler(exceptionMetadataMapper)") - .build()); + return Optional.empty(); } - -} +} \ No newline at end of file diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/XmlProtocolSpec.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/XmlProtocolSpec.java index 217ba232ff81..fa74e890f7ee 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/XmlProtocolSpec.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/XmlProtocolSpec.java @@ -22,12 +22,9 @@ import com.squareup.javapoet.ParameterizedTypeName; import com.squareup.javapoet.TypeName; import com.squareup.javapoet.WildcardTypeName; -import java.util.HashSet; import java.util.Map; import java.util.Optional; -import java.util.Set; import java.util.concurrent.CompletableFuture; -import java.util.function.Function; import software.amazon.awssdk.awscore.eventstream.EventStreamAsyncResponseTransformer; import software.amazon.awssdk.awscore.eventstream.EventStreamTaggedUnionPojoSupplier; import software.amazon.awssdk.awscore.eventstream.RestEventStreamAsyncResponseTransformer; @@ -46,7 +43,6 @@ import software.amazon.awssdk.core.SdkPojoBuilder; import software.amazon.awssdk.core.client.handler.ClientExecutionParams; import software.amazon.awssdk.core.http.HttpResponseHandler; -import software.amazon.awssdk.protocols.core.ExceptionMetadata; import software.amazon.awssdk.protocols.xml.AwsXmlProtocolFactory; import software.amazon.awssdk.protocols.xml.XmlOperationMetadata; import software.amazon.awssdk.utils.CompletableFutureUtils; @@ -95,7 +91,7 @@ public CodeBlock responseHandler(IntermediateModel model, return CodeBlock.builder() .addStatement("\n\n$T responseHandler = protocolFactory.createCombinedResponseHandler($T::builder, " + "new $T().withHasStreamingSuccessResponse($L))", - handlerType, responseType, XmlOperationMetadata.class, opModel.hasStreamingOutput()) + handlerType, responseType, XmlOperationMetadata.class, opModel.hasStreamingOutput()) .build(); } @@ -112,46 +108,7 @@ private CodeBlock streamingResponseHandler(OperationModel opModel) { @Override public Optional errorResponseHandler(OperationModel opModel) { - if (opModel.hasStreamingOutput()) { - return streamingErrorResponseHandler(opModel); - } - - CodeBlock.Builder builder = CodeBlock.builder(); - ParameterizedTypeName metadataMapperType = ParameterizedTypeName.get( - ClassName.get(Function.class), - ClassName.get(String.class), - ParameterizedTypeName.get(Optional.class, ExceptionMetadata.class)); - - builder.add("\n$T exceptionMetadataMapper = errorCode -> {\n", metadataMapperType); - builder.add("switch (errorCode) {\n"); - Set processedExceptions = new HashSet<>(); - - opModel.getExceptions().forEach(exception -> { - String exceptionName = exception.getExceptionName(); - if (!processedExceptions.add(exceptionName)) { - return; - } - ShapeModel exceptionShape = model.getShapes().get(exceptionName); - String errorCode = exceptionShape.getErrorCode(); - - builder.add("case $S:\n", errorCode); - builder.add("return $T.of($T.builder()\n", Optional.class, ExceptionMetadata.class) - .add(".errorCode($S)\n", errorCode); - builder.add(populateHttpStatusCode(exceptionShape, model)); - builder.add(".exceptionBuilderSupplier($T::builder)\n", - poetExtensions.getModelClassFromShape(exceptionShape)) - .add(".build());\n"); - }); - - builder.add("default: return $T.empty();\n", Optional.class); - builder.add("}\n"); - builder.add("};\n\n"); - - builder.add("$T<$T> errorResponseHandler = protocolFactory.createErrorResponseHandler(exceptionMetadataMapper);", - HttpResponseHandler.class, - AwsServiceException.class); - - return Optional.of(builder.build()); + return opModel.hasStreamingOutput() ? streamingErrorResponseHandler(opModel) : Optional.empty(); } private Optional streamingErrorResponseHandler(OperationModel opModel) { @@ -331,9 +288,9 @@ private CodeBlock eventStreamResponseHandlers(OperationModel opModel, TypeName p streamResponseOpMd); // Response handler responsible for errors for the API call itself, as well as errors sent over the event stream - // builder.addStatement("$T errorResponseHandler = protocolFactory" - // + ".createErrorResponseHandler()", ParameterizedTypeName.get(HttpResponseHandler.class, - // AwsServiceException.class)); + builder.addStatement("$T errorResponseHandler = protocolFactory" + + ".createErrorResponseHandler()", ParameterizedTypeName.get(HttpResponseHandler.class, + AwsServiceException.class)); ShapeModel eventStreamShape = EventStreamUtils.getEventStreamInResponse(opModel.getOutputShape()); @@ -429,4 +386,4 @@ private CodeBlock whenCompleteBlock(OperationModel operationModel, String respon return whenComplete.build(); } -} +} \ No newline at end of file diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-aws-json-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-aws-json-async-client-class.java index bc67efafb31c..1017028f4880 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-aws-json-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-aws-json-async-client-class.java @@ -194,11 +194,13 @@ public CompletableFuture aPostOperation(APostOperationRe case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); String hostPrefix = "{StringMember}-foo."; @@ -278,7 +280,6 @@ public CompletableFuture aPostOperationWithOut return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -361,11 +362,16 @@ public CompletableFuture eventStreamOperation(EventStreamOperationRequest Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); EventStreamTaggedUnionJsonMarshaller eventMarshaller = EventStreamTaggedUnionJsonMarshaller.builder() @@ -450,11 +456,16 @@ public CompletableFuture eventStreamO .createResponseHandler(operationMetadata, EventStreamOperationWithOnlyInputResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); EventStreamTaggedUnionJsonMarshaller eventMarshaller = EventStreamTaggedUnionJsonMarshaller.builder() @@ -546,11 +557,16 @@ public CompletableFuture eventStreamOperationWithOnlyOutput( Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); CompletableFuture future = new CompletableFuture<>(); @@ -633,11 +649,13 @@ public CompletableFuture getWithoutRequiredMe case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -699,11 +717,16 @@ public CompletableFuture operationWithChe operationMetadata, OperationWithChecksumRequiredResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -768,11 +791,16 @@ public CompletableFuture operationWithNoneAut operationMetadata, OperationWithNoneAuthTypeResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -834,11 +862,16 @@ public CompletableFuture operationWithR operationMetadata, OperationWithRequestCompressionResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -905,11 +938,16 @@ public CompletableFuture paginatedOpera operationMetadata, PaginatedOperationWithResultKeyResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -971,11 +1009,16 @@ public CompletableFuture paginatedOp .createResponseHandler(operationMetadata, PaginatedOperationWithoutResultKeyResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -1041,11 +1084,16 @@ public CompletableFuture streamingInputOperatio operationMetadata, StreamingInputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -1125,11 +1173,16 @@ public CompletableFuture streamingInputOutputOperation( operationMetadata, StreamingInputOutputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -1217,11 +1270,16 @@ public CompletableFuture streamingOutputOperation( operationMetadata, StreamingOutputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-cbor-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-cbor-async-client-class.java index dd68f2d61c33..a5c734fab269 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-cbor-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-cbor-async-client-class.java @@ -198,11 +198,13 @@ public CompletableFuture aPostOperation(APostOperationRe case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); String hostPrefix = "{StringMember}-foo."; @@ -282,7 +284,6 @@ public CompletableFuture aPostOperationWithOut return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -365,11 +366,16 @@ public CompletableFuture eventStreamOperation(EventStreamOperationRequest Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); EventStreamTaggedUnionJsonMarshaller eventMarshaller = EventStreamTaggedUnionJsonMarshaller.builder() @@ -454,11 +460,16 @@ public CompletableFuture eventStreamO .createResponseHandler(operationMetadata, EventStreamOperationWithOnlyInputResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); EventStreamTaggedUnionJsonMarshaller eventMarshaller = EventStreamTaggedUnionJsonMarshaller.builder() @@ -550,11 +561,16 @@ public CompletableFuture eventStreamOperationWithOnlyOutput( Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); CompletableFuture future = new CompletableFuture<>(); @@ -637,11 +653,13 @@ public CompletableFuture getWithoutRequiredMe case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -703,11 +721,16 @@ public CompletableFuture operationWithChe operationMetadata, OperationWithChecksumRequiredResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -772,11 +795,16 @@ public CompletableFuture operationWithNoneAut operationMetadata, OperationWithNoneAuthTypeResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -838,11 +866,16 @@ public CompletableFuture operationWithR operationMetadata, OperationWithRequestCompressionResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -909,11 +942,16 @@ public CompletableFuture paginatedOpera operationMetadata, PaginatedOperationWithResultKeyResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -975,11 +1013,16 @@ public CompletableFuture paginatedOp .createResponseHandler(operationMetadata, PaginatedOperationWithoutResultKeyResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -1045,11 +1088,16 @@ public CompletableFuture streamingInputOperatio operationMetadata, StreamingInputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -1129,11 +1177,16 @@ public CompletableFuture streamingInputOutputOperation( operationMetadata, StreamingInputOutputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -1221,11 +1274,16 @@ public CompletableFuture streamingOutputOperation( operationMetadata, StreamingOutputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-async-client-class.java index 6d1cc6ed29b4..e1873f9318e3 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-async-client-class.java @@ -212,7 +212,6 @@ public CompletableFuture aPostOperation(APostOperationRe return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); String hostPrefix = "{StringMember}-foo."; @@ -288,7 +287,6 @@ public CompletableFuture aPostOperationWithOut return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -349,11 +347,13 @@ public CompletableFuture bearerAuthOperation( operationMetadata, BearerAuthOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -442,11 +442,13 @@ public CompletableFuture eventStreamOperation(EventStreamOperationRequest Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); EventStreamTaggedUnionJsonMarshaller eventMarshaller = EventStreamTaggedUnionJsonMarshaller.builder() @@ -534,11 +536,13 @@ public CompletableFuture eventStreamO .createResponseHandler(operationMetadata, EventStreamOperationWithOnlyInputResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); EventStreamTaggedUnionJsonMarshaller eventMarshaller = EventStreamTaggedUnionJsonMarshaller.builder() @@ -635,11 +639,13 @@ public CompletableFuture eventStreamOperationWithOnlyOutput( Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); CompletableFuture future = new CompletableFuture<>(); @@ -721,11 +727,13 @@ public CompletableFuture getOperationWithCheck operationMetadata, GetOperationWithChecksumResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -805,7 +813,6 @@ public CompletableFuture getWithoutRequiredMe return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -867,11 +874,13 @@ public CompletableFuture operationWithChe operationMetadata, OperationWithChecksumRequiredResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -937,11 +946,13 @@ public CompletableFuture operationWithR operationMetadata, OperationWithRequestCompressionResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -1008,11 +1019,13 @@ public CompletableFuture paginatedOpera operationMetadata, PaginatedOperationWithResultKeyResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -1074,11 +1087,13 @@ public CompletableFuture paginatedOp .createResponseHandler(operationMetadata, PaginatedOperationWithoutResultKeyResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -1162,11 +1177,13 @@ public CompletableFuture putOperationWithChecksum( operationMetadata, PutOperationWithChecksumResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -1259,11 +1276,13 @@ public CompletableFuture streamingInputOperatio operationMetadata, StreamingInputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -1343,11 +1362,13 @@ public CompletableFuture streamingInputOutputOperation( operationMetadata, StreamingInputOutputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -1435,11 +1456,13 @@ public CompletableFuture streamingOutputOperation( operationMetadata, StreamingOutputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-client-class.java index 682816737b75..95f6623665b2 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-client-class.java @@ -149,7 +149,6 @@ public APostOperationResponse aPostOperation(APostOperationRequest aPostOperatio return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationRequest, this.clientConfiguration); @@ -214,7 +213,6 @@ public APostOperationWithOutputResponse aPostOperationWithOutput( return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationWithOutputRequest, @@ -265,11 +263,13 @@ public BearerAuthOperationResponse bearerAuthOperation(BearerAuthOperationReques operationMetadata, BearerAuthOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(bearerAuthOperationRequest, @@ -320,11 +320,13 @@ public GetOperationWithChecksumResponse getOperationWithChecksum( operationMetadata, GetOperationWithChecksumResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getOperationWithChecksumRequest, @@ -395,7 +397,6 @@ public GetWithoutRequiredMembersResponse getWithoutRequiredMembers( return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getWithoutRequiredMembersRequest, @@ -447,11 +448,13 @@ public OperationWithChecksumRequiredResponse operationWithChecksumRequired( operationMetadata, OperationWithChecksumRequiredResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithChecksumRequiredRequest, @@ -508,11 +511,13 @@ public OperationWithRequestCompressionResponse operationWithRequestCompression( operationMetadata, OperationWithRequestCompressionResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithRequestCompressionRequest, @@ -569,11 +574,13 @@ public PaginatedOperationWithResultKeyResponse paginatedOperationWithResultKey( operationMetadata, PaginatedOperationWithResultKeyResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(paginatedOperationWithResultKeyRequest, @@ -625,11 +632,13 @@ public PaginatedOperationWithoutResultKeyResponse paginatedOperationWithoutResul operationMetadata, PaginatedOperationWithoutResultKeyResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(paginatedOperationWithoutResultKeyRequest, @@ -707,11 +716,13 @@ public ReturnT putOperationWithChecksum(PutOperationWithChecksumReques operationMetadata, PutOperationWithChecksumResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putOperationWithChecksumRequest, @@ -790,11 +801,13 @@ public StreamingInputOperationResponse streamingInputOperation(StreamingInputOpe operationMetadata, StreamingInputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOperationRequest, @@ -872,11 +885,13 @@ public ReturnT streamingInputOutputOperation( operationMetadata, StreamingInputOutputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOutputOperationRequest, @@ -944,11 +959,13 @@ public ReturnT streamingOutputOperation(StreamingOutputOperationReques operationMetadata, StreamingOutputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingOutputOperationRequest, diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-async-client-class.java index 37c1810e43af..b5232cece3ec 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-async-client-class.java @@ -4,11 +4,9 @@ import java.util.Collections; import java.util.List; -import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ScheduledExecutorService; import java.util.function.Consumer; -import java.util.function.Function; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import software.amazon.awssdk.annotations.Generated; @@ -167,18 +165,7 @@ public CompletableFuture aPostOperation(APostOperationRe HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(APostOperationResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); String hostPrefix = "foo-"; String resolvedHostExpression = "foo-"; @@ -240,18 +227,7 @@ public CompletableFuture aPostOperationWithOut HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(APostOperationWithOutputResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -307,15 +283,7 @@ public CompletableFuture bearerAuthOperation( HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(BearerAuthOperationResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -371,15 +339,7 @@ public CompletableFuture getOperationWithCheck HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(GetOperationWithChecksumResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -444,15 +404,7 @@ public CompletableFuture operationWithChe HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithChecksumRequiredResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -512,15 +464,7 @@ public CompletableFuture operationWithContext HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithContextParamResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -577,15 +521,7 @@ public CompletableFuture operationWithCustomM HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithCustomMemberResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -643,15 +579,7 @@ public CompletableFuture o HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithCustomizedOperationContextParamResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -710,15 +638,7 @@ public CompletableFuture operatio HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithMapOperationContextParamResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -774,15 +694,7 @@ public CompletableFuture operationWithNoneAut HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithNoneAuthTypeResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -840,15 +752,7 @@ public CompletableFuture operationWi HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithOperationContextParamResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -905,15 +809,7 @@ public CompletableFuture operationWithR HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithRequestCompressionResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -975,15 +871,7 @@ public CompletableFuture operationWith HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithStaticContextParamsResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -1062,15 +950,7 @@ public CompletableFuture putOperationWithChecksum( HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(PutOperationWithChecksumResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler.execute( new ClientExecutionParams() @@ -1157,15 +1037,7 @@ public CompletableFuture streamingInputOperatio HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(StreamingInputOperationResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -1235,15 +1107,7 @@ public CompletableFuture streamingOutputOperation( HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(StreamingOutputOperationResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler.execute( new ClientExecutionParams() @@ -1289,8 +1153,12 @@ public final String serviceName() { } private AwsQueryProtocolFactory init() { - return AwsQueryProtocolFactory.builder().clientConfiguration(clientConfiguration) - .defaultServiceExceptionSupplier(QueryException::builder).build(); + return AwsQueryProtocolFactory + .builder() + .registerModeledException( + ExceptionMetadata.builder().errorCode("InvalidInput") + .exceptionBuilderSupplier(InvalidInputException::builder).httpStatusCode(400).build()) + .clientConfiguration(clientConfiguration).defaultServiceExceptionSupplier(QueryException::builder).build(); } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, @@ -1345,11 +1213,6 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, return configuration.build(); } - private HttpResponseHandler createErrorResponseHandler( - Function> exceptionMetadataMapper) { - return protocolFactory.createErrorResponseHandler(exceptionMetadataMapper); - } - @Override public void close() { clientHandler.close(); diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-client-class.java index 9fd239295c89..bc853bc4b61b 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-client-class.java @@ -2,9 +2,7 @@ import java.util.Collections; import java.util.List; -import java.util.Optional; import java.util.function.Consumer; -import java.util.function.Function; import software.amazon.awssdk.annotations.Generated; import software.amazon.awssdk.annotations.SdkInternalApi; import software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler; @@ -146,18 +144,7 @@ public APostOperationResponse aPostOperation(APostOperationRequest aPostOperatio HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(APostOperationResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationRequest .overrideConfiguration().orElse(null)); @@ -208,18 +195,7 @@ public APostOperationWithOutputResponse aPostOperationWithOutput( HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(APostOperationWithOutputResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationWithOutputRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationWithOutputRequest @@ -265,15 +241,7 @@ public BearerAuthOperationResponse bearerAuthOperation(BearerAuthOperationReques HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(BearerAuthOperationResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(bearerAuthOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, bearerAuthOperationRequest @@ -319,15 +287,7 @@ public GetOperationWithChecksumResponse getOperationWithChecksum( HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(GetOperationWithChecksumResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getOperationWithChecksumRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getOperationWithChecksumRequest @@ -382,15 +342,7 @@ public OperationWithChecksumRequiredResponse operationWithChecksumRequired( HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithChecksumRequiredResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithChecksumRequiredRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, @@ -442,15 +394,7 @@ public OperationWithContextParamResponse operationWithContextParam( HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithContextParamResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithContextParamRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithContextParamRequest @@ -498,15 +442,7 @@ public OperationWithCustomMemberResponse operationWithCustomMember( HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithCustomMemberResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithCustomMemberRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithCustomMemberRequest @@ -554,15 +490,7 @@ public OperationWithCustomizedOperationContextParamResponse operationWithCustomi HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithCustomizedOperationContextParamResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration( operationWithCustomizedOperationContextParamRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, @@ -611,15 +539,7 @@ public OperationWithMapOperationContextParamResponse operationWithMapOperationCo HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithMapOperationContextParamResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithMapOperationContextParamRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, @@ -666,15 +586,7 @@ public OperationWithNoneAuthTypeResponse operationWithNoneAuthType( HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithNoneAuthTypeResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithNoneAuthTypeRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithNoneAuthTypeRequest @@ -722,15 +634,7 @@ public OperationWithOperationContextParamResponse operationWithOperationContextP HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithOperationContextParamResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithOperationContextParamRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, @@ -777,15 +681,7 @@ public OperationWithRequestCompressionResponse operationWithRequestCompression( HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithRequestCompressionResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithRequestCompressionRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, @@ -837,15 +733,7 @@ public OperationWithStaticContextParamsResponse operationWithStaticContextParams HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithStaticContextParamsResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithStaticContextParamsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, @@ -918,15 +806,7 @@ public ReturnT putOperationWithChecksum(PutOperationWithChecksumReques HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(PutOperationWithChecksumResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putOperationWithChecksumRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, putOperationWithChecksumRequest @@ -1000,15 +880,7 @@ public StreamingInputOperationResponse streamingInputOperation(StreamingInputOpe HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(StreamingInputOperationResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingInputOperationRequest @@ -1069,15 +941,7 @@ public ReturnT streamingOutputOperation(StreamingOutputOperationReques HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(StreamingOutputOperationResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingOutputOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingOutputOperationRequest @@ -1133,11 +997,6 @@ private static List resolveMetricPublishers(SdkClientConfigurat return publishers; } - private HttpResponseHandler createErrorResponseHandler( - Function> exceptionMetadataMapper) { - return protocolFactory.createErrorResponseHandler(exceptionMetadataMapper); - } - private void updateRetryStrategyClientConfiguration(SdkClientConfiguration.Builder configuration) { ClientOverrideConfiguration.Builder builder = configuration.asOverrideConfigurationBuilder(); RetryMode retryMode = builder.retryMode(); @@ -1176,8 +1035,12 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, } private AwsQueryProtocolFactory init() { - return AwsQueryProtocolFactory.builder().clientConfiguration(clientConfiguration) - .defaultServiceExceptionSupplier(QueryException::builder).build(); + return AwsQueryProtocolFactory + .builder() + .registerModeledException( + ExceptionMetadata.builder().errorCode("InvalidInput") + .exceptionBuilderSupplier(InvalidInputException::builder).httpStatusCode(400).build()) + .clientConfiguration(clientConfiguration).defaultServiceExceptionSupplier(QueryException::builder).build(); } @Override diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-async-client-class.java index bf8a93786c2f..74adafb18c88 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-async-client-class.java @@ -4,11 +4,9 @@ import java.util.Collections; import java.util.List; -import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; import java.util.function.Consumer; -import java.util.function.Function; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import software.amazon.awssdk.annotations.Generated; @@ -159,19 +157,6 @@ public CompletableFuture aPostOperation(APostOperationRe HttpResponseHandler> responseHandler = protocolFactory .createCombinedResponseHandler(APostOperationResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); - - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); String hostPrefix = "foo-"; String resolvedHostExpression = "foo-"; @@ -235,19 +220,6 @@ public CompletableFuture aPostOperationWithOut .createCombinedResponseHandler(APostOperationWithOutputResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); - CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("APostOperationWithOutput").withRequestConfiguration(clientConfiguration) @@ -304,16 +276,6 @@ public CompletableFuture bearerAuthOperation( .createCombinedResponseHandler(BearerAuthOperationResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); - CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("BearerAuthOperation").withRequestConfiguration(clientConfiguration) @@ -368,6 +330,7 @@ public CompletableFuture eventStreamOperation(EventStreamOperationRequest HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( EventStreamOperationResponse::builder, XmlOperationMetadata.builder().hasStreamingSuccessResponse(true) .build()); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); HttpResponseHandler eventResponseHandler = protocolFactory.createResponseHandler( EventStreamTaggedUnionPojoSupplier.builder() .putSdkPojoSupplier("EventPayloadEvent", EventStream::eventPayloadEventBuilder) @@ -375,16 +338,6 @@ public CompletableFuture eventStreamOperation(EventStreamOperationRequest .putSdkPojoSupplier("SecondEventPayloadEvent", EventStream::secondEventPayloadEventBuilder) .defaultSdkPojoSupplier(() -> new SdkPojoBuilder(EventStream.UNKNOWN)).build(), XmlOperationMetadata .builder().hasStreamingSuccessResponse(false).build()); - - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); CompletableFuture eventStreamTransformFuture = new CompletableFuture<>(); EventStreamAsyncResponseTransformer asyncResponseTransformer = EventStreamAsyncResponseTransformer . builder().eventStreamResponseHandler(asyncResponseHandler) @@ -460,16 +413,6 @@ public CompletableFuture getOperationWithCheck .createCombinedResponseHandler(GetOperationWithChecksumResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); - CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("GetOperationWithChecksum") @@ -534,16 +477,6 @@ public CompletableFuture operationWithChe .createCombinedResponseHandler(OperationWithChecksumRequiredResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); - CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("OperationWithChecksumRequired") @@ -603,16 +536,6 @@ public CompletableFuture operationWithNoneAut .createCombinedResponseHandler(OperationWithNoneAuthTypeResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); - CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("OperationWithNoneAuthType").withRequestConfiguration(clientConfiguration) @@ -670,16 +593,6 @@ public CompletableFuture operationWithR .createCombinedResponseHandler(OperationWithRequestCompressionResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); - CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("OperationWithRequestCompression") @@ -762,15 +675,7 @@ public CompletableFuture putOperationWithChecksum( HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( PutOperationWithChecksumResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(true)); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler.execute( new ClientExecutionParams() @@ -858,16 +763,6 @@ public CompletableFuture streamingInputOperatio .createCombinedResponseHandler(StreamingInputOperationResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); - CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("StreamingInputOperation") @@ -937,15 +832,7 @@ public CompletableFuture streamingOutputOperation( HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( StreamingOutputOperationResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(true)); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler.execute( new ClientExecutionParams() @@ -986,8 +873,12 @@ public final String serviceName() { } private AwsXmlProtocolFactory init() { - return AwsXmlProtocolFactory.builder().clientConfiguration(clientConfiguration) - .defaultServiceExceptionSupplier(XmlException::builder).build(); + return AwsXmlProtocolFactory + .builder() + .registerModeledException( + ExceptionMetadata.builder().errorCode("InvalidInput") + .exceptionBuilderSupplier(InvalidInputException::builder).httpStatusCode(400).build()) + .clientConfiguration(clientConfiguration).defaultServiceExceptionSupplier(XmlException::builder).build(); } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, @@ -1042,11 +933,6 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, return configuration.build(); } - private HttpResponseHandler createErrorResponseHandler( - Function> exceptionMetadataMapper) { - return protocolFactory.createErrorResponseHandler(exceptionMetadataMapper); - } - @Override public void close() { clientHandler.close(); diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-client-class.java index dc66e4490262..9f607d734a2c 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-client-class.java @@ -2,9 +2,7 @@ import java.util.Collections; import java.util.List; -import java.util.Optional; import java.util.function.Consumer; -import java.util.function.Function; import software.amazon.awssdk.annotations.Generated; import software.amazon.awssdk.annotations.SdkInternalApi; import software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler; @@ -127,19 +125,6 @@ public APostOperationResponse aPostOperation(APostOperationRequest aPostOperatio HttpResponseHandler> responseHandler = protocolFactory.createCombinedResponseHandler( APostOperationResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); - - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationRequest .overrideConfiguration().orElse(null)); @@ -189,19 +174,6 @@ public APostOperationWithOutputResponse aPostOperationWithOutput( HttpResponseHandler> responseHandler = protocolFactory .createCombinedResponseHandler(APostOperationWithOutputResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); - - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationWithOutputRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationWithOutputRequest @@ -246,16 +218,6 @@ public BearerAuthOperationResponse bearerAuthOperation(BearerAuthOperationReques HttpResponseHandler> responseHandler = protocolFactory .createCombinedResponseHandler(BearerAuthOperationResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); - - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(bearerAuthOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, bearerAuthOperationRequest @@ -301,16 +263,6 @@ public GetOperationWithChecksumResponse getOperationWithChecksum( HttpResponseHandler> responseHandler = protocolFactory .createCombinedResponseHandler(GetOperationWithChecksumResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); - - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getOperationWithChecksumRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getOperationWithChecksumRequest @@ -364,16 +316,6 @@ public OperationWithChecksumRequiredResponse operationWithChecksumRequired( HttpResponseHandler> responseHandler = protocolFactory .createCombinedResponseHandler(OperationWithChecksumRequiredResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); - - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithChecksumRequiredRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, @@ -424,16 +366,6 @@ public OperationWithNoneAuthTypeResponse operationWithNoneAuthType( HttpResponseHandler> responseHandler = protocolFactory .createCombinedResponseHandler(OperationWithNoneAuthTypeResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); - - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithNoneAuthTypeRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithNoneAuthTypeRequest @@ -479,16 +411,6 @@ public OperationWithRequestCompressionResponse operationWithRequestCompression( HttpResponseHandler> responseHandler = protocolFactory .createCombinedResponseHandler(OperationWithRequestCompressionResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); - - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithRequestCompressionRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, @@ -565,15 +487,7 @@ public ReturnT putOperationWithChecksum(PutOperationWithChecksumReques HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( PutOperationWithChecksumResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(true)); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putOperationWithChecksumRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, putOperationWithChecksumRequest @@ -647,16 +561,6 @@ public StreamingInputOperationResponse streamingInputOperation(StreamingInputOpe HttpResponseHandler> responseHandler = protocolFactory .createCombinedResponseHandler(StreamingInputOperationResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); - - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingInputOperationRequest @@ -716,15 +620,7 @@ public ReturnT streamingOutputOperation(StreamingOutputOperationReques HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( StreamingOutputOperationResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(true)); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingOutputOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingOutputOperationRequest @@ -767,11 +663,6 @@ private static List resolveMetricPublishers(SdkClientConfigurat return publishers; } - private HttpResponseHandler createErrorResponseHandler( - Function> exceptionMetadataMapper) { - return protocolFactory.createErrorResponseHandler(exceptionMetadataMapper); - } - private void updateRetryStrategyClientConfiguration(SdkClientConfiguration.Builder configuration) { ClientOverrideConfiguration.Builder builder = configuration.asOverrideConfigurationBuilder(); RetryMode retryMode = builder.retryMode(); @@ -810,8 +701,12 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, } private AwsXmlProtocolFactory init() { - return AwsXmlProtocolFactory.builder().clientConfiguration(clientConfiguration) - .defaultServiceExceptionSupplier(XmlException::builder).build(); + return AwsXmlProtocolFactory + .builder() + .registerModeledException( + ExceptionMetadata.builder().errorCode("InvalidInput") + .exceptionBuilderSupplier(InvalidInputException::builder).httpStatusCode(400).build()) + .clientConfiguration(clientConfiguration).defaultServiceExceptionSupplier(XmlException::builder).build(); } @Override diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-json-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-json-async-client-class.java index 564a24b9831f..c2bbd72c1e91 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-json-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-json-async-client-class.java @@ -200,11 +200,13 @@ public CompletableFuture aPostOperation(APostOperationRe case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); String hostPrefix = "{StringMember}-foo."; @@ -284,7 +286,6 @@ public CompletableFuture aPostOperationWithOut return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -368,11 +369,16 @@ public CompletableFuture eventStreamOperation(EventStreamOperationRequest Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); EventStreamTaggedUnionJsonMarshaller eventMarshaller = EventStreamTaggedUnionJsonMarshaller.builder() @@ -459,11 +465,16 @@ public CompletableFuture eventStreamO .createResponseHandler(operationMetadata, EventStreamOperationWithOnlyInputResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); EventStreamTaggedUnionJsonMarshaller eventMarshaller = EventStreamTaggedUnionJsonMarshaller.builder() @@ -555,11 +566,16 @@ public CompletableFuture eventStreamOperationWithOnlyOutput( Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); CompletableFuture future = new CompletableFuture<>(); @@ -642,11 +658,13 @@ public CompletableFuture getWithoutRequiredMe case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -708,11 +726,16 @@ public CompletableFuture operationWithChe operationMetadata, OperationWithChecksumRequiredResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -777,11 +800,16 @@ public CompletableFuture operationWithNoneAut operationMetadata, OperationWithNoneAuthTypeResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -844,11 +872,16 @@ public CompletableFuture operationWithR operationMetadata, OperationWithRequestCompressionResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -915,11 +948,16 @@ public CompletableFuture paginatedOpera operationMetadata, PaginatedOperationWithResultKeyResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -981,11 +1019,16 @@ public CompletableFuture paginatedOp .createResponseHandler(operationMetadata, PaginatedOperationWithoutResultKeyResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -1054,11 +1097,16 @@ public CompletableFuture streamingInputOperatio operationMetadata, StreamingInputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -1140,11 +1188,16 @@ public CompletableFuture streamingInputOutputOperation( operationMetadata, StreamingInputOutputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -1232,11 +1285,16 @@ public CompletableFuture streamingOutputOperation( operationMetadata, StreamingOutputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -1359,4 +1417,4 @@ private HttpResponseHandler createErrorResponseHandler(Base public void close() { clientHandler.close(); } -} \ No newline at end of file +} diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-cbor-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-cbor-async-client-class.java index f0d6c0e36e63..9d35ccea75b5 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-cbor-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-cbor-async-client-class.java @@ -204,11 +204,13 @@ public CompletableFuture aPostOperation(APostOperationRe case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); String hostPrefix = "{StringMember}-foo."; @@ -288,7 +290,6 @@ public CompletableFuture aPostOperationWithOut return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -372,11 +373,16 @@ public CompletableFuture eventStreamOperation(EventStreamOperationRequest Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); EventStreamTaggedUnionJsonMarshaller eventMarshaller = EventStreamTaggedUnionJsonMarshaller.builder() @@ -463,11 +469,16 @@ public CompletableFuture eventStreamO .createResponseHandler(operationMetadata, EventStreamOperationWithOnlyInputResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); EventStreamTaggedUnionJsonMarshaller eventMarshaller = EventStreamTaggedUnionJsonMarshaller.builder() @@ -559,11 +570,16 @@ public CompletableFuture eventStreamOperationWithOnlyOutput( Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); CompletableFuture future = new CompletableFuture<>(); @@ -646,11 +662,13 @@ public CompletableFuture getWithoutRequiredMe case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -712,11 +730,16 @@ public CompletableFuture operationWithChe operationMetadata, OperationWithChecksumRequiredResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -781,11 +804,16 @@ public CompletableFuture operationWithNoneAut operationMetadata, OperationWithNoneAuthTypeResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -848,11 +876,16 @@ public CompletableFuture operationWithR operationMetadata, OperationWithRequestCompressionResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -919,11 +952,16 @@ public CompletableFuture paginatedOpera operationMetadata, PaginatedOperationWithResultKeyResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -985,11 +1023,16 @@ public CompletableFuture paginatedOp .createResponseHandler(operationMetadata, PaginatedOperationWithoutResultKeyResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -1058,11 +1101,16 @@ public CompletableFuture streamingInputOperatio operationMetadata, StreamingInputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -1144,11 +1192,16 @@ public CompletableFuture streamingInputOutputOperation( operationMetadata, StreamingInputOutputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -1236,11 +1289,16 @@ public CompletableFuture streamingOutputOperation( operationMetadata, StreamingOutputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -1363,4 +1421,4 @@ private HttpResponseHandler createErrorResponseHandler(Base public void close() { clientHandler.close(); } -} \ No newline at end of file +} diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-cbor-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-cbor-client-class.java index 73d59c6f9a1c..04fbb521fbab 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-cbor-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-cbor-client-class.java @@ -137,11 +137,13 @@ public APostOperationResponse aPostOperation(APostOperationRequest aPostOperatio case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationRequest, this.clientConfiguration); @@ -210,7 +212,6 @@ public APostOperationWithOutputResponse aPostOperationWithOutput( return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationWithOutputRequest, @@ -269,11 +270,13 @@ public GetWithoutRequiredMembersResponse getWithoutRequiredMembers( case "InvalidInputException": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getWithoutRequiredMembersRequest, @@ -325,11 +328,16 @@ public OperationWithChecksumRequiredResponse operationWithChecksumRequired( operationMetadata, OperationWithChecksumRequiredResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithChecksumRequiredRequest, @@ -386,11 +394,16 @@ public OperationWithNoneAuthTypeResponse operationWithNoneAuthType( operationMetadata, OperationWithNoneAuthTypeResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithNoneAuthTypeRequest, @@ -442,11 +455,16 @@ public OperationWithRequestCompressionResponse operationWithRequestCompression( operationMetadata, OperationWithRequestCompressionResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithRequestCompressionRequest, @@ -503,11 +521,16 @@ public PaginatedOperationWithResultKeyResponse paginatedOperationWithResultKey( operationMetadata, PaginatedOperationWithResultKeyResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(paginatedOperationWithResultKeyRequest, @@ -559,11 +582,16 @@ public PaginatedOperationWithoutResultKeyResponse paginatedOperationWithoutResul operationMetadata, PaginatedOperationWithoutResultKeyResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(paginatedOperationWithoutResultKeyRequest, @@ -625,11 +653,16 @@ public StreamingInputOperationResponse streamingInputOperation(StreamingInputOpe operationMetadata, StreamingInputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOperationRequest, @@ -707,11 +740,16 @@ public ReturnT streamingInputOutputOperation( operationMetadata, StreamingInputOutputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOutputOperationRequest, @@ -779,11 +817,16 @@ public ReturnT streamingOutputOperation(StreamingOutputOperationReques operationMetadata, StreamingOutputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingOutputOperationRequest, diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-async-client-class.java index 24f44f3561c7..8be171de0ca7 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-async-client-class.java @@ -219,7 +219,6 @@ public CompletableFuture aPostOperation(APostOperationRe return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); String hostPrefix = "{StringMember}-foo."; @@ -295,7 +294,6 @@ public CompletableFuture aPostOperationWithOut return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -357,11 +355,13 @@ public CompletableFuture bearerAuthOperation( operationMetadata, BearerAuthOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -451,11 +451,13 @@ public CompletableFuture eventStreamOperation(EventStreamOperationRequest Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); EventStreamTaggedUnionJsonMarshaller eventMarshaller = EventStreamTaggedUnionJsonMarshaller.builder() @@ -545,11 +547,13 @@ public CompletableFuture eventStreamO .createResponseHandler(operationMetadata, EventStreamOperationWithOnlyInputResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); EventStreamTaggedUnionJsonMarshaller eventMarshaller = EventStreamTaggedUnionJsonMarshaller.builder() @@ -646,11 +650,13 @@ public CompletableFuture eventStreamOperationWithOnlyOutput( Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); CompletableFuture future = new CompletableFuture<>(); @@ -732,11 +738,13 @@ public CompletableFuture getOperationWithCheck operationMetadata, GetOperationWithChecksumResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -816,7 +824,6 @@ public CompletableFuture getWithoutRequiredMe return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -878,11 +885,13 @@ public CompletableFuture operationWithChe operationMetadata, OperationWithChecksumRequiredResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -948,11 +957,13 @@ public CompletableFuture operationWithR operationMetadata, OperationWithRequestCompressionResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -1019,11 +1030,13 @@ public CompletableFuture paginatedOpera operationMetadata, PaginatedOperationWithResultKeyResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -1085,11 +1098,13 @@ public CompletableFuture paginatedOp .createResponseHandler(operationMetadata, PaginatedOperationWithoutResultKeyResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -1176,11 +1191,13 @@ public CompletableFuture putOperationWithChecksum( operationMetadata, PutOperationWithChecksumResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -1276,11 +1293,13 @@ public CompletableFuture streamingInputOperatio operationMetadata, StreamingInputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -1362,11 +1381,13 @@ public CompletableFuture streamingInputOutputOperation( operationMetadata, StreamingInputOutputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -1454,11 +1475,13 @@ public CompletableFuture streamingOutputOperation( operationMetadata, StreamingOutputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-client-class.java index cd6c248f6bf8..12e3b7e0c7f4 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-client-class.java @@ -154,7 +154,6 @@ public APostOperationResponse aPostOperation(APostOperationRequest aPostOperatio return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationRequest, this.clientConfiguration); @@ -219,7 +218,6 @@ public APostOperationWithOutputResponse aPostOperationWithOutput( return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationWithOutputRequest, @@ -271,11 +269,13 @@ public BearerAuthOperationResponse bearerAuthOperation(BearerAuthOperationReques operationMetadata, BearerAuthOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(bearerAuthOperationRequest, @@ -326,11 +326,13 @@ public GetOperationWithChecksumResponse getOperationWithChecksum( operationMetadata, GetOperationWithChecksumResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getOperationWithChecksumRequest, @@ -401,7 +403,6 @@ public GetWithoutRequiredMembersResponse getWithoutRequiredMembers( return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getWithoutRequiredMembersRequest, @@ -453,11 +454,13 @@ public OperationWithChecksumRequiredResponse operationWithChecksumRequired( operationMetadata, OperationWithChecksumRequiredResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithChecksumRequiredRequest, @@ -514,11 +517,13 @@ public OperationWithRequestCompressionResponse operationWithRequestCompression( operationMetadata, OperationWithRequestCompressionResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithRequestCompressionRequest, @@ -575,11 +580,13 @@ public PaginatedOperationWithResultKeyResponse paginatedOperationWithResultKey( operationMetadata, PaginatedOperationWithResultKeyResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(paginatedOperationWithResultKeyRequest, @@ -631,11 +638,13 @@ public PaginatedOperationWithoutResultKeyResponse paginatedOperationWithoutResul operationMetadata, PaginatedOperationWithoutResultKeyResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(paginatedOperationWithoutResultKeyRequest, @@ -713,11 +722,13 @@ public ReturnT putOperationWithChecksum(PutOperationWithChecksumReques operationMetadata, PutOperationWithChecksumResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putOperationWithChecksumRequest, @@ -796,11 +807,13 @@ public StreamingInputOperationResponse streamingInputOperation(StreamingInputOpe operationMetadata, StreamingInputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOperationRequest, @@ -880,11 +893,13 @@ public ReturnT streamingInputOutputOperation( operationMetadata, StreamingInputOutputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOutputOperationRequest, @@ -952,11 +967,13 @@ public ReturnT streamingOutputOperation(StreamingOutputOperationReques operationMetadata, StreamingOutputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingOutputOperationRequest, diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-async-client-class.java index c7bb91454dc1..f36a501f18c9 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-async-client-class.java @@ -4,11 +4,9 @@ import java.util.Collections; import java.util.List; -import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ScheduledExecutorService; import java.util.function.Consumer; -import java.util.function.Function; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import software.amazon.awssdk.annotations.Generated; @@ -172,18 +170,7 @@ public CompletableFuture aPostOperation(APostOperationRe HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(APostOperationResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); String hostPrefix = "foo-"; String resolvedHostExpression = "foo-"; @@ -245,18 +232,7 @@ public CompletableFuture aPostOperationWithOut HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(APostOperationWithOutputResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -313,15 +289,7 @@ public CompletableFuture bearerAuthOperation( HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(BearerAuthOperationResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -377,15 +345,7 @@ public CompletableFuture getOperationWithCheck HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(GetOperationWithChecksumResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -450,15 +410,7 @@ public CompletableFuture operationWithChe HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithChecksumRequiredResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -518,15 +470,7 @@ public CompletableFuture operationWithContext HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithContextParamResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -583,15 +527,7 @@ public CompletableFuture operationWithCustomM HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithCustomMemberResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -649,15 +585,7 @@ public CompletableFuture o HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithCustomizedOperationContextParamResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -716,15 +644,7 @@ public CompletableFuture operatio HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithMapOperationContextParamResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -780,15 +700,7 @@ public CompletableFuture operationWithNoneAut HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithNoneAuthTypeResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -847,15 +759,7 @@ public CompletableFuture operationWi HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithOperationContextParamResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -912,15 +816,7 @@ public CompletableFuture operationWithR HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithRequestCompressionResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -982,15 +878,7 @@ public CompletableFuture operationWith HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithStaticContextParamsResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -1072,15 +960,7 @@ public CompletableFuture putOperationWithChecksum( HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(PutOperationWithChecksumResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler.execute( new ClientExecutionParams() @@ -1170,15 +1050,7 @@ public CompletableFuture streamingInputOperatio HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(StreamingInputOperationResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() @@ -1248,15 +1120,7 @@ public CompletableFuture streamingOutputOperation( HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(StreamingOutputOperationResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler.execute( new ClientExecutionParams() @@ -1302,8 +1166,12 @@ public final String serviceName() { } private AwsQueryProtocolFactory init() { - return AwsQueryProtocolFactory.builder().clientConfiguration(clientConfiguration) - .defaultServiceExceptionSupplier(QueryException::builder).build(); + return AwsQueryProtocolFactory + .builder() + .registerModeledException( + ExceptionMetadata.builder().errorCode("InvalidInput") + .exceptionBuilderSupplier(InvalidInputException::builder).httpStatusCode(400).build()) + .clientConfiguration(clientConfiguration).defaultServiceExceptionSupplier(QueryException::builder).build(); } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, @@ -1373,11 +1241,6 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, return configuration.build(); } - private HttpResponseHandler createErrorResponseHandler( - Function> exceptionMetadataMapper) { - return protocolFactory.createErrorResponseHandler(exceptionMetadataMapper); - } - @Override public void close() { clientHandler.close(); diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-client-class.java index 5014ccf075f9..8811e4afe678 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-client-class.java @@ -2,9 +2,7 @@ import java.util.Collections; import java.util.List; -import java.util.Optional; import java.util.function.Consumer; -import java.util.function.Function; import software.amazon.awssdk.annotations.Generated; import software.amazon.awssdk.annotations.SdkInternalApi; import software.amazon.awssdk.auth.token.signer.aws.BearerTokenSigner; @@ -150,18 +148,7 @@ public APostOperationResponse aPostOperation(APostOperationRequest aPostOperatio HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(APostOperationResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationRequest .overrideConfiguration().orElse(null)); @@ -212,18 +199,7 @@ public APostOperationWithOutputResponse aPostOperationWithOutput( HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(APostOperationWithOutputResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationWithOutputRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationWithOutputRequest @@ -270,15 +246,7 @@ public BearerAuthOperationResponse bearerAuthOperation(BearerAuthOperationReques HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(BearerAuthOperationResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(bearerAuthOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, bearerAuthOperationRequest @@ -324,15 +292,7 @@ public GetOperationWithChecksumResponse getOperationWithChecksum( HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(GetOperationWithChecksumResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getOperationWithChecksumRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getOperationWithChecksumRequest @@ -387,15 +347,7 @@ public OperationWithChecksumRequiredResponse operationWithChecksumRequired( HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithChecksumRequiredResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithChecksumRequiredRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, @@ -447,15 +399,7 @@ public OperationWithContextParamResponse operationWithContextParam( HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithContextParamResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithContextParamRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithContextParamRequest @@ -503,15 +447,7 @@ public OperationWithCustomMemberResponse operationWithCustomMember( HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithCustomMemberResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithCustomMemberRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithCustomMemberRequest @@ -559,15 +495,7 @@ public OperationWithCustomizedOperationContextParamResponse operationWithCustomi HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithCustomizedOperationContextParamResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration( operationWithCustomizedOperationContextParamRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, @@ -616,15 +544,7 @@ public OperationWithMapOperationContextParamResponse operationWithMapOperationCo HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithMapOperationContextParamResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithMapOperationContextParamRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, @@ -671,15 +591,7 @@ public OperationWithNoneAuthTypeResponse operationWithNoneAuthType( HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithNoneAuthTypeResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithNoneAuthTypeRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithNoneAuthTypeRequest @@ -728,15 +640,7 @@ public OperationWithOperationContextParamResponse operationWithOperationContextP HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithOperationContextParamResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithOperationContextParamRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, @@ -783,15 +687,7 @@ public OperationWithRequestCompressionResponse operationWithRequestCompression( HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithRequestCompressionResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithRequestCompressionRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, @@ -843,15 +739,7 @@ public OperationWithStaticContextParamsResponse operationWithStaticContextParams HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(OperationWithStaticContextParamsResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithStaticContextParamsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, @@ -924,15 +812,7 @@ public ReturnT putOperationWithChecksum(PutOperationWithChecksumReques HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(PutOperationWithChecksumResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putOperationWithChecksumRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, putOperationWithChecksumRequest @@ -1006,15 +886,7 @@ public StreamingInputOperationResponse streamingInputOperation(StreamingInputOpe HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(StreamingInputOperationResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingInputOperationRequest @@ -1075,15 +947,7 @@ public ReturnT streamingOutputOperation(StreamingOutputOperationReques HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(StreamingOutputOperationResponse::builder); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingOutputOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingOutputOperationRequest @@ -1150,11 +1014,6 @@ private static List resolveMetricPublishers(SdkClientConfigurat return publishers; } - private HttpResponseHandler createErrorResponseHandler( - Function> exceptionMetadataMapper) { - return protocolFactory.createErrorResponseHandler(exceptionMetadataMapper); - } - private void updateRetryStrategyClientConfiguration(SdkClientConfiguration.Builder configuration) { ClientOverrideConfiguration.Builder builder = configuration.asOverrideConfigurationBuilder(); RetryMode retryMode = builder.retryMode(); @@ -1193,8 +1052,12 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, } private AwsQueryProtocolFactory init() { - return AwsQueryProtocolFactory.builder().clientConfiguration(clientConfiguration) - .defaultServiceExceptionSupplier(QueryException::builder).build(); + return AwsQueryProtocolFactory + .builder() + .registerModeledException( + ExceptionMetadata.builder().errorCode("InvalidInput") + .exceptionBuilderSupplier(InvalidInputException::builder).httpStatusCode(400).build()) + .clientConfiguration(clientConfiguration).defaultServiceExceptionSupplier(QueryException::builder).build(); } @Override 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 index 19eaf7b580b8..d360658456eb 100644 --- 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 @@ -146,11 +146,19 @@ public CompletableFuture emptyInputOutput(EmptyInputOu operationMetadata, EmptyInputOutputResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -209,11 +217,19 @@ public CompletableFuture float16(Float16Request float16Request) Float16Response::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -272,11 +288,19 @@ public CompletableFuture fractionalSeconds(Fractional operationMetadata, FractionalSecondsResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -338,17 +362,19 @@ public CompletableFuture greetingWithErrors(Greeting operationMetadata, GreetingWithErrorsResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "ComplexError": - return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") - .exceptionBuilderSupplier(ComplexErrorException::builder).build()); + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); case "InvalidGreeting": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -407,11 +433,19 @@ public CompletableFuture noInputOutput(NoInputOutputReque NoInputOutputResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -476,11 +510,16 @@ public CompletableFuture operationWithDefaults( case "ValidationException": return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -541,11 +580,19 @@ public CompletableFuture optionalInputOutput( operationMetadata, OptionalInputOutputResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -605,11 +652,19 @@ public CompletableFuture recursiveShapes(RecursiveShape operationMetadata, RecursiveShapesResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -673,11 +728,16 @@ public CompletableFuture rpcV2CborDenseMaps(RpcV2Cbo case "ValidationException": return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -740,11 +800,16 @@ public CompletableFuture rpcV2CborLists(RpcV2CborListsRe case "ValidationException": return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -809,11 +874,16 @@ public CompletableFuture rpcV2CborSparseMaps( case "ValidationException": return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -874,11 +944,19 @@ public CompletableFuture simpleScalarProperties( operationMetadata, SimpleScalarPropertiesResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); @@ -939,11 +1017,19 @@ public CompletableFuture sparseNullsOperation( operationMetadata, SparseNullsOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); 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 index bb027de770b0..5ef0371a3e73 100644 --- 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 @@ -130,11 +130,19 @@ public EmptyInputOutputResponse emptyInputOutput(EmptyInputOutputRequest emptyIn EmptyInputOutputResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(emptyInputOutputRequest, @@ -184,11 +192,19 @@ public Float16Response float16(Float16Request float16Request) throws AwsServiceE Float16Response::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(float16Request, this.clientConfiguration); @@ -236,11 +252,19 @@ public FractionalSecondsResponse fractionalSeconds(FractionalSecondsRequest frac FractionalSecondsResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(fractionalSecondsRequest, @@ -293,17 +317,19 @@ public GreetingWithErrorsResponse greetingWithErrors(GreetingWithErrorsRequest g operationMetadata, GreetingWithErrorsResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "ComplexError": - return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") - .exceptionBuilderSupplier(ComplexErrorException::builder).build()); + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); case "InvalidGreeting": return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(greetingWithErrorsRequest, @@ -353,11 +379,19 @@ public NoInputOutputResponse noInputOutput(NoInputOutputRequest noInputOutputReq NoInputOutputResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(noInputOutputRequest, this.clientConfiguration); @@ -410,11 +444,16 @@ public OperationWithDefaultsResponse operationWithDefaults(OperationWithDefaults case "ValidationException": return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithDefaultsRequest, @@ -464,11 +503,19 @@ public OptionalInputOutputResponse optionalInputOutput(OptionalInputOutputReques operationMetadata, OptionalInputOutputResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(optionalInputOutputRequest, @@ -518,11 +565,19 @@ public RecursiveShapesResponse recursiveShapes(RecursiveShapesRequest recursiveS RecursiveShapesResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(recursiveShapesRequest, @@ -576,11 +631,16 @@ public RpcV2CborDenseMapsResponse rpcV2CborDenseMaps(RpcV2CborDenseMapsRequest r case "ValidationException": return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(rpcV2CborDenseMapsRequest, @@ -634,11 +694,16 @@ public RpcV2CborListsResponse rpcV2CborLists(RpcV2CborListsRequest rpcV2CborList case "ValidationException": return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(rpcV2CborListsRequest, this.clientConfiguration); @@ -691,11 +756,16 @@ public RpcV2CborSparseMapsResponse rpcV2CborSparseMaps(RpcV2CborSparseMapsReques case "ValidationException": return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(rpcV2CborSparseMapsRequest, @@ -745,11 +815,19 @@ public SimpleScalarPropertiesResponse simpleScalarProperties(SimpleScalarPropert operationMetadata, SimpleScalarPropertiesResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(simpleScalarPropertiesRequest, @@ -800,11 +878,19 @@ public SparseNullsOperationResponse sparseNullsOperation(SparseNullsOperationReq operationMetadata, SparseNullsOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { switch (errorCode) { + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); default: return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(sparseNullsOperationRequest, diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-xml-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-xml-async-client-class.java index 2d8fa14da2f7..1bb83d163623 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-xml-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-xml-async-client-class.java @@ -4,11 +4,9 @@ import java.util.Collections; import java.util.List; -import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; import java.util.function.Consumer; -import java.util.function.Function; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import software.amazon.awssdk.annotations.Generated; @@ -164,19 +162,6 @@ public CompletableFuture aPostOperation(APostOperationRe HttpResponseHandler> responseHandler = protocolFactory .createCombinedResponseHandler(APostOperationResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); - - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); String hostPrefix = "foo-"; String resolvedHostExpression = "foo-"; @@ -240,19 +225,6 @@ public CompletableFuture aPostOperationWithOut .createCombinedResponseHandler(APostOperationWithOutputResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); - CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("APostOperationWithOutput").withRequestConfiguration(clientConfiguration) @@ -310,16 +282,6 @@ public CompletableFuture bearerAuthOperation( .createCombinedResponseHandler(BearerAuthOperationResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); - CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("BearerAuthOperation").withRequestConfiguration(clientConfiguration) @@ -374,6 +336,7 @@ public CompletableFuture eventStreamOperation(EventStreamOperationRequest HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( EventStreamOperationResponse::builder, XmlOperationMetadata.builder().hasStreamingSuccessResponse(true) .build()); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); HttpResponseHandler eventResponseHandler = protocolFactory.createResponseHandler( EventStreamTaggedUnionPojoSupplier.builder() .putSdkPojoSupplier("EventPayloadEvent", EventStream::eventPayloadEventBuilder) @@ -381,16 +344,6 @@ public CompletableFuture eventStreamOperation(EventStreamOperationRequest .putSdkPojoSupplier("SecondEventPayloadEvent", EventStream::secondEventPayloadEventBuilder) .defaultSdkPojoSupplier(() -> new SdkPojoBuilder(EventStream.UNKNOWN)).build(), XmlOperationMetadata .builder().hasStreamingSuccessResponse(false).build()); - - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); CompletableFuture eventStreamTransformFuture = new CompletableFuture<>(); EventStreamAsyncResponseTransformer asyncResponseTransformer = EventStreamAsyncResponseTransformer . builder().eventStreamResponseHandler(asyncResponseHandler) @@ -466,16 +419,6 @@ public CompletableFuture getOperationWithCheck .createCombinedResponseHandler(GetOperationWithChecksumResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); - CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("GetOperationWithChecksum") @@ -540,16 +483,6 @@ public CompletableFuture operationWithChe .createCombinedResponseHandler(OperationWithChecksumRequiredResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); - CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("OperationWithChecksumRequired") @@ -609,16 +542,6 @@ public CompletableFuture operationWithNoneAut .createCombinedResponseHandler(OperationWithNoneAuthTypeResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); - CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("OperationWithNoneAuthType").withRequestConfiguration(clientConfiguration) @@ -677,16 +600,6 @@ public CompletableFuture operationWithR .createCombinedResponseHandler(OperationWithRequestCompressionResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); - CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("OperationWithRequestCompression") @@ -772,15 +685,7 @@ public CompletableFuture putOperationWithChecksum( HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( PutOperationWithChecksumResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(true)); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler.execute( new ClientExecutionParams() @@ -871,16 +776,6 @@ public CompletableFuture streamingInputOperatio .createCombinedResponseHandler(StreamingInputOperationResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); - CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("StreamingInputOperation") @@ -950,15 +845,7 @@ public CompletableFuture streamingOutputOperation( HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( StreamingOutputOperationResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(true)); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler.execute( new ClientExecutionParams() @@ -999,8 +886,12 @@ public final String serviceName() { } private AwsXmlProtocolFactory init() { - return AwsXmlProtocolFactory.builder().clientConfiguration(clientConfiguration) - .defaultServiceExceptionSupplier(XmlException::builder).build(); + return AwsXmlProtocolFactory + .builder() + .registerModeledException( + ExceptionMetadata.builder().errorCode("InvalidInput") + .exceptionBuilderSupplier(InvalidInputException::builder).httpStatusCode(400).build()) + .clientConfiguration(clientConfiguration).defaultServiceExceptionSupplier(XmlException::builder).build(); } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, @@ -1070,11 +961,6 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, return configuration.build(); } - private HttpResponseHandler createErrorResponseHandler( - Function> exceptionMetadataMapper) { - return protocolFactory.createErrorResponseHandler(exceptionMetadataMapper); - } - @Override public void close() { clientHandler.close(); diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-xml-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-xml-client-class.java index 3eda14acf74a..7b0fd28b7194 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-xml-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-xml-client-class.java @@ -2,9 +2,7 @@ import java.util.Collections; import java.util.List; -import java.util.Optional; import java.util.function.Consumer; -import java.util.function.Function; import software.amazon.awssdk.annotations.Generated; import software.amazon.awssdk.annotations.SdkInternalApi; import software.amazon.awssdk.auth.token.signer.aws.BearerTokenSigner; @@ -131,19 +129,6 @@ public APostOperationResponse aPostOperation(APostOperationRequest aPostOperatio HttpResponseHandler> responseHandler = protocolFactory.createCombinedResponseHandler( APostOperationResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); - - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationRequest .overrideConfiguration().orElse(null)); @@ -193,19 +178,6 @@ public APostOperationWithOutputResponse aPostOperationWithOutput( HttpResponseHandler> responseHandler = protocolFactory .createCombinedResponseHandler(APostOperationWithOutputResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); - - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationWithOutputRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationWithOutputRequest @@ -251,16 +223,6 @@ public BearerAuthOperationResponse bearerAuthOperation(BearerAuthOperationReques HttpResponseHandler> responseHandler = protocolFactory .createCombinedResponseHandler(BearerAuthOperationResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); - - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(bearerAuthOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, bearerAuthOperationRequest @@ -306,16 +268,6 @@ public GetOperationWithChecksumResponse getOperationWithChecksum( HttpResponseHandler> responseHandler = protocolFactory .createCombinedResponseHandler(GetOperationWithChecksumResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); - - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getOperationWithChecksumRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getOperationWithChecksumRequest @@ -369,16 +321,6 @@ public OperationWithChecksumRequiredResponse operationWithChecksumRequired( HttpResponseHandler> responseHandler = protocolFactory .createCombinedResponseHandler(OperationWithChecksumRequiredResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); - - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithChecksumRequiredRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, @@ -429,16 +371,6 @@ public OperationWithNoneAuthTypeResponse operationWithNoneAuthType( HttpResponseHandler> responseHandler = protocolFactory .createCombinedResponseHandler(OperationWithNoneAuthTypeResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); - - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithNoneAuthTypeRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithNoneAuthTypeRequest @@ -485,16 +417,6 @@ public OperationWithRequestCompressionResponse operationWithRequestCompression( HttpResponseHandler> responseHandler = protocolFactory .createCombinedResponseHandler(OperationWithRequestCompressionResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); - - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithRequestCompressionRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, @@ -571,15 +493,7 @@ public ReturnT putOperationWithChecksum(PutOperationWithChecksumReques HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( PutOperationWithChecksumResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(true)); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putOperationWithChecksumRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, putOperationWithChecksumRequest @@ -653,16 +567,6 @@ public StreamingInputOperationResponse streamingInputOperation(StreamingInputOpe HttpResponseHandler> responseHandler = protocolFactory .createCombinedResponseHandler(StreamingInputOperationResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false)); - - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingInputOperationRequest @@ -722,15 +626,7 @@ public ReturnT streamingOutputOperation(StreamingOutputOperationReques HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( StreamingOutputOperationResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(true)); - Function> exceptionMetadataMapper = errorCode -> { - switch (errorCode) { - default: - return Optional.empty(); - } - }; - - HttpResponseHandler errorResponseHandler = protocolFactory - .createErrorResponseHandler(exceptionMetadataMapper); + HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingOutputOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingOutputOperationRequest @@ -784,11 +680,6 @@ private static List resolveMetricPublishers(SdkClientConfigurat return publishers; } - private HttpResponseHandler createErrorResponseHandler( - Function> exceptionMetadataMapper) { - return protocolFactory.createErrorResponseHandler(exceptionMetadataMapper); - } - private void updateRetryStrategyClientConfiguration(SdkClientConfiguration.Builder configuration) { ClientOverrideConfiguration.Builder builder = configuration.asOverrideConfigurationBuilder(); RetryMode retryMode = builder.retryMode(); @@ -827,8 +718,12 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, } private AwsXmlProtocolFactory init() { - return AwsXmlProtocolFactory.builder().clientConfiguration(clientConfiguration) - .defaultServiceExceptionSupplier(XmlException::builder).build(); + return AwsXmlProtocolFactory + .builder() + .registerModeledException( + ExceptionMetadata.builder().errorCode("InvalidInput") + .exceptionBuilderSupplier(InvalidInputException::builder).httpStatusCode(400).build()) + .clientConfiguration(clientConfiguration).defaultServiceExceptionSupplier(XmlException::builder).build(); } @Override diff --git a/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/AwsQueryProtocolFactory.java b/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/AwsQueryProtocolFactory.java index ebc8758ddcf5..bd103fecd3c7 100644 --- a/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/AwsQueryProtocolFactory.java +++ b/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/AwsQueryProtocolFactory.java @@ -21,7 +21,6 @@ import java.util.ArrayList; import java.util.List; import java.util.Optional; -import java.util.function.Function; import java.util.function.Supplier; import software.amazon.awssdk.annotations.SdkProtectedApi; import software.amazon.awssdk.awscore.AwsResponse; @@ -59,13 +58,13 @@ public class AwsQueryProtocolFactory { this.modeledExceptions = unmodifiableList(builder.modeledExceptions); this.defaultServiceExceptionSupplier = builder.defaultServiceExceptionSupplier; this.errorUnmarshaller = timeUnmarshalling(AwsXmlErrorProtocolUnmarshaller - .builder() - .defaultExceptionSupplier(defaultServiceExceptionSupplier) - .exceptions(modeledExceptions) - // We don't set result wrapper since that's handled by the errorRootExtractor - .errorUnmarshaller(QueryProtocolUnmarshaller.builder().build()) - .errorRootExtractor(this::getErrorRoot) - .build()); + .builder() + .defaultExceptionSupplier(defaultServiceExceptionSupplier) + .exceptions(modeledExceptions) + // We don't set result wrapper since that's handled by the errorRootExtractor + .errorUnmarshaller(QueryProtocolUnmarshaller.builder().build()) + .errorRootExtractor(this::getErrorRoot) + .build()); } /** @@ -110,23 +109,10 @@ public final HttpResponseHandler createResponseHandle * @return A {@link HttpResponseHandler} that will unmarshall the service exceptional response into * a modeled exception or the service base exception. */ - @Deprecated public final HttpResponseHandler createErrorResponseHandler() { return errorUnmarshaller; } - public final HttpResponseHandler createErrorResponseHandler(Function> exceptionMetadataMapper) { - return timeUnmarshalling(AwsXmlErrorProtocolUnmarshaller - .builder() - .defaultExceptionSupplier(defaultServiceExceptionSupplier) - .exceptionMetadataMapper(exceptionMetadataMapper) - // We don't set result wrapper since that's handled by the errorRootExtractor - .errorUnmarshaller(QueryProtocolUnmarshaller.builder().build()) - .errorRootExtractor(this::getErrorRoot) - .build()); - } - private MetricCollectingHttpResponseHandler timeUnmarshalling(HttpResponseHandler delegate) { return MetricCollectingHttpResponseHandler.create(CoreMetric.UNMARSHALLING_DURATION, delegate); } @@ -187,7 +173,6 @@ public final SubclassT clientConfiguration(SdkClientConfiguration clientConfigur * @param errorMetadata metadata for unmarshalling the exceptions * @return This builder for method chaining. */ - @Deprecated public final SubclassT registerModeledException(ExceptionMetadata errorMetadata) { modeledExceptions.add(errorMetadata); return getSubclass(); @@ -217,4 +202,4 @@ public AwsQueryProtocolFactory build() { return new AwsQueryProtocolFactory(this); } } -} +} \ No newline at end of file diff --git a/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/internal/unmarshall/AwsXmlErrorUnmarshaller.java b/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/internal/unmarshall/AwsXmlErrorUnmarshaller.java index 101b3f4bada0..1f1d4c3bdc16 100644 --- a/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/internal/unmarshall/AwsXmlErrorUnmarshaller.java +++ b/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/internal/unmarshall/AwsXmlErrorUnmarshaller.java @@ -20,7 +20,6 @@ import java.time.Duration; import java.util.List; import java.util.Optional; -import java.util.function.Function; import java.util.function.Supplier; import software.amazon.awssdk.annotations.SdkInternalApi; import software.amazon.awssdk.awscore.exception.AwsErrorDetails; @@ -44,7 +43,6 @@ public final class AwsXmlErrorUnmarshaller { private final List exceptions; private final Supplier defaultExceptionSupplier; - private final Function> exceptionMetadataMapper; private final XmlErrorUnmarshaller errorUnmarshaller; @@ -52,14 +50,6 @@ private AwsXmlErrorUnmarshaller(Builder builder) { this.exceptions = builder.exceptions; this.errorUnmarshaller = builder.errorUnmarshaller; this.defaultExceptionSupplier = builder.defaultExceptionSupplier; - this.exceptionMetadataMapper = builder.exceptionMetadataMapper != null - ? builder.exceptionMetadataMapper - : this::defaultMapToExceptionMetadata; - } - - private Optional defaultMapToExceptionMetadata(String errorCode) { - return exceptions.stream().filter(e -> e.errorCode().equals(errorCode)) - .findAny(); } /** @@ -132,11 +122,12 @@ private AwsServiceException.Builder defaultException() { private AwsServiceException.Builder unmarshallFromErrorCode(SdkHttpFullResponse response, XmlElement errorRoot, String errorCode) { - SdkPojo sdkPojo = exceptionMetadataMapper.apply(errorCode) - .map(ExceptionMetadata::exceptionBuilderSupplier) - .orElse(defaultExceptionSupplier) - .get(); - + SdkPojo sdkPojo = exceptions.stream() + .filter(e -> e.errorCode().equals(errorCode)) + .map(ExceptionMetadata::exceptionBuilderSupplier) + .findAny() + .orElse(defaultExceptionSupplier) + .get(); AwsServiceException.Builder builder = ((AwsServiceException) errorUnmarshaller.unmarshall(sdkPojo, errorRoot, response)).toBuilder(); @@ -213,7 +204,6 @@ public static final class Builder { private List exceptions; private Supplier defaultExceptionSupplier; private XmlErrorUnmarshaller errorUnmarshaller; - private Function> exceptionMetadataMapper; private Builder() { } @@ -229,11 +219,6 @@ public Builder exceptions(List exceptions) { return this; } - public Builder exceptionMetadataMapper(Function> exceptionMetadataMapper) { - this.exceptionMetadataMapper = exceptionMetadataMapper; - return this; - } - /** * Default exception type if "error code" does not match any known modeled exception. This is the generated * base exception for the service (i.e. DynamoDbException). @@ -264,4 +249,4 @@ public AwsXmlErrorUnmarshaller build() { return new AwsXmlErrorUnmarshaller(this); } } -} +} \ No newline at end of file diff --git a/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/unmarshall/AwsXmlErrorProtocolUnmarshaller.java b/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/unmarshall/AwsXmlErrorProtocolUnmarshaller.java index 46507a06d531..61e9dc700311 100644 --- a/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/unmarshall/AwsXmlErrorProtocolUnmarshaller.java +++ b/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/unmarshall/AwsXmlErrorProtocolUnmarshaller.java @@ -84,15 +84,12 @@ public final class AwsXmlErrorProtocolUnmarshaller implements HttpResponseHandle private final AwsXmlErrorUnmarshaller awsXmlErrorUnmarshaller; private final Function> errorRootExtractor; - private final Function> exceptionMetadataMapper; private AwsXmlErrorProtocolUnmarshaller(Builder builder) { this.errorRootExtractor = builder.errorRootExtractor; - this.exceptionMetadataMapper = builder.exceptionMetadataMapper; this.awsXmlErrorUnmarshaller = AwsXmlErrorUnmarshaller.builder() .defaultExceptionSupplier(builder.defaultExceptionSupplier) .exceptions(builder.exceptions) - .exceptionMetadataMapper(this.exceptionMetadataMapper) .errorUnmarshaller(builder.errorUnmarshaller) .build(); } @@ -164,7 +161,6 @@ public static final class Builder { private Supplier defaultExceptionSupplier; private Function> errorRootExtractor; private XmlErrorUnmarshaller errorUnmarshaller; - private Function> exceptionMetadataMapper; private Builder() { } @@ -175,17 +171,11 @@ private Builder() { * * @return This builder for method chaining. */ - @Deprecated public Builder exceptions(List exceptions) { this.exceptions = exceptions; return this; } - public Builder exceptionMetadataMapper(Function> exceptionMetadataMapper) { - this.exceptionMetadataMapper = exceptionMetadataMapper; - return this; - } - /** * Default exception type if "error code" does not match any known modeled exception. This is the generated * base exception for the service (i.e. DynamoDbException). @@ -230,4 +220,4 @@ public AwsXmlErrorProtocolUnmarshaller build() { return new AwsXmlErrorProtocolUnmarshaller(this); } } -} +} \ No newline at end of file diff --git a/core/protocols/aws-xml-protocol/src/main/java/software/amazon/awssdk/protocols/xml/AwsXmlProtocolFactory.java b/core/protocols/aws-xml-protocol/src/main/java/software/amazon/awssdk/protocols/xml/AwsXmlProtocolFactory.java index b556166cc891..fbb6d59afa4b 100644 --- a/core/protocols/aws-xml-protocol/src/main/java/software/amazon/awssdk/protocols/xml/AwsXmlProtocolFactory.java +++ b/core/protocols/aws-xml-protocol/src/main/java/software/amazon/awssdk/protocols/xml/AwsXmlProtocolFactory.java @@ -80,13 +80,11 @@ public class AwsXmlProtocolFactory { private final Supplier defaultServiceExceptionSupplier; private final HttpResponseHandler errorUnmarshaller; private final SdkClientConfiguration clientConfiguration; - private final Function> exceptionMetadataMapper; AwsXmlProtocolFactory(Builder builder) { this.modeledExceptions = unmodifiableList(builder.modeledExceptions); this.defaultServiceExceptionSupplier = builder.defaultServiceExceptionSupplier; this.clientConfiguration = builder.clientConfiguration; - this.exceptionMetadataMapper = builder.exceptionMetadataMapper; this.errorUnmarshaller = timeUnmarshalling( AwsXmlErrorProtocolUnmarshaller.builder() @@ -149,22 +147,10 @@ protected Function createErrorT .build(); } - @Deprecated public HttpResponseHandler createErrorResponseHandler() { return errorUnmarshaller; } - public HttpResponseHandler createErrorResponseHandler( - Function> exceptionMetadataMapper) { - return timeUnmarshalling( - AwsXmlErrorProtocolUnmarshaller.builder() - .defaultExceptionSupplier(defaultServiceExceptionSupplier) - .exceptionMetadataMapper(exceptionMetadataMapper) - .errorUnmarshaller(XML_PROTOCOL_UNMARSHALLER) - .errorRootExtractor(this::getErrorRoot) - .build()); - } - private MetricCollectingHttpResponseHandler timeUnmarshalling(HttpResponseHandler delegate) { return MetricCollectingHttpResponseHandler.create(CoreMetric.UNMARSHALLING_DURATION, delegate); } @@ -172,11 +158,8 @@ private MetricCollectingHttpResponseHandler timeUnmarshalling(HttpRespons public HttpResponseHandler> createCombinedResponseHandler( Supplier pojoSupplier, XmlOperationMetadata staxOperationMetadata) { - return new CombinedResponseHandler<> - (createResponseHandler(pojoSupplier, staxOperationMetadata), - this.exceptionMetadataMapper != null - ? createErrorResponseHandler(this.exceptionMetadataMapper) - : createErrorResponseHandler()); + return new CombinedResponseHandler<>(createResponseHandler(pojoSupplier, staxOperationMetadata), + createErrorResponseHandler()); } /** @@ -208,7 +191,6 @@ public static class Builder { private final List modeledExceptions = new ArrayList<>(); private Supplier defaultServiceExceptionSupplier; private SdkClientConfiguration clientConfiguration; - private Function> exceptionMetadataMapper; Builder() { } @@ -224,11 +206,6 @@ public final SubclassT registerModeledException(ExceptionMetadata errorMetadata) return getSubclass(); } - public SubclassT exceptionMetadataMapper(Function> exceptionMetadataMapper) { - this.exceptionMetadataMapper = exceptionMetadataMapper; - return getSubclass(); - } - /** * A supplier for the services base exception builder. This is used when we can't identify any modeled * exception to unmarshall into. @@ -261,4 +238,4 @@ public AwsXmlProtocolFactory build() { return new AwsXmlProtocolFactory(this); } } -} +} \ No newline at end of file From 5b61216e0e70c0aa2b6b9acd289c428b7b7e3385 Mon Sep 17 00:00:00 2001 From: Saranya Somepalli Date: Fri, 4 Apr 2025 09:18:47 -0700 Subject: [PATCH 10/22] Fixing checkstyle issues --- .../bugfix-AWSSDKforJavav2-e869e94.json | 2 +- .../poet/client/specs/JsonProtocolSpec.java | 5 +- .../poet/client/specs/XmlProtocolSpec.java | 2 +- .../query/AwsQueryProtocolFactory.java | 206 +------------- .../unmarshall/AwsXmlErrorUnmarshaller.java | 253 +----------------- .../AwsXmlErrorProtocolUnmarshaller.java | 224 +--------------- 6 files changed, 6 insertions(+), 686 deletions(-) diff --git a/.changes/next-release/bugfix-AWSSDKforJavav2-e869e94.json b/.changes/next-release/bugfix-AWSSDKforJavav2-e869e94.json index 8dfd2ca41bb2..096a10895c1c 100644 --- a/.changes/next-release/bugfix-AWSSDKforJavav2-e869e94.json +++ b/.changes/next-release/bugfix-AWSSDKforJavav2-e869e94.json @@ -2,5 +2,5 @@ "type": "bugfix", "category": "AWS SDK for Java v2", "contributor": "", - "description": "Update non-streaming error unmarshalling to use the same mapping function that was previously implemented for streaming operations." + "description": "Update non-streaming error unmarshalling to use the same mapping function that was previously implemented for streaming operations, which allows to deprecate createErrorResponseHandler(JsonOperationMetadata) method." } diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/JsonProtocolSpec.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/JsonProtocolSpec.java index 7e8b808b5df3..9c77b0869505 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/JsonProtocolSpec.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/JsonProtocolSpec.java @@ -438,10 +438,7 @@ public Optional createErrorResponseHandler() { ClassName sdkBaseException = ClassName.get(AwsServiceException.class); TypeName responseHandlerOfException = ParameterizedTypeName.get(httpResponseHandler, sdkBaseException); ParameterizedTypeName mapperType = ParameterizedTypeName.get(ClassName.get(Function.class), - ClassName.get(String.class), - ParameterizedTypeName.get(Optional.class, - ExceptionMetadata.class)); - + ClassName.get(String.class), ParameterizedTypeName.get(Optional.class, ExceptionMetadata.class)); return Optional.of(MethodSpec.methodBuilder("createErrorResponseHandler") .addParameter(BaseAwsJsonProtocolFactory.class, "protocolFactory") .addParameter(JsonOperationMetadata.class, "operationMetadata") diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/XmlProtocolSpec.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/XmlProtocolSpec.java index fa74e890f7ee..b31c9537f07f 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/XmlProtocolSpec.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/XmlProtocolSpec.java @@ -91,7 +91,7 @@ public CodeBlock responseHandler(IntermediateModel model, return CodeBlock.builder() .addStatement("\n\n$T responseHandler = protocolFactory.createCombinedResponseHandler($T::builder, " + "new $T().withHasStreamingSuccessResponse($L))", - handlerType, responseType, XmlOperationMetadata.class, opModel.hasStreamingOutput()) + handlerType, responseType, XmlOperationMetadata.class, opModel.hasStreamingOutput()) .build(); } diff --git a/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/AwsQueryProtocolFactory.java b/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/AwsQueryProtocolFactory.java index bd103fecd3c7..7e4d17b3ee38 100644 --- a/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/AwsQueryProtocolFactory.java +++ b/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/AwsQueryProtocolFactory.java @@ -1,205 +1 @@ -/* - * 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.protocols.query; - -import static java.util.Collections.unmodifiableList; - -import java.net.URI; -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; -import java.util.function.Supplier; -import software.amazon.awssdk.annotations.SdkProtectedApi; -import software.amazon.awssdk.awscore.AwsResponse; -import software.amazon.awssdk.awscore.exception.AwsServiceException; -import software.amazon.awssdk.core.ClientEndpointProvider; -import software.amazon.awssdk.core.SdkPojo; -import software.amazon.awssdk.core.client.config.SdkClientConfiguration; -import software.amazon.awssdk.core.client.config.SdkClientOption; -import software.amazon.awssdk.core.http.HttpResponseHandler; -import software.amazon.awssdk.core.http.MetricCollectingHttpResponseHandler; -import software.amazon.awssdk.core.metrics.CoreMetric; -import software.amazon.awssdk.http.SdkHttpFullRequest; -import software.amazon.awssdk.protocols.core.ExceptionMetadata; -import software.amazon.awssdk.protocols.core.OperationInfo; -import software.amazon.awssdk.protocols.core.ProtocolMarshaller; -import software.amazon.awssdk.protocols.query.internal.marshall.QueryProtocolMarshaller; -import software.amazon.awssdk.protocols.query.internal.unmarshall.AwsQueryResponseHandler; -import software.amazon.awssdk.protocols.query.internal.unmarshall.QueryProtocolUnmarshaller; -import software.amazon.awssdk.protocols.query.unmarshall.AwsXmlErrorProtocolUnmarshaller; -import software.amazon.awssdk.protocols.query.unmarshall.XmlElement; - -/** - * Protocol factory for the AWS/Query protocol. - */ -@SdkProtectedApi -public class AwsQueryProtocolFactory { - - private final SdkClientConfiguration clientConfiguration; - private final List modeledExceptions; - private final Supplier defaultServiceExceptionSupplier; - private final MetricCollectingHttpResponseHandler errorUnmarshaller; - - AwsQueryProtocolFactory(Builder builder) { - this.clientConfiguration = builder.clientConfiguration; - this.modeledExceptions = unmodifiableList(builder.modeledExceptions); - this.defaultServiceExceptionSupplier = builder.defaultServiceExceptionSupplier; - this.errorUnmarshaller = timeUnmarshalling(AwsXmlErrorProtocolUnmarshaller - .builder() - .defaultExceptionSupplier(defaultServiceExceptionSupplier) - .exceptions(modeledExceptions) - // We don't set result wrapper since that's handled by the errorRootExtractor - .errorUnmarshaller(QueryProtocolUnmarshaller.builder().build()) - .errorRootExtractor(this::getErrorRoot) - .build()); - } - - /** - * Creates a new marshaller for the given request. - * - * @param operationInfo Object containing metadata about the operation. - * @return New {@link ProtocolMarshaller}. - */ - public final ProtocolMarshaller createProtocolMarshaller( - OperationInfo operationInfo) { - return QueryProtocolMarshaller.builder() - .endpoint(endpoint(clientConfiguration)) - .operationInfo(operationInfo) - .isEc2(isEc2()) - .build(); - } - - private URI endpoint(SdkClientConfiguration clientConfiguration) { - ClientEndpointProvider endpointProvider = clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER); - if (endpointProvider != null) { - return endpointProvider.clientEndpoint(); - } - - // Some old client versions may not use the endpoint provider. In that case, use the legacy endpoint field. - return clientConfiguration.option(SdkClientOption.ENDPOINT); - } - - /** - * Creates the success response handler to unmarshall the response into a POJO. - * - * @param pojoSupplier Supplier of the POJO builder we are unmarshalling into. - * @param Type being unmarshalled. - * @return New {@link HttpResponseHandler} for success responses. - */ - public final HttpResponseHandler createResponseHandler(Supplier pojoSupplier) { - return timeUnmarshalling(new AwsQueryResponseHandler<>(QueryProtocolUnmarshaller.builder() - .hasResultWrapper(!isEc2()) - .build(), r -> pojoSupplier.get())); - } - - /** - * @return A {@link HttpResponseHandler} that will unmarshall the service exceptional response into - * a modeled exception or the service base exception. - */ - public final HttpResponseHandler createErrorResponseHandler() { - return errorUnmarshaller; - } - - private MetricCollectingHttpResponseHandler timeUnmarshalling(HttpResponseHandler delegate) { - return MetricCollectingHttpResponseHandler.create(CoreMetric.UNMARSHALLING_DURATION, delegate); - } - - /** - * Extracts the element from the root XML document. Method is protected as EC2 has a slightly - * different location. - * - * @param document Root XML document. - * @return If error root is found than a fulfilled {@link Optional}, otherwise an empty one. - */ - Optional getErrorRoot(XmlElement document) { - return document.getOptionalElementByName("Error"); - } - - /** - * EC2 has a few distinct differences from query so we wire things up a bit differently. - */ - boolean isEc2() { - return false; - } - - /** - * @return New Builder instance. - */ - public static Builder builder() { - return new Builder(); - } - - /** - * Builder for {@link AwsQueryProtocolFactory}. - * - * @param Subclass of Builder for fluent method chaining. - */ - public static class Builder { - - private final List modeledExceptions = new ArrayList<>(); - private SdkClientConfiguration clientConfiguration; - private Supplier defaultServiceExceptionSupplier; - - Builder() { - } - - /** - * Sets the {@link SdkClientConfiguration} which contains the service endpoint. - * - * @param clientConfiguration Configuration of the client. - * @return This builder for method chaining. - */ - public final SubclassT clientConfiguration(SdkClientConfiguration clientConfiguration) { - this.clientConfiguration = clientConfiguration; - return getSubclass(); - } - - /** - * Registers a new modeled exception by the error code. - * - * @param errorMetadata metadata for unmarshalling the exceptions - * @return This builder for method chaining. - */ - public final SubclassT registerModeledException(ExceptionMetadata errorMetadata) { - modeledExceptions.add(errorMetadata); - return getSubclass(); - } - - /** - * A supplier for the services base exception builder. This is used when we can't identify any modeled - * exception to unmarshall into. - * - * @param exceptionBuilderSupplier Suppplier of the base service exceptions Builder. - * @return This builder for method chaining. - */ - public final SubclassT defaultServiceExceptionSupplier(Supplier exceptionBuilderSupplier) { - this.defaultServiceExceptionSupplier = exceptionBuilderSupplier; - return getSubclass(); - } - - @SuppressWarnings("unchecked") - private SubclassT getSubclass() { - return (SubclassT) this; - } - - /** - * @return New instance of {@link AwsQueryProtocolFactory}. - */ - public AwsQueryProtocolFactory build() { - return new AwsQueryProtocolFactory(this); - } - } -} \ No newline at end of file +/* * 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.protocols.query; import static java.util.Collections.unmodifiableList; import java.net.URI; import java.util.ArrayList; import java.util.List; import java.util.Optional; import java.util.function.Supplier; import software.amazon.awssdk.annotations.SdkProtectedApi; import software.amazon.awssdk.awscore.AwsResponse; import software.amazon.awssdk.awscore.exception.AwsServiceException; import software.amazon.awssdk.core.ClientEndpointProvider; import software.amazon.awssdk.core.SdkPojo; import software.amazon.awssdk.core.client.config.SdkClientConfiguration; import software.amazon.awssdk.core.client.config.SdkClientOption; import software.amazon.awssdk.core.http.HttpResponseHandler; import software.amazon.awssdk.core.http.MetricCollectingHttpResponseHandler; import software.amazon.awssdk.core.metrics.CoreMetric; import software.amazon.awssdk.http.SdkHttpFullRequest; import software.amazon.awssdk.protocols.core.ExceptionMetadata; import software.amazon.awssdk.protocols.core.OperationInfo; import software.amazon.awssdk.protocols.core.ProtocolMarshaller; import software.amazon.awssdk.protocols.query.internal.marshall.QueryProtocolMarshaller; import software.amazon.awssdk.protocols.query.internal.unmarshall.AwsQueryResponseHandler; import software.amazon.awssdk.protocols.query.internal.unmarshall.QueryProtocolUnmarshaller; import software.amazon.awssdk.protocols.query.unmarshall.AwsXmlErrorProtocolUnmarshaller; import software.amazon.awssdk.protocols.query.unmarshall.XmlElement; /** * Protocol factory for the AWS/Query protocol. */ @SdkProtectedApi public class AwsQueryProtocolFactory { private final SdkClientConfiguration clientConfiguration; private final List modeledExceptions; private final Supplier defaultServiceExceptionSupplier; private final MetricCollectingHttpResponseHandler errorUnmarshaller; AwsQueryProtocolFactory(Builder builder) { this.clientConfiguration = builder.clientConfiguration; this.modeledExceptions = unmodifiableList(builder.modeledExceptions); this.defaultServiceExceptionSupplier = builder.defaultServiceExceptionSupplier; this.errorUnmarshaller = timeUnmarshalling(AwsXmlErrorProtocolUnmarshaller .builder() .defaultExceptionSupplier(defaultServiceExceptionSupplier) .exceptions(modeledExceptions) // We don't set result wrapper since that's handled by the errorRootExtractor .errorUnmarshaller(QueryProtocolUnmarshaller.builder().build()) .errorRootExtractor(this::getErrorRoot) .build()); } /** * Creates a new marshaller for the given request. * * @param operationInfo Object containing metadata about the operation. * @return New {@link ProtocolMarshaller}. */ public final ProtocolMarshaller createProtocolMarshaller( OperationInfo operationInfo) { return QueryProtocolMarshaller.builder() .endpoint(endpoint(clientConfiguration)) .operationInfo(operationInfo) .isEc2(isEc2()) .build(); } private URI endpoint(SdkClientConfiguration clientConfiguration) { ClientEndpointProvider endpointProvider = clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER); if (endpointProvider != null) { return endpointProvider.clientEndpoint(); } // Some old client versions may not use the endpoint provider. In that case, use the legacy endpoint field. return clientConfiguration.option(SdkClientOption.ENDPOINT); } /** * Creates the success response handler to unmarshall the response into a POJO. * * @param pojoSupplier Supplier of the POJO builder we are unmarshalling into. * @param Type being unmarshalled. * @return New {@link HttpResponseHandler} for success responses. */ public final HttpResponseHandler createResponseHandler(Supplier pojoSupplier) { return timeUnmarshalling(new AwsQueryResponseHandler<>(QueryProtocolUnmarshaller.builder() .hasResultWrapper(!isEc2()) .build(), r -> pojoSupplier.get())); } /** * @return A {@link HttpResponseHandler} that will unmarshall the service exceptional response into * a modeled exception or the service base exception. */ public final HttpResponseHandler createErrorResponseHandler() { return errorUnmarshaller; } private MetricCollectingHttpResponseHandler timeUnmarshalling(HttpResponseHandler delegate) { return MetricCollectingHttpResponseHandler.create(CoreMetric.UNMARSHALLING_DURATION, delegate); } /** * Extracts the element from the root XML document. Method is protected as EC2 has a slightly * different location. * * @param document Root XML document. * @return If error root is found than a fulfilled {@link Optional}, otherwise an empty one. */ Optional getErrorRoot(XmlElement document) { return document.getOptionalElementByName("Error"); } /** * EC2 has a few distinct differences from query so we wire things up a bit differently. */ boolean isEc2() { return false; } /** * @return New Builder instance. */ public static Builder builder() { return new Builder(); } /** * Builder for {@link AwsQueryProtocolFactory}. * * @param Subclass of Builder for fluent method chaining. */ public static class Builder { private final List modeledExceptions = new ArrayList<>(); private SdkClientConfiguration clientConfiguration; private Supplier defaultServiceExceptionSupplier; Builder() { } /** * Sets the {@link SdkClientConfiguration} which contains the service endpoint. * * @param clientConfiguration Configuration of the client. * @return This builder for method chaining. */ public final SubclassT clientConfiguration(SdkClientConfiguration clientConfiguration) { this.clientConfiguration = clientConfiguration; return getSubclass(); } /** * Registers a new modeled exception by the error code. * * @param errorMetadata metadata for unmarshalling the exceptions * @return This builder for method chaining. */ public final SubclassT registerModeledException(ExceptionMetadata errorMetadata) { modeledExceptions.add(errorMetadata); return getSubclass(); } /** * A supplier for the services base exception builder. This is used when we can't identify any modeled * exception to unmarshall into. * * @param exceptionBuilderSupplier Suppplier of the base service exceptions Builder. * @return This builder for method chaining. */ public final SubclassT defaultServiceExceptionSupplier(Supplier exceptionBuilderSupplier) { this.defaultServiceExceptionSupplier = exceptionBuilderSupplier; return getSubclass(); } @SuppressWarnings("unchecked") private SubclassT getSubclass() { return (SubclassT) this; } /** * @return New instance of {@link AwsQueryProtocolFactory}. */ public AwsQueryProtocolFactory build() { return new AwsQueryProtocolFactory(this); } } } \ No newline at end of file diff --git a/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/internal/unmarshall/AwsXmlErrorUnmarshaller.java b/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/internal/unmarshall/AwsXmlErrorUnmarshaller.java index 1f1d4c3bdc16..a4e94975bf6b 100644 --- a/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/internal/unmarshall/AwsXmlErrorUnmarshaller.java +++ b/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/internal/unmarshall/AwsXmlErrorUnmarshaller.java @@ -1,252 +1 @@ -/* - * 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.protocols.query.internal.unmarshall; - -import static software.amazon.awssdk.utils.FunctionalUtils.invokeSafely; - -import java.time.Duration; -import java.util.List; -import java.util.Optional; -import java.util.function.Supplier; -import software.amazon.awssdk.annotations.SdkInternalApi; -import software.amazon.awssdk.awscore.exception.AwsErrorDetails; -import software.amazon.awssdk.awscore.exception.AwsServiceException; -import software.amazon.awssdk.core.SdkBytes; -import software.amazon.awssdk.core.SdkPojo; -import software.amazon.awssdk.core.http.HttpResponseHandler; -import software.amazon.awssdk.core.interceptor.ExecutionAttributes; -import software.amazon.awssdk.core.interceptor.SdkExecutionAttribute; -import software.amazon.awssdk.http.SdkHttpFullResponse; -import software.amazon.awssdk.protocols.core.ExceptionMetadata; -import software.amazon.awssdk.protocols.query.unmarshall.XmlElement; -import software.amazon.awssdk.protocols.query.unmarshall.XmlErrorUnmarshaller; - -/** - * Unmarshalls an AWS XML exception from parsed XML. - */ -@SdkInternalApi -public final class AwsXmlErrorUnmarshaller { - private static final String X_AMZ_ID_2_HEADER = "x-amz-id-2"; - - private final List exceptions; - private final Supplier defaultExceptionSupplier; - - private final XmlErrorUnmarshaller errorUnmarshaller; - - private AwsXmlErrorUnmarshaller(Builder builder) { - this.exceptions = builder.exceptions; - this.errorUnmarshaller = builder.errorUnmarshaller; - this.defaultExceptionSupplier = builder.defaultExceptionSupplier; - } - - /** - * @return New Builder instance. - */ - public static Builder builder() { - return new Builder(); - } - - /** - * Unmarshal an AWS XML exception - * @param documentRoot The parsed payload document - * @param errorRoot The specific element of the parsed payload document that contains the error to be marshalled - * or empty if it could not be located. - * @param documentBytes The raw bytes of the original payload document if they are available - * @param response The HTTP response object - * @param executionAttributes {@link ExecutionAttributes} for the current execution - * @return An {@link AwsServiceException} unmarshalled from the XML. - */ - public AwsServiceException unmarshall(XmlElement documentRoot, - Optional errorRoot, - Optional documentBytes, - SdkHttpFullResponse response, - ExecutionAttributes executionAttributes) { - String errorCode = getErrorCode(errorRoot); - - AwsServiceException.Builder builder = errorRoot - .map(e -> invokeSafely(() -> unmarshallFromErrorCode(response, e, errorCode))) - .orElseGet(this::defaultException); - - AwsErrorDetails awsErrorDetails = - AwsErrorDetails.builder() - .errorCode(errorCode) - .errorMessage(builder.message()) - .rawResponse(documentBytes.orElse(null)) - .sdkHttpResponse(response) - .serviceName(executionAttributes.getAttribute(SdkExecutionAttribute.SERVICE_NAME)) - .build(); - - builder.requestId(getRequestId(response, documentRoot)) - .extendedRequestId(getExtendedRequestId(response)) - .statusCode(response.statusCode()) - .clockSkew(getClockSkew(executionAttributes)) - .awsErrorDetails(awsErrorDetails); - - return builder.build(); - } - - private Duration getClockSkew(ExecutionAttributes executionAttributes) { - Integer timeOffset = executionAttributes.getAttribute(SdkExecutionAttribute.TIME_OFFSET); - return timeOffset == null ? null : Duration.ofSeconds(timeOffset); - } - - /** - * @return Builder for the default service exception. Used when the error code doesn't match - * any known modeled exception or when we can't determine the error code. - */ - private AwsServiceException.Builder defaultException() { - return (AwsServiceException.Builder) defaultExceptionSupplier.get(); - } - - /** - * Unmarshalls the XML into the appropriate modeled exception based on the error code. If the error code - * is not present or does not match any known exception we unmarshall into the base service exception. - * - * @param errorRoot Root of element. Contains any modeled fields of the exception. - * @param errorCode Error code identifying the modeled exception. - * @return Unmarshalled exception builder. - */ - private AwsServiceException.Builder unmarshallFromErrorCode(SdkHttpFullResponse response, - XmlElement errorRoot, - String errorCode) { - SdkPojo sdkPojo = exceptions.stream() - .filter(e -> e.errorCode().equals(errorCode)) - .map(ExceptionMetadata::exceptionBuilderSupplier) - .findAny() - .orElse(defaultExceptionSupplier) - .get(); - - AwsServiceException.Builder builder = - ((AwsServiceException) errorUnmarshaller.unmarshall(sdkPojo, errorRoot, response)).toBuilder(); - builder.message(getMessage(errorRoot)); - return builder; - } - - /** - * Extracts the error code (used to identify the modeled exception) from the - * element. - * - * @param errorRoot Error element root. - * @return Error code or null if not present. - */ - private String getErrorCode(Optional errorRoot) { - return errorRoot.map(e -> e.getOptionalElementByName("Code") - .map(XmlElement::textContent) - .orElse(null)) - .orElse(null); - } - - /** - * Extracts the error message from the XML document. The message is in the - * element for all services. - * - * @param errorRoot Error element root. - * @return Error message or null if not present. - */ - private String getMessage(XmlElement errorRoot) { - return errorRoot.getOptionalElementByName("Message") - .map(XmlElement::textContent) - .orElse(null); - } - - /** - * Extracts the request ID from the XML document. Request ID is a top level element - * for all protocols, it may be RequestId or RequestID depending on the service. - * - * @param document Root XML document. - * @return Request ID string or null if not present. - */ - private String getRequestId(SdkHttpFullResponse response, XmlElement document) { - XmlElement requestId = document.getOptionalElementByName("RequestId") - .orElseGet(() -> document.getElementByName("RequestID")); - return requestId != null ? - requestId.textContent() : - matchRequestIdHeaders(response); - } - - private String matchRequestIdHeaders(SdkHttpFullResponse response) { - return HttpResponseHandler.X_AMZN_REQUEST_ID_HEADERS.stream() - .map(h -> response.firstMatchingHeader(h)) - .filter(Optional::isPresent) - .map(Optional::get) - .findFirst() - .orElse(null); - } - - /** - * Extracts the extended request ID from the response headers. - * - * @param response The HTTP response object. - * @return Extended Request ID string or null if not present. - */ - private String getExtendedRequestId(SdkHttpFullResponse response) { - return response.firstMatchingHeader(X_AMZ_ID_2_HEADER).orElse(null); - } - - /** - * Builder for {@link AwsXmlErrorUnmarshaller}. - */ - public static final class Builder { - - private List exceptions; - private Supplier defaultExceptionSupplier; - private XmlErrorUnmarshaller errorUnmarshaller; - - private Builder() { - } - - /** - * List of {@link ExceptionMetadata} to represent the modeled exceptions for the service. - * For AWS services the error type is a string representing the type of the modeled exception. - * - * @return This builder for method chaining. - */ - public Builder exceptions(List exceptions) { - this.exceptions = exceptions; - return this; - } - - /** - * Default exception type if "error code" does not match any known modeled exception. This is the generated - * base exception for the service (i.e. DynamoDbException). - * - * @return This builder for method chaining. - */ - public Builder defaultExceptionSupplier(Supplier defaultExceptionSupplier) { - this.defaultExceptionSupplier = defaultExceptionSupplier; - return this; - } - - /** - * The unmarshaller to use. The unmarshaller only unmarshalls any modeled fields of the exception, - * additional metadata is extracted by {@link AwsXmlErrorUnmarshaller}. - * - * @param errorUnmarshaller Error unmarshaller to use. - * @return This builder for method chaining. - */ - public Builder errorUnmarshaller(XmlErrorUnmarshaller errorUnmarshaller) { - this.errorUnmarshaller = errorUnmarshaller; - return this; - } - - /** - * @return New instance of {@link AwsXmlErrorUnmarshaller}. - */ - public AwsXmlErrorUnmarshaller build() { - return new AwsXmlErrorUnmarshaller(this); - } - } -} \ No newline at end of file +/* * 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.protocols.query.internal.unmarshall; import static software.amazon.awssdk.utils.FunctionalUtils.invokeSafely; import java.time.Duration; import java.util.List; import java.util.Optional; import java.util.function.Supplier; import software.amazon.awssdk.annotations.SdkInternalApi; import software.amazon.awssdk.awscore.exception.AwsErrorDetails; import software.amazon.awssdk.awscore.exception.AwsServiceException; import software.amazon.awssdk.core.SdkBytes; import software.amazon.awssdk.core.SdkPojo; import software.amazon.awssdk.core.http.HttpResponseHandler; import software.amazon.awssdk.core.interceptor.ExecutionAttributes; import software.amazon.awssdk.core.interceptor.SdkExecutionAttribute; import software.amazon.awssdk.http.SdkHttpFullResponse; import software.amazon.awssdk.protocols.core.ExceptionMetadata; import software.amazon.awssdk.protocols.query.unmarshall.XmlElement; import software.amazon.awssdk.protocols.query.unmarshall.XmlErrorUnmarshaller; /** * Unmarshalls an AWS XML exception from parsed XML. */ @SdkInternalApi public final class AwsXmlErrorUnmarshaller { private static final String X_AMZ_ID_2_HEADER = "x-amz-id-2"; private final List exceptions; private final Supplier defaultExceptionSupplier; private final XmlErrorUnmarshaller errorUnmarshaller; private AwsXmlErrorUnmarshaller(Builder builder) { this.exceptions = builder.exceptions; this.errorUnmarshaller = builder.errorUnmarshaller; this.defaultExceptionSupplier = builder.defaultExceptionSupplier; } /** * @return New Builder instance. */ public static Builder builder() { return new Builder(); } /** * Unmarshal an AWS XML exception * @param documentRoot The parsed payload document * @param errorRoot The specific element of the parsed payload document that contains the error to be marshalled * or empty if it could not be located. * @param documentBytes The raw bytes of the original payload document if they are available * @param response The HTTP response object * @param executionAttributes {@link ExecutionAttributes} for the current execution * @return An {@link AwsServiceException} unmarshalled from the XML. */ public AwsServiceException unmarshall(XmlElement documentRoot, Optional errorRoot, Optional documentBytes, SdkHttpFullResponse response, ExecutionAttributes executionAttributes) { String errorCode = getErrorCode(errorRoot); AwsServiceException.Builder builder = errorRoot .map(e -> invokeSafely(() -> unmarshallFromErrorCode(response, e, errorCode))) .orElseGet(this::defaultException); AwsErrorDetails awsErrorDetails = AwsErrorDetails.builder() .errorCode(errorCode) .errorMessage(builder.message()) .rawResponse(documentBytes.orElse(null)) .sdkHttpResponse(response) .serviceName(executionAttributes.getAttribute(SdkExecutionAttribute.SERVICE_NAME)) .build(); builder.requestId(getRequestId(response, documentRoot)) .extendedRequestId(getExtendedRequestId(response)) .statusCode(response.statusCode()) .clockSkew(getClockSkew(executionAttributes)) .awsErrorDetails(awsErrorDetails); return builder.build(); } private Duration getClockSkew(ExecutionAttributes executionAttributes) { Integer timeOffset = executionAttributes.getAttribute(SdkExecutionAttribute.TIME_OFFSET); return timeOffset == null ? null : Duration.ofSeconds(timeOffset); } /** * @return Builder for the default service exception. Used when the error code doesn't match * any known modeled exception or when we can't determine the error code. */ private AwsServiceException.Builder defaultException() { return (AwsServiceException.Builder) defaultExceptionSupplier.get(); } /** * Unmarshalls the XML into the appropriate modeled exception based on the error code. If the error code * is not present or does not match any known exception we unmarshall into the base service exception. * * @param errorRoot Root of element. Contains any modeled fields of the exception. * @param errorCode Error code identifying the modeled exception. * @return Unmarshalled exception builder. */ private AwsServiceException.Builder unmarshallFromErrorCode(SdkHttpFullResponse response, XmlElement errorRoot, String errorCode) { SdkPojo sdkPojo = exceptions.stream() .filter(e -> e.errorCode().equals(errorCode)) .map(ExceptionMetadata::exceptionBuilderSupplier) .findAny() .orElse(defaultExceptionSupplier) .get(); AwsServiceException.Builder builder = ((AwsServiceException) errorUnmarshaller.unmarshall(sdkPojo, errorRoot, response)).toBuilder(); builder.message(getMessage(errorRoot)); return builder; } /** * Extracts the error code (used to identify the modeled exception) from the * element. * * @param errorRoot Error element root. * @return Error code or null if not present. */ private String getErrorCode(Optional errorRoot) { return errorRoot.map(e -> e.getOptionalElementByName("Code") .map(XmlElement::textContent) .orElse(null)) .orElse(null); } /** * Extracts the error message from the XML document. The message is in the * element for all services. * * @param errorRoot Error element root. * @return Error message or null if not present. */ private String getMessage(XmlElement errorRoot) { return errorRoot.getOptionalElementByName("Message") .map(XmlElement::textContent) .orElse(null); } /** * Extracts the request ID from the XML document. Request ID is a top level element * for all protocols, it may be RequestId or RequestID depending on the service. * * @param document Root XML document. * @return Request ID string or null if not present. */ private String getRequestId(SdkHttpFullResponse response, XmlElement document) { XmlElement requestId = document.getOptionalElementByName("RequestId") .orElseGet(() -> document.getElementByName("RequestID")); return requestId != null ? requestId.textContent() : matchRequestIdHeaders(response); } private String matchRequestIdHeaders(SdkHttpFullResponse response) { return HttpResponseHandler.X_AMZN_REQUEST_ID_HEADERS.stream() .map(h -> response.firstMatchingHeader(h)) .filter(Optional::isPresent) .map(Optional::get) .findFirst() .orElse(null); } /** * Extracts the extended request ID from the response headers. * * @param response The HTTP response object. * @return Extended Request ID string or null if not present. */ private String getExtendedRequestId(SdkHttpFullResponse response) { return response.firstMatchingHeader(X_AMZ_ID_2_HEADER).orElse(null); } /** * Builder for {@link AwsXmlErrorUnmarshaller}. */ public static final class Builder { private List exceptions; private Supplier defaultExceptionSupplier; private XmlErrorUnmarshaller errorUnmarshaller; private Builder() { } /** * List of {@link ExceptionMetadata} to represent the modeled exceptions for the service. * For AWS services the error type is a string representing the type of the modeled exception. * * @return This builder for method chaining. */ public Builder exceptions(List exceptions) { this.exceptions = exceptions; return this; } /** * Default exception type if "error code" does not match any known modeled exception. This is the generated * base exception for the service (i.e. DynamoDbException). * * @return This builder for method chaining. */ public Builder defaultExceptionSupplier(Supplier defaultExceptionSupplier) { this.defaultExceptionSupplier = defaultExceptionSupplier; return this; } /** * The unmarshaller to use. The unmarshaller only unmarshalls any modeled fields of the exception, * additional metadata is extracted by {@link AwsXmlErrorUnmarshaller}. * * @param errorUnmarshaller Error unmarshaller to use. * @return This builder for method chaining. */ public Builder errorUnmarshaller(XmlErrorUnmarshaller errorUnmarshaller) { this.errorUnmarshaller = errorUnmarshaller; return this; } /** * @return New instance of {@link AwsXmlErrorUnmarshaller}. */ public AwsXmlErrorUnmarshaller build() { return new AwsXmlErrorUnmarshaller(this); } } } \ No newline at end of file diff --git a/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/unmarshall/AwsXmlErrorProtocolUnmarshaller.java b/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/unmarshall/AwsXmlErrorProtocolUnmarshaller.java index 61e9dc700311..c4bc283789aa 100644 --- a/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/unmarshall/AwsXmlErrorProtocolUnmarshaller.java +++ b/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/unmarshall/AwsXmlErrorProtocolUnmarshaller.java @@ -1,223 +1 @@ -/* - * 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.protocols.query.unmarshall; - -import java.io.IOException; -import java.util.List; -import java.util.Optional; -import java.util.function.Function; -import java.util.function.Supplier; -import software.amazon.awssdk.annotations.SdkProtectedApi; -import software.amazon.awssdk.awscore.exception.AwsErrorDetails; -import software.amazon.awssdk.awscore.exception.AwsServiceException; -import software.amazon.awssdk.core.SdkBytes; -import software.amazon.awssdk.core.SdkPojo; -import software.amazon.awssdk.core.http.HttpResponseHandler; -import software.amazon.awssdk.core.interceptor.ExecutionAttributes; -import software.amazon.awssdk.http.SdkHttpFullResponse; -import software.amazon.awssdk.protocols.core.ExceptionMetadata; -import software.amazon.awssdk.protocols.query.internal.unmarshall.AwsXmlErrorUnmarshaller; -import software.amazon.awssdk.utils.Pair; - -/** - * Error unmarshaller for Query/EC2/XML based protocols. Some examples of error responses from - * the various protocols are below. - * - *

Legacy Query (SimpleDB/EC2)

- *
- * {@code
- * 
- *    
- *       
- *          MissingParameter
- *          The request must contain the parameter DomainName
- *          0.0055590278
- *       
- *    
- *    ad3280dd-5ac1-efd1-b9b0-a86969a9234d
- * 
- * }
- * 
- * - *

Traditional Query/Rest-XML (Cloudfront)

- *
- * {@code
- * 
- *    
- *       Sender
- *       MalformedInput
- *       Invalid XML document
- *    
- *    7c8da4af-de44-11e8-a60e-1b2014315455
- * 
- * }
- * 
- * - *

Amazon S3

- *
- * {@code
- * 
- *    NoSuchBucket
- *    The specified bucket does not exist
- *    flajdfadjfladjf
- *    D9DBB9F267849CA3
- *    fn8B1fUvWzg7I3CIeMT4UMqCZDF4+QO1JlbOJlQAVOosACZsLWv/K2dapVncz34a2mArhp11PjI=
- * 
- * }
- * 
- */ -@SdkProtectedApi -public final class AwsXmlErrorProtocolUnmarshaller implements HttpResponseHandler { - - private final AwsXmlErrorUnmarshaller awsXmlErrorUnmarshaller; - private final Function> errorRootExtractor; - - private AwsXmlErrorProtocolUnmarshaller(Builder builder) { - this.errorRootExtractor = builder.errorRootExtractor; - this.awsXmlErrorUnmarshaller = AwsXmlErrorUnmarshaller.builder() - .defaultExceptionSupplier(builder.defaultExceptionSupplier) - .exceptions(builder.exceptions) - .errorUnmarshaller(builder.errorUnmarshaller) - .build(); - } - - @Override - public AwsServiceException handle(SdkHttpFullResponse response, ExecutionAttributes executionAttributes) { - Pair xmlAndBytes = parseXml(response); - XmlElement document = xmlAndBytes.left(); - Optional errorRoot = errorRootExtractor.apply(document); - return awsXmlErrorUnmarshaller.unmarshall(document, errorRoot, Optional.of(xmlAndBytes.right()), response, - executionAttributes); - } - - /** - * Parse the response content into an XML document. If we fail to read the content or the XML is malformed - * we still return an empty {@link XmlElement} so that unmarshalling can proceed. In those failure - * cases we can't parse out the error code so we'd unmarshall into a generic service exception. - * - * @param response HTTP response. - * @return Pair of the parsed {@link XmlElement} and the raw bytes of the response. - */ - private Pair parseXml(SdkHttpFullResponse response) { - SdkBytes bytes = getResponseBytes(response); - try { - return Pair.of(XmlDomParser.parse(bytes.asInputStream()), bytes); - } catch (Exception e) { - return Pair.of(XmlElement.empty(), bytes); - } - } - - /** - * Buffers the response content into an {@link SdkBytes} object. Used to fill the {@link AwsErrorDetails}. If - * an {@link IOException} occurs then this will return {@link #emptyXmlBytes()} so that unmarshalling can proceed. - * - * @param response HTTP response. - * @return Raw bytes of response. - */ - private SdkBytes getResponseBytes(SdkHttpFullResponse response) { - try { - return response.content() - .map(SdkBytes::fromInputStream) - .orElseGet(this::emptyXmlBytes); - } catch (Exception e) { - return emptyXmlBytes(); - } - } - - /** - * @return Dummy XML document to allow unmarshalling when response can't be read/parsed. - */ - private SdkBytes emptyXmlBytes() { - return SdkBytes.fromUtf8String(""); - } - - - /** - * @return New Builder instance. - */ - public static Builder builder() { - return new Builder(); - } - - /** - * Builder for {@link AwsXmlErrorProtocolUnmarshaller}. - */ - public static final class Builder { - - private List exceptions; - private Supplier defaultExceptionSupplier; - private Function> errorRootExtractor; - private XmlErrorUnmarshaller errorUnmarshaller; - - private Builder() { - } - - /** - * List of {@link ExceptionMetadata} to represent the modeled exceptions for the service. - * For AWS services the error type is a string representing the type of the modeled exception. - * - * @return This builder for method chaining. - */ - public Builder exceptions(List exceptions) { - this.exceptions = exceptions; - return this; - } - - /** - * Default exception type if "error code" does not match any known modeled exception. This is the generated - * base exception for the service (i.e. DynamoDbException). - * - * @return This builder for method chaining. - */ - public Builder defaultExceptionSupplier(Supplier defaultExceptionSupplier) { - this.defaultExceptionSupplier = defaultExceptionSupplier; - return this; - } - - /** - * Extracts the element from the top level XML document. Different protocols have slightly - * different formats for where the Error element is located. The error root of the XML document contains - * the code, message and any modeled fields of the exception. See javadocs of - * {@link AwsXmlErrorProtocolUnmarshaller} for examples. - * - * @param errorRootExtractor Function that extracts the element from the root XML document. - * @return This builder for method chaining. - */ - public Builder errorRootExtractor(Function> errorRootExtractor) { - this.errorRootExtractor = errorRootExtractor; - return this; - } - - /** - * The unmarshaller to use. The unmarshaller only unmarshalls any modeled fields of the exception, - * additional metadata is extracted by {@link AwsXmlErrorProtocolUnmarshaller}. - * - * @param errorUnmarshaller Error unmarshaller to use. - * @return This builder for method chaining. - */ - public Builder errorUnmarshaller(XmlErrorUnmarshaller errorUnmarshaller) { - this.errorUnmarshaller = errorUnmarshaller; - return this; - } - - /** - * @return New instance of {@link AwsXmlErrorProtocolUnmarshaller}. - */ - public AwsXmlErrorProtocolUnmarshaller build() { - return new AwsXmlErrorProtocolUnmarshaller(this); - } - } -} \ No newline at end of file +/* * 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.protocols.query.unmarshall; import java.io.IOException; import java.util.List; import java.util.Optional; import java.util.function.Function; import java.util.function.Supplier; import software.amazon.awssdk.annotations.SdkProtectedApi; import software.amazon.awssdk.awscore.exception.AwsErrorDetails; import software.amazon.awssdk.awscore.exception.AwsServiceException; import software.amazon.awssdk.core.SdkBytes; import software.amazon.awssdk.core.SdkPojo; import software.amazon.awssdk.core.http.HttpResponseHandler; import software.amazon.awssdk.core.interceptor.ExecutionAttributes; import software.amazon.awssdk.http.SdkHttpFullResponse; import software.amazon.awssdk.protocols.core.ExceptionMetadata; import software.amazon.awssdk.protocols.query.internal.unmarshall.AwsXmlErrorUnmarshaller; import software.amazon.awssdk.utils.Pair; /** * Error unmarshaller for Query/EC2/XML based protocols. Some examples of error responses from * the various protocols are below. * *

Legacy Query (SimpleDB/EC2)

*
 * {@code
 * 
 *    
 *       
 *          MissingParameter
 *          The request must contain the parameter DomainName
 *          0.0055590278
 *       
 *    
 *    ad3280dd-5ac1-efd1-b9b0-a86969a9234d
 * 
 * }
 * 
* *

Traditional Query/Rest-XML (Cloudfront)

*
 * {@code
 * 
 *    
 *       Sender
 *       MalformedInput
 *       Invalid XML document
 *    
 *    7c8da4af-de44-11e8-a60e-1b2014315455
 * 
 * }
 * 
* *

Amazon S3

*
 * {@code
 * 
 *    NoSuchBucket
 *    The specified bucket does not exist
 *    flajdfadjfladjf
 *    D9DBB9F267849CA3
 *    fn8B1fUvWzg7I3CIeMT4UMqCZDF4+QO1JlbOJlQAVOosACZsLWv/K2dapVncz34a2mArhp11PjI=
 * 
 * }
 * 
*/ @SdkProtectedApi public final class AwsXmlErrorProtocolUnmarshaller implements HttpResponseHandler { private final AwsXmlErrorUnmarshaller awsXmlErrorUnmarshaller; private final Function> errorRootExtractor; private AwsXmlErrorProtocolUnmarshaller(Builder builder) { this.errorRootExtractor = builder.errorRootExtractor; this.awsXmlErrorUnmarshaller = AwsXmlErrorUnmarshaller.builder() .defaultExceptionSupplier(builder.defaultExceptionSupplier) .exceptions(builder.exceptions) .errorUnmarshaller(builder.errorUnmarshaller) .build(); } @Override public AwsServiceException handle(SdkHttpFullResponse response, ExecutionAttributes executionAttributes) { Pair xmlAndBytes = parseXml(response); XmlElement document = xmlAndBytes.left(); Optional errorRoot = errorRootExtractor.apply(document); return awsXmlErrorUnmarshaller.unmarshall(document, errorRoot, Optional.of(xmlAndBytes.right()), response, executionAttributes); } /** * Parse the response content into an XML document. If we fail to read the content or the XML is malformed * we still return an empty {@link XmlElement} so that unmarshalling can proceed. In those failure * cases we can't parse out the error code so we'd unmarshall into a generic service exception. * * @param response HTTP response. * @return Pair of the parsed {@link XmlElement} and the raw bytes of the response. */ private Pair parseXml(SdkHttpFullResponse response) { SdkBytes bytes = getResponseBytes(response); try { return Pair.of(XmlDomParser.parse(bytes.asInputStream()), bytes); } catch (Exception e) { return Pair.of(XmlElement.empty(), bytes); } } /** * Buffers the response content into an {@link SdkBytes} object. Used to fill the {@link AwsErrorDetails}. If * an {@link IOException} occurs then this will return {@link #emptyXmlBytes()} so that unmarshalling can proceed. * * @param response HTTP response. * @return Raw bytes of response. */ private SdkBytes getResponseBytes(SdkHttpFullResponse response) { try { return response.content() .map(SdkBytes::fromInputStream) .orElseGet(this::emptyXmlBytes); } catch (Exception e) { return emptyXmlBytes(); } } /** * @return Dummy XML document to allow unmarshalling when response can't be read/parsed. */ private SdkBytes emptyXmlBytes() { return SdkBytes.fromUtf8String(""); } /** * @return New Builder instance. */ public static Builder builder() { return new Builder(); } /** * Builder for {@link AwsXmlErrorProtocolUnmarshaller}. */ public static final class Builder { private List exceptions; private Supplier defaultExceptionSupplier; private Function> errorRootExtractor; private XmlErrorUnmarshaller errorUnmarshaller; private Builder() { } /** * List of {@link ExceptionMetadata} to represent the modeled exceptions for the service. * For AWS services the error type is a string representing the type of the modeled exception. * * @return This builder for method chaining. */ public Builder exceptions(List exceptions) { this.exceptions = exceptions; return this; } /** * Default exception type if "error code" does not match any known modeled exception. This is the generated * base exception for the service (i.e. DynamoDbException). * * @return This builder for method chaining. */ public Builder defaultExceptionSupplier(Supplier defaultExceptionSupplier) { this.defaultExceptionSupplier = defaultExceptionSupplier; return this; } /** * Extracts the element from the top level XML document. Different protocols have slightly * different formats for where the Error element is located. The error root of the XML document contains * the code, message and any modeled fields of the exception. See javadocs of * {@link AwsXmlErrorProtocolUnmarshaller} for examples. * * @param errorRootExtractor Function that extracts the element from the root XML document. * @return This builder for method chaining. */ public Builder errorRootExtractor(Function> errorRootExtractor) { this.errorRootExtractor = errorRootExtractor; return this; } /** * The unmarshaller to use. The unmarshaller only unmarshalls any modeled fields of the exception, * additional metadata is extracted by {@link AwsXmlErrorProtocolUnmarshaller}. * * @param errorUnmarshaller Error unmarshaller to use. * @return This builder for method chaining. */ public Builder errorUnmarshaller(XmlErrorUnmarshaller errorUnmarshaller) { this.errorUnmarshaller = errorUnmarshaller; return this; } /** * @return New instance of {@link AwsXmlErrorProtocolUnmarshaller}. */ public AwsXmlErrorProtocolUnmarshaller build() { return new AwsXmlErrorProtocolUnmarshaller(this); } } } \ No newline at end of file From 859ca4541131f279a629cd44a0f50d236fdd0b65 Mon Sep 17 00:00:00 2001 From: Saranya Somepalli Date: Fri, 4 Apr 2025 09:25:41 -0700 Subject: [PATCH 11/22] Fixing checkstyle issues --- .../poet/client/specs/XmlProtocolSpec.java | 2 +- .../query/AwsQueryProtocolFactory.java | 206 +++++++++++++- .../unmarshall/AwsXmlErrorUnmarshaller.java | 253 +++++++++++++++++- .../AwsXmlErrorProtocolUnmarshaller.java | 224 +++++++++++++++- 4 files changed, 681 insertions(+), 4 deletions(-) diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/XmlProtocolSpec.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/XmlProtocolSpec.java index b31c9537f07f..de69a870d9bd 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/XmlProtocolSpec.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/XmlProtocolSpec.java @@ -91,7 +91,7 @@ public CodeBlock responseHandler(IntermediateModel model, return CodeBlock.builder() .addStatement("\n\n$T responseHandler = protocolFactory.createCombinedResponseHandler($T::builder, " + "new $T().withHasStreamingSuccessResponse($L))", - handlerType, responseType, XmlOperationMetadata.class, opModel.hasStreamingOutput()) + handlerType, responseType, XmlOperationMetadata.class, opModel.hasStreamingOutput()) .build(); } diff --git a/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/AwsQueryProtocolFactory.java b/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/AwsQueryProtocolFactory.java index 7e4d17b3ee38..978cddee25d4 100644 --- a/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/AwsQueryProtocolFactory.java +++ b/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/AwsQueryProtocolFactory.java @@ -1 +1,205 @@ -/* * 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.protocols.query; import static java.util.Collections.unmodifiableList; import java.net.URI; import java.util.ArrayList; import java.util.List; import java.util.Optional; import java.util.function.Supplier; import software.amazon.awssdk.annotations.SdkProtectedApi; import software.amazon.awssdk.awscore.AwsResponse; import software.amazon.awssdk.awscore.exception.AwsServiceException; import software.amazon.awssdk.core.ClientEndpointProvider; import software.amazon.awssdk.core.SdkPojo; import software.amazon.awssdk.core.client.config.SdkClientConfiguration; import software.amazon.awssdk.core.client.config.SdkClientOption; import software.amazon.awssdk.core.http.HttpResponseHandler; import software.amazon.awssdk.core.http.MetricCollectingHttpResponseHandler; import software.amazon.awssdk.core.metrics.CoreMetric; import software.amazon.awssdk.http.SdkHttpFullRequest; import software.amazon.awssdk.protocols.core.ExceptionMetadata; import software.amazon.awssdk.protocols.core.OperationInfo; import software.amazon.awssdk.protocols.core.ProtocolMarshaller; import software.amazon.awssdk.protocols.query.internal.marshall.QueryProtocolMarshaller; import software.amazon.awssdk.protocols.query.internal.unmarshall.AwsQueryResponseHandler; import software.amazon.awssdk.protocols.query.internal.unmarshall.QueryProtocolUnmarshaller; import software.amazon.awssdk.protocols.query.unmarshall.AwsXmlErrorProtocolUnmarshaller; import software.amazon.awssdk.protocols.query.unmarshall.XmlElement; /** * Protocol factory for the AWS/Query protocol. */ @SdkProtectedApi public class AwsQueryProtocolFactory { private final SdkClientConfiguration clientConfiguration; private final List modeledExceptions; private final Supplier defaultServiceExceptionSupplier; private final MetricCollectingHttpResponseHandler errorUnmarshaller; AwsQueryProtocolFactory(Builder builder) { this.clientConfiguration = builder.clientConfiguration; this.modeledExceptions = unmodifiableList(builder.modeledExceptions); this.defaultServiceExceptionSupplier = builder.defaultServiceExceptionSupplier; this.errorUnmarshaller = timeUnmarshalling(AwsXmlErrorProtocolUnmarshaller .builder() .defaultExceptionSupplier(defaultServiceExceptionSupplier) .exceptions(modeledExceptions) // We don't set result wrapper since that's handled by the errorRootExtractor .errorUnmarshaller(QueryProtocolUnmarshaller.builder().build()) .errorRootExtractor(this::getErrorRoot) .build()); } /** * Creates a new marshaller for the given request. * * @param operationInfo Object containing metadata about the operation. * @return New {@link ProtocolMarshaller}. */ public final ProtocolMarshaller createProtocolMarshaller( OperationInfo operationInfo) { return QueryProtocolMarshaller.builder() .endpoint(endpoint(clientConfiguration)) .operationInfo(operationInfo) .isEc2(isEc2()) .build(); } private URI endpoint(SdkClientConfiguration clientConfiguration) { ClientEndpointProvider endpointProvider = clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER); if (endpointProvider != null) { return endpointProvider.clientEndpoint(); } // Some old client versions may not use the endpoint provider. In that case, use the legacy endpoint field. return clientConfiguration.option(SdkClientOption.ENDPOINT); } /** * Creates the success response handler to unmarshall the response into a POJO. * * @param pojoSupplier Supplier of the POJO builder we are unmarshalling into. * @param Type being unmarshalled. * @return New {@link HttpResponseHandler} for success responses. */ public final HttpResponseHandler createResponseHandler(Supplier pojoSupplier) { return timeUnmarshalling(new AwsQueryResponseHandler<>(QueryProtocolUnmarshaller.builder() .hasResultWrapper(!isEc2()) .build(), r -> pojoSupplier.get())); } /** * @return A {@link HttpResponseHandler} that will unmarshall the service exceptional response into * a modeled exception or the service base exception. */ public final HttpResponseHandler createErrorResponseHandler() { return errorUnmarshaller; } private MetricCollectingHttpResponseHandler timeUnmarshalling(HttpResponseHandler delegate) { return MetricCollectingHttpResponseHandler.create(CoreMetric.UNMARSHALLING_DURATION, delegate); } /** * Extracts the element from the root XML document. Method is protected as EC2 has a slightly * different location. * * @param document Root XML document. * @return If error root is found than a fulfilled {@link Optional}, otherwise an empty one. */ Optional getErrorRoot(XmlElement document) { return document.getOptionalElementByName("Error"); } /** * EC2 has a few distinct differences from query so we wire things up a bit differently. */ boolean isEc2() { return false; } /** * @return New Builder instance. */ public static Builder builder() { return new Builder(); } /** * Builder for {@link AwsQueryProtocolFactory}. * * @param Subclass of Builder for fluent method chaining. */ public static class Builder { private final List modeledExceptions = new ArrayList<>(); private SdkClientConfiguration clientConfiguration; private Supplier defaultServiceExceptionSupplier; Builder() { } /** * Sets the {@link SdkClientConfiguration} which contains the service endpoint. * * @param clientConfiguration Configuration of the client. * @return This builder for method chaining. */ public final SubclassT clientConfiguration(SdkClientConfiguration clientConfiguration) { this.clientConfiguration = clientConfiguration; return getSubclass(); } /** * Registers a new modeled exception by the error code. * * @param errorMetadata metadata for unmarshalling the exceptions * @return This builder for method chaining. */ public final SubclassT registerModeledException(ExceptionMetadata errorMetadata) { modeledExceptions.add(errorMetadata); return getSubclass(); } /** * A supplier for the services base exception builder. This is used when we can't identify any modeled * exception to unmarshall into. * * @param exceptionBuilderSupplier Suppplier of the base service exceptions Builder. * @return This builder for method chaining. */ public final SubclassT defaultServiceExceptionSupplier(Supplier exceptionBuilderSupplier) { this.defaultServiceExceptionSupplier = exceptionBuilderSupplier; return getSubclass(); } @SuppressWarnings("unchecked") private SubclassT getSubclass() { return (SubclassT) this; } /** * @return New instance of {@link AwsQueryProtocolFactory}. */ public AwsQueryProtocolFactory build() { return new AwsQueryProtocolFactory(this); } } } \ No newline at end of file +/* + * 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.protocols.query; + +import static java.util.Collections.unmodifiableList; + +import java.net.URI; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; +import java.util.function.Supplier; +import software.amazon.awssdk.annotations.SdkProtectedApi; +import software.amazon.awssdk.awscore.AwsResponse; +import software.amazon.awssdk.awscore.exception.AwsServiceException; +import software.amazon.awssdk.core.ClientEndpointProvider; +import software.amazon.awssdk.core.SdkPojo; +import software.amazon.awssdk.core.client.config.SdkClientConfiguration; +import software.amazon.awssdk.core.client.config.SdkClientOption; +import software.amazon.awssdk.core.http.HttpResponseHandler; +import software.amazon.awssdk.core.http.MetricCollectingHttpResponseHandler; +import software.amazon.awssdk.core.metrics.CoreMetric; +import software.amazon.awssdk.http.SdkHttpFullRequest; +import software.amazon.awssdk.protocols.core.ExceptionMetadata; +import software.amazon.awssdk.protocols.core.OperationInfo; +import software.amazon.awssdk.protocols.core.ProtocolMarshaller; +import software.amazon.awssdk.protocols.query.internal.marshall.QueryProtocolMarshaller; +import software.amazon.awssdk.protocols.query.internal.unmarshall.AwsQueryResponseHandler; +import software.amazon.awssdk.protocols.query.internal.unmarshall.QueryProtocolUnmarshaller; +import software.amazon.awssdk.protocols.query.unmarshall.AwsXmlErrorProtocolUnmarshaller; +import software.amazon.awssdk.protocols.query.unmarshall.XmlElement; + +/** + * Protocol factory for the AWS/Query protocol. + */ +@SdkProtectedApi +public class AwsQueryProtocolFactory { + + private final SdkClientConfiguration clientConfiguration; + private final List modeledExceptions; + private final Supplier defaultServiceExceptionSupplier; + private final MetricCollectingHttpResponseHandler errorUnmarshaller; + + AwsQueryProtocolFactory(Builder builder) { + this.clientConfiguration = builder.clientConfiguration; + this.modeledExceptions = unmodifiableList(builder.modeledExceptions); + this.defaultServiceExceptionSupplier = builder.defaultServiceExceptionSupplier; + this.errorUnmarshaller = timeUnmarshalling(AwsXmlErrorProtocolUnmarshaller + .builder() + .defaultExceptionSupplier(defaultServiceExceptionSupplier) + .exceptions(modeledExceptions) + // We don't set result wrapper since that's handled by the errorRootExtractor + .errorUnmarshaller(QueryProtocolUnmarshaller.builder().build()) + .errorRootExtractor(this::getErrorRoot) + .build()); + } + + /** + * Creates a new marshaller for the given request. + * + * @param operationInfo Object containing metadata about the operation. + * @return New {@link ProtocolMarshaller}. + */ + public final ProtocolMarshaller createProtocolMarshaller( + OperationInfo operationInfo) { + return QueryProtocolMarshaller.builder() + .endpoint(endpoint(clientConfiguration)) + .operationInfo(operationInfo) + .isEc2(isEc2()) + .build(); + } + + private URI endpoint(SdkClientConfiguration clientConfiguration) { + ClientEndpointProvider endpointProvider = clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER); + if (endpointProvider != null) { + return endpointProvider.clientEndpoint(); + } + + // Some old client versions may not use the endpoint provider. In that case, use the legacy endpoint field. + return clientConfiguration.option(SdkClientOption.ENDPOINT); + } + + /** + * Creates the success response handler to unmarshall the response into a POJO. + * + * @param pojoSupplier Supplier of the POJO builder we are unmarshalling into. + * @param Type being unmarshalled. + * @return New {@link HttpResponseHandler} for success responses. + */ + public final HttpResponseHandler createResponseHandler(Supplier pojoSupplier) { + return timeUnmarshalling(new AwsQueryResponseHandler<>(QueryProtocolUnmarshaller.builder() + .hasResultWrapper(!isEc2()) + .build(), r -> pojoSupplier.get())); + } + + /** + * @return A {@link HttpResponseHandler} that will unmarshall the service exceptional response into + * a modeled exception or the service base exception. + */ + public final HttpResponseHandler createErrorResponseHandler() { + return errorUnmarshaller; + } + + private MetricCollectingHttpResponseHandler timeUnmarshalling(HttpResponseHandler delegate) { + return MetricCollectingHttpResponseHandler.create(CoreMetric.UNMARSHALLING_DURATION, delegate); + } + + /** + * Extracts the element from the root XML document. Method is protected as EC2 has a slightly + * different location. + * + * @param document Root XML document. + * @return If error root is found than a fulfilled {@link Optional}, otherwise an empty one. + */ + Optional getErrorRoot(XmlElement document) { + return document.getOptionalElementByName("Error"); + } + + /** + * EC2 has a few distinct differences from query so we wire things up a bit differently. + */ + boolean isEc2() { + return false; + } + + /** + * @return New Builder instance. + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link AwsQueryProtocolFactory}. + * + * @param Subclass of Builder for fluent method chaining. + */ + public static class Builder { + + private final List modeledExceptions = new ArrayList<>(); + private SdkClientConfiguration clientConfiguration; + private Supplier defaultServiceExceptionSupplier; + + Builder() { + } + + /** + * Sets the {@link SdkClientConfiguration} which contains the service endpoint. + * + * @param clientConfiguration Configuration of the client. + * @return This builder for method chaining. + */ + public final SubclassT clientConfiguration(SdkClientConfiguration clientConfiguration) { + this.clientConfiguration = clientConfiguration; + return getSubclass(); + } + + /** + * Registers a new modeled exception by the error code. + * + * @param errorMetadata metadata for unmarshalling the exceptions + * @return This builder for method chaining. + */ + public final SubclassT registerModeledException(ExceptionMetadata errorMetadata) { + modeledExceptions.add(errorMetadata); + return getSubclass(); + } + + /** + * A supplier for the services base exception builder. This is used when we can't identify any modeled + * exception to unmarshall into. + * + * @param exceptionBuilderSupplier Suppplier of the base service exceptions Builder. + * @return This builder for method chaining. + */ + public final SubclassT defaultServiceExceptionSupplier(Supplier exceptionBuilderSupplier) { + this.defaultServiceExceptionSupplier = exceptionBuilderSupplier; + return getSubclass(); + } + + @SuppressWarnings("unchecked") + private SubclassT getSubclass() { + return (SubclassT) this; + } + + /** + * @return New instance of {@link AwsQueryProtocolFactory}. + */ + public AwsQueryProtocolFactory build() { + return new AwsQueryProtocolFactory(this); + } + } +} \ No newline at end of file diff --git a/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/internal/unmarshall/AwsXmlErrorUnmarshaller.java b/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/internal/unmarshall/AwsXmlErrorUnmarshaller.java index a4e94975bf6b..1f1d4c3bdc16 100644 --- a/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/internal/unmarshall/AwsXmlErrorUnmarshaller.java +++ b/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/internal/unmarshall/AwsXmlErrorUnmarshaller.java @@ -1 +1,252 @@ -/* * 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.protocols.query.internal.unmarshall; import static software.amazon.awssdk.utils.FunctionalUtils.invokeSafely; import java.time.Duration; import java.util.List; import java.util.Optional; import java.util.function.Supplier; import software.amazon.awssdk.annotations.SdkInternalApi; import software.amazon.awssdk.awscore.exception.AwsErrorDetails; import software.amazon.awssdk.awscore.exception.AwsServiceException; import software.amazon.awssdk.core.SdkBytes; import software.amazon.awssdk.core.SdkPojo; import software.amazon.awssdk.core.http.HttpResponseHandler; import software.amazon.awssdk.core.interceptor.ExecutionAttributes; import software.amazon.awssdk.core.interceptor.SdkExecutionAttribute; import software.amazon.awssdk.http.SdkHttpFullResponse; import software.amazon.awssdk.protocols.core.ExceptionMetadata; import software.amazon.awssdk.protocols.query.unmarshall.XmlElement; import software.amazon.awssdk.protocols.query.unmarshall.XmlErrorUnmarshaller; /** * Unmarshalls an AWS XML exception from parsed XML. */ @SdkInternalApi public final class AwsXmlErrorUnmarshaller { private static final String X_AMZ_ID_2_HEADER = "x-amz-id-2"; private final List exceptions; private final Supplier defaultExceptionSupplier; private final XmlErrorUnmarshaller errorUnmarshaller; private AwsXmlErrorUnmarshaller(Builder builder) { this.exceptions = builder.exceptions; this.errorUnmarshaller = builder.errorUnmarshaller; this.defaultExceptionSupplier = builder.defaultExceptionSupplier; } /** * @return New Builder instance. */ public static Builder builder() { return new Builder(); } /** * Unmarshal an AWS XML exception * @param documentRoot The parsed payload document * @param errorRoot The specific element of the parsed payload document that contains the error to be marshalled * or empty if it could not be located. * @param documentBytes The raw bytes of the original payload document if they are available * @param response The HTTP response object * @param executionAttributes {@link ExecutionAttributes} for the current execution * @return An {@link AwsServiceException} unmarshalled from the XML. */ public AwsServiceException unmarshall(XmlElement documentRoot, Optional errorRoot, Optional documentBytes, SdkHttpFullResponse response, ExecutionAttributes executionAttributes) { String errorCode = getErrorCode(errorRoot); AwsServiceException.Builder builder = errorRoot .map(e -> invokeSafely(() -> unmarshallFromErrorCode(response, e, errorCode))) .orElseGet(this::defaultException); AwsErrorDetails awsErrorDetails = AwsErrorDetails.builder() .errorCode(errorCode) .errorMessage(builder.message()) .rawResponse(documentBytes.orElse(null)) .sdkHttpResponse(response) .serviceName(executionAttributes.getAttribute(SdkExecutionAttribute.SERVICE_NAME)) .build(); builder.requestId(getRequestId(response, documentRoot)) .extendedRequestId(getExtendedRequestId(response)) .statusCode(response.statusCode()) .clockSkew(getClockSkew(executionAttributes)) .awsErrorDetails(awsErrorDetails); return builder.build(); } private Duration getClockSkew(ExecutionAttributes executionAttributes) { Integer timeOffset = executionAttributes.getAttribute(SdkExecutionAttribute.TIME_OFFSET); return timeOffset == null ? null : Duration.ofSeconds(timeOffset); } /** * @return Builder for the default service exception. Used when the error code doesn't match * any known modeled exception or when we can't determine the error code. */ private AwsServiceException.Builder defaultException() { return (AwsServiceException.Builder) defaultExceptionSupplier.get(); } /** * Unmarshalls the XML into the appropriate modeled exception based on the error code. If the error code * is not present or does not match any known exception we unmarshall into the base service exception. * * @param errorRoot Root of element. Contains any modeled fields of the exception. * @param errorCode Error code identifying the modeled exception. * @return Unmarshalled exception builder. */ private AwsServiceException.Builder unmarshallFromErrorCode(SdkHttpFullResponse response, XmlElement errorRoot, String errorCode) { SdkPojo sdkPojo = exceptions.stream() .filter(e -> e.errorCode().equals(errorCode)) .map(ExceptionMetadata::exceptionBuilderSupplier) .findAny() .orElse(defaultExceptionSupplier) .get(); AwsServiceException.Builder builder = ((AwsServiceException) errorUnmarshaller.unmarshall(sdkPojo, errorRoot, response)).toBuilder(); builder.message(getMessage(errorRoot)); return builder; } /** * Extracts the error code (used to identify the modeled exception) from the * element. * * @param errorRoot Error element root. * @return Error code or null if not present. */ private String getErrorCode(Optional errorRoot) { return errorRoot.map(e -> e.getOptionalElementByName("Code") .map(XmlElement::textContent) .orElse(null)) .orElse(null); } /** * Extracts the error message from the XML document. The message is in the * element for all services. * * @param errorRoot Error element root. * @return Error message or null if not present. */ private String getMessage(XmlElement errorRoot) { return errorRoot.getOptionalElementByName("Message") .map(XmlElement::textContent) .orElse(null); } /** * Extracts the request ID from the XML document. Request ID is a top level element * for all protocols, it may be RequestId or RequestID depending on the service. * * @param document Root XML document. * @return Request ID string or null if not present. */ private String getRequestId(SdkHttpFullResponse response, XmlElement document) { XmlElement requestId = document.getOptionalElementByName("RequestId") .orElseGet(() -> document.getElementByName("RequestID")); return requestId != null ? requestId.textContent() : matchRequestIdHeaders(response); } private String matchRequestIdHeaders(SdkHttpFullResponse response) { return HttpResponseHandler.X_AMZN_REQUEST_ID_HEADERS.stream() .map(h -> response.firstMatchingHeader(h)) .filter(Optional::isPresent) .map(Optional::get) .findFirst() .orElse(null); } /** * Extracts the extended request ID from the response headers. * * @param response The HTTP response object. * @return Extended Request ID string or null if not present. */ private String getExtendedRequestId(SdkHttpFullResponse response) { return response.firstMatchingHeader(X_AMZ_ID_2_HEADER).orElse(null); } /** * Builder for {@link AwsXmlErrorUnmarshaller}. */ public static final class Builder { private List exceptions; private Supplier defaultExceptionSupplier; private XmlErrorUnmarshaller errorUnmarshaller; private Builder() { } /** * List of {@link ExceptionMetadata} to represent the modeled exceptions for the service. * For AWS services the error type is a string representing the type of the modeled exception. * * @return This builder for method chaining. */ public Builder exceptions(List exceptions) { this.exceptions = exceptions; return this; } /** * Default exception type if "error code" does not match any known modeled exception. This is the generated * base exception for the service (i.e. DynamoDbException). * * @return This builder for method chaining. */ public Builder defaultExceptionSupplier(Supplier defaultExceptionSupplier) { this.defaultExceptionSupplier = defaultExceptionSupplier; return this; } /** * The unmarshaller to use. The unmarshaller only unmarshalls any modeled fields of the exception, * additional metadata is extracted by {@link AwsXmlErrorUnmarshaller}. * * @param errorUnmarshaller Error unmarshaller to use. * @return This builder for method chaining. */ public Builder errorUnmarshaller(XmlErrorUnmarshaller errorUnmarshaller) { this.errorUnmarshaller = errorUnmarshaller; return this; } /** * @return New instance of {@link AwsXmlErrorUnmarshaller}. */ public AwsXmlErrorUnmarshaller build() { return new AwsXmlErrorUnmarshaller(this); } } } \ No newline at end of file +/* + * 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.protocols.query.internal.unmarshall; + +import static software.amazon.awssdk.utils.FunctionalUtils.invokeSafely; + +import java.time.Duration; +import java.util.List; +import java.util.Optional; +import java.util.function.Supplier; +import software.amazon.awssdk.annotations.SdkInternalApi; +import software.amazon.awssdk.awscore.exception.AwsErrorDetails; +import software.amazon.awssdk.awscore.exception.AwsServiceException; +import software.amazon.awssdk.core.SdkBytes; +import software.amazon.awssdk.core.SdkPojo; +import software.amazon.awssdk.core.http.HttpResponseHandler; +import software.amazon.awssdk.core.interceptor.ExecutionAttributes; +import software.amazon.awssdk.core.interceptor.SdkExecutionAttribute; +import software.amazon.awssdk.http.SdkHttpFullResponse; +import software.amazon.awssdk.protocols.core.ExceptionMetadata; +import software.amazon.awssdk.protocols.query.unmarshall.XmlElement; +import software.amazon.awssdk.protocols.query.unmarshall.XmlErrorUnmarshaller; + +/** + * Unmarshalls an AWS XML exception from parsed XML. + */ +@SdkInternalApi +public final class AwsXmlErrorUnmarshaller { + private static final String X_AMZ_ID_2_HEADER = "x-amz-id-2"; + + private final List exceptions; + private final Supplier defaultExceptionSupplier; + + private final XmlErrorUnmarshaller errorUnmarshaller; + + private AwsXmlErrorUnmarshaller(Builder builder) { + this.exceptions = builder.exceptions; + this.errorUnmarshaller = builder.errorUnmarshaller; + this.defaultExceptionSupplier = builder.defaultExceptionSupplier; + } + + /** + * @return New Builder instance. + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Unmarshal an AWS XML exception + * @param documentRoot The parsed payload document + * @param errorRoot The specific element of the parsed payload document that contains the error to be marshalled + * or empty if it could not be located. + * @param documentBytes The raw bytes of the original payload document if they are available + * @param response The HTTP response object + * @param executionAttributes {@link ExecutionAttributes} for the current execution + * @return An {@link AwsServiceException} unmarshalled from the XML. + */ + public AwsServiceException unmarshall(XmlElement documentRoot, + Optional errorRoot, + Optional documentBytes, + SdkHttpFullResponse response, + ExecutionAttributes executionAttributes) { + String errorCode = getErrorCode(errorRoot); + + AwsServiceException.Builder builder = errorRoot + .map(e -> invokeSafely(() -> unmarshallFromErrorCode(response, e, errorCode))) + .orElseGet(this::defaultException); + + AwsErrorDetails awsErrorDetails = + AwsErrorDetails.builder() + .errorCode(errorCode) + .errorMessage(builder.message()) + .rawResponse(documentBytes.orElse(null)) + .sdkHttpResponse(response) + .serviceName(executionAttributes.getAttribute(SdkExecutionAttribute.SERVICE_NAME)) + .build(); + + builder.requestId(getRequestId(response, documentRoot)) + .extendedRequestId(getExtendedRequestId(response)) + .statusCode(response.statusCode()) + .clockSkew(getClockSkew(executionAttributes)) + .awsErrorDetails(awsErrorDetails); + + return builder.build(); + } + + private Duration getClockSkew(ExecutionAttributes executionAttributes) { + Integer timeOffset = executionAttributes.getAttribute(SdkExecutionAttribute.TIME_OFFSET); + return timeOffset == null ? null : Duration.ofSeconds(timeOffset); + } + + /** + * @return Builder for the default service exception. Used when the error code doesn't match + * any known modeled exception or when we can't determine the error code. + */ + private AwsServiceException.Builder defaultException() { + return (AwsServiceException.Builder) defaultExceptionSupplier.get(); + } + + /** + * Unmarshalls the XML into the appropriate modeled exception based on the error code. If the error code + * is not present or does not match any known exception we unmarshall into the base service exception. + * + * @param errorRoot Root of element. Contains any modeled fields of the exception. + * @param errorCode Error code identifying the modeled exception. + * @return Unmarshalled exception builder. + */ + private AwsServiceException.Builder unmarshallFromErrorCode(SdkHttpFullResponse response, + XmlElement errorRoot, + String errorCode) { + SdkPojo sdkPojo = exceptions.stream() + .filter(e -> e.errorCode().equals(errorCode)) + .map(ExceptionMetadata::exceptionBuilderSupplier) + .findAny() + .orElse(defaultExceptionSupplier) + .get(); + + AwsServiceException.Builder builder = + ((AwsServiceException) errorUnmarshaller.unmarshall(sdkPojo, errorRoot, response)).toBuilder(); + builder.message(getMessage(errorRoot)); + return builder; + } + + /** + * Extracts the error code (used to identify the modeled exception) from the + * element. + * + * @param errorRoot Error element root. + * @return Error code or null if not present. + */ + private String getErrorCode(Optional errorRoot) { + return errorRoot.map(e -> e.getOptionalElementByName("Code") + .map(XmlElement::textContent) + .orElse(null)) + .orElse(null); + } + + /** + * Extracts the error message from the XML document. The message is in the + * element for all services. + * + * @param errorRoot Error element root. + * @return Error message or null if not present. + */ + private String getMessage(XmlElement errorRoot) { + return errorRoot.getOptionalElementByName("Message") + .map(XmlElement::textContent) + .orElse(null); + } + + /** + * Extracts the request ID from the XML document. Request ID is a top level element + * for all protocols, it may be RequestId or RequestID depending on the service. + * + * @param document Root XML document. + * @return Request ID string or null if not present. + */ + private String getRequestId(SdkHttpFullResponse response, XmlElement document) { + XmlElement requestId = document.getOptionalElementByName("RequestId") + .orElseGet(() -> document.getElementByName("RequestID")); + return requestId != null ? + requestId.textContent() : + matchRequestIdHeaders(response); + } + + private String matchRequestIdHeaders(SdkHttpFullResponse response) { + return HttpResponseHandler.X_AMZN_REQUEST_ID_HEADERS.stream() + .map(h -> response.firstMatchingHeader(h)) + .filter(Optional::isPresent) + .map(Optional::get) + .findFirst() + .orElse(null); + } + + /** + * Extracts the extended request ID from the response headers. + * + * @param response The HTTP response object. + * @return Extended Request ID string or null if not present. + */ + private String getExtendedRequestId(SdkHttpFullResponse response) { + return response.firstMatchingHeader(X_AMZ_ID_2_HEADER).orElse(null); + } + + /** + * Builder for {@link AwsXmlErrorUnmarshaller}. + */ + public static final class Builder { + + private List exceptions; + private Supplier defaultExceptionSupplier; + private XmlErrorUnmarshaller errorUnmarshaller; + + private Builder() { + } + + /** + * List of {@link ExceptionMetadata} to represent the modeled exceptions for the service. + * For AWS services the error type is a string representing the type of the modeled exception. + * + * @return This builder for method chaining. + */ + public Builder exceptions(List exceptions) { + this.exceptions = exceptions; + return this; + } + + /** + * Default exception type if "error code" does not match any known modeled exception. This is the generated + * base exception for the service (i.e. DynamoDbException). + * + * @return This builder for method chaining. + */ + public Builder defaultExceptionSupplier(Supplier defaultExceptionSupplier) { + this.defaultExceptionSupplier = defaultExceptionSupplier; + return this; + } + + /** + * The unmarshaller to use. The unmarshaller only unmarshalls any modeled fields of the exception, + * additional metadata is extracted by {@link AwsXmlErrorUnmarshaller}. + * + * @param errorUnmarshaller Error unmarshaller to use. + * @return This builder for method chaining. + */ + public Builder errorUnmarshaller(XmlErrorUnmarshaller errorUnmarshaller) { + this.errorUnmarshaller = errorUnmarshaller; + return this; + } + + /** + * @return New instance of {@link AwsXmlErrorUnmarshaller}. + */ + public AwsXmlErrorUnmarshaller build() { + return new AwsXmlErrorUnmarshaller(this); + } + } +} \ No newline at end of file diff --git a/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/unmarshall/AwsXmlErrorProtocolUnmarshaller.java b/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/unmarshall/AwsXmlErrorProtocolUnmarshaller.java index c4bc283789aa..61e9dc700311 100644 --- a/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/unmarshall/AwsXmlErrorProtocolUnmarshaller.java +++ b/core/protocols/aws-query-protocol/src/main/java/software/amazon/awssdk/protocols/query/unmarshall/AwsXmlErrorProtocolUnmarshaller.java @@ -1 +1,223 @@ -/* * 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.protocols.query.unmarshall; import java.io.IOException; import java.util.List; import java.util.Optional; import java.util.function.Function; import java.util.function.Supplier; import software.amazon.awssdk.annotations.SdkProtectedApi; import software.amazon.awssdk.awscore.exception.AwsErrorDetails; import software.amazon.awssdk.awscore.exception.AwsServiceException; import software.amazon.awssdk.core.SdkBytes; import software.amazon.awssdk.core.SdkPojo; import software.amazon.awssdk.core.http.HttpResponseHandler; import software.amazon.awssdk.core.interceptor.ExecutionAttributes; import software.amazon.awssdk.http.SdkHttpFullResponse; import software.amazon.awssdk.protocols.core.ExceptionMetadata; import software.amazon.awssdk.protocols.query.internal.unmarshall.AwsXmlErrorUnmarshaller; import software.amazon.awssdk.utils.Pair; /** * Error unmarshaller for Query/EC2/XML based protocols. Some examples of error responses from * the various protocols are below. * *

Legacy Query (SimpleDB/EC2)

*
 * {@code
 * 
 *    
 *       
 *          MissingParameter
 *          The request must contain the parameter DomainName
 *          0.0055590278
 *       
 *    
 *    ad3280dd-5ac1-efd1-b9b0-a86969a9234d
 * 
 * }
 * 
* *

Traditional Query/Rest-XML (Cloudfront)

*
 * {@code
 * 
 *    
 *       Sender
 *       MalformedInput
 *       Invalid XML document
 *    
 *    7c8da4af-de44-11e8-a60e-1b2014315455
 * 
 * }
 * 
* *

Amazon S3

*
 * {@code
 * 
 *    NoSuchBucket
 *    The specified bucket does not exist
 *    flajdfadjfladjf
 *    D9DBB9F267849CA3
 *    fn8B1fUvWzg7I3CIeMT4UMqCZDF4+QO1JlbOJlQAVOosACZsLWv/K2dapVncz34a2mArhp11PjI=
 * 
 * }
 * 
*/ @SdkProtectedApi public final class AwsXmlErrorProtocolUnmarshaller implements HttpResponseHandler { private final AwsXmlErrorUnmarshaller awsXmlErrorUnmarshaller; private final Function> errorRootExtractor; private AwsXmlErrorProtocolUnmarshaller(Builder builder) { this.errorRootExtractor = builder.errorRootExtractor; this.awsXmlErrorUnmarshaller = AwsXmlErrorUnmarshaller.builder() .defaultExceptionSupplier(builder.defaultExceptionSupplier) .exceptions(builder.exceptions) .errorUnmarshaller(builder.errorUnmarshaller) .build(); } @Override public AwsServiceException handle(SdkHttpFullResponse response, ExecutionAttributes executionAttributes) { Pair xmlAndBytes = parseXml(response); XmlElement document = xmlAndBytes.left(); Optional errorRoot = errorRootExtractor.apply(document); return awsXmlErrorUnmarshaller.unmarshall(document, errorRoot, Optional.of(xmlAndBytes.right()), response, executionAttributes); } /** * Parse the response content into an XML document. If we fail to read the content or the XML is malformed * we still return an empty {@link XmlElement} so that unmarshalling can proceed. In those failure * cases we can't parse out the error code so we'd unmarshall into a generic service exception. * * @param response HTTP response. * @return Pair of the parsed {@link XmlElement} and the raw bytes of the response. */ private Pair parseXml(SdkHttpFullResponse response) { SdkBytes bytes = getResponseBytes(response); try { return Pair.of(XmlDomParser.parse(bytes.asInputStream()), bytes); } catch (Exception e) { return Pair.of(XmlElement.empty(), bytes); } } /** * Buffers the response content into an {@link SdkBytes} object. Used to fill the {@link AwsErrorDetails}. If * an {@link IOException} occurs then this will return {@link #emptyXmlBytes()} so that unmarshalling can proceed. * * @param response HTTP response. * @return Raw bytes of response. */ private SdkBytes getResponseBytes(SdkHttpFullResponse response) { try { return response.content() .map(SdkBytes::fromInputStream) .orElseGet(this::emptyXmlBytes); } catch (Exception e) { return emptyXmlBytes(); } } /** * @return Dummy XML document to allow unmarshalling when response can't be read/parsed. */ private SdkBytes emptyXmlBytes() { return SdkBytes.fromUtf8String(""); } /** * @return New Builder instance. */ public static Builder builder() { return new Builder(); } /** * Builder for {@link AwsXmlErrorProtocolUnmarshaller}. */ public static final class Builder { private List exceptions; private Supplier defaultExceptionSupplier; private Function> errorRootExtractor; private XmlErrorUnmarshaller errorUnmarshaller; private Builder() { } /** * List of {@link ExceptionMetadata} to represent the modeled exceptions for the service. * For AWS services the error type is a string representing the type of the modeled exception. * * @return This builder for method chaining. */ public Builder exceptions(List exceptions) { this.exceptions = exceptions; return this; } /** * Default exception type if "error code" does not match any known modeled exception. This is the generated * base exception for the service (i.e. DynamoDbException). * * @return This builder for method chaining. */ public Builder defaultExceptionSupplier(Supplier defaultExceptionSupplier) { this.defaultExceptionSupplier = defaultExceptionSupplier; return this; } /** * Extracts the element from the top level XML document. Different protocols have slightly * different formats for where the Error element is located. The error root of the XML document contains * the code, message and any modeled fields of the exception. See javadocs of * {@link AwsXmlErrorProtocolUnmarshaller} for examples. * * @param errorRootExtractor Function that extracts the element from the root XML document. * @return This builder for method chaining. */ public Builder errorRootExtractor(Function> errorRootExtractor) { this.errorRootExtractor = errorRootExtractor; return this; } /** * The unmarshaller to use. The unmarshaller only unmarshalls any modeled fields of the exception, * additional metadata is extracted by {@link AwsXmlErrorProtocolUnmarshaller}. * * @param errorUnmarshaller Error unmarshaller to use. * @return This builder for method chaining. */ public Builder errorUnmarshaller(XmlErrorUnmarshaller errorUnmarshaller) { this.errorUnmarshaller = errorUnmarshaller; return this; } /** * @return New instance of {@link AwsXmlErrorProtocolUnmarshaller}. */ public AwsXmlErrorProtocolUnmarshaller build() { return new AwsXmlErrorProtocolUnmarshaller(this); } } } \ No newline at end of file +/* + * 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.protocols.query.unmarshall; + +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.function.Function; +import java.util.function.Supplier; +import software.amazon.awssdk.annotations.SdkProtectedApi; +import software.amazon.awssdk.awscore.exception.AwsErrorDetails; +import software.amazon.awssdk.awscore.exception.AwsServiceException; +import software.amazon.awssdk.core.SdkBytes; +import software.amazon.awssdk.core.SdkPojo; +import software.amazon.awssdk.core.http.HttpResponseHandler; +import software.amazon.awssdk.core.interceptor.ExecutionAttributes; +import software.amazon.awssdk.http.SdkHttpFullResponse; +import software.amazon.awssdk.protocols.core.ExceptionMetadata; +import software.amazon.awssdk.protocols.query.internal.unmarshall.AwsXmlErrorUnmarshaller; +import software.amazon.awssdk.utils.Pair; + +/** + * Error unmarshaller for Query/EC2/XML based protocols. Some examples of error responses from + * the various protocols are below. + * + *

Legacy Query (SimpleDB/EC2)

+ *
+ * {@code
+ * 
+ *    
+ *       
+ *          MissingParameter
+ *          The request must contain the parameter DomainName
+ *          0.0055590278
+ *       
+ *    
+ *    ad3280dd-5ac1-efd1-b9b0-a86969a9234d
+ * 
+ * }
+ * 
+ * + *

Traditional Query/Rest-XML (Cloudfront)

+ *
+ * {@code
+ * 
+ *    
+ *       Sender
+ *       MalformedInput
+ *       Invalid XML document
+ *    
+ *    7c8da4af-de44-11e8-a60e-1b2014315455
+ * 
+ * }
+ * 
+ * + *

Amazon S3

+ *
+ * {@code
+ * 
+ *    NoSuchBucket
+ *    The specified bucket does not exist
+ *    flajdfadjfladjf
+ *    D9DBB9F267849CA3
+ *    fn8B1fUvWzg7I3CIeMT4UMqCZDF4+QO1JlbOJlQAVOosACZsLWv/K2dapVncz34a2mArhp11PjI=
+ * 
+ * }
+ * 
+ */ +@SdkProtectedApi +public final class AwsXmlErrorProtocolUnmarshaller implements HttpResponseHandler { + + private final AwsXmlErrorUnmarshaller awsXmlErrorUnmarshaller; + private final Function> errorRootExtractor; + + private AwsXmlErrorProtocolUnmarshaller(Builder builder) { + this.errorRootExtractor = builder.errorRootExtractor; + this.awsXmlErrorUnmarshaller = AwsXmlErrorUnmarshaller.builder() + .defaultExceptionSupplier(builder.defaultExceptionSupplier) + .exceptions(builder.exceptions) + .errorUnmarshaller(builder.errorUnmarshaller) + .build(); + } + + @Override + public AwsServiceException handle(SdkHttpFullResponse response, ExecutionAttributes executionAttributes) { + Pair xmlAndBytes = parseXml(response); + XmlElement document = xmlAndBytes.left(); + Optional errorRoot = errorRootExtractor.apply(document); + return awsXmlErrorUnmarshaller.unmarshall(document, errorRoot, Optional.of(xmlAndBytes.right()), response, + executionAttributes); + } + + /** + * Parse the response content into an XML document. If we fail to read the content or the XML is malformed + * we still return an empty {@link XmlElement} so that unmarshalling can proceed. In those failure + * cases we can't parse out the error code so we'd unmarshall into a generic service exception. + * + * @param response HTTP response. + * @return Pair of the parsed {@link XmlElement} and the raw bytes of the response. + */ + private Pair parseXml(SdkHttpFullResponse response) { + SdkBytes bytes = getResponseBytes(response); + try { + return Pair.of(XmlDomParser.parse(bytes.asInputStream()), bytes); + } catch (Exception e) { + return Pair.of(XmlElement.empty(), bytes); + } + } + + /** + * Buffers the response content into an {@link SdkBytes} object. Used to fill the {@link AwsErrorDetails}. If + * an {@link IOException} occurs then this will return {@link #emptyXmlBytes()} so that unmarshalling can proceed. + * + * @param response HTTP response. + * @return Raw bytes of response. + */ + private SdkBytes getResponseBytes(SdkHttpFullResponse response) { + try { + return response.content() + .map(SdkBytes::fromInputStream) + .orElseGet(this::emptyXmlBytes); + } catch (Exception e) { + return emptyXmlBytes(); + } + } + + /** + * @return Dummy XML document to allow unmarshalling when response can't be read/parsed. + */ + private SdkBytes emptyXmlBytes() { + return SdkBytes.fromUtf8String(""); + } + + + /** + * @return New Builder instance. + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link AwsXmlErrorProtocolUnmarshaller}. + */ + public static final class Builder { + + private List exceptions; + private Supplier defaultExceptionSupplier; + private Function> errorRootExtractor; + private XmlErrorUnmarshaller errorUnmarshaller; + + private Builder() { + } + + /** + * List of {@link ExceptionMetadata} to represent the modeled exceptions for the service. + * For AWS services the error type is a string representing the type of the modeled exception. + * + * @return This builder for method chaining. + */ + public Builder exceptions(List exceptions) { + this.exceptions = exceptions; + return this; + } + + /** + * Default exception type if "error code" does not match any known modeled exception. This is the generated + * base exception for the service (i.e. DynamoDbException). + * + * @return This builder for method chaining. + */ + public Builder defaultExceptionSupplier(Supplier defaultExceptionSupplier) { + this.defaultExceptionSupplier = defaultExceptionSupplier; + return this; + } + + /** + * Extracts the element from the top level XML document. Different protocols have slightly + * different formats for where the Error element is located. The error root of the XML document contains + * the code, message and any modeled fields of the exception. See javadocs of + * {@link AwsXmlErrorProtocolUnmarshaller} for examples. + * + * @param errorRootExtractor Function that extracts the element from the root XML document. + * @return This builder for method chaining. + */ + public Builder errorRootExtractor(Function> errorRootExtractor) { + this.errorRootExtractor = errorRootExtractor; + return this; + } + + /** + * The unmarshaller to use. The unmarshaller only unmarshalls any modeled fields of the exception, + * additional metadata is extracted by {@link AwsXmlErrorProtocolUnmarshaller}. + * + * @param errorUnmarshaller Error unmarshaller to use. + * @return This builder for method chaining. + */ + public Builder errorUnmarshaller(XmlErrorUnmarshaller errorUnmarshaller) { + this.errorUnmarshaller = errorUnmarshaller; + return this; + } + + /** + * @return New instance of {@link AwsXmlErrorProtocolUnmarshaller}. + */ + public AwsXmlErrorProtocolUnmarshaller build() { + return new AwsXmlErrorProtocolUnmarshaller(this); + } + } +} \ No newline at end of file From 60795843950e2e3f544b91c346b20c661de95837 Mon Sep 17 00:00:00 2001 From: Saranya Somepalli Date: Wed, 9 Apr 2025 04:38:29 +0530 Subject: [PATCH 12/22] Fixing test failures --- .../bugfix-AWSSDKforJavav2-e869e94.json | 2 +- .../poet/client/specs/JsonProtocolSpec.java | 3 + .../sra/test-aws-json-async-client-class.java | 772 ++++++++-------- .../sra/test-cbor-async-client-class.java | 772 ++++++++-------- .../sra/test-json-async-client-class.java | 860 +++++++++-------- .../client/sra/test-json-client-class.java | 635 +++++++------ .../test-aws-json-async-client-class.java | 782 ++++++++-------- ...ry-compatible-json-async-client-class.java | 50 +- ...ery-compatible-json-sync-client-class.java | 50 +- .../poet/client/test-batchmanager-async.java | 44 +- .../client/test-cbor-async-client-class.java | 782 ++++++++-------- .../poet/client/test-cbor-client-class.java | 573 ++++++------ .../poet/client/test-custompackage-async.java | 46 +- .../poet/client/test-custompackage-sync.java | 44 +- .../test-customservicemetadata-async.java | 46 +- .../test-customservicemetadata-sync.java | 44 +- .../client/test-endpoint-discovery-async.java | 220 ++--- .../client/test-endpoint-discovery-sync.java | 178 ++-- .../client/test-json-async-client-class.java | 868 +++++++++--------- .../poet/client/test-json-client-class.java | 641 +++++++------ .../client/test-rpcv2-async-client-class.java | 653 ++++++------- .../codegen/poet/client/test-rpcv2-sync.java | 645 +++++++------ ...gned-payload-trait-async-client-class.java | 464 +++++----- ...igned-payload-trait-sync-client-class.java | 468 +++++----- .../kinesis/KinesisExceptionTest.java | 83 +- 25 files changed, 5153 insertions(+), 4572 deletions(-) diff --git a/.changes/next-release/bugfix-AWSSDKforJavav2-e869e94.json b/.changes/next-release/bugfix-AWSSDKforJavav2-e869e94.json index 096a10895c1c..359e53fe8270 100644 --- a/.changes/next-release/bugfix-AWSSDKforJavav2-e869e94.json +++ b/.changes/next-release/bugfix-AWSSDKforJavav2-e869e94.json @@ -2,5 +2,5 @@ "type": "bugfix", "category": "AWS SDK for Java v2", "contributor": "", - "description": "Update non-streaming error unmarshalling to use the same mapping function that was previously implemented for streaming operations, which allows to deprecate createErrorResponseHandler(JsonOperationMetadata) method." + "description": "Enhance non-streaming error unmarshalling to properly unmarshall exceptions to their expected types." } diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/JsonProtocolSpec.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/JsonProtocolSpec.java index 9c77b0869505..16f0ef70a3bc 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/JsonProtocolSpec.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/JsonProtocolSpec.java @@ -177,6 +177,9 @@ public Optional errorResponseHandler(OperationModel opModel) { ParameterizedTypeName.get(Optional.class, ExceptionMetadata.class)); builder.add("\n$T exceptionMetadataMapper = errorCode -> {\n", metadataMapperType); + builder.add("if (errorCode == null) {\n"); + builder.add("return $T.empty();\n", Optional.class); + builder.add("}\n"); builder.add("switch (errorCode) {\n"); model.getShapes().values().stream() .filter(shape -> shape.getShapeType() == ShapeType.Exception) diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-aws-json-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-aws-json-async-client-class.java index 1017028f4880..e4a6f0f5d2ab 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-aws-json-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-aws-json-async-client-class.java @@ -128,7 +128,7 @@ final class DefaultJsonAsyncClient implements JsonAsyncClient { private static final Logger log = LoggerFactory.getLogger(DefaultJsonAsyncClient.class); private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder() - .serviceProtocol(AwsServiceProtocol.AWS_JSON).build(); + .serviceProtocol(AwsServiceProtocol.AWS_JSON).build(); private final AsyncClientHandler clientHandler; @@ -178,43 +178,46 @@ public JsonUtilities utilities() { public CompletableFuture aPostOperation(APostOperationRequest aPostOperationRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "APostOperation"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, APostOperationResponse::builder); + operationMetadata, APostOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); String hostPrefix = "{StringMember}-foo."; HostnameValidator.validateHostnameCompliant(aPostOperationRequest.stringMember(), "StringMember", - "aPostOperationRequest"); + "aPostOperationRequest"); String resolvedHostExpression = String.format("%s-foo.", aPostOperationRequest.stringMember()); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("APostOperation").withProtocolMetadata(protocolMetadata) - .withMarshaller(new APostOperationRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .hostPrefixExpression(resolvedHostExpression).withInput(aPostOperationRequest)); + .execute(new ClientExecutionParams() + .withOperationName("APostOperation").withProtocolMetadata(protocolMetadata) + .withMarshaller(new APostOperationRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .hostPrefixExpression(resolvedHostExpression).withInput(aPostOperationRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -253,43 +256,46 @@ public CompletableFuture aPostOperation(APostOperationRe */ @Override public CompletableFuture aPostOperationWithOutput( - APostOperationWithOutputRequest aPostOperationWithOutputRequest) { + APostOperationWithOutputRequest aPostOperationWithOutputRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationWithOutputRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationWithOutputRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "APostOperationWithOutput"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, APostOperationWithOutputResponse::builder); + operationMetadata, APostOperationWithOutputResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("APostOperationWithOutput").withProtocolMetadata(protocolMetadata) - .withMarshaller(new APostOperationWithOutputRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(aPostOperationWithOutputRequest)); + .execute(new ClientExecutionParams() + .withOperationName("APostOperationWithOutput").withProtocolMetadata(protocolMetadata) + .withMarshaller(new APostOperationWithOutputRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(aPostOperationWithOutputRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -323,78 +329,81 @@ public CompletableFuture aPostOperationWithOut */ @Override public CompletableFuture eventStreamOperation(EventStreamOperationRequest eventStreamOperationRequest, - Publisher requestStream, EventStreamOperationResponseHandler asyncResponseHandler) { + Publisher requestStream, EventStreamOperationResponseHandler asyncResponseHandler) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(eventStreamOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, eventStreamOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "EventStreamOperation"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = new AttachHttpMetadataResponseHandler( - protocolFactory.createResponseHandler(operationMetadata, EventStreamOperationResponse::builder)); + protocolFactory.createResponseHandler(operationMetadata, EventStreamOperationResponse::builder)); HttpResponseHandler voidResponseHandler = protocolFactory.createResponseHandler(JsonOperationMetadata - .builder().isPayloadJson(false).hasStreamingSuccessResponse(true).build(), VoidSdkResponse::builder); + .builder().isPayloadJson(false).hasStreamingSuccessResponse(true).build(), VoidSdkResponse::builder); HttpResponseHandler eventResponseHandler = protocolFactory.createResponseHandler( - JsonOperationMetadata.builder().isPayloadJson(true).hasStreamingSuccessResponse(false).build(), - EventStreamTaggedUnionPojoSupplier.builder().putSdkPojoSupplier("EventOne", EventStream::eventOneBuilder) - .putSdkPojoSupplier("EventTheSecond", EventStream::eventTheSecondBuilder) - .putSdkPojoSupplier("secondEventOne", EventStream::secondEventOneBuilder) - .putSdkPojoSupplier("eventThree", EventStream::eventThreeBuilder) - .defaultSdkPojoSupplier(() -> new SdkPojoBuilder(EventStream.UNKNOWN)).build()); + JsonOperationMetadata.builder().isPayloadJson(true).hasStreamingSuccessResponse(false).build(), + EventStreamTaggedUnionPojoSupplier.builder().putSdkPojoSupplier("EventOne", EventStream::eventOneBuilder) + .putSdkPojoSupplier("EventTheSecond", EventStream::eventTheSecondBuilder) + .putSdkPojoSupplier("secondEventOne", EventStream::secondEventOneBuilder) + .putSdkPojoSupplier("eventThree", EventStream::eventThreeBuilder) + .defaultSdkPojoSupplier(() -> new SdkPojoBuilder(EventStream.UNKNOWN)).build()); Function> eventstreamExceptionMetadataMapper = errorCode -> { switch (errorCode) { - default: - return Optional.empty(); + default: + return Optional.empty(); } }; HttpResponseHandler errorEventResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, eventstreamExceptionMetadataMapper); + operationMetadata, eventstreamExceptionMetadataMapper); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); EventStreamTaggedUnionJsonMarshaller eventMarshaller = EventStreamTaggedUnionJsonMarshaller.builder() - .putMarshaller(DefaultInputEvent.class, new InputEventMarshaller(protocolFactory)).build(); + .putMarshaller(DefaultInputEvent.class, new InputEventMarshaller(protocolFactory)).build(); SdkPublisher eventPublisher = SdkPublisher.adapt(requestStream); Publisher adapted = eventPublisher.map(event -> eventMarshaller.marshall(event)).map( - AwsClientHandlerUtils::encodeEventStreamRequestToByteBuffer); + AwsClientHandlerUtils::encodeEventStreamRequestToByteBuffer); CompletableFuture future = new CompletableFuture<>(); EventStreamAsyncResponseTransformer asyncResponseTransformer = EventStreamAsyncResponseTransformer - . builder().eventStreamResponseHandler(asyncResponseHandler) - .eventResponseHandler(eventResponseHandler).initialResponseHandler(responseHandler) - .exceptionResponseHandler(errorEventResponseHandler).future(future).executor(executor) - .serviceName(serviceName()).build(); + . builder().eventStreamResponseHandler(asyncResponseHandler) + .eventResponseHandler(eventResponseHandler).initialResponseHandler(responseHandler) + .exceptionResponseHandler(errorEventResponseHandler).future(future).executor(executor) + .serviceName(serviceName()).build(); CompletableFuture executeFuture = clientHandler.execute( - new ClientExecutionParams() - .withOperationName("EventStreamOperation").withProtocolMetadata(protocolMetadata) - .withMarshaller(new EventStreamOperationRequestMarshaller(protocolFactory)) - .withAsyncRequestBody(AsyncRequestBody.fromPublisher(adapted)).withFullDuplex(true) - .withInitialRequestEvent(true).withResponseHandler(voidResponseHandler) - .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) - .withMetricCollector(apiCallMetricCollector).withInput(eventStreamOperationRequest), - asyncResponseTransformer); + new ClientExecutionParams() + .withOperationName("EventStreamOperation").withProtocolMetadata(protocolMetadata) + .withMarshaller(new EventStreamOperationRequestMarshaller(protocolFactory)) + .withAsyncRequestBody(AsyncRequestBody.fromPublisher(adapted)).withFullDuplex(true) + .withInitialRequestEvent(true).withResponseHandler(voidResponseHandler) + .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) + .withMetricCollector(apiCallMetricCollector).withInput(eventStreamOperationRequest), + asyncResponseTransformer); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { if (e != null) { try { @@ -409,7 +418,7 @@ public CompletableFuture eventStreamOperation(EventStreamOperationRequest return CompletableFutureUtils.forwardExceptionTo(future, executeFuture); } catch (Throwable t) { runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> asyncResponseHandler.exceptionOccurred(t)); + () -> asyncResponseHandler.exceptionOccurred(t)); metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } @@ -438,51 +447,54 @@ public CompletableFuture eventStreamOperation(EventStreamOperationRequest */ @Override public CompletableFuture eventStreamOperationWithOnlyInput( - EventStreamOperationWithOnlyInputRequest eventStreamOperationWithOnlyInputRequest, - Publisher requestStream) { + EventStreamOperationWithOnlyInputRequest eventStreamOperationWithOnlyInputRequest, + Publisher requestStream) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(eventStreamOperationWithOnlyInputRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - eventStreamOperationWithOnlyInputRequest.overrideConfiguration().orElse(null)); + eventStreamOperationWithOnlyInputRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "EventStreamOperationWithOnlyInput"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(operationMetadata, EventStreamOperationWithOnlyInputResponse::builder); + .createResponseHandler(operationMetadata, EventStreamOperationWithOnlyInputResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); EventStreamTaggedUnionJsonMarshaller eventMarshaller = EventStreamTaggedUnionJsonMarshaller.builder() - .putMarshaller(DefaultInputEventOne.class, new InputEventMarshaller(protocolFactory)) - .putMarshaller(DefaultInputEventTwo.class, new InputEventTwoMarshaller(protocolFactory)).build(); + .putMarshaller(DefaultInputEventOne.class, new InputEventMarshaller(protocolFactory)) + .putMarshaller(DefaultInputEventTwo.class, new InputEventTwoMarshaller(protocolFactory)).build(); SdkPublisher eventPublisher = SdkPublisher.adapt(requestStream); Publisher adapted = eventPublisher.map(event -> eventMarshaller.marshall(event)).map( - AwsClientHandlerUtils::encodeEventStreamRequestToByteBuffer); + AwsClientHandlerUtils::encodeEventStreamRequestToByteBuffer); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("EventStreamOperationWithOnlyInput").withProtocolMetadata(protocolMetadata) - .withMarshaller(new EventStreamOperationWithOnlyInputRequestMarshaller(protocolFactory)) - .withAsyncRequestBody(AsyncRequestBody.fromPublisher(adapted)).withInitialRequestEvent(true) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(eventStreamOperationWithOnlyInputRequest)); + .execute(new ClientExecutionParams() + .withOperationName("EventStreamOperationWithOnlyInput").withProtocolMetadata(protocolMetadata) + .withMarshaller(new EventStreamOperationWithOnlyInputRequestMarshaller(protocolFactory)) + .withAsyncRequestBody(AsyncRequestBody.fromPublisher(adapted)).withInitialRequestEvent(true) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(eventStreamOperationWithOnlyInputRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -517,72 +529,75 @@ public CompletableFuture eventStreamO */ @Override public CompletableFuture eventStreamOperationWithOnlyOutput( - EventStreamOperationWithOnlyOutputRequest eventStreamOperationWithOnlyOutputRequest, - EventStreamOperationWithOnlyOutputResponseHandler asyncResponseHandler) { + EventStreamOperationWithOnlyOutputRequest eventStreamOperationWithOnlyOutputRequest, + EventStreamOperationWithOnlyOutputResponseHandler asyncResponseHandler) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(eventStreamOperationWithOnlyOutputRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - eventStreamOperationWithOnlyOutputRequest.overrideConfiguration().orElse(null)); + eventStreamOperationWithOnlyOutputRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "EventStreamOperationWithOnlyOutput"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = new AttachHttpMetadataResponseHandler( - protocolFactory.createResponseHandler(operationMetadata, EventStreamOperationWithOnlyOutputResponse::builder)); + protocolFactory.createResponseHandler(operationMetadata, EventStreamOperationWithOnlyOutputResponse::builder)); HttpResponseHandler voidResponseHandler = protocolFactory.createResponseHandler(JsonOperationMetadata - .builder().isPayloadJson(false).hasStreamingSuccessResponse(true).build(), VoidSdkResponse::builder); + .builder().isPayloadJson(false).hasStreamingSuccessResponse(true).build(), VoidSdkResponse::builder); HttpResponseHandler eventResponseHandler = protocolFactory.createResponseHandler( - JsonOperationMetadata.builder().isPayloadJson(true).hasStreamingSuccessResponse(false).build(), - EventStreamTaggedUnionPojoSupplier.builder().putSdkPojoSupplier("EventOne", EventStream::eventOneBuilder) - .putSdkPojoSupplier("EventTheSecond", EventStream::eventTheSecondBuilder) - .putSdkPojoSupplier("secondEventOne", EventStream::secondEventOneBuilder) - .putSdkPojoSupplier("eventThree", EventStream::eventThreeBuilder) - .defaultSdkPojoSupplier(() -> new SdkPojoBuilder(EventStream.UNKNOWN)).build()); + JsonOperationMetadata.builder().isPayloadJson(true).hasStreamingSuccessResponse(false).build(), + EventStreamTaggedUnionPojoSupplier.builder().putSdkPojoSupplier("EventOne", EventStream::eventOneBuilder) + .putSdkPojoSupplier("EventTheSecond", EventStream::eventTheSecondBuilder) + .putSdkPojoSupplier("secondEventOne", EventStream::secondEventOneBuilder) + .putSdkPojoSupplier("eventThree", EventStream::eventThreeBuilder) + .defaultSdkPojoSupplier(() -> new SdkPojoBuilder(EventStream.UNKNOWN)).build()); Function> eventstreamExceptionMetadataMapper = errorCode -> { switch (errorCode) { - default: - return Optional.empty(); + default: + return Optional.empty(); } }; HttpResponseHandler errorEventResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, eventstreamExceptionMetadataMapper); + operationMetadata, eventstreamExceptionMetadataMapper); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture future = new CompletableFuture<>(); EventStreamAsyncResponseTransformer asyncResponseTransformer = EventStreamAsyncResponseTransformer - . builder() - .eventStreamResponseHandler(asyncResponseHandler).eventResponseHandler(eventResponseHandler) - .initialResponseHandler(responseHandler).exceptionResponseHandler(errorEventResponseHandler).future(future) - .executor(executor).serviceName(serviceName()).build(); + . builder() + .eventStreamResponseHandler(asyncResponseHandler).eventResponseHandler(eventResponseHandler) + .initialResponseHandler(responseHandler).exceptionResponseHandler(errorEventResponseHandler).future(future) + .executor(executor).serviceName(serviceName()).build(); CompletableFuture executeFuture = clientHandler.execute( - new ClientExecutionParams() - .withOperationName("EventStreamOperationWithOnlyOutput").withProtocolMetadata(protocolMetadata) - .withMarshaller(new EventStreamOperationWithOnlyOutputRequestMarshaller(protocolFactory)) - .withResponseHandler(voidResponseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(eventStreamOperationWithOnlyOutputRequest), asyncResponseTransformer); + new ClientExecutionParams() + .withOperationName("EventStreamOperationWithOnlyOutput").withProtocolMetadata(protocolMetadata) + .withMarshaller(new EventStreamOperationWithOnlyOutputRequestMarshaller(protocolFactory)) + .withResponseHandler(voidResponseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(eventStreamOperationWithOnlyOutputRequest), asyncResponseTransformer); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { if (e != null) { try { @@ -597,7 +612,7 @@ public CompletableFuture eventStreamOperationWithOnlyOutput( return CompletableFutureUtils.forwardExceptionTo(future, executeFuture); } catch (Throwable t) { runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> asyncResponseHandler.exceptionOccurred(t)); + () -> asyncResponseHandler.exceptionOccurred(t)); metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } @@ -629,43 +644,46 @@ public CompletableFuture eventStreamOperationWithOnlyOutput( */ @Override public CompletableFuture getWithoutRequiredMembers( - GetWithoutRequiredMembersRequest getWithoutRequiredMembersRequest) { + GetWithoutRequiredMembersRequest getWithoutRequiredMembersRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getWithoutRequiredMembersRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getWithoutRequiredMembersRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetWithoutRequiredMembers"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, GetWithoutRequiredMembersResponse::builder); + operationMetadata, GetWithoutRequiredMembersResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("GetWithoutRequiredMembers").withProtocolMetadata(protocolMetadata) - .withMarshaller(new GetWithoutRequiredMembersRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(getWithoutRequiredMembersRequest)); + .execute(new ClientExecutionParams() + .withOperationName("GetWithoutRequiredMembers").withProtocolMetadata(protocolMetadata) + .withMarshaller(new GetWithoutRequiredMembersRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(getWithoutRequiredMembersRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -700,47 +718,50 @@ public CompletableFuture getWithoutRequiredMe */ @Override public CompletableFuture operationWithChecksumRequired( - OperationWithChecksumRequiredRequest operationWithChecksumRequiredRequest) { + OperationWithChecksumRequiredRequest operationWithChecksumRequiredRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithChecksumRequiredRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithChecksumRequiredRequest.overrideConfiguration().orElse(null)); + operationWithChecksumRequiredRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithChecksumRequired"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, OperationWithChecksumRequiredResponse::builder); + operationMetadata, OperationWithChecksumRequiredResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithChecksumRequired") - .withProtocolMetadata(protocolMetadata) - .withMarshaller(new OperationWithChecksumRequiredRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute(SdkInternalExecutionAttribute.HTTP_CHECKSUM_REQUIRED, - HttpChecksumRequired.create()).withInput(operationWithChecksumRequiredRequest)); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithChecksumRequired") + .withProtocolMetadata(protocolMetadata) + .withMarshaller(new OperationWithChecksumRequiredRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute(SdkInternalExecutionAttribute.HTTP_CHECKSUM_REQUIRED, + HttpChecksumRequired.create()).withInput(operationWithChecksumRequiredRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -774,43 +795,46 @@ public CompletableFuture operationWithChe */ @Override public CompletableFuture operationWithNoneAuthType( - OperationWithNoneAuthTypeRequest operationWithNoneAuthTypeRequest) { + OperationWithNoneAuthTypeRequest operationWithNoneAuthTypeRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithNoneAuthTypeRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithNoneAuthTypeRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithNoneAuthType"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, OperationWithNoneAuthTypeResponse::builder); + operationMetadata, OperationWithNoneAuthTypeResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithNoneAuthType").withProtocolMetadata(protocolMetadata) - .withMarshaller(new OperationWithNoneAuthTypeRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(operationWithNoneAuthTypeRequest)); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithNoneAuthType").withProtocolMetadata(protocolMetadata) + .withMarshaller(new OperationWithNoneAuthTypeRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(operationWithNoneAuthTypeRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -845,48 +869,51 @@ public CompletableFuture operationWithNoneAut */ @Override public CompletableFuture operationWithRequestCompression( - OperationWithRequestCompressionRequest operationWithRequestCompressionRequest) { + OperationWithRequestCompressionRequest operationWithRequestCompressionRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithRequestCompressionRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithRequestCompressionRequest.overrideConfiguration().orElse(null)); + operationWithRequestCompressionRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithRequestCompression"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, OperationWithRequestCompressionResponse::builder); + operationMetadata, OperationWithRequestCompressionResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithRequestCompression") - .withProtocolMetadata(protocolMetadata) - .withMarshaller(new OperationWithRequestCompressionRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute(SdkInternalExecutionAttribute.REQUEST_COMPRESSION, - RequestCompression.builder().encodings("gzip").isStreaming(false).build()) - .withInput(operationWithRequestCompressionRequest)); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithRequestCompression") + .withProtocolMetadata(protocolMetadata) + .withMarshaller(new OperationWithRequestCompressionRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute(SdkInternalExecutionAttribute.REQUEST_COMPRESSION, + RequestCompression.builder().encodings("gzip").isStreaming(false).build()) + .withInput(operationWithRequestCompressionRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -921,43 +948,46 @@ public CompletableFuture operationWithR */ @Override public CompletableFuture paginatedOperationWithResultKey( - PaginatedOperationWithResultKeyRequest paginatedOperationWithResultKeyRequest) { + PaginatedOperationWithResultKeyRequest paginatedOperationWithResultKeyRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(paginatedOperationWithResultKeyRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - paginatedOperationWithResultKeyRequest.overrideConfiguration().orElse(null)); + paginatedOperationWithResultKeyRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PaginatedOperationWithResultKey"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, PaginatedOperationWithResultKeyResponse::builder); + operationMetadata, PaginatedOperationWithResultKeyResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("PaginatedOperationWithResultKey").withProtocolMetadata(protocolMetadata) - .withMarshaller(new PaginatedOperationWithResultKeyRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(paginatedOperationWithResultKeyRequest)); + .execute(new ClientExecutionParams() + .withOperationName("PaginatedOperationWithResultKey").withProtocolMetadata(protocolMetadata) + .withMarshaller(new PaginatedOperationWithResultKeyRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(paginatedOperationWithResultKeyRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -992,43 +1022,46 @@ public CompletableFuture paginatedOpera */ @Override public CompletableFuture paginatedOperationWithoutResultKey( - PaginatedOperationWithoutResultKeyRequest paginatedOperationWithoutResultKeyRequest) { + PaginatedOperationWithoutResultKeyRequest paginatedOperationWithoutResultKeyRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(paginatedOperationWithoutResultKeyRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - paginatedOperationWithoutResultKeyRequest.overrideConfiguration().orElse(null)); + paginatedOperationWithoutResultKeyRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PaginatedOperationWithoutResultKey"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(operationMetadata, PaginatedOperationWithoutResultKeyResponse::builder); + .createResponseHandler(operationMetadata, PaginatedOperationWithoutResultKeyResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("PaginatedOperationWithoutResultKey").withProtocolMetadata(protocolMetadata) - .withMarshaller(new PaginatedOperationWithoutResultKeyRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(paginatedOperationWithoutResultKeyRequest)); + .execute(new ClientExecutionParams() + .withOperationName("PaginatedOperationWithoutResultKey").withProtocolMetadata(protocolMetadata) + .withMarshaller(new PaginatedOperationWithoutResultKeyRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(paginatedOperationWithoutResultKeyRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -1067,47 +1100,50 @@ public CompletableFuture paginatedOp */ @Override public CompletableFuture streamingInputOperation( - StreamingInputOperationRequest streamingInputOperationRequest, AsyncRequestBody requestBody) { + StreamingInputOperationRequest streamingInputOperationRequest, AsyncRequestBody requestBody) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingInputOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingInputOperation"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, StreamingInputOperationResponse::builder); + operationMetadata, StreamingInputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("StreamingInputOperation") - .withProtocolMetadata(protocolMetadata) - .withMarshaller( - AsyncStreamingRequestMarshaller.builder() - .delegateMarshaller(new StreamingInputOperationRequestMarshaller(protocolFactory)) - .asyncRequestBody(requestBody).build()).withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) - .withMetricCollector(apiCallMetricCollector).withAsyncRequestBody(requestBody) - .withInput(streamingInputOperationRequest)); + .execute(new ClientExecutionParams() + .withOperationName("StreamingInputOperation") + .withProtocolMetadata(protocolMetadata) + .withMarshaller( + AsyncStreamingRequestMarshaller.builder() + .delegateMarshaller(new StreamingInputOperationRequestMarshaller(protocolFactory)) + .asyncRequestBody(requestBody).build()).withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) + .withMetricCollector(apiCallMetricCollector).withAsyncRequestBody(requestBody) + .withInput(streamingInputOperationRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -1151,60 +1187,63 @@ public CompletableFuture streamingInputOperatio */ @Override public CompletableFuture streamingInputOutputOperation( - StreamingInputOutputOperationRequest streamingInputOutputOperationRequest, AsyncRequestBody requestBody, - AsyncResponseTransformer asyncResponseTransformer) { + StreamingInputOutputOperationRequest streamingInputOutputOperationRequest, AsyncRequestBody requestBody, + AsyncResponseTransformer asyncResponseTransformer) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOutputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - streamingInputOutputOperationRequest.overrideConfiguration().orElse(null)); + streamingInputOutputOperationRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingInputOutputOperation"); Pair, CompletableFuture> pair = AsyncResponseTransformerUtils - .wrapWithEndOfStreamFuture(asyncResponseTransformer); + .wrapWithEndOfStreamFuture(asyncResponseTransformer); asyncResponseTransformer = pair.left(); CompletableFuture endOfStreamFuture = pair.right(); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(true) - .isPayloadJson(false).build(); + .isPayloadJson(false).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, StreamingInputOutputOperationResponse::builder); + operationMetadata, StreamingInputOutputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler.execute( - new ClientExecutionParams() - .withOperationName("StreamingInputOutputOperation") - .withProtocolMetadata(protocolMetadata) - .withMarshaller( - AsyncStreamingRequestMarshaller - .builder() - .delegateMarshaller( - new StreamingInputOutputOperationRequestMarshaller(protocolFactory)) - .asyncRequestBody(requestBody).transferEncoding(true).build()) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withAsyncRequestBody(requestBody).withInput(streamingInputOutputOperationRequest), - asyncResponseTransformer); + new ClientExecutionParams() + .withOperationName("StreamingInputOutputOperation") + .withProtocolMetadata(protocolMetadata) + .withMarshaller( + AsyncStreamingRequestMarshaller + .builder() + .delegateMarshaller( + new StreamingInputOutputOperationRequestMarshaller(protocolFactory)) + .asyncRequestBody(requestBody).transferEncoding(true).build()) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withAsyncRequestBody(requestBody).withInput(streamingInputOutputOperationRequest), + asyncResponseTransformer); AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { if (e != null) { runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> finalAsyncResponseTransformer.exceptionOccurred(e)); + () -> finalAsyncResponseTransformer.exceptionOccurred(e)); } endOfStreamFuture.whenComplete((r2, e2) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -1215,7 +1254,7 @@ public CompletableFuture streamingInputOutputOperation( } catch (Throwable t) { AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> finalAsyncResponseTransformer.exceptionOccurred(t)); + () -> finalAsyncResponseTransformer.exceptionOccurred(t)); metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } @@ -1248,53 +1287,56 @@ public CompletableFuture streamingInputOutputOperation( */ @Override public CompletableFuture streamingOutputOperation( - StreamingOutputOperationRequest streamingOutputOperationRequest, - AsyncResponseTransformer asyncResponseTransformer) { + StreamingOutputOperationRequest streamingOutputOperationRequest, + AsyncResponseTransformer asyncResponseTransformer) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingOutputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingOutputOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingOutputOperation"); Pair, CompletableFuture> pair = AsyncResponseTransformerUtils - .wrapWithEndOfStreamFuture(asyncResponseTransformer); + .wrapWithEndOfStreamFuture(asyncResponseTransformer); asyncResponseTransformer = pair.left(); CompletableFuture endOfStreamFuture = pair.right(); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(true) - .isPayloadJson(false).build(); + .isPayloadJson(false).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, StreamingOutputOperationResponse::builder); + operationMetadata, StreamingOutputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler.execute( - new ClientExecutionParams() - .withOperationName("StreamingOutputOperation").withProtocolMetadata(protocolMetadata) - .withMarshaller(new StreamingOutputOperationRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(streamingOutputOperationRequest), asyncResponseTransformer); + new ClientExecutionParams() + .withOperationName("StreamingOutputOperation").withProtocolMetadata(protocolMetadata) + .withMarshaller(new StreamingOutputOperationRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(streamingOutputOperationRequest), asyncResponseTransformer); AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { if (e != null) { runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> finalAsyncResponseTransformer.exceptionOccurred(e)); + () -> finalAsyncResponseTransformer.exceptionOccurred(e)); } endOfStreamFuture.whenComplete((r2, e2) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -1305,7 +1347,7 @@ public CompletableFuture streamingOutputOperation( } catch (Throwable t) { AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> finalAsyncResponseTransformer.exceptionOccurred(t)); + () -> finalAsyncResponseTransformer.exceptionOccurred(t)); metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } @@ -1323,11 +1365,11 @@ public final String serviceName() { private > T init(T builder) { return builder.clientConfiguration(clientConfiguration).defaultServiceExceptionSupplier(JsonException::builder) - .protocol(AwsJsonProtocol.AWS_JSON).protocolVersion("1.1"); + .protocol(AwsJsonProtocol.AWS_JSON).protocolVersion("1.1"); } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, - RequestOverrideConfiguration requestOverrideConfiguration) { + RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); @@ -1379,7 +1421,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, - JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { + JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); } diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-cbor-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-cbor-async-client-class.java index a5c734fab269..235d8c308f2e 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-cbor-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-cbor-async-client-class.java @@ -129,7 +129,7 @@ final class DefaultJsonAsyncClient implements JsonAsyncClient { private static final Logger log = LoggerFactory.getLogger(DefaultJsonAsyncClient.class); private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder() - .serviceProtocol(AwsServiceProtocol.CBOR).build(); + .serviceProtocol(AwsServiceProtocol.CBOR).build(); private final AsyncClientHandler clientHandler; @@ -182,43 +182,46 @@ public JsonUtilities utilities() { public CompletableFuture aPostOperation(APostOperationRequest aPostOperationRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "APostOperation"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, APostOperationResponse::builder); + operationMetadata, APostOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); String hostPrefix = "{StringMember}-foo."; HostnameValidator.validateHostnameCompliant(aPostOperationRequest.stringMember(), "StringMember", - "aPostOperationRequest"); + "aPostOperationRequest"); String resolvedHostExpression = String.format("%s-foo.", aPostOperationRequest.stringMember()); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("APostOperation").withProtocolMetadata(protocolMetadata) - .withMarshaller(new APostOperationRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .hostPrefixExpression(resolvedHostExpression).withInput(aPostOperationRequest)); + .execute(new ClientExecutionParams() + .withOperationName("APostOperation").withProtocolMetadata(protocolMetadata) + .withMarshaller(new APostOperationRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .hostPrefixExpression(resolvedHostExpression).withInput(aPostOperationRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -257,43 +260,46 @@ public CompletableFuture aPostOperation(APostOperationRe */ @Override public CompletableFuture aPostOperationWithOutput( - APostOperationWithOutputRequest aPostOperationWithOutputRequest) { + APostOperationWithOutputRequest aPostOperationWithOutputRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationWithOutputRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationWithOutputRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "APostOperationWithOutput"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, APostOperationWithOutputResponse::builder); + operationMetadata, APostOperationWithOutputResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("APostOperationWithOutput").withProtocolMetadata(protocolMetadata) - .withMarshaller(new APostOperationWithOutputRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(aPostOperationWithOutputRequest)); + .execute(new ClientExecutionParams() + .withOperationName("APostOperationWithOutput").withProtocolMetadata(protocolMetadata) + .withMarshaller(new APostOperationWithOutputRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(aPostOperationWithOutputRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -327,78 +333,81 @@ public CompletableFuture aPostOperationWithOut */ @Override public CompletableFuture eventStreamOperation(EventStreamOperationRequest eventStreamOperationRequest, - Publisher requestStream, EventStreamOperationResponseHandler asyncResponseHandler) { + Publisher requestStream, EventStreamOperationResponseHandler asyncResponseHandler) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(eventStreamOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, eventStreamOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "EventStreamOperation"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = new AttachHttpMetadataResponseHandler( - protocolFactory.createResponseHandler(operationMetadata, EventStreamOperationResponse::builder)); + protocolFactory.createResponseHandler(operationMetadata, EventStreamOperationResponse::builder)); HttpResponseHandler voidResponseHandler = protocolFactory.createResponseHandler(JsonOperationMetadata - .builder().isPayloadJson(false).hasStreamingSuccessResponse(true).build(), VoidSdkResponse::builder); + .builder().isPayloadJson(false).hasStreamingSuccessResponse(true).build(), VoidSdkResponse::builder); HttpResponseHandler eventResponseHandler = protocolFactory.createResponseHandler( - JsonOperationMetadata.builder().isPayloadJson(true).hasStreamingSuccessResponse(false).build(), - EventStreamTaggedUnionPojoSupplier.builder().putSdkPojoSupplier("EventOne", EventStream::eventOneBuilder) - .putSdkPojoSupplier("EventTheSecond", EventStream::eventTheSecondBuilder) - .putSdkPojoSupplier("secondEventOne", EventStream::secondEventOneBuilder) - .putSdkPojoSupplier("eventThree", EventStream::eventThreeBuilder) - .defaultSdkPojoSupplier(() -> new SdkPojoBuilder(EventStream.UNKNOWN)).build()); + JsonOperationMetadata.builder().isPayloadJson(true).hasStreamingSuccessResponse(false).build(), + EventStreamTaggedUnionPojoSupplier.builder().putSdkPojoSupplier("EventOne", EventStream::eventOneBuilder) + .putSdkPojoSupplier("EventTheSecond", EventStream::eventTheSecondBuilder) + .putSdkPojoSupplier("secondEventOne", EventStream::secondEventOneBuilder) + .putSdkPojoSupplier("eventThree", EventStream::eventThreeBuilder) + .defaultSdkPojoSupplier(() -> new SdkPojoBuilder(EventStream.UNKNOWN)).build()); Function> eventstreamExceptionMetadataMapper = errorCode -> { switch (errorCode) { - default: - return Optional.empty(); + default: + return Optional.empty(); } }; HttpResponseHandler errorEventResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, eventstreamExceptionMetadataMapper); + operationMetadata, eventstreamExceptionMetadataMapper); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); EventStreamTaggedUnionJsonMarshaller eventMarshaller = EventStreamTaggedUnionJsonMarshaller.builder() - .putMarshaller(DefaultInputEvent.class, new InputEventMarshaller(protocolFactory)).build(); + .putMarshaller(DefaultInputEvent.class, new InputEventMarshaller(protocolFactory)).build(); SdkPublisher eventPublisher = SdkPublisher.adapt(requestStream); Publisher adapted = eventPublisher.map(event -> eventMarshaller.marshall(event)).map( - AwsClientHandlerUtils::encodeEventStreamRequestToByteBuffer); + AwsClientHandlerUtils::encodeEventStreamRequestToByteBuffer); CompletableFuture future = new CompletableFuture<>(); EventStreamAsyncResponseTransformer asyncResponseTransformer = EventStreamAsyncResponseTransformer - . builder().eventStreamResponseHandler(asyncResponseHandler) - .eventResponseHandler(eventResponseHandler).initialResponseHandler(responseHandler) - .exceptionResponseHandler(errorEventResponseHandler).future(future).executor(executor) - .serviceName(serviceName()).build(); + . builder().eventStreamResponseHandler(asyncResponseHandler) + .eventResponseHandler(eventResponseHandler).initialResponseHandler(responseHandler) + .exceptionResponseHandler(errorEventResponseHandler).future(future).executor(executor) + .serviceName(serviceName()).build(); CompletableFuture executeFuture = clientHandler.execute( - new ClientExecutionParams() - .withOperationName("EventStreamOperation").withProtocolMetadata(protocolMetadata) - .withMarshaller(new EventStreamOperationRequestMarshaller(protocolFactory)) - .withAsyncRequestBody(AsyncRequestBody.fromPublisher(adapted)).withFullDuplex(true) - .withInitialRequestEvent(true).withResponseHandler(voidResponseHandler) - .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) - .withMetricCollector(apiCallMetricCollector).withInput(eventStreamOperationRequest), - asyncResponseTransformer); + new ClientExecutionParams() + .withOperationName("EventStreamOperation").withProtocolMetadata(protocolMetadata) + .withMarshaller(new EventStreamOperationRequestMarshaller(protocolFactory)) + .withAsyncRequestBody(AsyncRequestBody.fromPublisher(adapted)).withFullDuplex(true) + .withInitialRequestEvent(true).withResponseHandler(voidResponseHandler) + .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) + .withMetricCollector(apiCallMetricCollector).withInput(eventStreamOperationRequest), + asyncResponseTransformer); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { if (e != null) { try { @@ -413,7 +422,7 @@ public CompletableFuture eventStreamOperation(EventStreamOperationRequest return CompletableFutureUtils.forwardExceptionTo(future, executeFuture); } catch (Throwable t) { runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> asyncResponseHandler.exceptionOccurred(t)); + () -> asyncResponseHandler.exceptionOccurred(t)); metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } @@ -442,51 +451,54 @@ public CompletableFuture eventStreamOperation(EventStreamOperationRequest */ @Override public CompletableFuture eventStreamOperationWithOnlyInput( - EventStreamOperationWithOnlyInputRequest eventStreamOperationWithOnlyInputRequest, - Publisher requestStream) { + EventStreamOperationWithOnlyInputRequest eventStreamOperationWithOnlyInputRequest, + Publisher requestStream) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(eventStreamOperationWithOnlyInputRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - eventStreamOperationWithOnlyInputRequest.overrideConfiguration().orElse(null)); + eventStreamOperationWithOnlyInputRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "EventStreamOperationWithOnlyInput"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(operationMetadata, EventStreamOperationWithOnlyInputResponse::builder); + .createResponseHandler(operationMetadata, EventStreamOperationWithOnlyInputResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); EventStreamTaggedUnionJsonMarshaller eventMarshaller = EventStreamTaggedUnionJsonMarshaller.builder() - .putMarshaller(DefaultInputEventOne.class, new InputEventMarshaller(protocolFactory)) - .putMarshaller(DefaultInputEventTwo.class, new InputEventTwoMarshaller(protocolFactory)).build(); + .putMarshaller(DefaultInputEventOne.class, new InputEventMarshaller(protocolFactory)) + .putMarshaller(DefaultInputEventTwo.class, new InputEventTwoMarshaller(protocolFactory)).build(); SdkPublisher eventPublisher = SdkPublisher.adapt(requestStream); Publisher adapted = eventPublisher.map(event -> eventMarshaller.marshall(event)).map( - AwsClientHandlerUtils::encodeEventStreamRequestToByteBuffer); + AwsClientHandlerUtils::encodeEventStreamRequestToByteBuffer); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("EventStreamOperationWithOnlyInput").withProtocolMetadata(protocolMetadata) - .withMarshaller(new EventStreamOperationWithOnlyInputRequestMarshaller(protocolFactory)) - .withAsyncRequestBody(AsyncRequestBody.fromPublisher(adapted)).withInitialRequestEvent(true) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(eventStreamOperationWithOnlyInputRequest)); + .execute(new ClientExecutionParams() + .withOperationName("EventStreamOperationWithOnlyInput").withProtocolMetadata(protocolMetadata) + .withMarshaller(new EventStreamOperationWithOnlyInputRequestMarshaller(protocolFactory)) + .withAsyncRequestBody(AsyncRequestBody.fromPublisher(adapted)).withInitialRequestEvent(true) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(eventStreamOperationWithOnlyInputRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -521,72 +533,75 @@ public CompletableFuture eventStreamO */ @Override public CompletableFuture eventStreamOperationWithOnlyOutput( - EventStreamOperationWithOnlyOutputRequest eventStreamOperationWithOnlyOutputRequest, - EventStreamOperationWithOnlyOutputResponseHandler asyncResponseHandler) { + EventStreamOperationWithOnlyOutputRequest eventStreamOperationWithOnlyOutputRequest, + EventStreamOperationWithOnlyOutputResponseHandler asyncResponseHandler) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(eventStreamOperationWithOnlyOutputRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - eventStreamOperationWithOnlyOutputRequest.overrideConfiguration().orElse(null)); + eventStreamOperationWithOnlyOutputRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "EventStreamOperationWithOnlyOutput"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = new AttachHttpMetadataResponseHandler( - protocolFactory.createResponseHandler(operationMetadata, EventStreamOperationWithOnlyOutputResponse::builder)); + protocolFactory.createResponseHandler(operationMetadata, EventStreamOperationWithOnlyOutputResponse::builder)); HttpResponseHandler voidResponseHandler = protocolFactory.createResponseHandler(JsonOperationMetadata - .builder().isPayloadJson(false).hasStreamingSuccessResponse(true).build(), VoidSdkResponse::builder); + .builder().isPayloadJson(false).hasStreamingSuccessResponse(true).build(), VoidSdkResponse::builder); HttpResponseHandler eventResponseHandler = protocolFactory.createResponseHandler( - JsonOperationMetadata.builder().isPayloadJson(true).hasStreamingSuccessResponse(false).build(), - EventStreamTaggedUnionPojoSupplier.builder().putSdkPojoSupplier("EventOne", EventStream::eventOneBuilder) - .putSdkPojoSupplier("EventTheSecond", EventStream::eventTheSecondBuilder) - .putSdkPojoSupplier("secondEventOne", EventStream::secondEventOneBuilder) - .putSdkPojoSupplier("eventThree", EventStream::eventThreeBuilder) - .defaultSdkPojoSupplier(() -> new SdkPojoBuilder(EventStream.UNKNOWN)).build()); + JsonOperationMetadata.builder().isPayloadJson(true).hasStreamingSuccessResponse(false).build(), + EventStreamTaggedUnionPojoSupplier.builder().putSdkPojoSupplier("EventOne", EventStream::eventOneBuilder) + .putSdkPojoSupplier("EventTheSecond", EventStream::eventTheSecondBuilder) + .putSdkPojoSupplier("secondEventOne", EventStream::secondEventOneBuilder) + .putSdkPojoSupplier("eventThree", EventStream::eventThreeBuilder) + .defaultSdkPojoSupplier(() -> new SdkPojoBuilder(EventStream.UNKNOWN)).build()); Function> eventstreamExceptionMetadataMapper = errorCode -> { switch (errorCode) { - default: - return Optional.empty(); + default: + return Optional.empty(); } }; HttpResponseHandler errorEventResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, eventstreamExceptionMetadataMapper); + operationMetadata, eventstreamExceptionMetadataMapper); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture future = new CompletableFuture<>(); EventStreamAsyncResponseTransformer asyncResponseTransformer = EventStreamAsyncResponseTransformer - . builder() - .eventStreamResponseHandler(asyncResponseHandler).eventResponseHandler(eventResponseHandler) - .initialResponseHandler(responseHandler).exceptionResponseHandler(errorEventResponseHandler).future(future) - .executor(executor).serviceName(serviceName()).build(); + . builder() + .eventStreamResponseHandler(asyncResponseHandler).eventResponseHandler(eventResponseHandler) + .initialResponseHandler(responseHandler).exceptionResponseHandler(errorEventResponseHandler).future(future) + .executor(executor).serviceName(serviceName()).build(); CompletableFuture executeFuture = clientHandler.execute( - new ClientExecutionParams() - .withOperationName("EventStreamOperationWithOnlyOutput").withProtocolMetadata(protocolMetadata) - .withMarshaller(new EventStreamOperationWithOnlyOutputRequestMarshaller(protocolFactory)) - .withResponseHandler(voidResponseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(eventStreamOperationWithOnlyOutputRequest), asyncResponseTransformer); + new ClientExecutionParams() + .withOperationName("EventStreamOperationWithOnlyOutput").withProtocolMetadata(protocolMetadata) + .withMarshaller(new EventStreamOperationWithOnlyOutputRequestMarshaller(protocolFactory)) + .withResponseHandler(voidResponseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(eventStreamOperationWithOnlyOutputRequest), asyncResponseTransformer); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { if (e != null) { try { @@ -601,7 +616,7 @@ public CompletableFuture eventStreamOperationWithOnlyOutput( return CompletableFutureUtils.forwardExceptionTo(future, executeFuture); } catch (Throwable t) { runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> asyncResponseHandler.exceptionOccurred(t)); + () -> asyncResponseHandler.exceptionOccurred(t)); metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } @@ -633,43 +648,46 @@ public CompletableFuture eventStreamOperationWithOnlyOutput( */ @Override public CompletableFuture getWithoutRequiredMembers( - GetWithoutRequiredMembersRequest getWithoutRequiredMembersRequest) { + GetWithoutRequiredMembersRequest getWithoutRequiredMembersRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getWithoutRequiredMembersRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getWithoutRequiredMembersRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetWithoutRequiredMembers"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, GetWithoutRequiredMembersResponse::builder); + operationMetadata, GetWithoutRequiredMembersResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("GetWithoutRequiredMembers").withProtocolMetadata(protocolMetadata) - .withMarshaller(new GetWithoutRequiredMembersRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(getWithoutRequiredMembersRequest)); + .execute(new ClientExecutionParams() + .withOperationName("GetWithoutRequiredMembers").withProtocolMetadata(protocolMetadata) + .withMarshaller(new GetWithoutRequiredMembersRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(getWithoutRequiredMembersRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -704,47 +722,50 @@ public CompletableFuture getWithoutRequiredMe */ @Override public CompletableFuture operationWithChecksumRequired( - OperationWithChecksumRequiredRequest operationWithChecksumRequiredRequest) { + OperationWithChecksumRequiredRequest operationWithChecksumRequiredRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithChecksumRequiredRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithChecksumRequiredRequest.overrideConfiguration().orElse(null)); + operationWithChecksumRequiredRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithChecksumRequired"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, OperationWithChecksumRequiredResponse::builder); + operationMetadata, OperationWithChecksumRequiredResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithChecksumRequired") - .withProtocolMetadata(protocolMetadata) - .withMarshaller(new OperationWithChecksumRequiredRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute(SdkInternalExecutionAttribute.HTTP_CHECKSUM_REQUIRED, - HttpChecksumRequired.create()).withInput(operationWithChecksumRequiredRequest)); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithChecksumRequired") + .withProtocolMetadata(protocolMetadata) + .withMarshaller(new OperationWithChecksumRequiredRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute(SdkInternalExecutionAttribute.HTTP_CHECKSUM_REQUIRED, + HttpChecksumRequired.create()).withInput(operationWithChecksumRequiredRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -778,43 +799,46 @@ public CompletableFuture operationWithChe */ @Override public CompletableFuture operationWithNoneAuthType( - OperationWithNoneAuthTypeRequest operationWithNoneAuthTypeRequest) { + OperationWithNoneAuthTypeRequest operationWithNoneAuthTypeRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithNoneAuthTypeRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithNoneAuthTypeRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithNoneAuthType"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, OperationWithNoneAuthTypeResponse::builder); + operationMetadata, OperationWithNoneAuthTypeResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithNoneAuthType").withProtocolMetadata(protocolMetadata) - .withMarshaller(new OperationWithNoneAuthTypeRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(operationWithNoneAuthTypeRequest)); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithNoneAuthType").withProtocolMetadata(protocolMetadata) + .withMarshaller(new OperationWithNoneAuthTypeRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(operationWithNoneAuthTypeRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -849,48 +873,51 @@ public CompletableFuture operationWithNoneAut */ @Override public CompletableFuture operationWithRequestCompression( - OperationWithRequestCompressionRequest operationWithRequestCompressionRequest) { + OperationWithRequestCompressionRequest operationWithRequestCompressionRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithRequestCompressionRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithRequestCompressionRequest.overrideConfiguration().orElse(null)); + operationWithRequestCompressionRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithRequestCompression"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, OperationWithRequestCompressionResponse::builder); + operationMetadata, OperationWithRequestCompressionResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithRequestCompression") - .withProtocolMetadata(protocolMetadata) - .withMarshaller(new OperationWithRequestCompressionRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute(SdkInternalExecutionAttribute.REQUEST_COMPRESSION, - RequestCompression.builder().encodings("gzip").isStreaming(false).build()) - .withInput(operationWithRequestCompressionRequest)); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithRequestCompression") + .withProtocolMetadata(protocolMetadata) + .withMarshaller(new OperationWithRequestCompressionRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute(SdkInternalExecutionAttribute.REQUEST_COMPRESSION, + RequestCompression.builder().encodings("gzip").isStreaming(false).build()) + .withInput(operationWithRequestCompressionRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -925,43 +952,46 @@ public CompletableFuture operationWithR */ @Override public CompletableFuture paginatedOperationWithResultKey( - PaginatedOperationWithResultKeyRequest paginatedOperationWithResultKeyRequest) { + PaginatedOperationWithResultKeyRequest paginatedOperationWithResultKeyRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(paginatedOperationWithResultKeyRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - paginatedOperationWithResultKeyRequest.overrideConfiguration().orElse(null)); + paginatedOperationWithResultKeyRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PaginatedOperationWithResultKey"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, PaginatedOperationWithResultKeyResponse::builder); + operationMetadata, PaginatedOperationWithResultKeyResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("PaginatedOperationWithResultKey").withProtocolMetadata(protocolMetadata) - .withMarshaller(new PaginatedOperationWithResultKeyRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(paginatedOperationWithResultKeyRequest)); + .execute(new ClientExecutionParams() + .withOperationName("PaginatedOperationWithResultKey").withProtocolMetadata(protocolMetadata) + .withMarshaller(new PaginatedOperationWithResultKeyRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(paginatedOperationWithResultKeyRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -996,43 +1026,46 @@ public CompletableFuture paginatedOpera */ @Override public CompletableFuture paginatedOperationWithoutResultKey( - PaginatedOperationWithoutResultKeyRequest paginatedOperationWithoutResultKeyRequest) { + PaginatedOperationWithoutResultKeyRequest paginatedOperationWithoutResultKeyRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(paginatedOperationWithoutResultKeyRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - paginatedOperationWithoutResultKeyRequest.overrideConfiguration().orElse(null)); + paginatedOperationWithoutResultKeyRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PaginatedOperationWithoutResultKey"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(operationMetadata, PaginatedOperationWithoutResultKeyResponse::builder); + .createResponseHandler(operationMetadata, PaginatedOperationWithoutResultKeyResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("PaginatedOperationWithoutResultKey").withProtocolMetadata(protocolMetadata) - .withMarshaller(new PaginatedOperationWithoutResultKeyRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(paginatedOperationWithoutResultKeyRequest)); + .execute(new ClientExecutionParams() + .withOperationName("PaginatedOperationWithoutResultKey").withProtocolMetadata(protocolMetadata) + .withMarshaller(new PaginatedOperationWithoutResultKeyRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(paginatedOperationWithoutResultKeyRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -1071,47 +1104,50 @@ public CompletableFuture paginatedOp */ @Override public CompletableFuture streamingInputOperation( - StreamingInputOperationRequest streamingInputOperationRequest, AsyncRequestBody requestBody) { + StreamingInputOperationRequest streamingInputOperationRequest, AsyncRequestBody requestBody) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingInputOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingInputOperation"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, StreamingInputOperationResponse::builder); + operationMetadata, StreamingInputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("StreamingInputOperation") - .withProtocolMetadata(protocolMetadata) - .withMarshaller( - AsyncStreamingRequestMarshaller.builder() - .delegateMarshaller(new StreamingInputOperationRequestMarshaller(protocolFactory)) - .asyncRequestBody(requestBody).build()).withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) - .withMetricCollector(apiCallMetricCollector).withAsyncRequestBody(requestBody) - .withInput(streamingInputOperationRequest)); + .execute(new ClientExecutionParams() + .withOperationName("StreamingInputOperation") + .withProtocolMetadata(protocolMetadata) + .withMarshaller( + AsyncStreamingRequestMarshaller.builder() + .delegateMarshaller(new StreamingInputOperationRequestMarshaller(protocolFactory)) + .asyncRequestBody(requestBody).build()).withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) + .withMetricCollector(apiCallMetricCollector).withAsyncRequestBody(requestBody) + .withInput(streamingInputOperationRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -1155,60 +1191,63 @@ public CompletableFuture streamingInputOperatio */ @Override public CompletableFuture streamingInputOutputOperation( - StreamingInputOutputOperationRequest streamingInputOutputOperationRequest, AsyncRequestBody requestBody, - AsyncResponseTransformer asyncResponseTransformer) { + StreamingInputOutputOperationRequest streamingInputOutputOperationRequest, AsyncRequestBody requestBody, + AsyncResponseTransformer asyncResponseTransformer) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOutputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - streamingInputOutputOperationRequest.overrideConfiguration().orElse(null)); + streamingInputOutputOperationRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingInputOutputOperation"); Pair, CompletableFuture> pair = AsyncResponseTransformerUtils - .wrapWithEndOfStreamFuture(asyncResponseTransformer); + .wrapWithEndOfStreamFuture(asyncResponseTransformer); asyncResponseTransformer = pair.left(); CompletableFuture endOfStreamFuture = pair.right(); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(true) - .isPayloadJson(false).build(); + .isPayloadJson(false).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, StreamingInputOutputOperationResponse::builder); + operationMetadata, StreamingInputOutputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler.execute( - new ClientExecutionParams() - .withOperationName("StreamingInputOutputOperation") - .withProtocolMetadata(protocolMetadata) - .withMarshaller( - AsyncStreamingRequestMarshaller - .builder() - .delegateMarshaller( - new StreamingInputOutputOperationRequestMarshaller(protocolFactory)) - .asyncRequestBody(requestBody).transferEncoding(true).build()) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withAsyncRequestBody(requestBody).withInput(streamingInputOutputOperationRequest), - asyncResponseTransformer); + new ClientExecutionParams() + .withOperationName("StreamingInputOutputOperation") + .withProtocolMetadata(protocolMetadata) + .withMarshaller( + AsyncStreamingRequestMarshaller + .builder() + .delegateMarshaller( + new StreamingInputOutputOperationRequestMarshaller(protocolFactory)) + .asyncRequestBody(requestBody).transferEncoding(true).build()) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withAsyncRequestBody(requestBody).withInput(streamingInputOutputOperationRequest), + asyncResponseTransformer); AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { if (e != null) { runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> finalAsyncResponseTransformer.exceptionOccurred(e)); + () -> finalAsyncResponseTransformer.exceptionOccurred(e)); } endOfStreamFuture.whenComplete((r2, e2) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -1219,7 +1258,7 @@ public CompletableFuture streamingInputOutputOperation( } catch (Throwable t) { AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> finalAsyncResponseTransformer.exceptionOccurred(t)); + () -> finalAsyncResponseTransformer.exceptionOccurred(t)); metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } @@ -1252,53 +1291,56 @@ public CompletableFuture streamingInputOutputOperation( */ @Override public CompletableFuture streamingOutputOperation( - StreamingOutputOperationRequest streamingOutputOperationRequest, - AsyncResponseTransformer asyncResponseTransformer) { + StreamingOutputOperationRequest streamingOutputOperationRequest, + AsyncResponseTransformer asyncResponseTransformer) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingOutputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingOutputOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingOutputOperation"); Pair, CompletableFuture> pair = AsyncResponseTransformerUtils - .wrapWithEndOfStreamFuture(asyncResponseTransformer); + .wrapWithEndOfStreamFuture(asyncResponseTransformer); asyncResponseTransformer = pair.left(); CompletableFuture endOfStreamFuture = pair.right(); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(true) - .isPayloadJson(false).build(); + .isPayloadJson(false).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, StreamingOutputOperationResponse::builder); + operationMetadata, StreamingOutputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler.execute( - new ClientExecutionParams() - .withOperationName("StreamingOutputOperation").withProtocolMetadata(protocolMetadata) - .withMarshaller(new StreamingOutputOperationRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(streamingOutputOperationRequest), asyncResponseTransformer); + new ClientExecutionParams() + .withOperationName("StreamingOutputOperation").withProtocolMetadata(protocolMetadata) + .withMarshaller(new StreamingOutputOperationRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(streamingOutputOperationRequest), asyncResponseTransformer); AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { if (e != null) { runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> finalAsyncResponseTransformer.exceptionOccurred(e)); + () -> finalAsyncResponseTransformer.exceptionOccurred(e)); } endOfStreamFuture.whenComplete((r2, e2) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -1309,7 +1351,7 @@ public CompletableFuture streamingOutputOperation( } catch (Throwable t) { AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> finalAsyncResponseTransformer.exceptionOccurred(t)); + () -> finalAsyncResponseTransformer.exceptionOccurred(t)); metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } @@ -1327,11 +1369,11 @@ public final String serviceName() { private > T init(T builder) { return builder.clientConfiguration(clientConfiguration).defaultServiceExceptionSupplier(JsonException::builder) - .protocol(AwsJsonProtocol.AWS_JSON).protocolVersion("1.1"); + .protocol(AwsJsonProtocol.AWS_JSON).protocolVersion("1.1"); } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, - RequestOverrideConfiguration requestOverrideConfiguration) { + RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); @@ -1383,7 +1425,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, - JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { + JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); } diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-async-client-class.java index e1873f9318e3..48a6d4ca2de0 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-async-client-class.java @@ -139,7 +139,7 @@ final class DefaultJsonAsyncClient implements JsonAsyncClient { private static final Logger log = LoggerFactory.getLogger(DefaultJsonAsyncClient.class); private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder() - .serviceProtocol(AwsServiceProtocol.REST_JSON).build(); + .serviceProtocol(AwsServiceProtocol.REST_JSON).build(); private final AsyncClientHandler clientHandler; @@ -192,40 +192,43 @@ public JsonUtilities utilities() { public CompletableFuture aPostOperation(APostOperationRequest aPostOperationRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "APostOperation"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, APostOperationResponse::builder); + operationMetadata, APostOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); String hostPrefix = "{StringMember}-foo."; HostnameValidator.validateHostnameCompliant(aPostOperationRequest.stringMember(), "StringMember", - "aPostOperationRequest"); + "aPostOperationRequest"); String resolvedHostExpression = String.format("%s-foo.", aPostOperationRequest.stringMember()); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("APostOperation").withProtocolMetadata(protocolMetadata) - .withMarshaller(new APostOperationRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .hostPrefixExpression(resolvedHostExpression).withInput(aPostOperationRequest)); + .execute(new ClientExecutionParams() + .withOperationName("APostOperation").withProtocolMetadata(protocolMetadata) + .withMarshaller(new APostOperationRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .hostPrefixExpression(resolvedHostExpression).withInput(aPostOperationRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -263,40 +266,43 @@ public CompletableFuture aPostOperation(APostOperationRe */ @Override public CompletableFuture aPostOperationWithOutput( - APostOperationWithOutputRequest aPostOperationWithOutputRequest) { + APostOperationWithOutputRequest aPostOperationWithOutputRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationWithOutputRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationWithOutputRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "APostOperationWithOutput"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, APostOperationWithOutputResponse::builder); + operationMetadata, APostOperationWithOutputResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("APostOperationWithOutput").withProtocolMetadata(protocolMetadata) - .withMarshaller(new APostOperationWithOutputRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(aPostOperationWithOutputRequest)); + .execute(new ClientExecutionParams() + .withOperationName("APostOperationWithOutput").withProtocolMetadata(protocolMetadata) + .withMarshaller(new APostOperationWithOutputRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(aPostOperationWithOutputRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -330,40 +336,43 @@ public CompletableFuture aPostOperationWithOut */ @Override public CompletableFuture bearerAuthOperation( - BearerAuthOperationRequest bearerAuthOperationRequest) { + BearerAuthOperationRequest bearerAuthOperationRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(bearerAuthOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, bearerAuthOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "BearerAuthOperation"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, BearerAuthOperationResponse::builder); + operationMetadata, BearerAuthOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("BearerAuthOperation").withProtocolMetadata(protocolMetadata) - .withMarshaller(new BearerAuthOperationRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .credentialType(CredentialType.TOKEN).withInput(bearerAuthOperationRequest)); + .execute(new ClientExecutionParams() + .withOperationName("BearerAuthOperation").withProtocolMetadata(protocolMetadata) + .withMarshaller(new BearerAuthOperationRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .credentialType(CredentialType.TOKEN).withInput(bearerAuthOperationRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -397,84 +406,87 @@ public CompletableFuture bearerAuthOperation( */ @Override public CompletableFuture eventStreamOperation(EventStreamOperationRequest eventStreamOperationRequest, - Publisher requestStream, EventStreamOperationResponseHandler asyncResponseHandler) { + Publisher requestStream, EventStreamOperationResponseHandler asyncResponseHandler) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(eventStreamOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, eventStreamOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "EventStreamOperation"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = new AttachHttpMetadataResponseHandler( - protocolFactory.createResponseHandler(operationMetadata, EventStreamOperationResponse::builder)); + protocolFactory.createResponseHandler(operationMetadata, EventStreamOperationResponse::builder)); HttpResponseHandler voidResponseHandler = protocolFactory.createResponseHandler(JsonOperationMetadata - .builder().isPayloadJson(false).hasStreamingSuccessResponse(true).build(), VoidSdkResponse::builder); + .builder().isPayloadJson(false).hasStreamingSuccessResponse(true).build(), VoidSdkResponse::builder); HttpResponseHandler eventResponseHandler = protocolFactory.createResponseHandler( - JsonOperationMetadata.builder().isPayloadJson(true).hasStreamingSuccessResponse(false).build(), - EventStreamTaggedUnionPojoSupplier.builder().putSdkPojoSupplier("EventOne", EventStream::eventOneBuilder) - .putSdkPojoSupplier("EventTheSecond", EventStream::eventTheSecondBuilder) - .putSdkPojoSupplier("secondEventOne", EventStream::secondEventOneBuilder) - .putSdkPojoSupplier("eventThree", EventStream::eventThreeBuilder) - .defaultSdkPojoSupplier(() -> new SdkPojoBuilder(EventStream.UNKNOWN)).build()); + JsonOperationMetadata.builder().isPayloadJson(true).hasStreamingSuccessResponse(false).build(), + EventStreamTaggedUnionPojoSupplier.builder().putSdkPojoSupplier("EventOne", EventStream::eventOneBuilder) + .putSdkPojoSupplier("EventTheSecond", EventStream::eventTheSecondBuilder) + .putSdkPojoSupplier("secondEventOne", EventStream::secondEventOneBuilder) + .putSdkPojoSupplier("eventThree", EventStream::eventThreeBuilder) + .defaultSdkPojoSupplier(() -> new SdkPojoBuilder(EventStream.UNKNOWN)).build()); Function> eventstreamExceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "errorOne": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "errorTwo": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "errorOne": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "errorTwo": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorEventResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, eventstreamExceptionMetadataMapper); + operationMetadata, eventstreamExceptionMetadataMapper); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); EventStreamTaggedUnionJsonMarshaller eventMarshaller = EventStreamTaggedUnionJsonMarshaller.builder() - .putMarshaller(DefaultInputEvent.class, new InputEventMarshaller(protocolFactory)).build(); + .putMarshaller(DefaultInputEvent.class, new InputEventMarshaller(protocolFactory)).build(); SdkPublisher eventPublisher = SdkPublisher.adapt(requestStream); Publisher adapted = eventPublisher.map(event -> eventMarshaller.marshall(event)).map( - AwsClientHandlerUtils::encodeEventStreamRequestToByteBuffer); + AwsClientHandlerUtils::encodeEventStreamRequestToByteBuffer); CompletableFuture future = new CompletableFuture<>(); EventStreamAsyncResponseTransformer asyncResponseTransformer = EventStreamAsyncResponseTransformer - . builder().eventStreamResponseHandler(asyncResponseHandler) - .eventResponseHandler(eventResponseHandler).initialResponseHandler(responseHandler) - .exceptionResponseHandler(errorEventResponseHandler).future(future).executor(executor) - .serviceName(serviceName()).build(); + . builder().eventStreamResponseHandler(asyncResponseHandler) + .eventResponseHandler(eventResponseHandler).initialResponseHandler(responseHandler) + .exceptionResponseHandler(errorEventResponseHandler).future(future).executor(executor) + .serviceName(serviceName()).build(); RestEventStreamAsyncResponseTransformer restAsyncResponseTransformer = RestEventStreamAsyncResponseTransformer - . builder() - .eventStreamAsyncResponseTransformer(asyncResponseTransformer) - .eventStreamResponseHandler(asyncResponseHandler).build(); + . builder() + .eventStreamAsyncResponseTransformer(asyncResponseTransformer) + .eventStreamResponseHandler(asyncResponseHandler).build(); CompletableFuture executeFuture = clientHandler.execute( - new ClientExecutionParams() - .withOperationName("EventStreamOperation").withProtocolMetadata(protocolMetadata) - .withMarshaller(new EventStreamOperationRequestMarshaller(protocolFactory)) - .withAsyncRequestBody(AsyncRequestBody.fromPublisher(adapted)).withFullDuplex(true) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(eventStreamOperationRequest), restAsyncResponseTransformer); + new ClientExecutionParams() + .withOperationName("EventStreamOperation").withProtocolMetadata(protocolMetadata) + .withMarshaller(new EventStreamOperationRequestMarshaller(protocolFactory)) + .withAsyncRequestBody(AsyncRequestBody.fromPublisher(adapted)).withFullDuplex(true) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(eventStreamOperationRequest), restAsyncResponseTransformer); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { if (e != null) { try { @@ -489,7 +501,7 @@ public CompletableFuture eventStreamOperation(EventStreamOperationRequest return CompletableFutureUtils.forwardExceptionTo(future, executeFuture); } catch (Throwable t) { runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> asyncResponseHandler.exceptionOccurred(t)); + () -> asyncResponseHandler.exceptionOccurred(t)); metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } @@ -518,47 +530,50 @@ public CompletableFuture eventStreamOperation(EventStreamOperationRequest */ @Override public CompletableFuture eventStreamOperationWithOnlyInput( - EventStreamOperationWithOnlyInputRequest eventStreamOperationWithOnlyInputRequest, - Publisher requestStream) { + EventStreamOperationWithOnlyInputRequest eventStreamOperationWithOnlyInputRequest, + Publisher requestStream) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(eventStreamOperationWithOnlyInputRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - eventStreamOperationWithOnlyInputRequest.overrideConfiguration().orElse(null)); + eventStreamOperationWithOnlyInputRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "EventStreamOperationWithOnlyInput"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(operationMetadata, EventStreamOperationWithOnlyInputResponse::builder); + .createResponseHandler(operationMetadata, EventStreamOperationWithOnlyInputResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); EventStreamTaggedUnionJsonMarshaller eventMarshaller = EventStreamTaggedUnionJsonMarshaller.builder() - .putMarshaller(DefaultInputEventOne.class, new InputEventMarshaller(protocolFactory)) - .putMarshaller(DefaultInputEventTwo.class, new InputEventTwoMarshaller(protocolFactory)).build(); + .putMarshaller(DefaultInputEventOne.class, new InputEventMarshaller(protocolFactory)) + .putMarshaller(DefaultInputEventTwo.class, new InputEventTwoMarshaller(protocolFactory)).build(); SdkPublisher eventPublisher = SdkPublisher.adapt(requestStream); Publisher adapted = eventPublisher.map(event -> eventMarshaller.marshall(event)).map( - AwsClientHandlerUtils::encodeEventStreamRequestToByteBuffer); + AwsClientHandlerUtils::encodeEventStreamRequestToByteBuffer); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("EventStreamOperationWithOnlyInput").withProtocolMetadata(protocolMetadata) - .withMarshaller(new EventStreamOperationWithOnlyInputRequestMarshaller(protocolFactory)) - .withAsyncRequestBody(AsyncRequestBody.fromPublisher(adapted)).withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) - .withMetricCollector(apiCallMetricCollector).withInput(eventStreamOperationWithOnlyInputRequest)); + .execute(new ClientExecutionParams() + .withOperationName("EventStreamOperationWithOnlyInput").withProtocolMetadata(protocolMetadata) + .withMarshaller(new EventStreamOperationWithOnlyInputRequestMarshaller(protocolFactory)) + .withAsyncRequestBody(AsyncRequestBody.fromPublisher(adapted)).withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) + .withMetricCollector(apiCallMetricCollector).withInput(eventStreamOperationWithOnlyInputRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -593,81 +608,84 @@ public CompletableFuture eventStreamO */ @Override public CompletableFuture eventStreamOperationWithOnlyOutput( - EventStreamOperationWithOnlyOutputRequest eventStreamOperationWithOnlyOutputRequest, - EventStreamOperationWithOnlyOutputResponseHandler asyncResponseHandler) { + EventStreamOperationWithOnlyOutputRequest eventStreamOperationWithOnlyOutputRequest, + EventStreamOperationWithOnlyOutputResponseHandler asyncResponseHandler) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(eventStreamOperationWithOnlyOutputRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - eventStreamOperationWithOnlyOutputRequest.overrideConfiguration().orElse(null)); + eventStreamOperationWithOnlyOutputRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "EventStreamOperationWithOnlyOutput"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = new AttachHttpMetadataResponseHandler( - protocolFactory.createResponseHandler(operationMetadata, EventStreamOperationWithOnlyOutputResponse::builder)); + protocolFactory.createResponseHandler(operationMetadata, EventStreamOperationWithOnlyOutputResponse::builder)); HttpResponseHandler voidResponseHandler = protocolFactory.createResponseHandler(JsonOperationMetadata - .builder().isPayloadJson(false).hasStreamingSuccessResponse(true).build(), VoidSdkResponse::builder); + .builder().isPayloadJson(false).hasStreamingSuccessResponse(true).build(), VoidSdkResponse::builder); HttpResponseHandler eventResponseHandler = protocolFactory.createResponseHandler( - JsonOperationMetadata.builder().isPayloadJson(true).hasStreamingSuccessResponse(false).build(), - EventStreamTaggedUnionPojoSupplier.builder().putSdkPojoSupplier("EventOne", EventStream::eventOneBuilder) - .putSdkPojoSupplier("EventTheSecond", EventStream::eventTheSecondBuilder) - .putSdkPojoSupplier("secondEventOne", EventStream::secondEventOneBuilder) - .putSdkPojoSupplier("eventThree", EventStream::eventThreeBuilder) - .defaultSdkPojoSupplier(() -> new SdkPojoBuilder(EventStream.UNKNOWN)).build()); + JsonOperationMetadata.builder().isPayloadJson(true).hasStreamingSuccessResponse(false).build(), + EventStreamTaggedUnionPojoSupplier.builder().putSdkPojoSupplier("EventOne", EventStream::eventOneBuilder) + .putSdkPojoSupplier("EventTheSecond", EventStream::eventTheSecondBuilder) + .putSdkPojoSupplier("secondEventOne", EventStream::secondEventOneBuilder) + .putSdkPojoSupplier("eventThree", EventStream::eventThreeBuilder) + .defaultSdkPojoSupplier(() -> new SdkPojoBuilder(EventStream.UNKNOWN)).build()); Function> eventstreamExceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "errorOne": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "errorTwo": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "errorOne": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "errorTwo": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorEventResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, eventstreamExceptionMetadataMapper); + operationMetadata, eventstreamExceptionMetadataMapper); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture future = new CompletableFuture<>(); EventStreamAsyncResponseTransformer asyncResponseTransformer = EventStreamAsyncResponseTransformer - . builder() - .eventStreamResponseHandler(asyncResponseHandler).eventResponseHandler(eventResponseHandler) - .initialResponseHandler(responseHandler).exceptionResponseHandler(errorEventResponseHandler).future(future) - .executor(executor).serviceName(serviceName()).build(); + . builder() + .eventStreamResponseHandler(asyncResponseHandler).eventResponseHandler(eventResponseHandler) + .initialResponseHandler(responseHandler).exceptionResponseHandler(errorEventResponseHandler).future(future) + .executor(executor).serviceName(serviceName()).build(); RestEventStreamAsyncResponseTransformer restAsyncResponseTransformer = RestEventStreamAsyncResponseTransformer - . builder() - .eventStreamAsyncResponseTransformer(asyncResponseTransformer) - .eventStreamResponseHandler(asyncResponseHandler).build(); + . builder() + .eventStreamAsyncResponseTransformer(asyncResponseTransformer) + .eventStreamResponseHandler(asyncResponseHandler).build(); CompletableFuture executeFuture = clientHandler - .execute( - new ClientExecutionParams() - .withOperationName("EventStreamOperationWithOnlyOutput") - .withProtocolMetadata(protocolMetadata) - .withMarshaller(new EventStreamOperationWithOnlyOutputRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(eventStreamOperationWithOnlyOutputRequest), restAsyncResponseTransformer); + .execute( + new ClientExecutionParams() + .withOperationName("EventStreamOperationWithOnlyOutput") + .withProtocolMetadata(protocolMetadata) + .withMarshaller(new EventStreamOperationWithOnlyOutputRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(eventStreamOperationWithOnlyOutputRequest), restAsyncResponseTransformer); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { if (e != null) { try { @@ -682,7 +700,7 @@ public CompletableFuture eventStreamOperationWithOnlyOutput( return CompletableFutureUtils.forwardExceptionTo(future, executeFuture); } catch (Throwable t) { runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> asyncResponseHandler.exceptionOccurred(t)); + () -> asyncResponseHandler.exceptionOccurred(t)); metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } @@ -710,48 +728,51 @@ public CompletableFuture eventStreamOperationWithOnlyOutput( */ @Override public CompletableFuture getOperationWithChecksum( - GetOperationWithChecksumRequest getOperationWithChecksumRequest) { + GetOperationWithChecksumRequest getOperationWithChecksumRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getOperationWithChecksumRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getOperationWithChecksumRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetOperationWithChecksum"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(false).build(); + .isPayloadJson(false).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, GetOperationWithChecksumResponse::builder); + operationMetadata, GetOperationWithChecksumResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("GetOperationWithChecksum") - .withProtocolMetadata(protocolMetadata) - .withMarshaller(new GetOperationWithChecksumRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute( - SdkInternalExecutionAttribute.HTTP_CHECKSUM, - HttpChecksum.builder().requestChecksumRequired(true).isRequestStreaming(false) - .requestAlgorithm(getOperationWithChecksumRequest.checksumAlgorithmAsString()) - .requestAlgorithmHeader("x-amz-sdk-checksum-algorithm").build()) - .withInput(getOperationWithChecksumRequest)); + .execute(new ClientExecutionParams() + .withOperationName("GetOperationWithChecksum") + .withProtocolMetadata(protocolMetadata) + .withMarshaller(new GetOperationWithChecksumRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute( + SdkInternalExecutionAttribute.HTTP_CHECKSUM, + HttpChecksum.builder().requestChecksumRequired(true).isRequestStreaming(false) + .requestAlgorithm(getOperationWithChecksumRequest.checksumAlgorithmAsString()) + .requestAlgorithmHeader("x-amz-sdk-checksum-algorithm").build()) + .withInput(getOperationWithChecksumRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -789,40 +810,43 @@ public CompletableFuture getOperationWithCheck */ @Override public CompletableFuture getWithoutRequiredMembers( - GetWithoutRequiredMembersRequest getWithoutRequiredMembersRequest) { + GetWithoutRequiredMembersRequest getWithoutRequiredMembersRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getWithoutRequiredMembersRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getWithoutRequiredMembersRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetWithoutRequiredMembers"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, GetWithoutRequiredMembersResponse::builder); + operationMetadata, GetWithoutRequiredMembersResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("GetWithoutRequiredMembers").withProtocolMetadata(protocolMetadata) - .withMarshaller(new GetWithoutRequiredMembersRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(getWithoutRequiredMembersRequest)); + .execute(new ClientExecutionParams() + .withOperationName("GetWithoutRequiredMembers").withProtocolMetadata(protocolMetadata) + .withMarshaller(new GetWithoutRequiredMembersRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(getWithoutRequiredMembersRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -857,44 +881,47 @@ public CompletableFuture getWithoutRequiredMe */ @Override public CompletableFuture operationWithChecksumRequired( - OperationWithChecksumRequiredRequest operationWithChecksumRequiredRequest) { + OperationWithChecksumRequiredRequest operationWithChecksumRequiredRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithChecksumRequiredRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithChecksumRequiredRequest.overrideConfiguration().orElse(null)); + operationWithChecksumRequiredRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithChecksumRequired"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, OperationWithChecksumRequiredResponse::builder); + operationMetadata, OperationWithChecksumRequiredResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithChecksumRequired") - .withProtocolMetadata(protocolMetadata) - .withMarshaller(new OperationWithChecksumRequiredRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute(SdkInternalExecutionAttribute.HTTP_CHECKSUM_REQUIRED, - HttpChecksumRequired.create()).withInput(operationWithChecksumRequiredRequest)); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithChecksumRequired") + .withProtocolMetadata(protocolMetadata) + .withMarshaller(new OperationWithChecksumRequiredRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute(SdkInternalExecutionAttribute.HTTP_CHECKSUM_REQUIRED, + HttpChecksumRequired.create()).withInput(operationWithChecksumRequiredRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -929,45 +956,48 @@ public CompletableFuture operationWithChe */ @Override public CompletableFuture operationWithRequestCompression( - OperationWithRequestCompressionRequest operationWithRequestCompressionRequest) { + OperationWithRequestCompressionRequest operationWithRequestCompressionRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithRequestCompressionRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithRequestCompressionRequest.overrideConfiguration().orElse(null)); + operationWithRequestCompressionRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithRequestCompression"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, OperationWithRequestCompressionResponse::builder); + operationMetadata, OperationWithRequestCompressionResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithRequestCompression") - .withProtocolMetadata(protocolMetadata) - .withMarshaller(new OperationWithRequestCompressionRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute(SdkInternalExecutionAttribute.REQUEST_COMPRESSION, - RequestCompression.builder().encodings("gzip").isStreaming(false).build()) - .withInput(operationWithRequestCompressionRequest)); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithRequestCompression") + .withProtocolMetadata(protocolMetadata) + .withMarshaller(new OperationWithRequestCompressionRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute(SdkInternalExecutionAttribute.REQUEST_COMPRESSION, + RequestCompression.builder().encodings("gzip").isStreaming(false).build()) + .withInput(operationWithRequestCompressionRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -1002,40 +1032,43 @@ public CompletableFuture operationWithR */ @Override public CompletableFuture paginatedOperationWithResultKey( - PaginatedOperationWithResultKeyRequest paginatedOperationWithResultKeyRequest) { + PaginatedOperationWithResultKeyRequest paginatedOperationWithResultKeyRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(paginatedOperationWithResultKeyRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - paginatedOperationWithResultKeyRequest.overrideConfiguration().orElse(null)); + paginatedOperationWithResultKeyRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PaginatedOperationWithResultKey"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, PaginatedOperationWithResultKeyResponse::builder); + operationMetadata, PaginatedOperationWithResultKeyResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("PaginatedOperationWithResultKey").withProtocolMetadata(protocolMetadata) - .withMarshaller(new PaginatedOperationWithResultKeyRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(paginatedOperationWithResultKeyRequest)); + .execute(new ClientExecutionParams() + .withOperationName("PaginatedOperationWithResultKey").withProtocolMetadata(protocolMetadata) + .withMarshaller(new PaginatedOperationWithResultKeyRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(paginatedOperationWithResultKeyRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -1070,40 +1103,43 @@ public CompletableFuture paginatedOpera */ @Override public CompletableFuture paginatedOperationWithoutResultKey( - PaginatedOperationWithoutResultKeyRequest paginatedOperationWithoutResultKeyRequest) { + PaginatedOperationWithoutResultKeyRequest paginatedOperationWithoutResultKeyRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(paginatedOperationWithoutResultKeyRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - paginatedOperationWithoutResultKeyRequest.overrideConfiguration().orElse(null)); + paginatedOperationWithoutResultKeyRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PaginatedOperationWithoutResultKey"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(operationMetadata, PaginatedOperationWithoutResultKeyResponse::builder); + .createResponseHandler(operationMetadata, PaginatedOperationWithoutResultKeyResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("PaginatedOperationWithoutResultKey").withProtocolMetadata(protocolMetadata) - .withMarshaller(new PaginatedOperationWithoutResultKeyRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(paginatedOperationWithoutResultKeyRequest)); + .execute(new ClientExecutionParams() + .withOperationName("PaginatedOperationWithoutResultKey").withProtocolMetadata(protocolMetadata) + .withMarshaller(new PaginatedOperationWithoutResultKeyRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(paginatedOperationWithoutResultKeyRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -1155,67 +1191,70 @@ public CompletableFuture paginatedOp */ @Override public CompletableFuture putOperationWithChecksum( - PutOperationWithChecksumRequest putOperationWithChecksumRequest, AsyncRequestBody requestBody, - AsyncResponseTransformer asyncResponseTransformer) { + PutOperationWithChecksumRequest putOperationWithChecksumRequest, AsyncRequestBody requestBody, + AsyncResponseTransformer asyncResponseTransformer) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putOperationWithChecksumRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, putOperationWithChecksumRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PutOperationWithChecksum"); Pair, CompletableFuture> pair = AsyncResponseTransformerUtils - .wrapWithEndOfStreamFuture(asyncResponseTransformer); + .wrapWithEndOfStreamFuture(asyncResponseTransformer); asyncResponseTransformer = pair.left(); CompletableFuture endOfStreamFuture = pair.right(); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(true) - .isPayloadJson(false).build(); + .isPayloadJson(false).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, PutOperationWithChecksumResponse::builder); + operationMetadata, PutOperationWithChecksumResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler.execute( - new ClientExecutionParams() - .withOperationName("PutOperationWithChecksum") - .withProtocolMetadata(protocolMetadata) - .withMarshaller( - AsyncStreamingRequestMarshaller.builder() - .delegateMarshaller(new PutOperationWithChecksumRequestMarshaller(protocolFactory)) - .asyncRequestBody(requestBody).build()) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withMetricCollector(apiCallMetricCollector) - .withAsyncRequestBody(requestBody) - .putExecutionAttribute( - SdkInternalExecutionAttribute.HTTP_CHECKSUM, - HttpChecksum - .builder() - .requestChecksumRequired(false) - .isRequestStreaming(true) - .requestValidationMode(putOperationWithChecksumRequest.checksumModeAsString()) - .responseAlgorithmsV2(DefaultChecksumAlgorithm.CRC32C, - DefaultChecksumAlgorithm.CRC32, DefaultChecksumAlgorithm.SHA1, - DefaultChecksumAlgorithm.SHA256).build()) - .withInput(putOperationWithChecksumRequest), asyncResponseTransformer); + new ClientExecutionParams() + .withOperationName("PutOperationWithChecksum") + .withProtocolMetadata(protocolMetadata) + .withMarshaller( + AsyncStreamingRequestMarshaller.builder() + .delegateMarshaller(new PutOperationWithChecksumRequestMarshaller(protocolFactory)) + .asyncRequestBody(requestBody).build()) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withMetricCollector(apiCallMetricCollector) + .withAsyncRequestBody(requestBody) + .putExecutionAttribute( + SdkInternalExecutionAttribute.HTTP_CHECKSUM, + HttpChecksum + .builder() + .requestChecksumRequired(false) + .isRequestStreaming(true) + .requestValidationMode(putOperationWithChecksumRequest.checksumModeAsString()) + .responseAlgorithmsV2(DefaultChecksumAlgorithm.CRC32C, + DefaultChecksumAlgorithm.CRC32, DefaultChecksumAlgorithm.SHA1, + DefaultChecksumAlgorithm.SHA256).build()) + .withInput(putOperationWithChecksumRequest), asyncResponseTransformer); AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { if (e != null) { runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> finalAsyncResponseTransformer.exceptionOccurred(e)); + () -> finalAsyncResponseTransformer.exceptionOccurred(e)); } endOfStreamFuture.whenComplete((r2, e2) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -1226,7 +1265,7 @@ public CompletableFuture putOperationWithChecksum( } catch (Throwable t) { AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> finalAsyncResponseTransformer.exceptionOccurred(t)); + () -> finalAsyncResponseTransformer.exceptionOccurred(t)); metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } @@ -1259,44 +1298,47 @@ public CompletableFuture putOperationWithChecksum( */ @Override public CompletableFuture streamingInputOperation( - StreamingInputOperationRequest streamingInputOperationRequest, AsyncRequestBody requestBody) { + StreamingInputOperationRequest streamingInputOperationRequest, AsyncRequestBody requestBody) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingInputOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingInputOperation"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, StreamingInputOperationResponse::builder); + operationMetadata, StreamingInputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("StreamingInputOperation") - .withProtocolMetadata(protocolMetadata) - .withMarshaller( - AsyncStreamingRequestMarshaller.builder() - .delegateMarshaller(new StreamingInputOperationRequestMarshaller(protocolFactory)) - .asyncRequestBody(requestBody).build()).withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) - .withMetricCollector(apiCallMetricCollector).withAsyncRequestBody(requestBody) - .withInput(streamingInputOperationRequest)); + .execute(new ClientExecutionParams() + .withOperationName("StreamingInputOperation") + .withProtocolMetadata(protocolMetadata) + .withMarshaller( + AsyncStreamingRequestMarshaller.builder() + .delegateMarshaller(new StreamingInputOperationRequestMarshaller(protocolFactory)) + .asyncRequestBody(requestBody).build()).withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) + .withMetricCollector(apiCallMetricCollector).withAsyncRequestBody(requestBody) + .withInput(streamingInputOperationRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -1340,57 +1382,60 @@ public CompletableFuture streamingInputOperatio */ @Override public CompletableFuture streamingInputOutputOperation( - StreamingInputOutputOperationRequest streamingInputOutputOperationRequest, AsyncRequestBody requestBody, - AsyncResponseTransformer asyncResponseTransformer) { + StreamingInputOutputOperationRequest streamingInputOutputOperationRequest, AsyncRequestBody requestBody, + AsyncResponseTransformer asyncResponseTransformer) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOutputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - streamingInputOutputOperationRequest.overrideConfiguration().orElse(null)); + streamingInputOutputOperationRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingInputOutputOperation"); Pair, CompletableFuture> pair = AsyncResponseTransformerUtils - .wrapWithEndOfStreamFuture(asyncResponseTransformer); + .wrapWithEndOfStreamFuture(asyncResponseTransformer); asyncResponseTransformer = pair.left(); CompletableFuture endOfStreamFuture = pair.right(); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(true) - .isPayloadJson(false).build(); + .isPayloadJson(false).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, StreamingInputOutputOperationResponse::builder); + operationMetadata, StreamingInputOutputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler.execute( - new ClientExecutionParams() - .withOperationName("StreamingInputOutputOperation") - .withProtocolMetadata(protocolMetadata) - .withMarshaller( - AsyncStreamingRequestMarshaller - .builder() - .delegateMarshaller( - new StreamingInputOutputOperationRequestMarshaller(protocolFactory)) - .asyncRequestBody(requestBody).transferEncoding(true).build()) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withAsyncRequestBody(requestBody).withInput(streamingInputOutputOperationRequest), - asyncResponseTransformer); + new ClientExecutionParams() + .withOperationName("StreamingInputOutputOperation") + .withProtocolMetadata(protocolMetadata) + .withMarshaller( + AsyncStreamingRequestMarshaller + .builder() + .delegateMarshaller( + new StreamingInputOutputOperationRequestMarshaller(protocolFactory)) + .asyncRequestBody(requestBody).transferEncoding(true).build()) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withAsyncRequestBody(requestBody).withInput(streamingInputOutputOperationRequest), + asyncResponseTransformer); AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { if (e != null) { runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> finalAsyncResponseTransformer.exceptionOccurred(e)); + () -> finalAsyncResponseTransformer.exceptionOccurred(e)); } endOfStreamFuture.whenComplete((r2, e2) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -1401,7 +1446,7 @@ public CompletableFuture streamingInputOutputOperation( } catch (Throwable t) { AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> finalAsyncResponseTransformer.exceptionOccurred(t)); + () -> finalAsyncResponseTransformer.exceptionOccurred(t)); metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } @@ -1434,50 +1479,53 @@ public CompletableFuture streamingInputOutputOperation( */ @Override public CompletableFuture streamingOutputOperation( - StreamingOutputOperationRequest streamingOutputOperationRequest, - AsyncResponseTransformer asyncResponseTransformer) { + StreamingOutputOperationRequest streamingOutputOperationRequest, + AsyncResponseTransformer asyncResponseTransformer) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingOutputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingOutputOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingOutputOperation"); Pair, CompletableFuture> pair = AsyncResponseTransformerUtils - .wrapWithEndOfStreamFuture(asyncResponseTransformer); + .wrapWithEndOfStreamFuture(asyncResponseTransformer); asyncResponseTransformer = pair.left(); CompletableFuture endOfStreamFuture = pair.right(); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(true) - .isPayloadJson(false).build(); + .isPayloadJson(false).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, StreamingOutputOperationResponse::builder); + operationMetadata, StreamingOutputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler.execute( - new ClientExecutionParams() - .withOperationName("StreamingOutputOperation").withProtocolMetadata(protocolMetadata) - .withMarshaller(new StreamingOutputOperationRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(streamingOutputOperationRequest), asyncResponseTransformer); + new ClientExecutionParams() + .withOperationName("StreamingOutputOperation").withProtocolMetadata(protocolMetadata) + .withMarshaller(new StreamingOutputOperationRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(streamingOutputOperationRequest), asyncResponseTransformer); AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { if (e != null) { runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> finalAsyncResponseTransformer.exceptionOccurred(e)); + () -> finalAsyncResponseTransformer.exceptionOccurred(e)); } endOfStreamFuture.whenComplete((r2, e2) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -1488,7 +1536,7 @@ public CompletableFuture streamingOutputOperation( } catch (Throwable t) { AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> finalAsyncResponseTransformer.exceptionOccurred(t)); + () -> finalAsyncResponseTransformer.exceptionOccurred(t)); metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } @@ -1511,11 +1559,11 @@ public final String serviceName() { private > T init(T builder) { return builder.clientConfiguration(clientConfiguration).defaultServiceExceptionSupplier(JsonException::builder) - .protocol(AwsJsonProtocol.REST_JSON).protocolVersion("1.1"); + .protocol(AwsJsonProtocol.REST_JSON).protocolVersion("1.1"); } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, - RequestOverrideConfiguration requestOverrideConfiguration) { + RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); @@ -1567,7 +1615,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, - JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { + JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); } diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-client-class.java index 95f6623665b2..746f4f882f01 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-client-class.java @@ -98,7 +98,7 @@ final class DefaultJsonClient implements JsonClient { private static final Logger log = Logger.loggerFor(DefaultJsonClient.class); private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder() - .serviceProtocol(AwsServiceProtocol.REST_JSON).build(); + .serviceProtocol(AwsServiceProtocol.REST_JSON).build(); private final SyncClientHandler clientHandler; @@ -134,42 +134,45 @@ protected DefaultJsonClient(SdkClientConfiguration clientConfiguration) { */ @Override public APostOperationResponse aPostOperation(APostOperationRequest aPostOperationRequest) throws InvalidInputException, - AwsServiceException, SdkClientException, JsonException { + AwsServiceException, SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, - APostOperationResponse::builder); + APostOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "APostOperation"); String hostPrefix = "{StringMember}-foo."; HostnameValidator.validateHostnameCompliant(aPostOperationRequest.stringMember(), "StringMember", - "aPostOperationRequest"); + "aPostOperationRequest"); String resolvedHostExpression = String.format("%s-foo.", aPostOperationRequest.stringMember()); return clientHandler.execute(new ClientExecutionParams() - .withOperationName("APostOperation").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .hostPrefixExpression(resolvedHostExpression).withRequestConfiguration(clientConfiguration) - .withInput(aPostOperationRequest).withMetricCollector(apiCallMetricCollector) - .withMarshaller(new APostOperationRequestMarshaller(protocolFactory))); + .withOperationName("APostOperation").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .hostPrefixExpression(resolvedHostExpression).withRequestConfiguration(clientConfiguration) + .withInput(aPostOperationRequest).withMetricCollector(apiCallMetricCollector) + .withMarshaller(new APostOperationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -197,41 +200,44 @@ public APostOperationResponse aPostOperation(APostOperationRequest aPostOperatio */ @Override public APostOperationWithOutputResponse aPostOperationWithOutput( - APostOperationWithOutputRequest aPostOperationWithOutputRequest) throws InvalidInputException, AwsServiceException, - SdkClientException, JsonException { + APostOperationWithOutputRequest aPostOperationWithOutputRequest) throws InvalidInputException, AwsServiceException, + SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, APostOperationWithOutputResponse::builder); + operationMetadata, APostOperationWithOutputResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationWithOutputRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationWithOutputRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "APostOperationWithOutput"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("APostOperationWithOutput").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(aPostOperationWithOutputRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new APostOperationWithOutputRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("APostOperationWithOutput").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(aPostOperationWithOutputRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new APostOperationWithOutputRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -255,39 +261,42 @@ public APostOperationWithOutputResponse aPostOperationWithOutput( */ @Override public BearerAuthOperationResponse bearerAuthOperation(BearerAuthOperationRequest bearerAuthOperationRequest) - throws AwsServiceException, SdkClientException, JsonException { + throws AwsServiceException, SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, BearerAuthOperationResponse::builder); + operationMetadata, BearerAuthOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(bearerAuthOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, bearerAuthOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "BearerAuthOperation"); return clientHandler.execute(new ClientExecutionParams() - .withOperationName("BearerAuthOperation").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .credentialType(CredentialType.TOKEN).withRequestConfiguration(clientConfiguration) - .withInput(bearerAuthOperationRequest).withMetricCollector(apiCallMetricCollector) - .withMarshaller(new BearerAuthOperationRequestMarshaller(protocolFactory))); + .withOperationName("BearerAuthOperation").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .credentialType(CredentialType.TOKEN).withRequestConfiguration(clientConfiguration) + .withInput(bearerAuthOperationRequest).withMetricCollector(apiCallMetricCollector) + .withMarshaller(new BearerAuthOperationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -311,49 +320,52 @@ public BearerAuthOperationResponse bearerAuthOperation(BearerAuthOperationReques */ @Override public GetOperationWithChecksumResponse getOperationWithChecksum( - GetOperationWithChecksumRequest getOperationWithChecksumRequest) throws AwsServiceException, SdkClientException, - JsonException { + GetOperationWithChecksumRequest getOperationWithChecksumRequest) throws AwsServiceException, SdkClientException, + JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(false).build(); + .isPayloadJson(false).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, GetOperationWithChecksumResponse::builder); + operationMetadata, GetOperationWithChecksumResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getOperationWithChecksumRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getOperationWithChecksumRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetOperationWithChecksum"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("GetOperationWithChecksum") - .withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withInput(getOperationWithChecksumRequest) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute( - SdkInternalExecutionAttribute.HTTP_CHECKSUM, - HttpChecksum.builder().requestChecksumRequired(true).isRequestStreaming(false) - .requestAlgorithm(getOperationWithChecksumRequest.checksumAlgorithmAsString()) - .requestAlgorithmHeader("x-amz-sdk-checksum-algorithm").build()) - .withMarshaller(new GetOperationWithChecksumRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("GetOperationWithChecksum") + .withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withInput(getOperationWithChecksumRequest) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute( + SdkInternalExecutionAttribute.HTTP_CHECKSUM, + HttpChecksum.builder().requestChecksumRequired(true).isRequestStreaming(false) + .requestAlgorithm(getOperationWithChecksumRequest.checksumAlgorithmAsString()) + .requestAlgorithmHeader("x-amz-sdk-checksum-algorithm").build()) + .withMarshaller(new GetOperationWithChecksumRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -381,41 +393,44 @@ public GetOperationWithChecksumResponse getOperationWithChecksum( */ @Override public GetWithoutRequiredMembersResponse getWithoutRequiredMembers( - GetWithoutRequiredMembersRequest getWithoutRequiredMembersRequest) throws InvalidInputException, AwsServiceException, - SdkClientException, JsonException { + GetWithoutRequiredMembersRequest getWithoutRequiredMembersRequest) throws InvalidInputException, AwsServiceException, + SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, GetWithoutRequiredMembersResponse::builder); + operationMetadata, GetWithoutRequiredMembersResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getWithoutRequiredMembersRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getWithoutRequiredMembersRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetWithoutRequiredMembers"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("GetWithoutRequiredMembers").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(getWithoutRequiredMembersRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new GetWithoutRequiredMembersRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("GetWithoutRequiredMembers").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(getWithoutRequiredMembersRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new GetWithoutRequiredMembersRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -439,46 +454,49 @@ public GetWithoutRequiredMembersResponse getWithoutRequiredMembers( */ @Override public OperationWithChecksumRequiredResponse operationWithChecksumRequired( - OperationWithChecksumRequiredRequest operationWithChecksumRequiredRequest) throws AwsServiceException, - SdkClientException, JsonException { + OperationWithChecksumRequiredRequest operationWithChecksumRequiredRequest) throws AwsServiceException, + SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, OperationWithChecksumRequiredResponse::builder); + operationMetadata, OperationWithChecksumRequiredResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithChecksumRequiredRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithChecksumRequiredRequest.overrideConfiguration().orElse(null)); + operationWithChecksumRequiredRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithChecksumRequired"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithChecksumRequired") - .withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withInput(operationWithChecksumRequiredRequest) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute(SdkInternalExecutionAttribute.HTTP_CHECKSUM_REQUIRED, - HttpChecksumRequired.create()) - .withMarshaller(new OperationWithChecksumRequiredRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithChecksumRequired") + .withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withInput(operationWithChecksumRequiredRequest) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute(SdkInternalExecutionAttribute.HTTP_CHECKSUM_REQUIRED, + HttpChecksumRequired.create()) + .withMarshaller(new OperationWithChecksumRequiredRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -502,46 +520,49 @@ public OperationWithChecksumRequiredResponse operationWithChecksumRequired( */ @Override public OperationWithRequestCompressionResponse operationWithRequestCompression( - OperationWithRequestCompressionRequest operationWithRequestCompressionRequest) throws AwsServiceException, - SdkClientException, JsonException { + OperationWithRequestCompressionRequest operationWithRequestCompressionRequest) throws AwsServiceException, + SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, OperationWithRequestCompressionResponse::builder); + operationMetadata, OperationWithRequestCompressionResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithRequestCompressionRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithRequestCompressionRequest.overrideConfiguration().orElse(null)); + operationWithRequestCompressionRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithRequestCompression"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithRequestCompression") - .withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withInput(operationWithRequestCompressionRequest) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute(SdkInternalExecutionAttribute.REQUEST_COMPRESSION, - RequestCompression.builder().encodings("gzip").isStreaming(false).build()) - .withMarshaller(new OperationWithRequestCompressionRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithRequestCompression") + .withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withInput(operationWithRequestCompressionRequest) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute(SdkInternalExecutionAttribute.REQUEST_COMPRESSION, + RequestCompression.builder().encodings("gzip").isStreaming(false).build()) + .withMarshaller(new OperationWithRequestCompressionRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -565,41 +586,44 @@ public OperationWithRequestCompressionResponse operationWithRequestCompression( */ @Override public PaginatedOperationWithResultKeyResponse paginatedOperationWithResultKey( - PaginatedOperationWithResultKeyRequest paginatedOperationWithResultKeyRequest) throws AwsServiceException, - SdkClientException, JsonException { + PaginatedOperationWithResultKeyRequest paginatedOperationWithResultKeyRequest) throws AwsServiceException, + SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, PaginatedOperationWithResultKeyResponse::builder); + operationMetadata, PaginatedOperationWithResultKeyResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(paginatedOperationWithResultKeyRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - paginatedOperationWithResultKeyRequest.overrideConfiguration().orElse(null)); + paginatedOperationWithResultKeyRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PaginatedOperationWithResultKey"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("PaginatedOperationWithResultKey").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(paginatedOperationWithResultKeyRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new PaginatedOperationWithResultKeyRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("PaginatedOperationWithResultKey").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(paginatedOperationWithResultKeyRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new PaginatedOperationWithResultKeyRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -623,41 +647,44 @@ public PaginatedOperationWithResultKeyResponse paginatedOperationWithResultKey( */ @Override public PaginatedOperationWithoutResultKeyResponse paginatedOperationWithoutResultKey( - PaginatedOperationWithoutResultKeyRequest paginatedOperationWithoutResultKeyRequest) throws AwsServiceException, - SdkClientException, JsonException { + PaginatedOperationWithoutResultKeyRequest paginatedOperationWithoutResultKeyRequest) throws AwsServiceException, + SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, PaginatedOperationWithoutResultKeyResponse::builder); + operationMetadata, PaginatedOperationWithoutResultKeyResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(paginatedOperationWithoutResultKeyRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - paginatedOperationWithoutResultKeyRequest.overrideConfiguration().orElse(null)); + paginatedOperationWithoutResultKeyRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PaginatedOperationWithoutResultKey"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("PaginatedOperationWithoutResultKey").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(paginatedOperationWithoutResultKeyRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new PaginatedOperationWithoutResultKeyRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("PaginatedOperationWithoutResultKey").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(paginatedOperationWithoutResultKeyRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new PaginatedOperationWithoutResultKeyRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -707,58 +734,61 @@ public PaginatedOperationWithoutResultKeyResponse paginatedOperationWithoutResul */ @Override public ReturnT putOperationWithChecksum(PutOperationWithChecksumRequest putOperationWithChecksumRequest, - RequestBody requestBody, ResponseTransformer responseTransformer) - throws AwsServiceException, SdkClientException, JsonException { + RequestBody requestBody, ResponseTransformer responseTransformer) + throws AwsServiceException, SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(true) - .isPayloadJson(false).build(); + .isPayloadJson(false).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, PutOperationWithChecksumResponse::builder); + operationMetadata, PutOperationWithChecksumResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putOperationWithChecksumRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, putOperationWithChecksumRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PutOperationWithChecksum"); return clientHandler.execute( - new ClientExecutionParams() - .withOperationName("PutOperationWithChecksum") - .withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withInput(putOperationWithChecksumRequest) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute( - SdkInternalExecutionAttribute.HTTP_CHECKSUM, - HttpChecksum - .builder() - .requestChecksumRequired(false) - .isRequestStreaming(true) - .requestValidationMode(putOperationWithChecksumRequest.checksumModeAsString()) - .responseAlgorithmsV2(DefaultChecksumAlgorithm.CRC32C, - DefaultChecksumAlgorithm.CRC32, DefaultChecksumAlgorithm.SHA1, - DefaultChecksumAlgorithm.SHA256).build()) - .withRequestBody(requestBody) - .withMarshaller( - StreamingRequestMarshaller.builder() - .delegateMarshaller(new PutOperationWithChecksumRequestMarshaller(protocolFactory)) - .requestBody(requestBody).build()), responseTransformer); + new ClientExecutionParams() + .withOperationName("PutOperationWithChecksum") + .withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withInput(putOperationWithChecksumRequest) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute( + SdkInternalExecutionAttribute.HTTP_CHECKSUM, + HttpChecksum + .builder() + .requestChecksumRequired(false) + .isRequestStreaming(true) + .requestValidationMode(putOperationWithChecksumRequest.checksumModeAsString()) + .responseAlgorithmsV2(DefaultChecksumAlgorithm.CRC32C, + DefaultChecksumAlgorithm.CRC32, DefaultChecksumAlgorithm.SHA1, + DefaultChecksumAlgorithm.SHA256).build()) + .withRequestBody(requestBody) + .withMarshaller( + StreamingRequestMarshaller.builder() + .delegateMarshaller(new PutOperationWithChecksumRequestMarshaller(protocolFactory)) + .requestBody(requestBody).build()), responseTransformer); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -793,47 +823,50 @@ public ReturnT putOperationWithChecksum(PutOperationWithChecksumReques */ @Override public StreamingInputOperationResponse streamingInputOperation(StreamingInputOperationRequest streamingInputOperationRequest, - RequestBody requestBody) throws AwsServiceException, SdkClientException, JsonException { + RequestBody requestBody) throws AwsServiceException, SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, StreamingInputOperationResponse::builder); + operationMetadata, StreamingInputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingInputOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingInputOperation"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("StreamingInputOperation") - .withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withInput(streamingInputOperationRequest) - .withMetricCollector(apiCallMetricCollector) - .withRequestBody(requestBody) - .withMarshaller( - StreamingRequestMarshaller.builder() - .delegateMarshaller(new StreamingInputOperationRequestMarshaller(protocolFactory)) - .requestBody(requestBody).build())); + .execute(new ClientExecutionParams() + .withOperationName("StreamingInputOperation") + .withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withInput(streamingInputOperationRequest) + .withMetricCollector(apiCallMetricCollector) + .withRequestBody(requestBody) + .withMarshaller( + StreamingRequestMarshaller.builder() + .delegateMarshaller(new StreamingInputOperationRequestMarshaller(protocolFactory)) + .requestBody(requestBody).build())); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -875,51 +908,54 @@ public StreamingInputOperationResponse streamingInputOperation(StreamingInputOpe */ @Override public ReturnT streamingInputOutputOperation( - StreamingInputOutputOperationRequest streamingInputOutputOperationRequest, RequestBody requestBody, - ResponseTransformer responseTransformer) throws AwsServiceException, - SdkClientException, JsonException { + StreamingInputOutputOperationRequest streamingInputOutputOperationRequest, RequestBody requestBody, + ResponseTransformer responseTransformer) throws AwsServiceException, + SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(true) - .isPayloadJson(false).build(); + .isPayloadJson(false).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, StreamingInputOutputOperationResponse::builder); + operationMetadata, StreamingInputOutputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOutputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - streamingInputOutputOperationRequest.overrideConfiguration().orElse(null)); + streamingInputOutputOperationRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingInputOutputOperation"); return clientHandler.execute( - new ClientExecutionParams() - .withOperationName("StreamingInputOutputOperation") - .withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withInput(streamingInputOutputOperationRequest) - .withMetricCollector(apiCallMetricCollector) - .withRequestBody(requestBody) - .withMarshaller( - StreamingRequestMarshaller - .builder() - .delegateMarshaller( - new StreamingInputOutputOperationRequestMarshaller(protocolFactory)) - .requestBody(requestBody).transferEncoding(true).build()), responseTransformer); + new ClientExecutionParams() + .withOperationName("StreamingInputOutputOperation") + .withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withInput(streamingInputOutputOperationRequest) + .withMetricCollector(apiCallMetricCollector) + .withRequestBody(requestBody) + .withMarshaller( + StreamingRequestMarshaller + .builder() + .delegateMarshaller( + new StreamingInputOutputOperationRequestMarshaller(protocolFactory)) + .requestBody(requestBody).transferEncoding(true).build()), responseTransformer); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -950,41 +986,44 @@ public ReturnT streamingInputOutputOperation( */ @Override public ReturnT streamingOutputOperation(StreamingOutputOperationRequest streamingOutputOperationRequest, - ResponseTransformer responseTransformer) throws AwsServiceException, - SdkClientException, JsonException { + ResponseTransformer responseTransformer) throws AwsServiceException, + SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(true) - .isPayloadJson(false).build(); + .isPayloadJson(false).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, StreamingOutputOperationResponse::builder); + operationMetadata, StreamingOutputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingOutputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingOutputOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingOutputOperation"); return clientHandler.execute( - new ClientExecutionParams() - .withOperationName("StreamingOutputOperation").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(streamingOutputOperationRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new StreamingOutputOperationRequestMarshaller(protocolFactory)), responseTransformer); + new ClientExecutionParams() + .withOperationName("StreamingOutputOperation").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(streamingOutputOperationRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new StreamingOutputOperationRequestMarshaller(protocolFactory)), responseTransformer); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -1004,7 +1043,7 @@ public final String serviceName() { } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, - RequestOverrideConfiguration requestOverrideConfiguration) { + RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); @@ -1019,7 +1058,7 @@ private static List resolveMetricPublishers(SdkClientConfigurat } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, - JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { + JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); } @@ -1062,7 +1101,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, private > T init(T builder) { return builder.clientConfiguration(clientConfiguration).defaultServiceExceptionSupplier(JsonException::builder) - .protocol(AwsJsonProtocol.REST_JSON).protocolVersion("1.1"); + .protocol(AwsJsonProtocol.REST_JSON).protocolVersion("1.1"); } @Override diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-json-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-json-async-client-class.java index c2bbd72c1e91..8a79e84d719a 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-json-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-json-async-client-class.java @@ -134,7 +134,7 @@ final class DefaultJsonAsyncClient implements JsonAsyncClient { private static final Logger log = LoggerFactory.getLogger(DefaultJsonAsyncClient.class); private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder() - .serviceProtocol(AwsServiceProtocol.AWS_JSON).build(); + .serviceProtocol(AwsServiceProtocol.AWS_JSON).build(); private final AsyncClientHandler clientHandler; @@ -184,43 +184,46 @@ public JsonUtilities utilities() { public CompletableFuture aPostOperation(APostOperationRequest aPostOperationRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "APostOperation"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, APostOperationResponse::builder); + operationMetadata, APostOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); String hostPrefix = "{StringMember}-foo."; HostnameValidator.validateHostnameCompliant(aPostOperationRequest.stringMember(), "StringMember", - "aPostOperationRequest"); + "aPostOperationRequest"); String resolvedHostExpression = String.format("%s-foo.", aPostOperationRequest.stringMember()); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("APostOperation").withProtocolMetadata(protocolMetadata) - .withMarshaller(new APostOperationRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .hostPrefixExpression(resolvedHostExpression).withInput(aPostOperationRequest)); + .execute(new ClientExecutionParams() + .withOperationName("APostOperation").withProtocolMetadata(protocolMetadata) + .withMarshaller(new APostOperationRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .hostPrefixExpression(resolvedHostExpression).withInput(aPostOperationRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -259,43 +262,46 @@ public CompletableFuture aPostOperation(APostOperationRe */ @Override public CompletableFuture aPostOperationWithOutput( - APostOperationWithOutputRequest aPostOperationWithOutputRequest) { + APostOperationWithOutputRequest aPostOperationWithOutputRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationWithOutputRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationWithOutputRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "APostOperationWithOutput"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, APostOperationWithOutputResponse::builder); + operationMetadata, APostOperationWithOutputResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("APostOperationWithOutput").withProtocolMetadata(protocolMetadata) - .withMarshaller(new APostOperationWithOutputRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(aPostOperationWithOutputRequest)); + .execute(new ClientExecutionParams() + .withOperationName("APostOperationWithOutput").withProtocolMetadata(protocolMetadata) + .withMarshaller(new APostOperationWithOutputRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(aPostOperationWithOutputRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -329,79 +335,82 @@ public CompletableFuture aPostOperationWithOut */ @Override public CompletableFuture eventStreamOperation(EventStreamOperationRequest eventStreamOperationRequest, - Publisher requestStream, EventStreamOperationResponseHandler asyncResponseHandler) { + Publisher requestStream, EventStreamOperationResponseHandler asyncResponseHandler) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(eventStreamOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, eventStreamOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "EventStreamOperation"); eventStreamOperationRequest = applySignerOverride(eventStreamOperationRequest, EventStreamAws4Signer.create()); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = new AttachHttpMetadataResponseHandler( - protocolFactory.createResponseHandler(operationMetadata, EventStreamOperationResponse::builder)); + protocolFactory.createResponseHandler(operationMetadata, EventStreamOperationResponse::builder)); HttpResponseHandler voidResponseHandler = protocolFactory.createResponseHandler(JsonOperationMetadata - .builder().isPayloadJson(false).hasStreamingSuccessResponse(true).build(), VoidSdkResponse::builder); + .builder().isPayloadJson(false).hasStreamingSuccessResponse(true).build(), VoidSdkResponse::builder); HttpResponseHandler eventResponseHandler = protocolFactory.createResponseHandler( - JsonOperationMetadata.builder().isPayloadJson(true).hasStreamingSuccessResponse(false).build(), - EventStreamTaggedUnionPojoSupplier.builder().putSdkPojoSupplier("EventOne", EventStream::eventOneBuilder) - .putSdkPojoSupplier("EventTheSecond", EventStream::eventTheSecondBuilder) - .putSdkPojoSupplier("secondEventOne", EventStream::secondEventOneBuilder) - .putSdkPojoSupplier("eventThree", EventStream::eventThreeBuilder) - .defaultSdkPojoSupplier(() -> new SdkPojoBuilder(EventStream.UNKNOWN)).build()); + JsonOperationMetadata.builder().isPayloadJson(true).hasStreamingSuccessResponse(false).build(), + EventStreamTaggedUnionPojoSupplier.builder().putSdkPojoSupplier("EventOne", EventStream::eventOneBuilder) + .putSdkPojoSupplier("EventTheSecond", EventStream::eventTheSecondBuilder) + .putSdkPojoSupplier("secondEventOne", EventStream::secondEventOneBuilder) + .putSdkPojoSupplier("eventThree", EventStream::eventThreeBuilder) + .defaultSdkPojoSupplier(() -> new SdkPojoBuilder(EventStream.UNKNOWN)).build()); Function> eventstreamExceptionMetadataMapper = errorCode -> { switch (errorCode) { - default: - return Optional.empty(); + default: + return Optional.empty(); } }; HttpResponseHandler errorEventResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, eventstreamExceptionMetadataMapper); + operationMetadata, eventstreamExceptionMetadataMapper); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); EventStreamTaggedUnionJsonMarshaller eventMarshaller = EventStreamTaggedUnionJsonMarshaller.builder() - .putMarshaller(DefaultInputEvent.class, new InputEventMarshaller(protocolFactory)).build(); + .putMarshaller(DefaultInputEvent.class, new InputEventMarshaller(protocolFactory)).build(); SdkPublisher eventPublisher = SdkPublisher.adapt(requestStream); Publisher adapted = eventPublisher.map(event -> eventMarshaller.marshall(event)).map( - AwsClientHandlerUtils::encodeEventStreamRequestToByteBuffer); + AwsClientHandlerUtils::encodeEventStreamRequestToByteBuffer); CompletableFuture future = new CompletableFuture<>(); EventStreamAsyncResponseTransformer asyncResponseTransformer = EventStreamAsyncResponseTransformer - . builder().eventStreamResponseHandler(asyncResponseHandler) - .eventResponseHandler(eventResponseHandler).initialResponseHandler(responseHandler) - .exceptionResponseHandler(errorEventResponseHandler).future(future).executor(executor) - .serviceName(serviceName()).build(); + . builder().eventStreamResponseHandler(asyncResponseHandler) + .eventResponseHandler(eventResponseHandler).initialResponseHandler(responseHandler) + .exceptionResponseHandler(errorEventResponseHandler).future(future).executor(executor) + .serviceName(serviceName()).build(); CompletableFuture executeFuture = clientHandler.execute( - new ClientExecutionParams() - .withOperationName("EventStreamOperation").withProtocolMetadata(protocolMetadata) - .withMarshaller(new EventStreamOperationRequestMarshaller(protocolFactory)) - .withAsyncRequestBody(AsyncRequestBody.fromPublisher(adapted)).withFullDuplex(true) - .withInitialRequestEvent(true).withResponseHandler(voidResponseHandler) - .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) - .withMetricCollector(apiCallMetricCollector).withInput(eventStreamOperationRequest), - asyncResponseTransformer); + new ClientExecutionParams() + .withOperationName("EventStreamOperation").withProtocolMetadata(protocolMetadata) + .withMarshaller(new EventStreamOperationRequestMarshaller(protocolFactory)) + .withAsyncRequestBody(AsyncRequestBody.fromPublisher(adapted)).withFullDuplex(true) + .withInitialRequestEvent(true).withResponseHandler(voidResponseHandler) + .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) + .withMetricCollector(apiCallMetricCollector).withInput(eventStreamOperationRequest), + asyncResponseTransformer); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { if (e != null) { try { @@ -416,7 +425,7 @@ public CompletableFuture eventStreamOperation(EventStreamOperationRequest return CompletableFutureUtils.forwardExceptionTo(future, executeFuture); } catch (Throwable t) { runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> asyncResponseHandler.exceptionOccurred(t)); + () -> asyncResponseHandler.exceptionOccurred(t)); metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } @@ -445,53 +454,56 @@ public CompletableFuture eventStreamOperation(EventStreamOperationRequest */ @Override public CompletableFuture eventStreamOperationWithOnlyInput( - EventStreamOperationWithOnlyInputRequest eventStreamOperationWithOnlyInputRequest, - Publisher requestStream) { + EventStreamOperationWithOnlyInputRequest eventStreamOperationWithOnlyInputRequest, + Publisher requestStream) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(eventStreamOperationWithOnlyInputRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - eventStreamOperationWithOnlyInputRequest.overrideConfiguration().orElse(null)); + eventStreamOperationWithOnlyInputRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "EventStreamOperationWithOnlyInput"); eventStreamOperationWithOnlyInputRequest = applySignerOverride(eventStreamOperationWithOnlyInputRequest, - EventStreamAws4Signer.create()); + EventStreamAws4Signer.create()); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(operationMetadata, EventStreamOperationWithOnlyInputResponse::builder); + .createResponseHandler(operationMetadata, EventStreamOperationWithOnlyInputResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); EventStreamTaggedUnionJsonMarshaller eventMarshaller = EventStreamTaggedUnionJsonMarshaller.builder() - .putMarshaller(DefaultInputEventOne.class, new InputEventMarshaller(protocolFactory)) - .putMarshaller(DefaultInputEventTwo.class, new InputEventTwoMarshaller(protocolFactory)).build(); + .putMarshaller(DefaultInputEventOne.class, new InputEventMarshaller(protocolFactory)) + .putMarshaller(DefaultInputEventTwo.class, new InputEventTwoMarshaller(protocolFactory)).build(); SdkPublisher eventPublisher = SdkPublisher.adapt(requestStream); Publisher adapted = eventPublisher.map(event -> eventMarshaller.marshall(event)).map( - AwsClientHandlerUtils::encodeEventStreamRequestToByteBuffer); + AwsClientHandlerUtils::encodeEventStreamRequestToByteBuffer); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("EventStreamOperationWithOnlyInput").withProtocolMetadata(protocolMetadata) - .withMarshaller(new EventStreamOperationWithOnlyInputRequestMarshaller(protocolFactory)) - .withAsyncRequestBody(AsyncRequestBody.fromPublisher(adapted)).withInitialRequestEvent(true) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(eventStreamOperationWithOnlyInputRequest)); + .execute(new ClientExecutionParams() + .withOperationName("EventStreamOperationWithOnlyInput").withProtocolMetadata(protocolMetadata) + .withMarshaller(new EventStreamOperationWithOnlyInputRequestMarshaller(protocolFactory)) + .withAsyncRequestBody(AsyncRequestBody.fromPublisher(adapted)).withInitialRequestEvent(true) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(eventStreamOperationWithOnlyInputRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -526,72 +538,75 @@ public CompletableFuture eventStreamO */ @Override public CompletableFuture eventStreamOperationWithOnlyOutput( - EventStreamOperationWithOnlyOutputRequest eventStreamOperationWithOnlyOutputRequest, - EventStreamOperationWithOnlyOutputResponseHandler asyncResponseHandler) { + EventStreamOperationWithOnlyOutputRequest eventStreamOperationWithOnlyOutputRequest, + EventStreamOperationWithOnlyOutputResponseHandler asyncResponseHandler) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(eventStreamOperationWithOnlyOutputRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - eventStreamOperationWithOnlyOutputRequest.overrideConfiguration().orElse(null)); + eventStreamOperationWithOnlyOutputRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "EventStreamOperationWithOnlyOutput"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = new AttachHttpMetadataResponseHandler( - protocolFactory.createResponseHandler(operationMetadata, EventStreamOperationWithOnlyOutputResponse::builder)); + protocolFactory.createResponseHandler(operationMetadata, EventStreamOperationWithOnlyOutputResponse::builder)); HttpResponseHandler voidResponseHandler = protocolFactory.createResponseHandler(JsonOperationMetadata - .builder().isPayloadJson(false).hasStreamingSuccessResponse(true).build(), VoidSdkResponse::builder); + .builder().isPayloadJson(false).hasStreamingSuccessResponse(true).build(), VoidSdkResponse::builder); HttpResponseHandler eventResponseHandler = protocolFactory.createResponseHandler( - JsonOperationMetadata.builder().isPayloadJson(true).hasStreamingSuccessResponse(false).build(), - EventStreamTaggedUnionPojoSupplier.builder().putSdkPojoSupplier("EventOne", EventStream::eventOneBuilder) - .putSdkPojoSupplier("EventTheSecond", EventStream::eventTheSecondBuilder) - .putSdkPojoSupplier("secondEventOne", EventStream::secondEventOneBuilder) - .putSdkPojoSupplier("eventThree", EventStream::eventThreeBuilder) - .defaultSdkPojoSupplier(() -> new SdkPojoBuilder(EventStream.UNKNOWN)).build()); + JsonOperationMetadata.builder().isPayloadJson(true).hasStreamingSuccessResponse(false).build(), + EventStreamTaggedUnionPojoSupplier.builder().putSdkPojoSupplier("EventOne", EventStream::eventOneBuilder) + .putSdkPojoSupplier("EventTheSecond", EventStream::eventTheSecondBuilder) + .putSdkPojoSupplier("secondEventOne", EventStream::secondEventOneBuilder) + .putSdkPojoSupplier("eventThree", EventStream::eventThreeBuilder) + .defaultSdkPojoSupplier(() -> new SdkPojoBuilder(EventStream.UNKNOWN)).build()); Function> eventstreamExceptionMetadataMapper = errorCode -> { switch (errorCode) { - default: - return Optional.empty(); + default: + return Optional.empty(); } }; HttpResponseHandler errorEventResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, eventstreamExceptionMetadataMapper); + operationMetadata, eventstreamExceptionMetadataMapper); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture future = new CompletableFuture<>(); EventStreamAsyncResponseTransformer asyncResponseTransformer = EventStreamAsyncResponseTransformer - . builder() - .eventStreamResponseHandler(asyncResponseHandler).eventResponseHandler(eventResponseHandler) - .initialResponseHandler(responseHandler).exceptionResponseHandler(errorEventResponseHandler).future(future) - .executor(executor).serviceName(serviceName()).build(); + . builder() + .eventStreamResponseHandler(asyncResponseHandler).eventResponseHandler(eventResponseHandler) + .initialResponseHandler(responseHandler).exceptionResponseHandler(errorEventResponseHandler).future(future) + .executor(executor).serviceName(serviceName()).build(); CompletableFuture executeFuture = clientHandler.execute( - new ClientExecutionParams() - .withOperationName("EventStreamOperationWithOnlyOutput").withProtocolMetadata(protocolMetadata) - .withMarshaller(new EventStreamOperationWithOnlyOutputRequestMarshaller(protocolFactory)) - .withResponseHandler(voidResponseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(eventStreamOperationWithOnlyOutputRequest), asyncResponseTransformer); + new ClientExecutionParams() + .withOperationName("EventStreamOperationWithOnlyOutput").withProtocolMetadata(protocolMetadata) + .withMarshaller(new EventStreamOperationWithOnlyOutputRequestMarshaller(protocolFactory)) + .withResponseHandler(voidResponseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(eventStreamOperationWithOnlyOutputRequest), asyncResponseTransformer); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { if (e != null) { try { @@ -606,7 +621,7 @@ public CompletableFuture eventStreamOperationWithOnlyOutput( return CompletableFutureUtils.forwardExceptionTo(future, executeFuture); } catch (Throwable t) { runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> asyncResponseHandler.exceptionOccurred(t)); + () -> asyncResponseHandler.exceptionOccurred(t)); metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } @@ -638,43 +653,46 @@ public CompletableFuture eventStreamOperationWithOnlyOutput( */ @Override public CompletableFuture getWithoutRequiredMembers( - GetWithoutRequiredMembersRequest getWithoutRequiredMembersRequest) { + GetWithoutRequiredMembersRequest getWithoutRequiredMembersRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getWithoutRequiredMembersRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getWithoutRequiredMembersRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetWithoutRequiredMembers"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, GetWithoutRequiredMembersResponse::builder); + operationMetadata, GetWithoutRequiredMembersResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("GetWithoutRequiredMembers").withProtocolMetadata(protocolMetadata) - .withMarshaller(new GetWithoutRequiredMembersRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(getWithoutRequiredMembersRequest)); + .execute(new ClientExecutionParams() + .withOperationName("GetWithoutRequiredMembers").withProtocolMetadata(protocolMetadata) + .withMarshaller(new GetWithoutRequiredMembersRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(getWithoutRequiredMembersRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -709,47 +727,50 @@ public CompletableFuture getWithoutRequiredMe */ @Override public CompletableFuture operationWithChecksumRequired( - OperationWithChecksumRequiredRequest operationWithChecksumRequiredRequest) { + OperationWithChecksumRequiredRequest operationWithChecksumRequiredRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithChecksumRequiredRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithChecksumRequiredRequest.overrideConfiguration().orElse(null)); + operationWithChecksumRequiredRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithChecksumRequired"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, OperationWithChecksumRequiredResponse::builder); + operationMetadata, OperationWithChecksumRequiredResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithChecksumRequired") - .withProtocolMetadata(protocolMetadata) - .withMarshaller(new OperationWithChecksumRequiredRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute(SdkInternalExecutionAttribute.HTTP_CHECKSUM_REQUIRED, - HttpChecksumRequired.create()).withInput(operationWithChecksumRequiredRequest)); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithChecksumRequired") + .withProtocolMetadata(protocolMetadata) + .withMarshaller(new OperationWithChecksumRequiredRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute(SdkInternalExecutionAttribute.HTTP_CHECKSUM_REQUIRED, + HttpChecksumRequired.create()).withInput(operationWithChecksumRequiredRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -783,44 +804,47 @@ public CompletableFuture operationWithChe */ @Override public CompletableFuture operationWithNoneAuthType( - OperationWithNoneAuthTypeRequest operationWithNoneAuthTypeRequest) { + OperationWithNoneAuthTypeRequest operationWithNoneAuthTypeRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithNoneAuthTypeRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithNoneAuthTypeRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithNoneAuthType"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, OperationWithNoneAuthTypeResponse::builder); + operationMetadata, OperationWithNoneAuthTypeResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithNoneAuthType").withProtocolMetadata(protocolMetadata) - .withMarshaller(new OperationWithNoneAuthTypeRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute(SdkInternalExecutionAttribute.IS_NONE_AUTH_TYPE_REQUEST, false) - .withInput(operationWithNoneAuthTypeRequest)); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithNoneAuthType").withProtocolMetadata(protocolMetadata) + .withMarshaller(new OperationWithNoneAuthTypeRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute(SdkInternalExecutionAttribute.IS_NONE_AUTH_TYPE_REQUEST, false) + .withInput(operationWithNoneAuthTypeRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -855,48 +879,51 @@ public CompletableFuture operationWithNoneAut */ @Override public CompletableFuture operationWithRequestCompression( - OperationWithRequestCompressionRequest operationWithRequestCompressionRequest) { + OperationWithRequestCompressionRequest operationWithRequestCompressionRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithRequestCompressionRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithRequestCompressionRequest.overrideConfiguration().orElse(null)); + operationWithRequestCompressionRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithRequestCompression"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, OperationWithRequestCompressionResponse::builder); + operationMetadata, OperationWithRequestCompressionResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithRequestCompression") - .withProtocolMetadata(protocolMetadata) - .withMarshaller(new OperationWithRequestCompressionRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute(SdkInternalExecutionAttribute.REQUEST_COMPRESSION, - RequestCompression.builder().encodings("gzip").isStreaming(false).build()) - .withInput(operationWithRequestCompressionRequest)); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithRequestCompression") + .withProtocolMetadata(protocolMetadata) + .withMarshaller(new OperationWithRequestCompressionRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute(SdkInternalExecutionAttribute.REQUEST_COMPRESSION, + RequestCompression.builder().encodings("gzip").isStreaming(false).build()) + .withInput(operationWithRequestCompressionRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -931,43 +958,46 @@ public CompletableFuture operationWithR */ @Override public CompletableFuture paginatedOperationWithResultKey( - PaginatedOperationWithResultKeyRequest paginatedOperationWithResultKeyRequest) { + PaginatedOperationWithResultKeyRequest paginatedOperationWithResultKeyRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(paginatedOperationWithResultKeyRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - paginatedOperationWithResultKeyRequest.overrideConfiguration().orElse(null)); + paginatedOperationWithResultKeyRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PaginatedOperationWithResultKey"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, PaginatedOperationWithResultKeyResponse::builder); + operationMetadata, PaginatedOperationWithResultKeyResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("PaginatedOperationWithResultKey").withProtocolMetadata(protocolMetadata) - .withMarshaller(new PaginatedOperationWithResultKeyRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(paginatedOperationWithResultKeyRequest)); + .execute(new ClientExecutionParams() + .withOperationName("PaginatedOperationWithResultKey").withProtocolMetadata(protocolMetadata) + .withMarshaller(new PaginatedOperationWithResultKeyRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(paginatedOperationWithResultKeyRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -1002,43 +1032,46 @@ public CompletableFuture paginatedOpera */ @Override public CompletableFuture paginatedOperationWithoutResultKey( - PaginatedOperationWithoutResultKeyRequest paginatedOperationWithoutResultKeyRequest) { + PaginatedOperationWithoutResultKeyRequest paginatedOperationWithoutResultKeyRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(paginatedOperationWithoutResultKeyRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - paginatedOperationWithoutResultKeyRequest.overrideConfiguration().orElse(null)); + paginatedOperationWithoutResultKeyRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PaginatedOperationWithoutResultKey"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(operationMetadata, PaginatedOperationWithoutResultKeyResponse::builder); + .createResponseHandler(operationMetadata, PaginatedOperationWithoutResultKeyResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("PaginatedOperationWithoutResultKey").withProtocolMetadata(protocolMetadata) - .withMarshaller(new PaginatedOperationWithoutResultKeyRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(paginatedOperationWithoutResultKeyRequest)); + .execute(new ClientExecutionParams() + .withOperationName("PaginatedOperationWithoutResultKey").withProtocolMetadata(protocolMetadata) + .withMarshaller(new PaginatedOperationWithoutResultKeyRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(paginatedOperationWithoutResultKeyRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -1077,13 +1110,13 @@ public CompletableFuture paginatedOp */ @Override public CompletableFuture streamingInputOperation( - StreamingInputOperationRequest streamingInputOperationRequest, AsyncRequestBody requestBody) { + StreamingInputOperationRequest streamingInputOperationRequest, AsyncRequestBody requestBody) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingInputOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingInputOperation"); @@ -1091,36 +1124,39 @@ public CompletableFuture streamingInputOperatio streamingInputOperationRequest = applySignerOverride(streamingInputOperationRequest, AsyncAws4Signer.create()); } JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, StreamingInputOperationResponse::builder); + operationMetadata, StreamingInputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("StreamingInputOperation") - .withProtocolMetadata(protocolMetadata) - .withMarshaller( - AsyncStreamingRequestMarshaller.builder() - .delegateMarshaller(new StreamingInputOperationRequestMarshaller(protocolFactory)) - .asyncRequestBody(requestBody).build()).withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) - .withMetricCollector(apiCallMetricCollector).withAsyncRequestBody(requestBody) - .withInput(streamingInputOperationRequest)); + .execute(new ClientExecutionParams() + .withOperationName("StreamingInputOperation") + .withProtocolMetadata(protocolMetadata) + .withMarshaller( + AsyncStreamingRequestMarshaller.builder() + .delegateMarshaller(new StreamingInputOperationRequestMarshaller(protocolFactory)) + .asyncRequestBody(requestBody).build()).withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) + .withMetricCollector(apiCallMetricCollector).withAsyncRequestBody(requestBody) + .withInput(streamingInputOperationRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -1164,62 +1200,65 @@ public CompletableFuture streamingInputOperatio */ @Override public CompletableFuture streamingInputOutputOperation( - StreamingInputOutputOperationRequest streamingInputOutputOperationRequest, AsyncRequestBody requestBody, - AsyncResponseTransformer asyncResponseTransformer) { + StreamingInputOutputOperationRequest streamingInputOutputOperationRequest, AsyncRequestBody requestBody, + AsyncResponseTransformer asyncResponseTransformer) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOutputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - streamingInputOutputOperationRequest.overrideConfiguration().orElse(null)); + streamingInputOutputOperationRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingInputOutputOperation"); Pair, CompletableFuture> pair = AsyncResponseTransformerUtils - .wrapWithEndOfStreamFuture(asyncResponseTransformer); + .wrapWithEndOfStreamFuture(asyncResponseTransformer); asyncResponseTransformer = pair.left(); CompletableFuture endOfStreamFuture = pair.right(); streamingInputOutputOperationRequest = applySignerOverride(streamingInputOutputOperationRequest, - Aws4UnsignedPayloadSigner.create()); + Aws4UnsignedPayloadSigner.create()); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(true) - .isPayloadJson(false).build(); + .isPayloadJson(false).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, StreamingInputOutputOperationResponse::builder); + operationMetadata, StreamingInputOutputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler.execute( - new ClientExecutionParams() - .withOperationName("StreamingInputOutputOperation") - .withProtocolMetadata(protocolMetadata) - .withMarshaller( - AsyncStreamingRequestMarshaller - .builder() - .delegateMarshaller( - new StreamingInputOutputOperationRequestMarshaller(protocolFactory)) - .asyncRequestBody(requestBody).transferEncoding(true).build()) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withAsyncRequestBody(requestBody).withInput(streamingInputOutputOperationRequest), - asyncResponseTransformer); + new ClientExecutionParams() + .withOperationName("StreamingInputOutputOperation") + .withProtocolMetadata(protocolMetadata) + .withMarshaller( + AsyncStreamingRequestMarshaller + .builder() + .delegateMarshaller( + new StreamingInputOutputOperationRequestMarshaller(protocolFactory)) + .asyncRequestBody(requestBody).transferEncoding(true).build()) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withAsyncRequestBody(requestBody).withInput(streamingInputOutputOperationRequest), + asyncResponseTransformer); AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { if (e != null) { runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> finalAsyncResponseTransformer.exceptionOccurred(e)); + () -> finalAsyncResponseTransformer.exceptionOccurred(e)); } endOfStreamFuture.whenComplete((r2, e2) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -1230,7 +1269,7 @@ public CompletableFuture streamingInputOutputOperation( } catch (Throwable t) { AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> finalAsyncResponseTransformer.exceptionOccurred(t)); + () -> finalAsyncResponseTransformer.exceptionOccurred(t)); metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } @@ -1263,53 +1302,56 @@ public CompletableFuture streamingInputOutputOperation( */ @Override public CompletableFuture streamingOutputOperation( - StreamingOutputOperationRequest streamingOutputOperationRequest, - AsyncResponseTransformer asyncResponseTransformer) { + StreamingOutputOperationRequest streamingOutputOperationRequest, + AsyncResponseTransformer asyncResponseTransformer) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingOutputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingOutputOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingOutputOperation"); Pair, CompletableFuture> pair = AsyncResponseTransformerUtils - .wrapWithEndOfStreamFuture(asyncResponseTransformer); + .wrapWithEndOfStreamFuture(asyncResponseTransformer); asyncResponseTransformer = pair.left(); CompletableFuture endOfStreamFuture = pair.right(); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(true) - .isPayloadJson(false).build(); + .isPayloadJson(false).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, StreamingOutputOperationResponse::builder); + operationMetadata, StreamingOutputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler.execute( - new ClientExecutionParams() - .withOperationName("StreamingOutputOperation").withProtocolMetadata(protocolMetadata) - .withMarshaller(new StreamingOutputOperationRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(streamingOutputOperationRequest), asyncResponseTransformer); + new ClientExecutionParams() + .withOperationName("StreamingOutputOperation").withProtocolMetadata(protocolMetadata) + .withMarshaller(new StreamingOutputOperationRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(streamingOutputOperationRequest), asyncResponseTransformer); AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { if (e != null) { runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> finalAsyncResponseTransformer.exceptionOccurred(e)); + () -> finalAsyncResponseTransformer.exceptionOccurred(e)); } endOfStreamFuture.whenComplete((r2, e2) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -1320,7 +1362,7 @@ public CompletableFuture streamingOutputOperation( } catch (Throwable t) { AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> finalAsyncResponseTransformer.exceptionOccurred(t)); + () -> finalAsyncResponseTransformer.exceptionOccurred(t)); metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } @@ -1338,11 +1380,11 @@ public final String serviceName() { private > T init(T builder) { return builder.clientConfiguration(clientConfiguration).defaultServiceExceptionSupplier(JsonException::builder) - .protocol(AwsJsonProtocol.AWS_JSON).protocolVersion("1.1"); + .protocol(AwsJsonProtocol.AWS_JSON).protocolVersion("1.1"); } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, - RequestOverrideConfiguration requestOverrideConfiguration) { + RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); @@ -1362,8 +1404,8 @@ private T applySignerOverride(T request, Signer signer) } Consumer signerOverride = b -> b.signer(signer).build(); AwsRequestOverrideConfiguration overrideConfiguration = request.overrideConfiguration() - .map(c -> c.toBuilder().applyMutation(signerOverride).build()) - .orElse((AwsRequestOverrideConfiguration.builder().applyMutation(signerOverride).build())); + .map(c -> c.toBuilder().applyMutation(signerOverride).build()) + .orElse((AwsRequestOverrideConfiguration.builder().applyMutation(signerOverride).build())); return (T) request.toBuilder().overrideConfiguration(overrideConfiguration).build(); } @@ -1409,7 +1451,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, - JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { + JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); } diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-async-client-class.java index f60395e3be3d..4e035d57ed02 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-async-client-class.java @@ -57,7 +57,7 @@ final class DefaultQueryToJsonCompatibleAsyncClient implements QueryToJsonCompat private static final Logger log = LoggerFactory.getLogger(DefaultQueryToJsonCompatibleAsyncClient.class); private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder() - .serviceProtocol(AwsServiceProtocol.AWS_JSON).build(); + .serviceProtocol(AwsServiceProtocol.AWS_JSON).build(); private final AsyncClientHandler clientHandler; @@ -99,41 +99,43 @@ protected DefaultQueryToJsonCompatibleAsyncClient(SdkClientConfiguration clientC public CompletableFuture aPostOperation(APostOperationRequest aPostOperationRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "QueryToJsonCompatibleService"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "APostOperation"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, APostOperationResponse::builder); + operationMetadata, APostOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); String hostPrefix = "{StringMember}-foo."; HostnameValidator.validateHostnameCompliant(aPostOperationRequest.stringMember(), "StringMember", - "aPostOperationRequest"); + "aPostOperationRequest"); String resolvedHostExpression = String.format("%s-foo.", aPostOperationRequest.stringMember()); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("APostOperation").withProtocolMetadata(protocolMetadata) - .withMarshaller(new APostOperationRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .hostPrefixExpression(resolvedHostExpression).withInput(aPostOperationRequest)); + .execute(new ClientExecutionParams() + .withOperationName("APostOperation").withProtocolMetadata(protocolMetadata) + .withMarshaller(new APostOperationRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .hostPrefixExpression(resolvedHostExpression).withInput(aPostOperationRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -157,12 +159,12 @@ public final String serviceName() { private > T init(T builder) { return builder.clientConfiguration(clientConfiguration) - .defaultServiceExceptionSupplier(QueryToJsonCompatibleException::builder).protocol(AwsJsonProtocol.AWS_JSON) - .protocolVersion("1.1").hasAwsQueryCompatible(true); + .defaultServiceExceptionSupplier(QueryToJsonCompatibleException::builder).protocol(AwsJsonProtocol.AWS_JSON) + .protocolVersion("1.1").hasAwsQueryCompatible(true); } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, - RequestOverrideConfiguration requestOverrideConfiguration) { + RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); @@ -206,7 +208,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, return configuration.build(); } QueryToJsonCompatibleServiceClientConfigurationBuilder serviceConfigBuilder = new QueryToJsonCompatibleServiceClientConfigurationBuilder( - configuration); + configuration); for (SdkPlugin plugin : plugins) { plugin.configureClient(serviceConfigBuilder); } @@ -215,7 +217,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, - JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { + JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); } diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-sync-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-sync-client-class.java index 2bf5924b4b2d..aa52553f0bf0 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-sync-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-sync-client-class.java @@ -53,7 +53,7 @@ final class DefaultQueryToJsonCompatibleClient implements QueryToJsonCompatibleC private static final Logger log = Logger.loggerFor(DefaultQueryToJsonCompatibleClient.class); private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder() - .serviceProtocol(AwsServiceProtocol.AWS_JSON).build(); + .serviceProtocol(AwsServiceProtocol.AWS_JSON).build(); private final SyncClientHandler clientHandler; @@ -89,43 +89,45 @@ protected DefaultQueryToJsonCompatibleClient(SdkClientConfiguration clientConfig */ @Override public APostOperationResponse aPostOperation(APostOperationRequest aPostOperationRequest) throws InvalidInputException, - AwsServiceException, SdkClientException, QueryToJsonCompatibleException { + AwsServiceException, SdkClientException, QueryToJsonCompatibleException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, - APostOperationResponse::builder); + APostOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "QueryToJsonCompatibleService"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "APostOperation"); String hostPrefix = "{StringMember}-foo."; HostnameValidator.validateHostnameCompliant(aPostOperationRequest.stringMember(), "StringMember", - "aPostOperationRequest"); + "aPostOperationRequest"); String resolvedHostExpression = String.format("%s-foo.", aPostOperationRequest.stringMember()); return clientHandler.execute(new ClientExecutionParams() - .withOperationName("APostOperation").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .hostPrefixExpression(resolvedHostExpression).withRequestConfiguration(clientConfiguration) - .withInput(aPostOperationRequest).withMetricCollector(apiCallMetricCollector) - .withMarshaller(new APostOperationRequestMarshaller(protocolFactory))); + .withOperationName("APostOperation").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .hostPrefixExpression(resolvedHostExpression).withRequestConfiguration(clientConfiguration) + .withInput(aPostOperationRequest).withMetricCollector(apiCallMetricCollector) + .withMarshaller(new APostOperationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -137,7 +139,7 @@ public final String serviceName() { } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, - RequestOverrideConfiguration requestOverrideConfiguration) { + RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); @@ -152,7 +154,7 @@ private static List resolveMetricPublishers(SdkClientConfigurat } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, - JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { + JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); } @@ -186,7 +188,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, return configuration.build(); } QueryToJsonCompatibleServiceClientConfigurationBuilder serviceConfigBuilder = new QueryToJsonCompatibleServiceClientConfigurationBuilder( - configuration); + configuration); for (SdkPlugin plugin : plugins) { plugin.configureClient(serviceConfigBuilder); } @@ -196,8 +198,8 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, private > T init(T builder) { return builder.clientConfiguration(clientConfiguration) - .defaultServiceExceptionSupplier(QueryToJsonCompatibleException::builder).protocol(AwsJsonProtocol.AWS_JSON) - .protocolVersion("1.1").hasAwsQueryCompatible(true); + .defaultServiceExceptionSupplier(QueryToJsonCompatibleException::builder).protocol(AwsJsonProtocol.AWS_JSON) + .protocolVersion("1.1").hasAwsQueryCompatible(true); } @Override diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-batchmanager-async.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-batchmanager-async.java index aa68cc26f981..8c13f1420fd1 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-batchmanager-async.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-batchmanager-async.java @@ -57,7 +57,7 @@ final class DefaultBatchManagerTestAsyncClient implements BatchManagerTestAsyncC private static final Logger log = LoggerFactory.getLogger(DefaultBatchManagerTestAsyncClient.class); private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder() - .serviceProtocol(AwsServiceProtocol.REST_JSON).build(); + .serviceProtocol(AwsServiceProtocol.REST_JSON).build(); private final AsyncClientHandler clientHandler; @@ -98,34 +98,36 @@ protected DefaultBatchManagerTestAsyncClient(SdkClientConfiguration clientConfig public CompletableFuture sendRequest(SendRequestRequest sendRequestRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(sendRequestRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, sendRequestRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "BatchManagerTest"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "SendRequest"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, - SendRequestResponse::builder); + SendRequestResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - default: - return Optional.empty(); + default: + return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("SendRequest").withProtocolMetadata(protocolMetadata) - .withMarshaller(new SendRequestRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(sendRequestRequest)); + .execute(new ClientExecutionParams() + .withOperationName("SendRequest").withProtocolMetadata(protocolMetadata) + .withMarshaller(new SendRequestRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(sendRequestRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -154,12 +156,12 @@ public final String serviceName() { private > T init(T builder) { return builder.clientConfiguration(clientConfiguration) - .defaultServiceExceptionSupplier(BatchManagerTestException::builder).protocol(AwsJsonProtocol.REST_JSON) - .protocolVersion("1.1"); + .defaultServiceExceptionSupplier(BatchManagerTestException::builder).protocol(AwsJsonProtocol.REST_JSON) + .protocolVersion("1.1"); } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, - RequestOverrideConfiguration requestOverrideConfiguration) { + RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); @@ -203,7 +205,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, return configuration.build(); } BatchManagerTestServiceClientConfigurationBuilder serviceConfigBuilder = new BatchManagerTestServiceClientConfigurationBuilder( - configuration); + configuration); for (SdkPlugin plugin : plugins) { plugin.configureClient(serviceConfigBuilder); } @@ -212,7 +214,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, - JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { + JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); } @@ -220,4 +222,4 @@ private HttpResponseHandler createErrorResponseHandler(Base public void close() { clientHandler.close(); } -} \ No newline at end of file +} diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-cbor-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-cbor-async-client-class.java index 9d35ccea75b5..8b73813753cf 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-cbor-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-cbor-async-client-class.java @@ -135,7 +135,7 @@ final class DefaultJsonAsyncClient implements JsonAsyncClient { private static final Logger log = LoggerFactory.getLogger(DefaultJsonAsyncClient.class); private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder() - .serviceProtocol(AwsServiceProtocol.CBOR).build(); + .serviceProtocol(AwsServiceProtocol.CBOR).build(); private final AsyncClientHandler clientHandler; @@ -188,43 +188,46 @@ public JsonUtilities utilities() { public CompletableFuture aPostOperation(APostOperationRequest aPostOperationRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "APostOperation"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, APostOperationResponse::builder); + operationMetadata, APostOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); String hostPrefix = "{StringMember}-foo."; HostnameValidator.validateHostnameCompliant(aPostOperationRequest.stringMember(), "StringMember", - "aPostOperationRequest"); + "aPostOperationRequest"); String resolvedHostExpression = String.format("%s-foo.", aPostOperationRequest.stringMember()); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("APostOperation").withProtocolMetadata(protocolMetadata) - .withMarshaller(new APostOperationRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .hostPrefixExpression(resolvedHostExpression).withInput(aPostOperationRequest)); + .execute(new ClientExecutionParams() + .withOperationName("APostOperation").withProtocolMetadata(protocolMetadata) + .withMarshaller(new APostOperationRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .hostPrefixExpression(resolvedHostExpression).withInput(aPostOperationRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -263,43 +266,46 @@ public CompletableFuture aPostOperation(APostOperationRe */ @Override public CompletableFuture aPostOperationWithOutput( - APostOperationWithOutputRequest aPostOperationWithOutputRequest) { + APostOperationWithOutputRequest aPostOperationWithOutputRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationWithOutputRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationWithOutputRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "APostOperationWithOutput"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, APostOperationWithOutputResponse::builder); + operationMetadata, APostOperationWithOutputResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("APostOperationWithOutput").withProtocolMetadata(protocolMetadata) - .withMarshaller(new APostOperationWithOutputRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(aPostOperationWithOutputRequest)); + .execute(new ClientExecutionParams() + .withOperationName("APostOperationWithOutput").withProtocolMetadata(protocolMetadata) + .withMarshaller(new APostOperationWithOutputRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(aPostOperationWithOutputRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -333,79 +339,82 @@ public CompletableFuture aPostOperationWithOut */ @Override public CompletableFuture eventStreamOperation(EventStreamOperationRequest eventStreamOperationRequest, - Publisher requestStream, EventStreamOperationResponseHandler asyncResponseHandler) { + Publisher requestStream, EventStreamOperationResponseHandler asyncResponseHandler) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(eventStreamOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, eventStreamOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "EventStreamOperation"); eventStreamOperationRequest = applySignerOverride(eventStreamOperationRequest, EventStreamAws4Signer.create()); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = new AttachHttpMetadataResponseHandler( - protocolFactory.createResponseHandler(operationMetadata, EventStreamOperationResponse::builder)); + protocolFactory.createResponseHandler(operationMetadata, EventStreamOperationResponse::builder)); HttpResponseHandler voidResponseHandler = protocolFactory.createResponseHandler(JsonOperationMetadata - .builder().isPayloadJson(false).hasStreamingSuccessResponse(true).build(), VoidSdkResponse::builder); + .builder().isPayloadJson(false).hasStreamingSuccessResponse(true).build(), VoidSdkResponse::builder); HttpResponseHandler eventResponseHandler = protocolFactory.createResponseHandler( - JsonOperationMetadata.builder().isPayloadJson(true).hasStreamingSuccessResponse(false).build(), - EventStreamTaggedUnionPojoSupplier.builder().putSdkPojoSupplier("EventOne", EventStream::eventOneBuilder) - .putSdkPojoSupplier("EventTheSecond", EventStream::eventTheSecondBuilder) - .putSdkPojoSupplier("secondEventOne", EventStream::secondEventOneBuilder) - .putSdkPojoSupplier("eventThree", EventStream::eventThreeBuilder) - .defaultSdkPojoSupplier(() -> new SdkPojoBuilder(EventStream.UNKNOWN)).build()); + JsonOperationMetadata.builder().isPayloadJson(true).hasStreamingSuccessResponse(false).build(), + EventStreamTaggedUnionPojoSupplier.builder().putSdkPojoSupplier("EventOne", EventStream::eventOneBuilder) + .putSdkPojoSupplier("EventTheSecond", EventStream::eventTheSecondBuilder) + .putSdkPojoSupplier("secondEventOne", EventStream::secondEventOneBuilder) + .putSdkPojoSupplier("eventThree", EventStream::eventThreeBuilder) + .defaultSdkPojoSupplier(() -> new SdkPojoBuilder(EventStream.UNKNOWN)).build()); Function> eventstreamExceptionMetadataMapper = errorCode -> { switch (errorCode) { - default: - return Optional.empty(); + default: + return Optional.empty(); } }; HttpResponseHandler errorEventResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, eventstreamExceptionMetadataMapper); + operationMetadata, eventstreamExceptionMetadataMapper); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); EventStreamTaggedUnionJsonMarshaller eventMarshaller = EventStreamTaggedUnionJsonMarshaller.builder() - .putMarshaller(DefaultInputEvent.class, new InputEventMarshaller(protocolFactory)).build(); + .putMarshaller(DefaultInputEvent.class, new InputEventMarshaller(protocolFactory)).build(); SdkPublisher eventPublisher = SdkPublisher.adapt(requestStream); Publisher adapted = eventPublisher.map(event -> eventMarshaller.marshall(event)).map( - AwsClientHandlerUtils::encodeEventStreamRequestToByteBuffer); + AwsClientHandlerUtils::encodeEventStreamRequestToByteBuffer); CompletableFuture future = new CompletableFuture<>(); EventStreamAsyncResponseTransformer asyncResponseTransformer = EventStreamAsyncResponseTransformer - . builder().eventStreamResponseHandler(asyncResponseHandler) - .eventResponseHandler(eventResponseHandler).initialResponseHandler(responseHandler) - .exceptionResponseHandler(errorEventResponseHandler).future(future).executor(executor) - .serviceName(serviceName()).build(); + . builder().eventStreamResponseHandler(asyncResponseHandler) + .eventResponseHandler(eventResponseHandler).initialResponseHandler(responseHandler) + .exceptionResponseHandler(errorEventResponseHandler).future(future).executor(executor) + .serviceName(serviceName()).build(); CompletableFuture executeFuture = clientHandler.execute( - new ClientExecutionParams() - .withOperationName("EventStreamOperation").withProtocolMetadata(protocolMetadata) - .withMarshaller(new EventStreamOperationRequestMarshaller(protocolFactory)) - .withAsyncRequestBody(AsyncRequestBody.fromPublisher(adapted)).withFullDuplex(true) - .withInitialRequestEvent(true).withResponseHandler(voidResponseHandler) - .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) - .withMetricCollector(apiCallMetricCollector).withInput(eventStreamOperationRequest), - asyncResponseTransformer); + new ClientExecutionParams() + .withOperationName("EventStreamOperation").withProtocolMetadata(protocolMetadata) + .withMarshaller(new EventStreamOperationRequestMarshaller(protocolFactory)) + .withAsyncRequestBody(AsyncRequestBody.fromPublisher(adapted)).withFullDuplex(true) + .withInitialRequestEvent(true).withResponseHandler(voidResponseHandler) + .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) + .withMetricCollector(apiCallMetricCollector).withInput(eventStreamOperationRequest), + asyncResponseTransformer); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { if (e != null) { try { @@ -420,7 +429,7 @@ public CompletableFuture eventStreamOperation(EventStreamOperationRequest return CompletableFutureUtils.forwardExceptionTo(future, executeFuture); } catch (Throwable t) { runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> asyncResponseHandler.exceptionOccurred(t)); + () -> asyncResponseHandler.exceptionOccurred(t)); metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } @@ -449,53 +458,56 @@ public CompletableFuture eventStreamOperation(EventStreamOperationRequest */ @Override public CompletableFuture eventStreamOperationWithOnlyInput( - EventStreamOperationWithOnlyInputRequest eventStreamOperationWithOnlyInputRequest, - Publisher requestStream) { + EventStreamOperationWithOnlyInputRequest eventStreamOperationWithOnlyInputRequest, + Publisher requestStream) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(eventStreamOperationWithOnlyInputRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - eventStreamOperationWithOnlyInputRequest.overrideConfiguration().orElse(null)); + eventStreamOperationWithOnlyInputRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "EventStreamOperationWithOnlyInput"); eventStreamOperationWithOnlyInputRequest = applySignerOverride(eventStreamOperationWithOnlyInputRequest, - EventStreamAws4Signer.create()); + EventStreamAws4Signer.create()); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(operationMetadata, EventStreamOperationWithOnlyInputResponse::builder); + .createResponseHandler(operationMetadata, EventStreamOperationWithOnlyInputResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); EventStreamTaggedUnionJsonMarshaller eventMarshaller = EventStreamTaggedUnionJsonMarshaller.builder() - .putMarshaller(DefaultInputEventOne.class, new InputEventMarshaller(protocolFactory)) - .putMarshaller(DefaultInputEventTwo.class, new InputEventTwoMarshaller(protocolFactory)).build(); + .putMarshaller(DefaultInputEventOne.class, new InputEventMarshaller(protocolFactory)) + .putMarshaller(DefaultInputEventTwo.class, new InputEventTwoMarshaller(protocolFactory)).build(); SdkPublisher eventPublisher = SdkPublisher.adapt(requestStream); Publisher adapted = eventPublisher.map(event -> eventMarshaller.marshall(event)).map( - AwsClientHandlerUtils::encodeEventStreamRequestToByteBuffer); + AwsClientHandlerUtils::encodeEventStreamRequestToByteBuffer); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("EventStreamOperationWithOnlyInput").withProtocolMetadata(protocolMetadata) - .withMarshaller(new EventStreamOperationWithOnlyInputRequestMarshaller(protocolFactory)) - .withAsyncRequestBody(AsyncRequestBody.fromPublisher(adapted)).withInitialRequestEvent(true) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(eventStreamOperationWithOnlyInputRequest)); + .execute(new ClientExecutionParams() + .withOperationName("EventStreamOperationWithOnlyInput").withProtocolMetadata(protocolMetadata) + .withMarshaller(new EventStreamOperationWithOnlyInputRequestMarshaller(protocolFactory)) + .withAsyncRequestBody(AsyncRequestBody.fromPublisher(adapted)).withInitialRequestEvent(true) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(eventStreamOperationWithOnlyInputRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -530,72 +542,75 @@ public CompletableFuture eventStreamO */ @Override public CompletableFuture eventStreamOperationWithOnlyOutput( - EventStreamOperationWithOnlyOutputRequest eventStreamOperationWithOnlyOutputRequest, - EventStreamOperationWithOnlyOutputResponseHandler asyncResponseHandler) { + EventStreamOperationWithOnlyOutputRequest eventStreamOperationWithOnlyOutputRequest, + EventStreamOperationWithOnlyOutputResponseHandler asyncResponseHandler) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(eventStreamOperationWithOnlyOutputRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - eventStreamOperationWithOnlyOutputRequest.overrideConfiguration().orElse(null)); + eventStreamOperationWithOnlyOutputRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "EventStreamOperationWithOnlyOutput"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = new AttachHttpMetadataResponseHandler( - protocolFactory.createResponseHandler(operationMetadata, EventStreamOperationWithOnlyOutputResponse::builder)); + protocolFactory.createResponseHandler(operationMetadata, EventStreamOperationWithOnlyOutputResponse::builder)); HttpResponseHandler voidResponseHandler = protocolFactory.createResponseHandler(JsonOperationMetadata - .builder().isPayloadJson(false).hasStreamingSuccessResponse(true).build(), VoidSdkResponse::builder); + .builder().isPayloadJson(false).hasStreamingSuccessResponse(true).build(), VoidSdkResponse::builder); HttpResponseHandler eventResponseHandler = protocolFactory.createResponseHandler( - JsonOperationMetadata.builder().isPayloadJson(true).hasStreamingSuccessResponse(false).build(), - EventStreamTaggedUnionPojoSupplier.builder().putSdkPojoSupplier("EventOne", EventStream::eventOneBuilder) - .putSdkPojoSupplier("EventTheSecond", EventStream::eventTheSecondBuilder) - .putSdkPojoSupplier("secondEventOne", EventStream::secondEventOneBuilder) - .putSdkPojoSupplier("eventThree", EventStream::eventThreeBuilder) - .defaultSdkPojoSupplier(() -> new SdkPojoBuilder(EventStream.UNKNOWN)).build()); + JsonOperationMetadata.builder().isPayloadJson(true).hasStreamingSuccessResponse(false).build(), + EventStreamTaggedUnionPojoSupplier.builder().putSdkPojoSupplier("EventOne", EventStream::eventOneBuilder) + .putSdkPojoSupplier("EventTheSecond", EventStream::eventTheSecondBuilder) + .putSdkPojoSupplier("secondEventOne", EventStream::secondEventOneBuilder) + .putSdkPojoSupplier("eventThree", EventStream::eventThreeBuilder) + .defaultSdkPojoSupplier(() -> new SdkPojoBuilder(EventStream.UNKNOWN)).build()); Function> eventstreamExceptionMetadataMapper = errorCode -> { switch (errorCode) { - default: - return Optional.empty(); + default: + return Optional.empty(); } }; HttpResponseHandler errorEventResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, eventstreamExceptionMetadataMapper); + operationMetadata, eventstreamExceptionMetadataMapper); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture future = new CompletableFuture<>(); EventStreamAsyncResponseTransformer asyncResponseTransformer = EventStreamAsyncResponseTransformer - . builder() - .eventStreamResponseHandler(asyncResponseHandler).eventResponseHandler(eventResponseHandler) - .initialResponseHandler(responseHandler).exceptionResponseHandler(errorEventResponseHandler).future(future) - .executor(executor).serviceName(serviceName()).build(); + . builder() + .eventStreamResponseHandler(asyncResponseHandler).eventResponseHandler(eventResponseHandler) + .initialResponseHandler(responseHandler).exceptionResponseHandler(errorEventResponseHandler).future(future) + .executor(executor).serviceName(serviceName()).build(); CompletableFuture executeFuture = clientHandler.execute( - new ClientExecutionParams() - .withOperationName("EventStreamOperationWithOnlyOutput").withProtocolMetadata(protocolMetadata) - .withMarshaller(new EventStreamOperationWithOnlyOutputRequestMarshaller(protocolFactory)) - .withResponseHandler(voidResponseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(eventStreamOperationWithOnlyOutputRequest), asyncResponseTransformer); + new ClientExecutionParams() + .withOperationName("EventStreamOperationWithOnlyOutput").withProtocolMetadata(protocolMetadata) + .withMarshaller(new EventStreamOperationWithOnlyOutputRequestMarshaller(protocolFactory)) + .withResponseHandler(voidResponseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(eventStreamOperationWithOnlyOutputRequest), asyncResponseTransformer); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { if (e != null) { try { @@ -610,7 +625,7 @@ public CompletableFuture eventStreamOperationWithOnlyOutput( return CompletableFutureUtils.forwardExceptionTo(future, executeFuture); } catch (Throwable t) { runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> asyncResponseHandler.exceptionOccurred(t)); + () -> asyncResponseHandler.exceptionOccurred(t)); metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } @@ -642,43 +657,46 @@ public CompletableFuture eventStreamOperationWithOnlyOutput( */ @Override public CompletableFuture getWithoutRequiredMembers( - GetWithoutRequiredMembersRequest getWithoutRequiredMembersRequest) { + GetWithoutRequiredMembersRequest getWithoutRequiredMembersRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getWithoutRequiredMembersRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getWithoutRequiredMembersRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetWithoutRequiredMembers"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, GetWithoutRequiredMembersResponse::builder); + operationMetadata, GetWithoutRequiredMembersResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("GetWithoutRequiredMembers").withProtocolMetadata(protocolMetadata) - .withMarshaller(new GetWithoutRequiredMembersRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(getWithoutRequiredMembersRequest)); + .execute(new ClientExecutionParams() + .withOperationName("GetWithoutRequiredMembers").withProtocolMetadata(protocolMetadata) + .withMarshaller(new GetWithoutRequiredMembersRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(getWithoutRequiredMembersRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -713,47 +731,50 @@ public CompletableFuture getWithoutRequiredMe */ @Override public CompletableFuture operationWithChecksumRequired( - OperationWithChecksumRequiredRequest operationWithChecksumRequiredRequest) { + OperationWithChecksumRequiredRequest operationWithChecksumRequiredRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithChecksumRequiredRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithChecksumRequiredRequest.overrideConfiguration().orElse(null)); + operationWithChecksumRequiredRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithChecksumRequired"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, OperationWithChecksumRequiredResponse::builder); + operationMetadata, OperationWithChecksumRequiredResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithChecksumRequired") - .withProtocolMetadata(protocolMetadata) - .withMarshaller(new OperationWithChecksumRequiredRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute(SdkInternalExecutionAttribute.HTTP_CHECKSUM_REQUIRED, - HttpChecksumRequired.create()).withInput(operationWithChecksumRequiredRequest)); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithChecksumRequired") + .withProtocolMetadata(protocolMetadata) + .withMarshaller(new OperationWithChecksumRequiredRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute(SdkInternalExecutionAttribute.HTTP_CHECKSUM_REQUIRED, + HttpChecksumRequired.create()).withInput(operationWithChecksumRequiredRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -787,44 +808,47 @@ public CompletableFuture operationWithChe */ @Override public CompletableFuture operationWithNoneAuthType( - OperationWithNoneAuthTypeRequest operationWithNoneAuthTypeRequest) { + OperationWithNoneAuthTypeRequest operationWithNoneAuthTypeRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithNoneAuthTypeRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithNoneAuthTypeRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithNoneAuthType"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, OperationWithNoneAuthTypeResponse::builder); + operationMetadata, OperationWithNoneAuthTypeResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithNoneAuthType").withProtocolMetadata(protocolMetadata) - .withMarshaller(new OperationWithNoneAuthTypeRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute(SdkInternalExecutionAttribute.IS_NONE_AUTH_TYPE_REQUEST, false) - .withInput(operationWithNoneAuthTypeRequest)); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithNoneAuthType").withProtocolMetadata(protocolMetadata) + .withMarshaller(new OperationWithNoneAuthTypeRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute(SdkInternalExecutionAttribute.IS_NONE_AUTH_TYPE_REQUEST, false) + .withInput(operationWithNoneAuthTypeRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -859,48 +883,51 @@ public CompletableFuture operationWithNoneAut */ @Override public CompletableFuture operationWithRequestCompression( - OperationWithRequestCompressionRequest operationWithRequestCompressionRequest) { + OperationWithRequestCompressionRequest operationWithRequestCompressionRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithRequestCompressionRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithRequestCompressionRequest.overrideConfiguration().orElse(null)); + operationWithRequestCompressionRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithRequestCompression"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, OperationWithRequestCompressionResponse::builder); + operationMetadata, OperationWithRequestCompressionResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithRequestCompression") - .withProtocolMetadata(protocolMetadata) - .withMarshaller(new OperationWithRequestCompressionRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute(SdkInternalExecutionAttribute.REQUEST_COMPRESSION, - RequestCompression.builder().encodings("gzip").isStreaming(false).build()) - .withInput(operationWithRequestCompressionRequest)); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithRequestCompression") + .withProtocolMetadata(protocolMetadata) + .withMarshaller(new OperationWithRequestCompressionRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute(SdkInternalExecutionAttribute.REQUEST_COMPRESSION, + RequestCompression.builder().encodings("gzip").isStreaming(false).build()) + .withInput(operationWithRequestCompressionRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -935,43 +962,46 @@ public CompletableFuture operationWithR */ @Override public CompletableFuture paginatedOperationWithResultKey( - PaginatedOperationWithResultKeyRequest paginatedOperationWithResultKeyRequest) { + PaginatedOperationWithResultKeyRequest paginatedOperationWithResultKeyRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(paginatedOperationWithResultKeyRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - paginatedOperationWithResultKeyRequest.overrideConfiguration().orElse(null)); + paginatedOperationWithResultKeyRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PaginatedOperationWithResultKey"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, PaginatedOperationWithResultKeyResponse::builder); + operationMetadata, PaginatedOperationWithResultKeyResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("PaginatedOperationWithResultKey").withProtocolMetadata(protocolMetadata) - .withMarshaller(new PaginatedOperationWithResultKeyRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(paginatedOperationWithResultKeyRequest)); + .execute(new ClientExecutionParams() + .withOperationName("PaginatedOperationWithResultKey").withProtocolMetadata(protocolMetadata) + .withMarshaller(new PaginatedOperationWithResultKeyRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(paginatedOperationWithResultKeyRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -1006,43 +1036,46 @@ public CompletableFuture paginatedOpera */ @Override public CompletableFuture paginatedOperationWithoutResultKey( - PaginatedOperationWithoutResultKeyRequest paginatedOperationWithoutResultKeyRequest) { + PaginatedOperationWithoutResultKeyRequest paginatedOperationWithoutResultKeyRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(paginatedOperationWithoutResultKeyRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - paginatedOperationWithoutResultKeyRequest.overrideConfiguration().orElse(null)); + paginatedOperationWithoutResultKeyRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PaginatedOperationWithoutResultKey"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(operationMetadata, PaginatedOperationWithoutResultKeyResponse::builder); + .createResponseHandler(operationMetadata, PaginatedOperationWithoutResultKeyResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("PaginatedOperationWithoutResultKey").withProtocolMetadata(protocolMetadata) - .withMarshaller(new PaginatedOperationWithoutResultKeyRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(paginatedOperationWithoutResultKeyRequest)); + .execute(new ClientExecutionParams() + .withOperationName("PaginatedOperationWithoutResultKey").withProtocolMetadata(protocolMetadata) + .withMarshaller(new PaginatedOperationWithoutResultKeyRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(paginatedOperationWithoutResultKeyRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -1081,13 +1114,13 @@ public CompletableFuture paginatedOp */ @Override public CompletableFuture streamingInputOperation( - StreamingInputOperationRequest streamingInputOperationRequest, AsyncRequestBody requestBody) { + StreamingInputOperationRequest streamingInputOperationRequest, AsyncRequestBody requestBody) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingInputOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingInputOperation"); @@ -1095,36 +1128,39 @@ public CompletableFuture streamingInputOperatio streamingInputOperationRequest = applySignerOverride(streamingInputOperationRequest, AsyncAws4Signer.create()); } JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, StreamingInputOperationResponse::builder); + operationMetadata, StreamingInputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("StreamingInputOperation") - .withProtocolMetadata(protocolMetadata) - .withMarshaller( - AsyncStreamingRequestMarshaller.builder() - .delegateMarshaller(new StreamingInputOperationRequestMarshaller(protocolFactory)) - .asyncRequestBody(requestBody).build()).withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) - .withMetricCollector(apiCallMetricCollector).withAsyncRequestBody(requestBody) - .withInput(streamingInputOperationRequest)); + .execute(new ClientExecutionParams() + .withOperationName("StreamingInputOperation") + .withProtocolMetadata(protocolMetadata) + .withMarshaller( + AsyncStreamingRequestMarshaller.builder() + .delegateMarshaller(new StreamingInputOperationRequestMarshaller(protocolFactory)) + .asyncRequestBody(requestBody).build()).withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) + .withMetricCollector(apiCallMetricCollector).withAsyncRequestBody(requestBody) + .withInput(streamingInputOperationRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -1168,62 +1204,65 @@ public CompletableFuture streamingInputOperatio */ @Override public CompletableFuture streamingInputOutputOperation( - StreamingInputOutputOperationRequest streamingInputOutputOperationRequest, AsyncRequestBody requestBody, - AsyncResponseTransformer asyncResponseTransformer) { + StreamingInputOutputOperationRequest streamingInputOutputOperationRequest, AsyncRequestBody requestBody, + AsyncResponseTransformer asyncResponseTransformer) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOutputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - streamingInputOutputOperationRequest.overrideConfiguration().orElse(null)); + streamingInputOutputOperationRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingInputOutputOperation"); Pair, CompletableFuture> pair = AsyncResponseTransformerUtils - .wrapWithEndOfStreamFuture(asyncResponseTransformer); + .wrapWithEndOfStreamFuture(asyncResponseTransformer); asyncResponseTransformer = pair.left(); CompletableFuture endOfStreamFuture = pair.right(); streamingInputOutputOperationRequest = applySignerOverride(streamingInputOutputOperationRequest, - Aws4UnsignedPayloadSigner.create()); + Aws4UnsignedPayloadSigner.create()); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(true) - .isPayloadJson(false).build(); + .isPayloadJson(false).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, StreamingInputOutputOperationResponse::builder); + operationMetadata, StreamingInputOutputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler.execute( - new ClientExecutionParams() - .withOperationName("StreamingInputOutputOperation") - .withProtocolMetadata(protocolMetadata) - .withMarshaller( - AsyncStreamingRequestMarshaller - .builder() - .delegateMarshaller( - new StreamingInputOutputOperationRequestMarshaller(protocolFactory)) - .asyncRequestBody(requestBody).transferEncoding(true).build()) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withAsyncRequestBody(requestBody).withInput(streamingInputOutputOperationRequest), - asyncResponseTransformer); + new ClientExecutionParams() + .withOperationName("StreamingInputOutputOperation") + .withProtocolMetadata(protocolMetadata) + .withMarshaller( + AsyncStreamingRequestMarshaller + .builder() + .delegateMarshaller( + new StreamingInputOutputOperationRequestMarshaller(protocolFactory)) + .asyncRequestBody(requestBody).transferEncoding(true).build()) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withAsyncRequestBody(requestBody).withInput(streamingInputOutputOperationRequest), + asyncResponseTransformer); AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { if (e != null) { runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> finalAsyncResponseTransformer.exceptionOccurred(e)); + () -> finalAsyncResponseTransformer.exceptionOccurred(e)); } endOfStreamFuture.whenComplete((r2, e2) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -1234,7 +1273,7 @@ public CompletableFuture streamingInputOutputOperation( } catch (Throwable t) { AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> finalAsyncResponseTransformer.exceptionOccurred(t)); + () -> finalAsyncResponseTransformer.exceptionOccurred(t)); metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } @@ -1267,53 +1306,56 @@ public CompletableFuture streamingInputOutputOperation( */ @Override public CompletableFuture streamingOutputOperation( - StreamingOutputOperationRequest streamingOutputOperationRequest, - AsyncResponseTransformer asyncResponseTransformer) { + StreamingOutputOperationRequest streamingOutputOperationRequest, + AsyncResponseTransformer asyncResponseTransformer) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingOutputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingOutputOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingOutputOperation"); Pair, CompletableFuture> pair = AsyncResponseTransformerUtils - .wrapWithEndOfStreamFuture(asyncResponseTransformer); + .wrapWithEndOfStreamFuture(asyncResponseTransformer); asyncResponseTransformer = pair.left(); CompletableFuture endOfStreamFuture = pair.right(); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(true) - .isPayloadJson(false).build(); + .isPayloadJson(false).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, StreamingOutputOperationResponse::builder); + operationMetadata, StreamingOutputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler.execute( - new ClientExecutionParams() - .withOperationName("StreamingOutputOperation").withProtocolMetadata(protocolMetadata) - .withMarshaller(new StreamingOutputOperationRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(streamingOutputOperationRequest), asyncResponseTransformer); + new ClientExecutionParams() + .withOperationName("StreamingOutputOperation").withProtocolMetadata(protocolMetadata) + .withMarshaller(new StreamingOutputOperationRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(streamingOutputOperationRequest), asyncResponseTransformer); AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { if (e != null) { runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> finalAsyncResponseTransformer.exceptionOccurred(e)); + () -> finalAsyncResponseTransformer.exceptionOccurred(e)); } endOfStreamFuture.whenComplete((r2, e2) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -1324,7 +1366,7 @@ public CompletableFuture streamingOutputOperation( } catch (Throwable t) { AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> finalAsyncResponseTransformer.exceptionOccurred(t)); + () -> finalAsyncResponseTransformer.exceptionOccurred(t)); metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } @@ -1342,11 +1384,11 @@ public final String serviceName() { private > T init(T builder) { return builder.clientConfiguration(clientConfiguration).defaultServiceExceptionSupplier(JsonException::builder) - .protocol(AwsJsonProtocol.AWS_JSON).protocolVersion("1.1"); + .protocol(AwsJsonProtocol.AWS_JSON).protocolVersion("1.1"); } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, - RequestOverrideConfiguration requestOverrideConfiguration) { + RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); @@ -1366,8 +1408,8 @@ private T applySignerOverride(T request, Signer signer) } Consumer signerOverride = b -> b.signer(signer).build(); AwsRequestOverrideConfiguration overrideConfiguration = request.overrideConfiguration() - .map(c -> c.toBuilder().applyMutation(signerOverride).build()) - .orElse((AwsRequestOverrideConfiguration.builder().applyMutation(signerOverride).build())); + .map(c -> c.toBuilder().applyMutation(signerOverride).build()) + .orElse((AwsRequestOverrideConfiguration.builder().applyMutation(signerOverride).build())); return (T) request.toBuilder().overrideConfiguration(overrideConfiguration).build(); } @@ -1413,7 +1455,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, - JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { + JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); } diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-cbor-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-cbor-client-class.java index 04fbb521fbab..cfa013f73a9d 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-cbor-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-cbor-client-class.java @@ -90,7 +90,7 @@ final class DefaultJsonClient implements JsonClient { private static final Logger log = Logger.loggerFor(DefaultJsonClient.class); private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder() - .serviceProtocol(AwsServiceProtocol.CBOR).build(); + .serviceProtocol(AwsServiceProtocol.CBOR).build(); private final SyncClientHandler clientHandler; @@ -126,45 +126,48 @@ protected DefaultJsonClient(SdkClientConfiguration clientConfiguration) { */ @Override public APostOperationResponse aPostOperation(APostOperationRequest aPostOperationRequest) throws InvalidInputException, - AwsServiceException, SdkClientException, JsonException { + AwsServiceException, SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, - APostOperationResponse::builder); + APostOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "APostOperation"); String hostPrefix = "{StringMember}-foo."; HostnameValidator.validateHostnameCompliant(aPostOperationRequest.stringMember(), "StringMember", - "aPostOperationRequest"); + "aPostOperationRequest"); String resolvedHostExpression = String.format("%s-foo.", aPostOperationRequest.stringMember()); return clientHandler.execute(new ClientExecutionParams() - .withOperationName("APostOperation").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .hostPrefixExpression(resolvedHostExpression).withRequestConfiguration(clientConfiguration) - .withInput(aPostOperationRequest).withMetricCollector(apiCallMetricCollector) - .withMarshaller(new APostOperationRequestMarshaller(protocolFactory))); + .withOperationName("APostOperation").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .hostPrefixExpression(resolvedHostExpression).withRequestConfiguration(clientConfiguration) + .withInput(aPostOperationRequest).withMetricCollector(apiCallMetricCollector) + .withMarshaller(new APostOperationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -193,44 +196,47 @@ public APostOperationResponse aPostOperation(APostOperationRequest aPostOperatio */ @Override public APostOperationWithOutputResponse aPostOperationWithOutput( - APostOperationWithOutputRequest aPostOperationWithOutputRequest) throws InvalidInputException, ServiceFaultException, - AwsServiceException, SdkClientException, JsonException { + APostOperationWithOutputRequest aPostOperationWithOutputRequest) throws InvalidInputException, ServiceFaultException, + AwsServiceException, SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, APostOperationWithOutputResponse::builder); + operationMetadata, APostOperationWithOutputResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationWithOutputRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationWithOutputRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "APostOperationWithOutput"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("APostOperationWithOutput").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(aPostOperationWithOutputRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new APostOperationWithOutputRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("APostOperationWithOutput").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(aPostOperationWithOutputRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new APostOperationWithOutputRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -258,44 +264,47 @@ public APostOperationWithOutputResponse aPostOperationWithOutput( */ @Override public GetWithoutRequiredMembersResponse getWithoutRequiredMembers( - GetWithoutRequiredMembersRequest getWithoutRequiredMembersRequest) throws InvalidInputException, AwsServiceException, - SdkClientException, JsonException { + GetWithoutRequiredMembersRequest getWithoutRequiredMembersRequest) throws InvalidInputException, AwsServiceException, + SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, GetWithoutRequiredMembersResponse::builder); + operationMetadata, GetWithoutRequiredMembersResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getWithoutRequiredMembersRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getWithoutRequiredMembersRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetWithoutRequiredMembers"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("GetWithoutRequiredMembers").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(getWithoutRequiredMembersRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new GetWithoutRequiredMembersRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("GetWithoutRequiredMembers").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(getWithoutRequiredMembersRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new GetWithoutRequiredMembersRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -319,49 +328,52 @@ public GetWithoutRequiredMembersResponse getWithoutRequiredMembers( */ @Override public OperationWithChecksumRequiredResponse operationWithChecksumRequired( - OperationWithChecksumRequiredRequest operationWithChecksumRequiredRequest) throws AwsServiceException, - SdkClientException, JsonException { + OperationWithChecksumRequiredRequest operationWithChecksumRequiredRequest) throws AwsServiceException, + SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, OperationWithChecksumRequiredResponse::builder); + operationMetadata, OperationWithChecksumRequiredResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithChecksumRequiredRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithChecksumRequiredRequest.overrideConfiguration().orElse(null)); + operationWithChecksumRequiredRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithChecksumRequired"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithChecksumRequired") - .withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withInput(operationWithChecksumRequiredRequest) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute(SdkInternalExecutionAttribute.HTTP_CHECKSUM_REQUIRED, - HttpChecksumRequired.create()) - .withMarshaller(new OperationWithChecksumRequiredRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithChecksumRequired") + .withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withInput(operationWithChecksumRequiredRequest) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute(SdkInternalExecutionAttribute.HTTP_CHECKSUM_REQUIRED, + HttpChecksumRequired.create()) + .withMarshaller(new OperationWithChecksumRequiredRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -385,44 +397,47 @@ public OperationWithChecksumRequiredResponse operationWithChecksumRequired( */ @Override public OperationWithNoneAuthTypeResponse operationWithNoneAuthType( - OperationWithNoneAuthTypeRequest operationWithNoneAuthTypeRequest) throws AwsServiceException, SdkClientException, - JsonException { + OperationWithNoneAuthTypeRequest operationWithNoneAuthTypeRequest) throws AwsServiceException, SdkClientException, + JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, OperationWithNoneAuthTypeResponse::builder); + operationMetadata, OperationWithNoneAuthTypeResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithNoneAuthTypeRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithNoneAuthTypeRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithNoneAuthType"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithNoneAuthType").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(operationWithNoneAuthTypeRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new OperationWithNoneAuthTypeRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithNoneAuthType").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(operationWithNoneAuthTypeRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new OperationWithNoneAuthTypeRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -446,49 +461,52 @@ public OperationWithNoneAuthTypeResponse operationWithNoneAuthType( */ @Override public OperationWithRequestCompressionResponse operationWithRequestCompression( - OperationWithRequestCompressionRequest operationWithRequestCompressionRequest) throws AwsServiceException, - SdkClientException, JsonException { + OperationWithRequestCompressionRequest operationWithRequestCompressionRequest) throws AwsServiceException, + SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, OperationWithRequestCompressionResponse::builder); + operationMetadata, OperationWithRequestCompressionResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithRequestCompressionRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithRequestCompressionRequest.overrideConfiguration().orElse(null)); + operationWithRequestCompressionRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithRequestCompression"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithRequestCompression") - .withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withInput(operationWithRequestCompressionRequest) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute(SdkInternalExecutionAttribute.REQUEST_COMPRESSION, - RequestCompression.builder().encodings("gzip").isStreaming(false).build()) - .withMarshaller(new OperationWithRequestCompressionRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithRequestCompression") + .withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withInput(operationWithRequestCompressionRequest) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute(SdkInternalExecutionAttribute.REQUEST_COMPRESSION, + RequestCompression.builder().encodings("gzip").isStreaming(false).build()) + .withMarshaller(new OperationWithRequestCompressionRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -512,44 +530,47 @@ public OperationWithRequestCompressionResponse operationWithRequestCompression( */ @Override public PaginatedOperationWithResultKeyResponse paginatedOperationWithResultKey( - PaginatedOperationWithResultKeyRequest paginatedOperationWithResultKeyRequest) throws AwsServiceException, - SdkClientException, JsonException { + PaginatedOperationWithResultKeyRequest paginatedOperationWithResultKeyRequest) throws AwsServiceException, + SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, PaginatedOperationWithResultKeyResponse::builder); + operationMetadata, PaginatedOperationWithResultKeyResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(paginatedOperationWithResultKeyRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - paginatedOperationWithResultKeyRequest.overrideConfiguration().orElse(null)); + paginatedOperationWithResultKeyRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PaginatedOperationWithResultKey"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("PaginatedOperationWithResultKey").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(paginatedOperationWithResultKeyRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new PaginatedOperationWithResultKeyRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("PaginatedOperationWithResultKey").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(paginatedOperationWithResultKeyRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new PaginatedOperationWithResultKeyRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -573,44 +594,47 @@ public PaginatedOperationWithResultKeyResponse paginatedOperationWithResultKey( */ @Override public PaginatedOperationWithoutResultKeyResponse paginatedOperationWithoutResultKey( - PaginatedOperationWithoutResultKeyRequest paginatedOperationWithoutResultKeyRequest) throws AwsServiceException, - SdkClientException, JsonException { + PaginatedOperationWithoutResultKeyRequest paginatedOperationWithoutResultKeyRequest) throws AwsServiceException, + SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, PaginatedOperationWithoutResultKeyResponse::builder); + operationMetadata, PaginatedOperationWithoutResultKeyResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(paginatedOperationWithoutResultKeyRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - paginatedOperationWithoutResultKeyRequest.overrideConfiguration().orElse(null)); + paginatedOperationWithoutResultKeyRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PaginatedOperationWithoutResultKey"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("PaginatedOperationWithoutResultKey").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(paginatedOperationWithoutResultKeyRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new PaginatedOperationWithoutResultKeyRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("PaginatedOperationWithoutResultKey").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(paginatedOperationWithoutResultKeyRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new PaginatedOperationWithoutResultKeyRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -645,50 +669,53 @@ public PaginatedOperationWithoutResultKeyResponse paginatedOperationWithoutResul */ @Override public StreamingInputOperationResponse streamingInputOperation(StreamingInputOperationRequest streamingInputOperationRequest, - RequestBody requestBody) throws AwsServiceException, SdkClientException, JsonException { + RequestBody requestBody) throws AwsServiceException, SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, StreamingInputOperationResponse::builder); + operationMetadata, StreamingInputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingInputOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingInputOperation"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("StreamingInputOperation") - .withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withInput(streamingInputOperationRequest) - .withMetricCollector(apiCallMetricCollector) - .withRequestBody(requestBody) - .withMarshaller( - StreamingRequestMarshaller.builder() - .delegateMarshaller(new StreamingInputOperationRequestMarshaller(protocolFactory)) - .requestBody(requestBody).build())); + .execute(new ClientExecutionParams() + .withOperationName("StreamingInputOperation") + .withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withInput(streamingInputOperationRequest) + .withMetricCollector(apiCallMetricCollector) + .withRequestBody(requestBody) + .withMarshaller( + StreamingRequestMarshaller.builder() + .delegateMarshaller(new StreamingInputOperationRequestMarshaller(protocolFactory)) + .requestBody(requestBody).build())); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -730,54 +757,57 @@ public StreamingInputOperationResponse streamingInputOperation(StreamingInputOpe */ @Override public ReturnT streamingInputOutputOperation( - StreamingInputOutputOperationRequest streamingInputOutputOperationRequest, RequestBody requestBody, - ResponseTransformer responseTransformer) throws AwsServiceException, - SdkClientException, JsonException { + StreamingInputOutputOperationRequest streamingInputOutputOperationRequest, RequestBody requestBody, + ResponseTransformer responseTransformer) throws AwsServiceException, + SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(true) - .isPayloadJson(false).build(); + .isPayloadJson(false).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, StreamingInputOutputOperationResponse::builder); + operationMetadata, StreamingInputOutputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOutputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - streamingInputOutputOperationRequest.overrideConfiguration().orElse(null)); + streamingInputOutputOperationRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingInputOutputOperation"); return clientHandler.execute( - new ClientExecutionParams() - .withOperationName("StreamingInputOutputOperation") - .withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withInput(streamingInputOutputOperationRequest) - .withMetricCollector(apiCallMetricCollector) - .withRequestBody(requestBody) - .withMarshaller( - StreamingRequestMarshaller - .builder() - .delegateMarshaller( - new StreamingInputOutputOperationRequestMarshaller(protocolFactory)) - .requestBody(requestBody).transferEncoding(true).build()), responseTransformer); + new ClientExecutionParams() + .withOperationName("StreamingInputOutputOperation") + .withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withInput(streamingInputOutputOperationRequest) + .withMetricCollector(apiCallMetricCollector) + .withRequestBody(requestBody) + .withMarshaller( + StreamingRequestMarshaller + .builder() + .delegateMarshaller( + new StreamingInputOutputOperationRequestMarshaller(protocolFactory)) + .requestBody(requestBody).transferEncoding(true).build()), responseTransformer); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -808,44 +838,47 @@ public ReturnT streamingInputOutputOperation( */ @Override public ReturnT streamingOutputOperation(StreamingOutputOperationRequest streamingOutputOperationRequest, - ResponseTransformer responseTransformer) throws AwsServiceException, - SdkClientException, JsonException { + ResponseTransformer responseTransformer) throws AwsServiceException, + SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(true) - .isPayloadJson(false).build(); + .isPayloadJson(false).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, StreamingOutputOperationResponse::builder); + operationMetadata, StreamingOutputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInputException": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "ServiceFaultException": - return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) - .exceptionBuilderSupplier(ServiceFaultException::builder).build()); - default: - return Optional.empty(); + case "InvalidInputException": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInputException").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "ServiceFaultException": + return Optional.of(ExceptionMetadata.builder().errorCode("ServiceFaultException").httpStatusCode(500) + .exceptionBuilderSupplier(ServiceFaultException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingOutputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingOutputOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingOutputOperation"); return clientHandler.execute( - new ClientExecutionParams() - .withOperationName("StreamingOutputOperation").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(streamingOutputOperationRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new StreamingOutputOperationRequestMarshaller(protocolFactory)), responseTransformer); + new ClientExecutionParams() + .withOperationName("StreamingOutputOperation").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(streamingOutputOperationRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new StreamingOutputOperationRequestMarshaller(protocolFactory)), responseTransformer); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -865,7 +898,7 @@ public final String serviceName() { } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, - RequestOverrideConfiguration requestOverrideConfiguration) { + RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); @@ -880,7 +913,7 @@ private static List resolveMetricPublishers(SdkClientConfigurat } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, - JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { + JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); } @@ -923,7 +956,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, private > T init(T builder) { return builder.clientConfiguration(clientConfiguration).defaultServiceExceptionSupplier(JsonException::builder) - .protocol(AwsJsonProtocol.AWS_JSON).protocolVersion("1.1"); + .protocol(AwsJsonProtocol.AWS_JSON).protocolVersion("1.1"); } @Override diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-custompackage-async.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-custompackage-async.java index 94898e8950ca..d1740b039d14 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-custompackage-async.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-custompackage-async.java @@ -55,7 +55,7 @@ final class DefaultProtocolRestJsonWithCustomPackageAsyncClient implements Proto private static final Logger log = LoggerFactory.getLogger(DefaultProtocolRestJsonWithCustomPackageAsyncClient.class); private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder() - .serviceProtocol(AwsServiceProtocol.REST_JSON).build(); + .serviceProtocol(AwsServiceProtocol.REST_JSON).build(); private final AsyncClientHandler clientHandler; @@ -93,34 +93,36 @@ protected DefaultProtocolRestJsonWithCustomPackageAsyncClient(SdkClientConfigura public CompletableFuture oneOperation(OneOperationRequest oneOperationRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(oneOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, oneOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AmazonProtocolRestJsonWithCustomPackage"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OneOperation"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, - OneOperationResponse::builder); + OneOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - default: - return Optional.empty(); + default: + return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OneOperation").withProtocolMetadata(protocolMetadata) - .withMarshaller(new OneOperationRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(oneOperationRequest)); + .execute(new ClientExecutionParams() + .withOperationName("OneOperation").withProtocolMetadata(protocolMetadata) + .withMarshaller(new OneOperationRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(oneOperationRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -135,7 +137,7 @@ public CompletableFuture oneOperation(OneOperationRequest @Override public final ProtocolRestJsonWithCustomPackageServiceClientConfiguration serviceClientConfiguration() { return new ProtocolRestJsonWithCustomPackageServiceClientConfigurationBuilder(this.clientConfiguration.toBuilder()) - .build(); + .build(); } @Override @@ -145,12 +147,12 @@ public final String serviceName() { private > T init(T builder) { return builder.clientConfiguration(clientConfiguration) - .defaultServiceExceptionSupplier(ProtocolRestJsonWithCustomPackageException::builder) - .protocol(AwsJsonProtocol.REST_JSON).protocolVersion("1.1"); + .defaultServiceExceptionSupplier(ProtocolRestJsonWithCustomPackageException::builder) + .protocol(AwsJsonProtocol.REST_JSON).protocolVersion("1.1"); } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, - RequestOverrideConfiguration requestOverrideConfiguration) { + RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); @@ -194,7 +196,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, return configuration.build(); } ProtocolRestJsonWithCustomPackageServiceClientConfigurationBuilder serviceConfigBuilder = new ProtocolRestJsonWithCustomPackageServiceClientConfigurationBuilder( - configuration); + configuration); for (SdkPlugin plugin : plugins) { plugin.configureClient(serviceConfigBuilder); } @@ -203,7 +205,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, - JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { + JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); } @@ -211,4 +213,4 @@ private HttpResponseHandler createErrorResponseHandler(Base public void close() { clientHandler.close(); } -} \ No newline at end of file +} diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-custompackage-sync.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-custompackage-sync.java index 455c357cdd30..e6bad19f4837 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-custompackage-sync.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-custompackage-sync.java @@ -51,7 +51,7 @@ final class DefaultProtocolRestJsonWithCustomPackageClient implements ProtocolRe private static final Logger log = Logger.loggerFor(DefaultProtocolRestJsonWithCustomPackageClient.class); private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder() - .serviceProtocol(AwsServiceProtocol.REST_JSON).build(); + .serviceProtocol(AwsServiceProtocol.REST_JSON).build(); private final SyncClientHandler clientHandler; @@ -83,36 +83,38 @@ protected DefaultProtocolRestJsonWithCustomPackageClient(SdkClientConfiguration */ @Override public OneOperationResponse oneOperation(OneOperationRequest oneOperationRequest) throws AwsServiceException, - SdkClientException, ProtocolRestJsonWithCustomPackageException { + SdkClientException, ProtocolRestJsonWithCustomPackageException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, - OneOperationResponse::builder); + OneOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - default: - return Optional.empty(); + default: + return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(oneOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, oneOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AmazonProtocolRestJsonWithCustomPackage"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OneOperation"); return clientHandler.execute(new ClientExecutionParams() - .withOperationName("OneOperation").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(oneOperationRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new OneOperationRequestMarshaller(protocolFactory))); + .withOperationName("OneOperation").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(oneOperationRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new OneOperationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -124,7 +126,7 @@ public final String serviceName() { } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, - RequestOverrideConfiguration requestOverrideConfiguration) { + RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); @@ -139,7 +141,7 @@ private static List resolveMetricPublishers(SdkClientConfigurat } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, - JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { + JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); } @@ -173,7 +175,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, return configuration.build(); } ProtocolRestJsonWithCustomPackageServiceClientConfigurationBuilder serviceConfigBuilder = new ProtocolRestJsonWithCustomPackageServiceClientConfigurationBuilder( - configuration); + configuration); for (SdkPlugin plugin : plugins) { plugin.configureClient(serviceConfigBuilder); } @@ -183,14 +185,14 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, private > T init(T builder) { return builder.clientConfiguration(clientConfiguration) - .defaultServiceExceptionSupplier(ProtocolRestJsonWithCustomPackageException::builder) - .protocol(AwsJsonProtocol.REST_JSON).protocolVersion("1.1"); + .defaultServiceExceptionSupplier(ProtocolRestJsonWithCustomPackageException::builder) + .protocol(AwsJsonProtocol.REST_JSON).protocolVersion("1.1"); } @Override public final ProtocolRestJsonWithCustomPackageServiceClientConfiguration serviceClientConfiguration() { return new ProtocolRestJsonWithCustomPackageServiceClientConfigurationBuilder(this.clientConfiguration.toBuilder()) - .build(); + .build(); } @Override diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-customservicemetadata-async.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-customservicemetadata-async.java index ef90eb6fafc8..1ecac26efb45 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-customservicemetadata-async.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-customservicemetadata-async.java @@ -55,7 +55,7 @@ final class DefaultProtocolRestJsonWithCustomContentTypeAsyncClient implements P private static final Logger log = LoggerFactory.getLogger(DefaultProtocolRestJsonWithCustomContentTypeAsyncClient.class); private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder() - .serviceProtocol(AwsServiceProtocol.REST_JSON).build(); + .serviceProtocol(AwsServiceProtocol.REST_JSON).build(); private final AsyncClientHandler clientHandler; @@ -93,34 +93,36 @@ protected DefaultProtocolRestJsonWithCustomContentTypeAsyncClient(SdkClientConfi public CompletableFuture oneOperation(OneOperationRequest oneOperationRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(oneOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, oneOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AmazonProtocolRestJsonWithCustomContentType"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OneOperation"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, - OneOperationResponse::builder); + OneOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - default: - return Optional.empty(); + default: + return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OneOperation").withProtocolMetadata(protocolMetadata) - .withMarshaller(new OneOperationRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(oneOperationRequest)); + .execute(new ClientExecutionParams() + .withOperationName("OneOperation").withProtocolMetadata(protocolMetadata) + .withMarshaller(new OneOperationRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(oneOperationRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -135,7 +137,7 @@ public CompletableFuture oneOperation(OneOperationRequest @Override public final ProtocolRestJsonWithCustomContentTypeServiceClientConfiguration serviceClientConfiguration() { return new ProtocolRestJsonWithCustomContentTypeServiceClientConfigurationBuilder(this.clientConfiguration.toBuilder()) - .build(); + .build(); } @Override @@ -145,12 +147,12 @@ public final String serviceName() { private > T init(T builder) { return builder.clientConfiguration(clientConfiguration) - .defaultServiceExceptionSupplier(ProtocolRestJsonWithCustomContentTypeException::builder) - .protocol(AwsJsonProtocol.REST_JSON).protocolVersion("1.1").contentType("application/json"); + .defaultServiceExceptionSupplier(ProtocolRestJsonWithCustomContentTypeException::builder) + .protocol(AwsJsonProtocol.REST_JSON).protocolVersion("1.1").contentType("application/json"); } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, - RequestOverrideConfiguration requestOverrideConfiguration) { + RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); @@ -194,7 +196,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, return configuration.build(); } ProtocolRestJsonWithCustomContentTypeServiceClientConfigurationBuilder serviceConfigBuilder = new ProtocolRestJsonWithCustomContentTypeServiceClientConfigurationBuilder( - configuration); + configuration); for (SdkPlugin plugin : plugins) { plugin.configureClient(serviceConfigBuilder); } @@ -203,7 +205,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, - JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { + JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); } @@ -211,4 +213,4 @@ private HttpResponseHandler createErrorResponseHandler(Base public void close() { clientHandler.close(); } -} \ No newline at end of file +} diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-customservicemetadata-sync.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-customservicemetadata-sync.java index 0a1e74cdcc0a..b97e2307b4d0 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-customservicemetadata-sync.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-customservicemetadata-sync.java @@ -51,7 +51,7 @@ final class DefaultProtocolRestJsonWithCustomContentTypeClient implements Protoc private static final Logger log = Logger.loggerFor(DefaultProtocolRestJsonWithCustomContentTypeClient.class); private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder() - .serviceProtocol(AwsServiceProtocol.REST_JSON).build(); + .serviceProtocol(AwsServiceProtocol.REST_JSON).build(); private final SyncClientHandler clientHandler; @@ -83,36 +83,38 @@ protected DefaultProtocolRestJsonWithCustomContentTypeClient(SdkClientConfigurat */ @Override public OneOperationResponse oneOperation(OneOperationRequest oneOperationRequest) throws AwsServiceException, - SdkClientException, ProtocolRestJsonWithCustomContentTypeException { + SdkClientException, ProtocolRestJsonWithCustomContentTypeException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, - OneOperationResponse::builder); + OneOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - default: - return Optional.empty(); + default: + return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(oneOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, oneOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AmazonProtocolRestJsonWithCustomContentType"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OneOperation"); return clientHandler.execute(new ClientExecutionParams() - .withOperationName("OneOperation").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(oneOperationRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new OneOperationRequestMarshaller(protocolFactory))); + .withOperationName("OneOperation").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(oneOperationRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new OneOperationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -124,7 +126,7 @@ public final String serviceName() { } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, - RequestOverrideConfiguration requestOverrideConfiguration) { + RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); @@ -139,7 +141,7 @@ private static List resolveMetricPublishers(SdkClientConfigurat } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, - JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { + JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); } @@ -173,7 +175,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, return configuration.build(); } ProtocolRestJsonWithCustomContentTypeServiceClientConfigurationBuilder serviceConfigBuilder = new ProtocolRestJsonWithCustomContentTypeServiceClientConfigurationBuilder( - configuration); + configuration); for (SdkPlugin plugin : plugins) { plugin.configureClient(serviceConfigBuilder); } @@ -183,14 +185,14 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, private > T init(T builder) { return builder.clientConfiguration(clientConfiguration) - .defaultServiceExceptionSupplier(ProtocolRestJsonWithCustomContentTypeException::builder) - .protocol(AwsJsonProtocol.REST_JSON).protocolVersion("1.1").contentType("application/json"); + .defaultServiceExceptionSupplier(ProtocolRestJsonWithCustomContentTypeException::builder) + .protocol(AwsJsonProtocol.REST_JSON).protocolVersion("1.1").contentType("application/json"); } @Override public final ProtocolRestJsonWithCustomContentTypeServiceClientConfiguration serviceClientConfiguration() { return new ProtocolRestJsonWithCustomContentTypeServiceClientConfigurationBuilder(this.clientConfiguration.toBuilder()) - .build(); + .build(); } @Override diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-endpoint-discovery-async.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-endpoint-discovery-async.java index bac2237163fd..7324f449c25e 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-endpoint-discovery-async.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-endpoint-discovery-async.java @@ -70,7 +70,7 @@ final class DefaultEndpointDiscoveryTestAsyncClient implements EndpointDiscovery private static final Logger log = LoggerFactory.getLogger(DefaultEndpointDiscoveryTestAsyncClient.class); private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder() - .serviceProtocol(AwsServiceProtocol.AWS_JSON).build(); + .serviceProtocol(AwsServiceProtocol.AWS_JSON).build(); private final AsyncClientHandler clientHandler; @@ -86,7 +86,7 @@ protected DefaultEndpointDiscoveryTestAsyncClient(SdkClientConfiguration clientC this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build(); if (clientConfiguration.option(SdkClientOption.ENDPOINT_DISCOVERY_ENABLED)) { this.endpointDiscoveryCache = EndpointDiscoveryRefreshCache - .create(EndpointDiscoveryTestAsyncEndpointDiscoveryCacheLoader.create(this)); + .create(EndpointDiscoveryTestAsyncEndpointDiscoveryCacheLoader.create(this)); } } @@ -111,36 +111,38 @@ protected DefaultEndpointDiscoveryTestAsyncClient(SdkClientConfiguration clientC @Override public CompletableFuture describeEndpoints(DescribeEndpointsRequest describeEndpointsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeEndpointsRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeEndpointsRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AwsEndpointDiscoveryTest"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeEndpoints"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, DescribeEndpointsResponse::builder); + operationMetadata, DescribeEndpointsResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - default: - return Optional.empty(); + default: + return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("DescribeEndpoints").withProtocolMetadata(protocolMetadata) - .withMarshaller(new DescribeEndpointsRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(describeEndpointsRequest)); + .execute(new ClientExecutionParams() + .withOperationName("DescribeEndpoints").withProtocolMetadata(protocolMetadata) + .withMarshaller(new DescribeEndpointsRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(describeEndpointsRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -173,67 +175,69 @@ public CompletableFuture describeEndpoints(DescribeEn */ @Override public CompletableFuture testDiscoveryIdentifiersRequired( - TestDiscoveryIdentifiersRequiredRequest testDiscoveryIdentifiersRequiredRequest) { + TestDiscoveryIdentifiersRequiredRequest testDiscoveryIdentifiersRequiredRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(testDiscoveryIdentifiersRequiredRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - testDiscoveryIdentifiersRequiredRequest.overrideConfiguration().orElse(null)); + testDiscoveryIdentifiersRequiredRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AwsEndpointDiscoveryTest"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "TestDiscoveryIdentifiersRequired"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(operationMetadata, TestDiscoveryIdentifiersRequiredResponse::builder); + .createResponseHandler(operationMetadata, TestDiscoveryIdentifiersRequiredResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - default: - return Optional.empty(); + default: + return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); boolean endpointDiscoveryEnabled = clientConfiguration.option(SdkClientOption.ENDPOINT_DISCOVERY_ENABLED); boolean endpointOverridden = clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER) - .isEndpointOverridden(); + .isEndpointOverridden(); if (endpointOverridden) { throw new IllegalStateException( - "This operation requires endpoint discovery, but an endpoint override was specified when the client was created. This is not supported."); + "This operation requires endpoint discovery, but an endpoint override was specified when the client was created. This is not supported."); } if (!endpointDiscoveryEnabled) { throw new IllegalStateException( - "This operation requires endpoint discovery, but endpoint discovery was disabled on the client."); + "This operation requires endpoint discovery, but endpoint discovery was disabled on the client."); } CompletableFuture endpointFuture = CompletableFuture.completedFuture(null); if (endpointDiscoveryEnabled) { CompletableFuture identityFuture = testDiscoveryIdentifiersRequiredRequest - .overrideConfiguration().flatMap(AwsRequestOverrideConfiguration::credentialsIdentityProvider) - .orElseGet(() -> clientConfiguration.option(AwsClientOption.CREDENTIALS_IDENTITY_PROVIDER)) - .resolveIdentity(); + .overrideConfiguration().flatMap(AwsRequestOverrideConfiguration::credentialsIdentityProvider) + .orElseGet(() -> clientConfiguration.option(AwsClientOption.CREDENTIALS_IDENTITY_PROVIDER)) + .resolveIdentity(); endpointFuture = identityFuture.thenCompose(credentials -> { EndpointDiscoveryRequest endpointDiscoveryRequest = EndpointDiscoveryRequest - .builder() - .required(true) - .defaultEndpoint( - clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER).clientEndpoint()) - .overrideConfiguration(testDiscoveryIdentifiersRequiredRequest.overrideConfiguration().orElse(null)) - .build(); + .builder() + .required(true) + .defaultEndpoint( + clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER).clientEndpoint()) + .overrideConfiguration(testDiscoveryIdentifiersRequiredRequest.overrideConfiguration().orElse(null)) + .build(); return endpointDiscoveryCache.getAsync(credentials.accessKeyId(), endpointDiscoveryRequest); }); } CompletableFuture executeFuture = endpointFuture - .thenCompose(cachedEndpoint -> clientHandler - .execute(new ClientExecutionParams() - .withOperationName("TestDiscoveryIdentifiersRequired").withProtocolMetadata(protocolMetadata) - .withMarshaller(new TestDiscoveryIdentifiersRequiredRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .discoveredEndpoint(cachedEndpoint).withInput(testDiscoveryIdentifiersRequiredRequest))); + .thenCompose(cachedEndpoint -> clientHandler + .execute(new ClientExecutionParams() + .withOperationName("TestDiscoveryIdentifiersRequired").withProtocolMetadata(protocolMetadata) + .withMarshaller(new TestDiscoveryIdentifiersRequiredRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .discoveredEndpoint(cachedEndpoint).withInput(testDiscoveryIdentifiersRequiredRequest))); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -265,58 +269,60 @@ public CompletableFuture testDiscovery */ @Override public CompletableFuture testDiscoveryOptional( - TestDiscoveryOptionalRequest testDiscoveryOptionalRequest) { + TestDiscoveryOptionalRequest testDiscoveryOptionalRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(testDiscoveryOptionalRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, testDiscoveryOptionalRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AwsEndpointDiscoveryTest"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "TestDiscoveryOptional"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, TestDiscoveryOptionalResponse::builder); + operationMetadata, TestDiscoveryOptionalResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - default: - return Optional.empty(); + default: + return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); boolean endpointDiscoveryEnabled = clientConfiguration.option(SdkClientOption.ENDPOINT_DISCOVERY_ENABLED); boolean endpointOverridden = clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER) - .isEndpointOverridden(); + .isEndpointOverridden(); CompletableFuture endpointFuture = CompletableFuture.completedFuture(null); if (endpointDiscoveryEnabled) { CompletableFuture identityFuture = testDiscoveryOptionalRequest - .overrideConfiguration().flatMap(AwsRequestOverrideConfiguration::credentialsIdentityProvider) - .orElseGet(() -> clientConfiguration.option(AwsClientOption.CREDENTIALS_IDENTITY_PROVIDER)) - .resolveIdentity(); + .overrideConfiguration().flatMap(AwsRequestOverrideConfiguration::credentialsIdentityProvider) + .orElseGet(() -> clientConfiguration.option(AwsClientOption.CREDENTIALS_IDENTITY_PROVIDER)) + .resolveIdentity(); endpointFuture = identityFuture.thenCompose(credentials -> { EndpointDiscoveryRequest endpointDiscoveryRequest = EndpointDiscoveryRequest - .builder() - .required(false) - .defaultEndpoint( - clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER).clientEndpoint()) - .overrideConfiguration(testDiscoveryOptionalRequest.overrideConfiguration().orElse(null)).build(); + .builder() + .required(false) + .defaultEndpoint( + clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER).clientEndpoint()) + .overrideConfiguration(testDiscoveryOptionalRequest.overrideConfiguration().orElse(null)).build(); return endpointDiscoveryCache.getAsync(credentials.accessKeyId(), endpointDiscoveryRequest); }); } CompletableFuture executeFuture = endpointFuture - .thenCompose(cachedEndpoint -> clientHandler - .execute(new ClientExecutionParams() - .withOperationName("TestDiscoveryOptional").withProtocolMetadata(protocolMetadata) - .withMarshaller(new TestDiscoveryOptionalRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .discoveredEndpoint(cachedEndpoint).withInput(testDiscoveryOptionalRequest))); + .thenCompose(cachedEndpoint -> clientHandler + .execute(new ClientExecutionParams() + .withOperationName("TestDiscoveryOptional").withProtocolMetadata(protocolMetadata) + .withMarshaller(new TestDiscoveryOptionalRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .discoveredEndpoint(cachedEndpoint).withInput(testDiscoveryOptionalRequest))); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -348,66 +354,68 @@ public CompletableFuture testDiscoveryOptional( */ @Override public CompletableFuture testDiscoveryRequired( - TestDiscoveryRequiredRequest testDiscoveryRequiredRequest) { + TestDiscoveryRequiredRequest testDiscoveryRequiredRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(testDiscoveryRequiredRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, testDiscoveryRequiredRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AwsEndpointDiscoveryTest"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "TestDiscoveryRequired"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, TestDiscoveryRequiredResponse::builder); + operationMetadata, TestDiscoveryRequiredResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - default: - return Optional.empty(); + default: + return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); boolean endpointDiscoveryEnabled = clientConfiguration.option(SdkClientOption.ENDPOINT_DISCOVERY_ENABLED); boolean endpointOverridden = clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER) - .isEndpointOverridden(); + .isEndpointOverridden(); if (endpointOverridden) { throw new IllegalStateException( - "This operation requires endpoint discovery, but an endpoint override was specified when the client was created. This is not supported."); + "This operation requires endpoint discovery, but an endpoint override was specified when the client was created. This is not supported."); } if (!endpointDiscoveryEnabled) { throw new IllegalStateException( - "This operation requires endpoint discovery, but endpoint discovery was disabled on the client."); + "This operation requires endpoint discovery, but endpoint discovery was disabled on the client."); } CompletableFuture endpointFuture = CompletableFuture.completedFuture(null); if (endpointDiscoveryEnabled) { CompletableFuture identityFuture = testDiscoveryRequiredRequest - .overrideConfiguration().flatMap(AwsRequestOverrideConfiguration::credentialsIdentityProvider) - .orElseGet(() -> clientConfiguration.option(AwsClientOption.CREDENTIALS_IDENTITY_PROVIDER)) - .resolveIdentity(); + .overrideConfiguration().flatMap(AwsRequestOverrideConfiguration::credentialsIdentityProvider) + .orElseGet(() -> clientConfiguration.option(AwsClientOption.CREDENTIALS_IDENTITY_PROVIDER)) + .resolveIdentity(); endpointFuture = identityFuture.thenCompose(credentials -> { EndpointDiscoveryRequest endpointDiscoveryRequest = EndpointDiscoveryRequest - .builder() - .required(true) - .defaultEndpoint( - clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER).clientEndpoint()) - .overrideConfiguration(testDiscoveryRequiredRequest.overrideConfiguration().orElse(null)).build(); + .builder() + .required(true) + .defaultEndpoint( + clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER).clientEndpoint()) + .overrideConfiguration(testDiscoveryRequiredRequest.overrideConfiguration().orElse(null)).build(); return endpointDiscoveryCache.getAsync(credentials.accessKeyId(), endpointDiscoveryRequest); }); } CompletableFuture executeFuture = endpointFuture - .thenCompose(cachedEndpoint -> clientHandler - .execute(new ClientExecutionParams() - .withOperationName("TestDiscoveryRequired").withProtocolMetadata(protocolMetadata) - .withMarshaller(new TestDiscoveryRequiredRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .discoveredEndpoint(cachedEndpoint).withInput(testDiscoveryRequiredRequest))); + .thenCompose(cachedEndpoint -> clientHandler + .execute(new ClientExecutionParams() + .withOperationName("TestDiscoveryRequired").withProtocolMetadata(protocolMetadata) + .withMarshaller(new TestDiscoveryRequiredRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .discoveredEndpoint(cachedEndpoint).withInput(testDiscoveryRequiredRequest))); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -431,12 +439,12 @@ public final String serviceName() { private > T init(T builder) { return builder.clientConfiguration(clientConfiguration) - .defaultServiceExceptionSupplier(EndpointDiscoveryTestException::builder).protocol(AwsJsonProtocol.AWS_JSON) - .protocolVersion("1.1"); + .defaultServiceExceptionSupplier(EndpointDiscoveryTestException::builder).protocol(AwsJsonProtocol.AWS_JSON) + .protocolVersion("1.1"); } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, - RequestOverrideConfiguration requestOverrideConfiguration) { + RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); @@ -480,7 +488,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, return configuration.build(); } EndpointDiscoveryTestServiceClientConfigurationBuilder serviceConfigBuilder = new EndpointDiscoveryTestServiceClientConfigurationBuilder( - configuration); + configuration); for (SdkPlugin plugin : plugins) { plugin.configureClient(serviceConfigBuilder); } @@ -489,7 +497,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, - JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { + JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); } @@ -497,4 +505,4 @@ private HttpResponseHandler createErrorResponseHandler(Base public void close() { clientHandler.close(); } -} \ No newline at end of file +} diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-endpoint-discovery-sync.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-endpoint-discovery-sync.java index d33e11aeb6d4..a473c2090cdb 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-endpoint-discovery-sync.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-endpoint-discovery-sync.java @@ -68,7 +68,7 @@ final class DefaultEndpointDiscoveryTestClient implements EndpointDiscoveryTestC private static final Logger log = Logger.loggerFor(DefaultEndpointDiscoveryTestClient.class); private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder() - .serviceProtocol(AwsServiceProtocol.AWS_JSON).build(); + .serviceProtocol(AwsServiceProtocol.AWS_JSON).build(); private final SyncClientHandler clientHandler; @@ -84,7 +84,7 @@ protected DefaultEndpointDiscoveryTestClient(SdkClientConfiguration clientConfig this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build(); if (clientConfiguration.option(SdkClientOption.ENDPOINT_DISCOVERY_ENABLED)) { this.endpointDiscoveryCache = EndpointDiscoveryRefreshCache.create(EndpointDiscoveryTestEndpointDiscoveryCacheLoader - .create(this)); + .create(this)); } } @@ -104,37 +104,39 @@ protected DefaultEndpointDiscoveryTestClient(SdkClientConfiguration clientConfig */ @Override public DescribeEndpointsResponse describeEndpoints(DescribeEndpointsRequest describeEndpointsRequest) - throws AwsServiceException, SdkClientException, EndpointDiscoveryTestException { + throws AwsServiceException, SdkClientException, EndpointDiscoveryTestException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, - DescribeEndpointsResponse::builder); + DescribeEndpointsResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - default: - return Optional.empty(); + default: + return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeEndpointsRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeEndpointsRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AwsEndpointDiscoveryTest"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeEndpoints"); return clientHandler.execute(new ClientExecutionParams() - .withOperationName("DescribeEndpoints").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(describeEndpointsRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new DescribeEndpointsRequestMarshaller(protocolFactory))); + .withOperationName("DescribeEndpoints").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(describeEndpointsRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new DescribeEndpointsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -156,60 +158,62 @@ public DescribeEndpointsResponse describeEndpoints(DescribeEndpointsRequest desc */ @Override public TestDiscoveryIdentifiersRequiredResponse testDiscoveryIdentifiersRequired( - TestDiscoveryIdentifiersRequiredRequest testDiscoveryIdentifiersRequiredRequest) throws AwsServiceException, - SdkClientException, EndpointDiscoveryTestException { + TestDiscoveryIdentifiersRequiredRequest testDiscoveryIdentifiersRequiredRequest) throws AwsServiceException, + SdkClientException, EndpointDiscoveryTestException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, TestDiscoveryIdentifiersRequiredResponse::builder); + operationMetadata, TestDiscoveryIdentifiersRequiredResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - default: - return Optional.empty(); + default: + return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); boolean endpointDiscoveryEnabled = clientConfiguration.option(SdkClientOption.ENDPOINT_DISCOVERY_ENABLED); boolean endpointOverridden = clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER).isEndpointOverridden(); if (endpointOverridden) { throw new IllegalStateException( - "This operation requires endpoint discovery, but an endpoint override was specified when the client was created. This is not supported."); + "This operation requires endpoint discovery, but an endpoint override was specified when the client was created. This is not supported."); } if (!endpointDiscoveryEnabled) { throw new IllegalStateException( - "This operation requires endpoint discovery, but endpoint discovery was disabled on the client."); + "This operation requires endpoint discovery, but endpoint discovery was disabled on the client."); } URI cachedEndpoint = null; if (endpointDiscoveryEnabled) { CompletableFuture identityFuture = testDiscoveryIdentifiersRequiredRequest - .overrideConfiguration().flatMap(AwsRequestOverrideConfiguration::credentialsIdentityProvider) - .orElseGet(() -> clientConfiguration.option(AwsClientOption.CREDENTIALS_IDENTITY_PROVIDER)).resolveIdentity(); + .overrideConfiguration().flatMap(AwsRequestOverrideConfiguration::credentialsIdentityProvider) + .orElseGet(() -> clientConfiguration.option(AwsClientOption.CREDENTIALS_IDENTITY_PROVIDER)).resolveIdentity(); String key = CompletableFutureUtils.joinLikeSync(identityFuture).accessKeyId(); EndpointDiscoveryRequest endpointDiscoveryRequest = EndpointDiscoveryRequest.builder().required(true) - .defaultEndpoint(clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER).clientEndpoint()) - .overrideConfiguration(testDiscoveryIdentifiersRequiredRequest.overrideConfiguration().orElse(null)).build(); + .defaultEndpoint(clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER).clientEndpoint()) + .overrideConfiguration(testDiscoveryIdentifiersRequiredRequest.overrideConfiguration().orElse(null)).build(); cachedEndpoint = endpointDiscoveryCache.get(key, endpointDiscoveryRequest); } SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(testDiscoveryIdentifiersRequiredRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - testDiscoveryIdentifiersRequiredRequest.overrideConfiguration().orElse(null)); + testDiscoveryIdentifiersRequiredRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AwsEndpointDiscoveryTest"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "TestDiscoveryIdentifiersRequired"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("TestDiscoveryIdentifiersRequired").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .discoveredEndpoint(cachedEndpoint).withRequestConfiguration(clientConfiguration) - .withInput(testDiscoveryIdentifiersRequiredRequest).withMetricCollector(apiCallMetricCollector) - .withMarshaller(new TestDiscoveryIdentifiersRequiredRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("TestDiscoveryIdentifiersRequired").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .discoveredEndpoint(cachedEndpoint).withRequestConfiguration(clientConfiguration) + .withInput(testDiscoveryIdentifiersRequiredRequest).withMetricCollector(apiCallMetricCollector) + .withMarshaller(new TestDiscoveryIdentifiersRequiredRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -231,50 +235,52 @@ public TestDiscoveryIdentifiersRequiredResponse testDiscoveryIdentifiersRequired */ @Override public TestDiscoveryOptionalResponse testDiscoveryOptional(TestDiscoveryOptionalRequest testDiscoveryOptionalRequest) - throws AwsServiceException, SdkClientException, EndpointDiscoveryTestException { + throws AwsServiceException, SdkClientException, EndpointDiscoveryTestException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, TestDiscoveryOptionalResponse::builder); + operationMetadata, TestDiscoveryOptionalResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - default: - return Optional.empty(); + default: + return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); boolean endpointDiscoveryEnabled = clientConfiguration.option(SdkClientOption.ENDPOINT_DISCOVERY_ENABLED); boolean endpointOverridden = clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER).isEndpointOverridden(); URI cachedEndpoint = null; if (endpointDiscoveryEnabled) { CompletableFuture identityFuture = testDiscoveryOptionalRequest - .overrideConfiguration().flatMap(AwsRequestOverrideConfiguration::credentialsIdentityProvider) - .orElseGet(() -> clientConfiguration.option(AwsClientOption.CREDENTIALS_IDENTITY_PROVIDER)).resolveIdentity(); + .overrideConfiguration().flatMap(AwsRequestOverrideConfiguration::credentialsIdentityProvider) + .orElseGet(() -> clientConfiguration.option(AwsClientOption.CREDENTIALS_IDENTITY_PROVIDER)).resolveIdentity(); String key = CompletableFutureUtils.joinLikeSync(identityFuture).accessKeyId(); EndpointDiscoveryRequest endpointDiscoveryRequest = EndpointDiscoveryRequest.builder().required(false) - .defaultEndpoint(clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER).clientEndpoint()) - .overrideConfiguration(testDiscoveryOptionalRequest.overrideConfiguration().orElse(null)).build(); + .defaultEndpoint(clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER).clientEndpoint()) + .overrideConfiguration(testDiscoveryOptionalRequest.overrideConfiguration().orElse(null)).build(); cachedEndpoint = endpointDiscoveryCache.get(key, endpointDiscoveryRequest); } SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(testDiscoveryOptionalRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, testDiscoveryOptionalRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AwsEndpointDiscoveryTest"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "TestDiscoveryOptional"); return clientHandler.execute(new ClientExecutionParams() - .withOperationName("TestDiscoveryOptional").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .discoveredEndpoint(cachedEndpoint).withRequestConfiguration(clientConfiguration) - .withInput(testDiscoveryOptionalRequest).withMetricCollector(apiCallMetricCollector) - .withMarshaller(new TestDiscoveryOptionalRequestMarshaller(protocolFactory))); + .withOperationName("TestDiscoveryOptional").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .discoveredEndpoint(cachedEndpoint).withRequestConfiguration(clientConfiguration) + .withInput(testDiscoveryOptionalRequest).withMetricCollector(apiCallMetricCollector) + .withMarshaller(new TestDiscoveryOptionalRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -296,58 +302,60 @@ public TestDiscoveryOptionalResponse testDiscoveryOptional(TestDiscoveryOptional */ @Override public TestDiscoveryRequiredResponse testDiscoveryRequired(TestDiscoveryRequiredRequest testDiscoveryRequiredRequest) - throws AwsServiceException, SdkClientException, EndpointDiscoveryTestException { + throws AwsServiceException, SdkClientException, EndpointDiscoveryTestException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, TestDiscoveryRequiredResponse::builder); + operationMetadata, TestDiscoveryRequiredResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - default: - return Optional.empty(); + default: + return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); boolean endpointDiscoveryEnabled = clientConfiguration.option(SdkClientOption.ENDPOINT_DISCOVERY_ENABLED); boolean endpointOverridden = clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER).isEndpointOverridden(); if (endpointOverridden) { throw new IllegalStateException( - "This operation requires endpoint discovery, but an endpoint override was specified when the client was created. This is not supported."); + "This operation requires endpoint discovery, but an endpoint override was specified when the client was created. This is not supported."); } if (!endpointDiscoveryEnabled) { throw new IllegalStateException( - "This operation requires endpoint discovery, but endpoint discovery was disabled on the client."); + "This operation requires endpoint discovery, but endpoint discovery was disabled on the client."); } URI cachedEndpoint = null; if (endpointDiscoveryEnabled) { CompletableFuture identityFuture = testDiscoveryRequiredRequest - .overrideConfiguration().flatMap(AwsRequestOverrideConfiguration::credentialsIdentityProvider) - .orElseGet(() -> clientConfiguration.option(AwsClientOption.CREDENTIALS_IDENTITY_PROVIDER)).resolveIdentity(); + .overrideConfiguration().flatMap(AwsRequestOverrideConfiguration::credentialsIdentityProvider) + .orElseGet(() -> clientConfiguration.option(AwsClientOption.CREDENTIALS_IDENTITY_PROVIDER)).resolveIdentity(); String key = CompletableFutureUtils.joinLikeSync(identityFuture).accessKeyId(); EndpointDiscoveryRequest endpointDiscoveryRequest = EndpointDiscoveryRequest.builder().required(true) - .defaultEndpoint(clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER).clientEndpoint()) - .overrideConfiguration(testDiscoveryRequiredRequest.overrideConfiguration().orElse(null)).build(); + .defaultEndpoint(clientConfiguration.option(SdkClientOption.CLIENT_ENDPOINT_PROVIDER).clientEndpoint()) + .overrideConfiguration(testDiscoveryRequiredRequest.overrideConfiguration().orElse(null)).build(); cachedEndpoint = endpointDiscoveryCache.get(key, endpointDiscoveryRequest); } SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(testDiscoveryRequiredRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, testDiscoveryRequiredRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AwsEndpointDiscoveryTest"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "TestDiscoveryRequired"); return clientHandler.execute(new ClientExecutionParams() - .withOperationName("TestDiscoveryRequired").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .discoveredEndpoint(cachedEndpoint).withRequestConfiguration(clientConfiguration) - .withInput(testDiscoveryRequiredRequest).withMetricCollector(apiCallMetricCollector) - .withMarshaller(new TestDiscoveryRequiredRequestMarshaller(protocolFactory))); + .withOperationName("TestDiscoveryRequired").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .discoveredEndpoint(cachedEndpoint).withRequestConfiguration(clientConfiguration) + .withInput(testDiscoveryRequiredRequest).withMetricCollector(apiCallMetricCollector) + .withMarshaller(new TestDiscoveryRequiredRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -359,7 +367,7 @@ public final String serviceName() { } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, - RequestOverrideConfiguration requestOverrideConfiguration) { + RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); @@ -374,7 +382,7 @@ private static List resolveMetricPublishers(SdkClientConfigurat } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, - JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { + JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); } @@ -408,7 +416,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, return configuration.build(); } EndpointDiscoveryTestServiceClientConfigurationBuilder serviceConfigBuilder = new EndpointDiscoveryTestServiceClientConfigurationBuilder( - configuration); + configuration); for (SdkPlugin plugin : plugins) { plugin.configureClient(serviceConfigBuilder); } @@ -418,8 +426,8 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, private > T init(T builder) { return builder.clientConfiguration(clientConfiguration) - .defaultServiceExceptionSupplier(EndpointDiscoveryTestException::builder).protocol(AwsJsonProtocol.AWS_JSON) - .protocolVersion("1.1"); + .defaultServiceExceptionSupplier(EndpointDiscoveryTestException::builder).protocol(AwsJsonProtocol.AWS_JSON) + .protocolVersion("1.1"); } @Override diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-async-client-class.java index 8be171de0ca7..68816b5809c0 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-async-client-class.java @@ -146,7 +146,7 @@ final class DefaultJsonAsyncClient implements JsonAsyncClient { private static final Logger log = LoggerFactory.getLogger(DefaultJsonAsyncClient.class); private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder() - .serviceProtocol(AwsServiceProtocol.REST_JSON).build(); + .serviceProtocol(AwsServiceProtocol.REST_JSON).build(); private final AsyncClientHandler clientHandler; @@ -199,40 +199,43 @@ public JsonUtilities utilities() { public CompletableFuture aPostOperation(APostOperationRequest aPostOperationRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "APostOperation"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, APostOperationResponse::builder); + operationMetadata, APostOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); String hostPrefix = "{StringMember}-foo."; HostnameValidator.validateHostnameCompliant(aPostOperationRequest.stringMember(), "StringMember", - "aPostOperationRequest"); + "aPostOperationRequest"); String resolvedHostExpression = String.format("%s-foo.", aPostOperationRequest.stringMember()); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("APostOperation").withProtocolMetadata(protocolMetadata) - .withMarshaller(new APostOperationRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .hostPrefixExpression(resolvedHostExpression).withInput(aPostOperationRequest)); + .execute(new ClientExecutionParams() + .withOperationName("APostOperation").withProtocolMetadata(protocolMetadata) + .withMarshaller(new APostOperationRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .hostPrefixExpression(resolvedHostExpression).withInput(aPostOperationRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -270,40 +273,43 @@ public CompletableFuture aPostOperation(APostOperationRe */ @Override public CompletableFuture aPostOperationWithOutput( - APostOperationWithOutputRequest aPostOperationWithOutputRequest) { + APostOperationWithOutputRequest aPostOperationWithOutputRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationWithOutputRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationWithOutputRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "APostOperationWithOutput"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, APostOperationWithOutputResponse::builder); + operationMetadata, APostOperationWithOutputResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("APostOperationWithOutput").withProtocolMetadata(protocolMetadata) - .withMarshaller(new APostOperationWithOutputRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(aPostOperationWithOutputRequest)); + .execute(new ClientExecutionParams() + .withOperationName("APostOperationWithOutput").withProtocolMetadata(protocolMetadata) + .withMarshaller(new APostOperationWithOutputRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(aPostOperationWithOutputRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -337,41 +343,44 @@ public CompletableFuture aPostOperationWithOut */ @Override public CompletableFuture bearerAuthOperation( - BearerAuthOperationRequest bearerAuthOperationRequest) { + BearerAuthOperationRequest bearerAuthOperationRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(bearerAuthOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, bearerAuthOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "BearerAuthOperation"); bearerAuthOperationRequest = applySignerOverride(bearerAuthOperationRequest, BearerTokenSigner.create()); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, BearerAuthOperationResponse::builder); + operationMetadata, BearerAuthOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("BearerAuthOperation").withProtocolMetadata(protocolMetadata) - .withMarshaller(new BearerAuthOperationRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .credentialType(CredentialType.TOKEN).withInput(bearerAuthOperationRequest)); + .execute(new ClientExecutionParams() + .withOperationName("BearerAuthOperation").withProtocolMetadata(protocolMetadata) + .withMarshaller(new BearerAuthOperationRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .credentialType(CredentialType.TOKEN).withInput(bearerAuthOperationRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -405,85 +414,88 @@ public CompletableFuture bearerAuthOperation( */ @Override public CompletableFuture eventStreamOperation(EventStreamOperationRequest eventStreamOperationRequest, - Publisher requestStream, EventStreamOperationResponseHandler asyncResponseHandler) { + Publisher requestStream, EventStreamOperationResponseHandler asyncResponseHandler) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(eventStreamOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, eventStreamOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "EventStreamOperation"); eventStreamOperationRequest = applySignerOverride(eventStreamOperationRequest, EventStreamAws4Signer.create()); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = new AttachHttpMetadataResponseHandler( - protocolFactory.createResponseHandler(operationMetadata, EventStreamOperationResponse::builder)); + protocolFactory.createResponseHandler(operationMetadata, EventStreamOperationResponse::builder)); HttpResponseHandler voidResponseHandler = protocolFactory.createResponseHandler(JsonOperationMetadata - .builder().isPayloadJson(false).hasStreamingSuccessResponse(true).build(), VoidSdkResponse::builder); + .builder().isPayloadJson(false).hasStreamingSuccessResponse(true).build(), VoidSdkResponse::builder); HttpResponseHandler eventResponseHandler = protocolFactory.createResponseHandler( - JsonOperationMetadata.builder().isPayloadJson(true).hasStreamingSuccessResponse(false).build(), - EventStreamTaggedUnionPojoSupplier.builder().putSdkPojoSupplier("EventOne", EventStream::eventOneBuilder) - .putSdkPojoSupplier("EventTheSecond", EventStream::eventTheSecondBuilder) - .putSdkPojoSupplier("secondEventOne", EventStream::secondEventOneBuilder) - .putSdkPojoSupplier("eventThree", EventStream::eventThreeBuilder) - .defaultSdkPojoSupplier(() -> new SdkPojoBuilder(EventStream.UNKNOWN)).build()); + JsonOperationMetadata.builder().isPayloadJson(true).hasStreamingSuccessResponse(false).build(), + EventStreamTaggedUnionPojoSupplier.builder().putSdkPojoSupplier("EventOne", EventStream::eventOneBuilder) + .putSdkPojoSupplier("EventTheSecond", EventStream::eventTheSecondBuilder) + .putSdkPojoSupplier("secondEventOne", EventStream::secondEventOneBuilder) + .putSdkPojoSupplier("eventThree", EventStream::eventThreeBuilder) + .defaultSdkPojoSupplier(() -> new SdkPojoBuilder(EventStream.UNKNOWN)).build()); Function> eventstreamExceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "errorOne": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "errorTwo": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "errorOne": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "errorTwo": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorEventResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, eventstreamExceptionMetadataMapper); + operationMetadata, eventstreamExceptionMetadataMapper); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); EventStreamTaggedUnionJsonMarshaller eventMarshaller = EventStreamTaggedUnionJsonMarshaller.builder() - .putMarshaller(DefaultInputEvent.class, new InputEventMarshaller(protocolFactory)).build(); + .putMarshaller(DefaultInputEvent.class, new InputEventMarshaller(protocolFactory)).build(); SdkPublisher eventPublisher = SdkPublisher.adapt(requestStream); Publisher adapted = eventPublisher.map(event -> eventMarshaller.marshall(event)).map( - AwsClientHandlerUtils::encodeEventStreamRequestToByteBuffer); + AwsClientHandlerUtils::encodeEventStreamRequestToByteBuffer); CompletableFuture future = new CompletableFuture<>(); EventStreamAsyncResponseTransformer asyncResponseTransformer = EventStreamAsyncResponseTransformer - . builder().eventStreamResponseHandler(asyncResponseHandler) - .eventResponseHandler(eventResponseHandler).initialResponseHandler(responseHandler) - .exceptionResponseHandler(errorEventResponseHandler).future(future).executor(executor) - .serviceName(serviceName()).build(); + . builder().eventStreamResponseHandler(asyncResponseHandler) + .eventResponseHandler(eventResponseHandler).initialResponseHandler(responseHandler) + .exceptionResponseHandler(errorEventResponseHandler).future(future).executor(executor) + .serviceName(serviceName()).build(); RestEventStreamAsyncResponseTransformer restAsyncResponseTransformer = RestEventStreamAsyncResponseTransformer - . builder() - .eventStreamAsyncResponseTransformer(asyncResponseTransformer) - .eventStreamResponseHandler(asyncResponseHandler).build(); + . builder() + .eventStreamAsyncResponseTransformer(asyncResponseTransformer) + .eventStreamResponseHandler(asyncResponseHandler).build(); CompletableFuture executeFuture = clientHandler.execute( - new ClientExecutionParams() - .withOperationName("EventStreamOperation").withProtocolMetadata(protocolMetadata) - .withMarshaller(new EventStreamOperationRequestMarshaller(protocolFactory)) - .withAsyncRequestBody(AsyncRequestBody.fromPublisher(adapted)).withFullDuplex(true) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(eventStreamOperationRequest), restAsyncResponseTransformer); + new ClientExecutionParams() + .withOperationName("EventStreamOperation").withProtocolMetadata(protocolMetadata) + .withMarshaller(new EventStreamOperationRequestMarshaller(protocolFactory)) + .withAsyncRequestBody(AsyncRequestBody.fromPublisher(adapted)).withFullDuplex(true) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(eventStreamOperationRequest), restAsyncResponseTransformer); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { if (e != null) { try { @@ -498,7 +510,7 @@ public CompletableFuture eventStreamOperation(EventStreamOperationRequest return CompletableFutureUtils.forwardExceptionTo(future, executeFuture); } catch (Throwable t) { runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> asyncResponseHandler.exceptionOccurred(t)); + () -> asyncResponseHandler.exceptionOccurred(t)); metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } @@ -527,49 +539,52 @@ public CompletableFuture eventStreamOperation(EventStreamOperationRequest */ @Override public CompletableFuture eventStreamOperationWithOnlyInput( - EventStreamOperationWithOnlyInputRequest eventStreamOperationWithOnlyInputRequest, - Publisher requestStream) { + EventStreamOperationWithOnlyInputRequest eventStreamOperationWithOnlyInputRequest, + Publisher requestStream) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(eventStreamOperationWithOnlyInputRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - eventStreamOperationWithOnlyInputRequest.overrideConfiguration().orElse(null)); + eventStreamOperationWithOnlyInputRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "EventStreamOperationWithOnlyInput"); eventStreamOperationWithOnlyInputRequest = applySignerOverride(eventStreamOperationWithOnlyInputRequest, - EventStreamAws4Signer.create()); + EventStreamAws4Signer.create()); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(operationMetadata, EventStreamOperationWithOnlyInputResponse::builder); + .createResponseHandler(operationMetadata, EventStreamOperationWithOnlyInputResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); EventStreamTaggedUnionJsonMarshaller eventMarshaller = EventStreamTaggedUnionJsonMarshaller.builder() - .putMarshaller(DefaultInputEventOne.class, new InputEventMarshaller(protocolFactory)) - .putMarshaller(DefaultInputEventTwo.class, new InputEventTwoMarshaller(protocolFactory)).build(); + .putMarshaller(DefaultInputEventOne.class, new InputEventMarshaller(protocolFactory)) + .putMarshaller(DefaultInputEventTwo.class, new InputEventTwoMarshaller(protocolFactory)).build(); SdkPublisher eventPublisher = SdkPublisher.adapt(requestStream); Publisher adapted = eventPublisher.map(event -> eventMarshaller.marshall(event)).map( - AwsClientHandlerUtils::encodeEventStreamRequestToByteBuffer); + AwsClientHandlerUtils::encodeEventStreamRequestToByteBuffer); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("EventStreamOperationWithOnlyInput").withProtocolMetadata(protocolMetadata) - .withMarshaller(new EventStreamOperationWithOnlyInputRequestMarshaller(protocolFactory)) - .withAsyncRequestBody(AsyncRequestBody.fromPublisher(adapted)).withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) - .withMetricCollector(apiCallMetricCollector).withInput(eventStreamOperationWithOnlyInputRequest)); + .execute(new ClientExecutionParams() + .withOperationName("EventStreamOperationWithOnlyInput").withProtocolMetadata(protocolMetadata) + .withMarshaller(new EventStreamOperationWithOnlyInputRequestMarshaller(protocolFactory)) + .withAsyncRequestBody(AsyncRequestBody.fromPublisher(adapted)).withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) + .withMetricCollector(apiCallMetricCollector).withInput(eventStreamOperationWithOnlyInputRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -604,81 +619,84 @@ public CompletableFuture eventStreamO */ @Override public CompletableFuture eventStreamOperationWithOnlyOutput( - EventStreamOperationWithOnlyOutputRequest eventStreamOperationWithOnlyOutputRequest, - EventStreamOperationWithOnlyOutputResponseHandler asyncResponseHandler) { + EventStreamOperationWithOnlyOutputRequest eventStreamOperationWithOnlyOutputRequest, + EventStreamOperationWithOnlyOutputResponseHandler asyncResponseHandler) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(eventStreamOperationWithOnlyOutputRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - eventStreamOperationWithOnlyOutputRequest.overrideConfiguration().orElse(null)); + eventStreamOperationWithOnlyOutputRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "EventStreamOperationWithOnlyOutput"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = new AttachHttpMetadataResponseHandler( - protocolFactory.createResponseHandler(operationMetadata, EventStreamOperationWithOnlyOutputResponse::builder)); + protocolFactory.createResponseHandler(operationMetadata, EventStreamOperationWithOnlyOutputResponse::builder)); HttpResponseHandler voidResponseHandler = protocolFactory.createResponseHandler(JsonOperationMetadata - .builder().isPayloadJson(false).hasStreamingSuccessResponse(true).build(), VoidSdkResponse::builder); + .builder().isPayloadJson(false).hasStreamingSuccessResponse(true).build(), VoidSdkResponse::builder); HttpResponseHandler eventResponseHandler = protocolFactory.createResponseHandler( - JsonOperationMetadata.builder().isPayloadJson(true).hasStreamingSuccessResponse(false).build(), - EventStreamTaggedUnionPojoSupplier.builder().putSdkPojoSupplier("EventOne", EventStream::eventOneBuilder) - .putSdkPojoSupplier("EventTheSecond", EventStream::eventTheSecondBuilder) - .putSdkPojoSupplier("secondEventOne", EventStream::secondEventOneBuilder) - .putSdkPojoSupplier("eventThree", EventStream::eventThreeBuilder) - .defaultSdkPojoSupplier(() -> new SdkPojoBuilder(EventStream.UNKNOWN)).build()); + JsonOperationMetadata.builder().isPayloadJson(true).hasStreamingSuccessResponse(false).build(), + EventStreamTaggedUnionPojoSupplier.builder().putSdkPojoSupplier("EventOne", EventStream::eventOneBuilder) + .putSdkPojoSupplier("EventTheSecond", EventStream::eventTheSecondBuilder) + .putSdkPojoSupplier("secondEventOne", EventStream::secondEventOneBuilder) + .putSdkPojoSupplier("eventThree", EventStream::eventThreeBuilder) + .defaultSdkPojoSupplier(() -> new SdkPojoBuilder(EventStream.UNKNOWN)).build()); Function> eventstreamExceptionMetadataMapper = errorCode -> { switch (errorCode) { - case "errorOne": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - case "errorTwo": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "errorOne": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + case "errorTwo": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorEventResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, eventstreamExceptionMetadataMapper); + operationMetadata, eventstreamExceptionMetadataMapper); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture future = new CompletableFuture<>(); EventStreamAsyncResponseTransformer asyncResponseTransformer = EventStreamAsyncResponseTransformer - . builder() - .eventStreamResponseHandler(asyncResponseHandler).eventResponseHandler(eventResponseHandler) - .initialResponseHandler(responseHandler).exceptionResponseHandler(errorEventResponseHandler).future(future) - .executor(executor).serviceName(serviceName()).build(); + . builder() + .eventStreamResponseHandler(asyncResponseHandler).eventResponseHandler(eventResponseHandler) + .initialResponseHandler(responseHandler).exceptionResponseHandler(errorEventResponseHandler).future(future) + .executor(executor).serviceName(serviceName()).build(); RestEventStreamAsyncResponseTransformer restAsyncResponseTransformer = RestEventStreamAsyncResponseTransformer - . builder() - .eventStreamAsyncResponseTransformer(asyncResponseTransformer) - .eventStreamResponseHandler(asyncResponseHandler).build(); + . builder() + .eventStreamAsyncResponseTransformer(asyncResponseTransformer) + .eventStreamResponseHandler(asyncResponseHandler).build(); CompletableFuture executeFuture = clientHandler - .execute( - new ClientExecutionParams() - .withOperationName("EventStreamOperationWithOnlyOutput") - .withProtocolMetadata(protocolMetadata) - .withMarshaller(new EventStreamOperationWithOnlyOutputRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(eventStreamOperationWithOnlyOutputRequest), restAsyncResponseTransformer); + .execute( + new ClientExecutionParams() + .withOperationName("EventStreamOperationWithOnlyOutput") + .withProtocolMetadata(protocolMetadata) + .withMarshaller(new EventStreamOperationWithOnlyOutputRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(eventStreamOperationWithOnlyOutputRequest), restAsyncResponseTransformer); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { if (e != null) { try { @@ -693,7 +711,7 @@ public CompletableFuture eventStreamOperationWithOnlyOutput( return CompletableFutureUtils.forwardExceptionTo(future, executeFuture); } catch (Throwable t) { runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> asyncResponseHandler.exceptionOccurred(t)); + () -> asyncResponseHandler.exceptionOccurred(t)); metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } @@ -721,48 +739,51 @@ public CompletableFuture eventStreamOperationWithOnlyOutput( */ @Override public CompletableFuture getOperationWithChecksum( - GetOperationWithChecksumRequest getOperationWithChecksumRequest) { + GetOperationWithChecksumRequest getOperationWithChecksumRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getOperationWithChecksumRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getOperationWithChecksumRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetOperationWithChecksum"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(false).build(); + .isPayloadJson(false).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, GetOperationWithChecksumResponse::builder); + operationMetadata, GetOperationWithChecksumResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("GetOperationWithChecksum") - .withProtocolMetadata(protocolMetadata) - .withMarshaller(new GetOperationWithChecksumRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute( - SdkInternalExecutionAttribute.HTTP_CHECKSUM, - HttpChecksum.builder().requestChecksumRequired(true).isRequestStreaming(false) - .requestAlgorithm(getOperationWithChecksumRequest.checksumAlgorithmAsString()) - .requestAlgorithmHeader("x-amz-sdk-checksum-algorithm").build()) - .withInput(getOperationWithChecksumRequest)); + .execute(new ClientExecutionParams() + .withOperationName("GetOperationWithChecksum") + .withProtocolMetadata(protocolMetadata) + .withMarshaller(new GetOperationWithChecksumRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute( + SdkInternalExecutionAttribute.HTTP_CHECKSUM, + HttpChecksum.builder().requestChecksumRequired(true).isRequestStreaming(false) + .requestAlgorithm(getOperationWithChecksumRequest.checksumAlgorithmAsString()) + .requestAlgorithmHeader("x-amz-sdk-checksum-algorithm").build()) + .withInput(getOperationWithChecksumRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -800,40 +821,43 @@ public CompletableFuture getOperationWithCheck */ @Override public CompletableFuture getWithoutRequiredMembers( - GetWithoutRequiredMembersRequest getWithoutRequiredMembersRequest) { + GetWithoutRequiredMembersRequest getWithoutRequiredMembersRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getWithoutRequiredMembersRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getWithoutRequiredMembersRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetWithoutRequiredMembers"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, GetWithoutRequiredMembersResponse::builder); + operationMetadata, GetWithoutRequiredMembersResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("GetWithoutRequiredMembers").withProtocolMetadata(protocolMetadata) - .withMarshaller(new GetWithoutRequiredMembersRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(getWithoutRequiredMembersRequest)); + .execute(new ClientExecutionParams() + .withOperationName("GetWithoutRequiredMembers").withProtocolMetadata(protocolMetadata) + .withMarshaller(new GetWithoutRequiredMembersRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(getWithoutRequiredMembersRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -868,44 +892,47 @@ public CompletableFuture getWithoutRequiredMe */ @Override public CompletableFuture operationWithChecksumRequired( - OperationWithChecksumRequiredRequest operationWithChecksumRequiredRequest) { + OperationWithChecksumRequiredRequest operationWithChecksumRequiredRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithChecksumRequiredRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithChecksumRequiredRequest.overrideConfiguration().orElse(null)); + operationWithChecksumRequiredRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithChecksumRequired"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, OperationWithChecksumRequiredResponse::builder); + operationMetadata, OperationWithChecksumRequiredResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithChecksumRequired") - .withProtocolMetadata(protocolMetadata) - .withMarshaller(new OperationWithChecksumRequiredRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute(SdkInternalExecutionAttribute.HTTP_CHECKSUM_REQUIRED, - HttpChecksumRequired.create()).withInput(operationWithChecksumRequiredRequest)); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithChecksumRequired") + .withProtocolMetadata(protocolMetadata) + .withMarshaller(new OperationWithChecksumRequiredRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute(SdkInternalExecutionAttribute.HTTP_CHECKSUM_REQUIRED, + HttpChecksumRequired.create()).withInput(operationWithChecksumRequiredRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -940,45 +967,48 @@ public CompletableFuture operationWithChe */ @Override public CompletableFuture operationWithRequestCompression( - OperationWithRequestCompressionRequest operationWithRequestCompressionRequest) { + OperationWithRequestCompressionRequest operationWithRequestCompressionRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithRequestCompressionRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithRequestCompressionRequest.overrideConfiguration().orElse(null)); + operationWithRequestCompressionRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithRequestCompression"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, OperationWithRequestCompressionResponse::builder); + operationMetadata, OperationWithRequestCompressionResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithRequestCompression") - .withProtocolMetadata(protocolMetadata) - .withMarshaller(new OperationWithRequestCompressionRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute(SdkInternalExecutionAttribute.REQUEST_COMPRESSION, - RequestCompression.builder().encodings("gzip").isStreaming(false).build()) - .withInput(operationWithRequestCompressionRequest)); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithRequestCompression") + .withProtocolMetadata(protocolMetadata) + .withMarshaller(new OperationWithRequestCompressionRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute(SdkInternalExecutionAttribute.REQUEST_COMPRESSION, + RequestCompression.builder().encodings("gzip").isStreaming(false).build()) + .withInput(operationWithRequestCompressionRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -1013,40 +1043,43 @@ public CompletableFuture operationWithR */ @Override public CompletableFuture paginatedOperationWithResultKey( - PaginatedOperationWithResultKeyRequest paginatedOperationWithResultKeyRequest) { + PaginatedOperationWithResultKeyRequest paginatedOperationWithResultKeyRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(paginatedOperationWithResultKeyRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - paginatedOperationWithResultKeyRequest.overrideConfiguration().orElse(null)); + paginatedOperationWithResultKeyRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PaginatedOperationWithResultKey"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, PaginatedOperationWithResultKeyResponse::builder); + operationMetadata, PaginatedOperationWithResultKeyResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("PaginatedOperationWithResultKey").withProtocolMetadata(protocolMetadata) - .withMarshaller(new PaginatedOperationWithResultKeyRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(paginatedOperationWithResultKeyRequest)); + .execute(new ClientExecutionParams() + .withOperationName("PaginatedOperationWithResultKey").withProtocolMetadata(protocolMetadata) + .withMarshaller(new PaginatedOperationWithResultKeyRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(paginatedOperationWithResultKeyRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -1081,40 +1114,43 @@ public CompletableFuture paginatedOpera */ @Override public CompletableFuture paginatedOperationWithoutResultKey( - PaginatedOperationWithoutResultKeyRequest paginatedOperationWithoutResultKeyRequest) { + PaginatedOperationWithoutResultKeyRequest paginatedOperationWithoutResultKeyRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(paginatedOperationWithoutResultKeyRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - paginatedOperationWithoutResultKeyRequest.overrideConfiguration().orElse(null)); + paginatedOperationWithoutResultKeyRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PaginatedOperationWithoutResultKey"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(operationMetadata, PaginatedOperationWithoutResultKeyResponse::builder); + .createResponseHandler(operationMetadata, PaginatedOperationWithoutResultKeyResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("PaginatedOperationWithoutResultKey").withProtocolMetadata(protocolMetadata) - .withMarshaller(new PaginatedOperationWithoutResultKeyRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(paginatedOperationWithoutResultKeyRequest)); + .execute(new ClientExecutionParams() + .withOperationName("PaginatedOperationWithoutResultKey").withProtocolMetadata(protocolMetadata) + .withMarshaller(new PaginatedOperationWithoutResultKeyRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(paginatedOperationWithoutResultKeyRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -1166,70 +1202,73 @@ public CompletableFuture paginatedOp */ @Override public CompletableFuture putOperationWithChecksum( - PutOperationWithChecksumRequest putOperationWithChecksumRequest, AsyncRequestBody requestBody, - AsyncResponseTransformer asyncResponseTransformer) { + PutOperationWithChecksumRequest putOperationWithChecksumRequest, AsyncRequestBody requestBody, + AsyncResponseTransformer asyncResponseTransformer) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putOperationWithChecksumRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, putOperationWithChecksumRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PutOperationWithChecksum"); Pair, CompletableFuture> pair = AsyncResponseTransformerUtils - .wrapWithEndOfStreamFuture(asyncResponseTransformer); + .wrapWithEndOfStreamFuture(asyncResponseTransformer); asyncResponseTransformer = pair.left(); CompletableFuture endOfStreamFuture = pair.right(); if (!isSignerOverridden(clientConfiguration)) { putOperationWithChecksumRequest = applySignerOverride(putOperationWithChecksumRequest, AsyncAws4Signer.create()); } JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(true) - .isPayloadJson(false).build(); + .isPayloadJson(false).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, PutOperationWithChecksumResponse::builder); + operationMetadata, PutOperationWithChecksumResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler.execute( - new ClientExecutionParams() - .withOperationName("PutOperationWithChecksum") - .withProtocolMetadata(protocolMetadata) - .withMarshaller( - AsyncStreamingRequestMarshaller.builder() - .delegateMarshaller(new PutOperationWithChecksumRequestMarshaller(protocolFactory)) - .asyncRequestBody(requestBody).build()) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withMetricCollector(apiCallMetricCollector) - .withAsyncRequestBody(requestBody) - .putExecutionAttribute( - SdkInternalExecutionAttribute.HTTP_CHECKSUM, - HttpChecksum - .builder() - .requestChecksumRequired(false) - .isRequestStreaming(true) - .requestValidationMode(putOperationWithChecksumRequest.checksumModeAsString()) - .responseAlgorithmsV2(DefaultChecksumAlgorithm.CRC32C, - DefaultChecksumAlgorithm.CRC32, DefaultChecksumAlgorithm.SHA1, - DefaultChecksumAlgorithm.SHA256).build()) - .withInput(putOperationWithChecksumRequest), asyncResponseTransformer); + new ClientExecutionParams() + .withOperationName("PutOperationWithChecksum") + .withProtocolMetadata(protocolMetadata) + .withMarshaller( + AsyncStreamingRequestMarshaller.builder() + .delegateMarshaller(new PutOperationWithChecksumRequestMarshaller(protocolFactory)) + .asyncRequestBody(requestBody).build()) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withMetricCollector(apiCallMetricCollector) + .withAsyncRequestBody(requestBody) + .putExecutionAttribute( + SdkInternalExecutionAttribute.HTTP_CHECKSUM, + HttpChecksum + .builder() + .requestChecksumRequired(false) + .isRequestStreaming(true) + .requestValidationMode(putOperationWithChecksumRequest.checksumModeAsString()) + .responseAlgorithmsV2(DefaultChecksumAlgorithm.CRC32C, + DefaultChecksumAlgorithm.CRC32, DefaultChecksumAlgorithm.SHA1, + DefaultChecksumAlgorithm.SHA256).build()) + .withInput(putOperationWithChecksumRequest), asyncResponseTransformer); AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { if (e != null) { runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> finalAsyncResponseTransformer.exceptionOccurred(e)); + () -> finalAsyncResponseTransformer.exceptionOccurred(e)); } endOfStreamFuture.whenComplete((r2, e2) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -1240,7 +1279,7 @@ public CompletableFuture putOperationWithChecksum( } catch (Throwable t) { AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> finalAsyncResponseTransformer.exceptionOccurred(t)); + () -> finalAsyncResponseTransformer.exceptionOccurred(t)); metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } @@ -1273,13 +1312,13 @@ public CompletableFuture putOperationWithChecksum( */ @Override public CompletableFuture streamingInputOperation( - StreamingInputOperationRequest streamingInputOperationRequest, AsyncRequestBody requestBody) { + StreamingInputOperationRequest streamingInputOperationRequest, AsyncRequestBody requestBody) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingInputOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingInputOperation"); @@ -1287,33 +1326,36 @@ public CompletableFuture streamingInputOperatio streamingInputOperationRequest = applySignerOverride(streamingInputOperationRequest, AsyncAws4Signer.create()); } JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, StreamingInputOperationResponse::builder); + operationMetadata, StreamingInputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("StreamingInputOperation") - .withProtocolMetadata(protocolMetadata) - .withMarshaller( - AsyncStreamingRequestMarshaller.builder() - .delegateMarshaller(new StreamingInputOperationRequestMarshaller(protocolFactory)) - .asyncRequestBody(requestBody).build()).withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) - .withMetricCollector(apiCallMetricCollector).withAsyncRequestBody(requestBody) - .withInput(streamingInputOperationRequest)); + .execute(new ClientExecutionParams() + .withOperationName("StreamingInputOperation") + .withProtocolMetadata(protocolMetadata) + .withMarshaller( + AsyncStreamingRequestMarshaller.builder() + .delegateMarshaller(new StreamingInputOperationRequestMarshaller(protocolFactory)) + .asyncRequestBody(requestBody).build()).withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) + .withMetricCollector(apiCallMetricCollector).withAsyncRequestBody(requestBody) + .withInput(streamingInputOperationRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -1357,59 +1399,62 @@ public CompletableFuture streamingInputOperatio */ @Override public CompletableFuture streamingInputOutputOperation( - StreamingInputOutputOperationRequest streamingInputOutputOperationRequest, AsyncRequestBody requestBody, - AsyncResponseTransformer asyncResponseTransformer) { + StreamingInputOutputOperationRequest streamingInputOutputOperationRequest, AsyncRequestBody requestBody, + AsyncResponseTransformer asyncResponseTransformer) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOutputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - streamingInputOutputOperationRequest.overrideConfiguration().orElse(null)); + streamingInputOutputOperationRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingInputOutputOperation"); Pair, CompletableFuture> pair = AsyncResponseTransformerUtils - .wrapWithEndOfStreamFuture(asyncResponseTransformer); + .wrapWithEndOfStreamFuture(asyncResponseTransformer); asyncResponseTransformer = pair.left(); CompletableFuture endOfStreamFuture = pair.right(); streamingInputOutputOperationRequest = applySignerOverride(streamingInputOutputOperationRequest, - Aws4UnsignedPayloadSigner.create()); + Aws4UnsignedPayloadSigner.create()); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(true) - .isPayloadJson(false).build(); + .isPayloadJson(false).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, StreamingInputOutputOperationResponse::builder); + operationMetadata, StreamingInputOutputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler.execute( - new ClientExecutionParams() - .withOperationName("StreamingInputOutputOperation") - .withProtocolMetadata(protocolMetadata) - .withMarshaller( - AsyncStreamingRequestMarshaller - .builder() - .delegateMarshaller( - new StreamingInputOutputOperationRequestMarshaller(protocolFactory)) - .asyncRequestBody(requestBody).transferEncoding(true).build()) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withAsyncRequestBody(requestBody).withInput(streamingInputOutputOperationRequest), - asyncResponseTransformer); + new ClientExecutionParams() + .withOperationName("StreamingInputOutputOperation") + .withProtocolMetadata(protocolMetadata) + .withMarshaller( + AsyncStreamingRequestMarshaller + .builder() + .delegateMarshaller( + new StreamingInputOutputOperationRequestMarshaller(protocolFactory)) + .asyncRequestBody(requestBody).transferEncoding(true).build()) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withAsyncRequestBody(requestBody).withInput(streamingInputOutputOperationRequest), + asyncResponseTransformer); AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { if (e != null) { runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> finalAsyncResponseTransformer.exceptionOccurred(e)); + () -> finalAsyncResponseTransformer.exceptionOccurred(e)); } endOfStreamFuture.whenComplete((r2, e2) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -1420,7 +1465,7 @@ public CompletableFuture streamingInputOutputOperation( } catch (Throwable t) { AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> finalAsyncResponseTransformer.exceptionOccurred(t)); + () -> finalAsyncResponseTransformer.exceptionOccurred(t)); metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } @@ -1453,50 +1498,53 @@ public CompletableFuture streamingInputOutputOperation( */ @Override public CompletableFuture streamingOutputOperation( - StreamingOutputOperationRequest streamingOutputOperationRequest, - AsyncResponseTransformer asyncResponseTransformer) { + StreamingOutputOperationRequest streamingOutputOperationRequest, + AsyncResponseTransformer asyncResponseTransformer) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingOutputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingOutputOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingOutputOperation"); Pair, CompletableFuture> pair = AsyncResponseTransformerUtils - .wrapWithEndOfStreamFuture(asyncResponseTransformer); + .wrapWithEndOfStreamFuture(asyncResponseTransformer); asyncResponseTransformer = pair.left(); CompletableFuture endOfStreamFuture = pair.right(); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(true) - .isPayloadJson(false).build(); + .isPayloadJson(false).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, StreamingOutputOperationResponse::builder); + operationMetadata, StreamingOutputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler.execute( - new ClientExecutionParams() - .withOperationName("StreamingOutputOperation").withProtocolMetadata(protocolMetadata) - .withMarshaller(new StreamingOutputOperationRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(streamingOutputOperationRequest), asyncResponseTransformer); + new ClientExecutionParams() + .withOperationName("StreamingOutputOperation").withProtocolMetadata(protocolMetadata) + .withMarshaller(new StreamingOutputOperationRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(streamingOutputOperationRequest), asyncResponseTransformer); AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { if (e != null) { runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> finalAsyncResponseTransformer.exceptionOccurred(e)); + () -> finalAsyncResponseTransformer.exceptionOccurred(e)); } endOfStreamFuture.whenComplete((r2, e2) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); @@ -1507,7 +1555,7 @@ public CompletableFuture streamingOutputOperation( } catch (Throwable t) { AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", - () -> finalAsyncResponseTransformer.exceptionOccurred(t)); + () -> finalAsyncResponseTransformer.exceptionOccurred(t)); metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } @@ -1530,11 +1578,11 @@ public final String serviceName() { private > T init(T builder) { return builder.clientConfiguration(clientConfiguration).defaultServiceExceptionSupplier(JsonException::builder) - .protocol(AwsJsonProtocol.REST_JSON).protocolVersion("1.1"); + .protocol(AwsJsonProtocol.REST_JSON).protocolVersion("1.1"); } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, - RequestOverrideConfiguration requestOverrideConfiguration) { + RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); @@ -1554,8 +1602,8 @@ private T applySignerOverride(T request, Signer signer) } Consumer signerOverride = b -> b.signer(signer).build(); AwsRequestOverrideConfiguration overrideConfiguration = request.overrideConfiguration() - .map(c -> c.toBuilder().applyMutation(signerOverride).build()) - .orElse((AwsRequestOverrideConfiguration.builder().applyMutation(signerOverride).build())); + .map(c -> c.toBuilder().applyMutation(signerOverride).build()) + .orElse((AwsRequestOverrideConfiguration.builder().applyMutation(signerOverride).build())); return (T) request.toBuilder().overrideConfiguration(overrideConfiguration).build(); } @@ -1601,7 +1649,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, - JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { + JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); } diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-client-class.java index 12e3b7e0c7f4..cded3b503aec 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-client-class.java @@ -103,7 +103,7 @@ final class DefaultJsonClient implements JsonClient { private static final Logger log = Logger.loggerFor(DefaultJsonClient.class); private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder() - .serviceProtocol(AwsServiceProtocol.REST_JSON).build(); + .serviceProtocol(AwsServiceProtocol.REST_JSON).build(); private final SyncClientHandler clientHandler; @@ -139,42 +139,45 @@ protected DefaultJsonClient(SdkClientConfiguration clientConfiguration) { */ @Override public APostOperationResponse aPostOperation(APostOperationRequest aPostOperationRequest) throws InvalidInputException, - AwsServiceException, SdkClientException, JsonException { + AwsServiceException, SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, - APostOperationResponse::builder); + APostOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "APostOperation"); String hostPrefix = "{StringMember}-foo."; HostnameValidator.validateHostnameCompliant(aPostOperationRequest.stringMember(), "StringMember", - "aPostOperationRequest"); + "aPostOperationRequest"); String resolvedHostExpression = String.format("%s-foo.", aPostOperationRequest.stringMember()); return clientHandler.execute(new ClientExecutionParams() - .withOperationName("APostOperation").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .hostPrefixExpression(resolvedHostExpression).withRequestConfiguration(clientConfiguration) - .withInput(aPostOperationRequest).withMetricCollector(apiCallMetricCollector) - .withMarshaller(new APostOperationRequestMarshaller(protocolFactory))); + .withOperationName("APostOperation").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .hostPrefixExpression(resolvedHostExpression).withRequestConfiguration(clientConfiguration) + .withInput(aPostOperationRequest).withMetricCollector(apiCallMetricCollector) + .withMarshaller(new APostOperationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -202,41 +205,44 @@ public APostOperationResponse aPostOperation(APostOperationRequest aPostOperatio */ @Override public APostOperationWithOutputResponse aPostOperationWithOutput( - APostOperationWithOutputRequest aPostOperationWithOutputRequest) throws InvalidInputException, AwsServiceException, - SdkClientException, JsonException { + APostOperationWithOutputRequest aPostOperationWithOutputRequest) throws InvalidInputException, AwsServiceException, + SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, APostOperationWithOutputResponse::builder); + operationMetadata, APostOperationWithOutputResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(aPostOperationWithOutputRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationWithOutputRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "APostOperationWithOutput"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("APostOperationWithOutput").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(aPostOperationWithOutputRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new APostOperationWithOutputRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("APostOperationWithOutput").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(aPostOperationWithOutputRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new APostOperationWithOutputRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -260,40 +266,43 @@ public APostOperationWithOutputResponse aPostOperationWithOutput( */ @Override public BearerAuthOperationResponse bearerAuthOperation(BearerAuthOperationRequest bearerAuthOperationRequest) - throws AwsServiceException, SdkClientException, JsonException { + throws AwsServiceException, SdkClientException, JsonException { bearerAuthOperationRequest = applySignerOverride(bearerAuthOperationRequest, BearerTokenSigner.create()); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, BearerAuthOperationResponse::builder); + operationMetadata, BearerAuthOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(bearerAuthOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, bearerAuthOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "BearerAuthOperation"); return clientHandler.execute(new ClientExecutionParams() - .withOperationName("BearerAuthOperation").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .credentialType(CredentialType.TOKEN).withRequestConfiguration(clientConfiguration) - .withInput(bearerAuthOperationRequest).withMetricCollector(apiCallMetricCollector) - .withMarshaller(new BearerAuthOperationRequestMarshaller(protocolFactory))); + .withOperationName("BearerAuthOperation").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .credentialType(CredentialType.TOKEN).withRequestConfiguration(clientConfiguration) + .withInput(bearerAuthOperationRequest).withMetricCollector(apiCallMetricCollector) + .withMarshaller(new BearerAuthOperationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -317,49 +326,52 @@ public BearerAuthOperationResponse bearerAuthOperation(BearerAuthOperationReques */ @Override public GetOperationWithChecksumResponse getOperationWithChecksum( - GetOperationWithChecksumRequest getOperationWithChecksumRequest) throws AwsServiceException, SdkClientException, - JsonException { + GetOperationWithChecksumRequest getOperationWithChecksumRequest) throws AwsServiceException, SdkClientException, + JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(false).build(); + .isPayloadJson(false).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, GetOperationWithChecksumResponse::builder); + operationMetadata, GetOperationWithChecksumResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getOperationWithChecksumRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getOperationWithChecksumRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetOperationWithChecksum"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("GetOperationWithChecksum") - .withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withInput(getOperationWithChecksumRequest) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute( - SdkInternalExecutionAttribute.HTTP_CHECKSUM, - HttpChecksum.builder().requestChecksumRequired(true).isRequestStreaming(false) - .requestAlgorithm(getOperationWithChecksumRequest.checksumAlgorithmAsString()) - .requestAlgorithmHeader("x-amz-sdk-checksum-algorithm").build()) - .withMarshaller(new GetOperationWithChecksumRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("GetOperationWithChecksum") + .withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withInput(getOperationWithChecksumRequest) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute( + SdkInternalExecutionAttribute.HTTP_CHECKSUM, + HttpChecksum.builder().requestChecksumRequired(true).isRequestStreaming(false) + .requestAlgorithm(getOperationWithChecksumRequest.checksumAlgorithmAsString()) + .requestAlgorithmHeader("x-amz-sdk-checksum-algorithm").build()) + .withMarshaller(new GetOperationWithChecksumRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -387,41 +399,44 @@ public GetOperationWithChecksumResponse getOperationWithChecksum( */ @Override public GetWithoutRequiredMembersResponse getWithoutRequiredMembers( - GetWithoutRequiredMembersRequest getWithoutRequiredMembersRequest) throws InvalidInputException, AwsServiceException, - SdkClientException, JsonException { + GetWithoutRequiredMembersRequest getWithoutRequiredMembersRequest) throws InvalidInputException, AwsServiceException, + SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, GetWithoutRequiredMembersResponse::builder); + operationMetadata, GetWithoutRequiredMembersResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getWithoutRequiredMembersRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getWithoutRequiredMembersRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetWithoutRequiredMembers"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("GetWithoutRequiredMembers").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(getWithoutRequiredMembersRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new GetWithoutRequiredMembersRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("GetWithoutRequiredMembers").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(getWithoutRequiredMembersRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new GetWithoutRequiredMembersRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -445,46 +460,49 @@ public GetWithoutRequiredMembersResponse getWithoutRequiredMembers( */ @Override public OperationWithChecksumRequiredResponse operationWithChecksumRequired( - OperationWithChecksumRequiredRequest operationWithChecksumRequiredRequest) throws AwsServiceException, - SdkClientException, JsonException { + OperationWithChecksumRequiredRequest operationWithChecksumRequiredRequest) throws AwsServiceException, + SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, OperationWithChecksumRequiredResponse::builder); + operationMetadata, OperationWithChecksumRequiredResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithChecksumRequiredRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithChecksumRequiredRequest.overrideConfiguration().orElse(null)); + operationWithChecksumRequiredRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithChecksumRequired"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithChecksumRequired") - .withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withInput(operationWithChecksumRequiredRequest) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute(SdkInternalExecutionAttribute.HTTP_CHECKSUM_REQUIRED, - HttpChecksumRequired.create()) - .withMarshaller(new OperationWithChecksumRequiredRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithChecksumRequired") + .withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withInput(operationWithChecksumRequiredRequest) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute(SdkInternalExecutionAttribute.HTTP_CHECKSUM_REQUIRED, + HttpChecksumRequired.create()) + .withMarshaller(new OperationWithChecksumRequiredRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -508,46 +526,49 @@ public OperationWithChecksumRequiredResponse operationWithChecksumRequired( */ @Override public OperationWithRequestCompressionResponse operationWithRequestCompression( - OperationWithRequestCompressionRequest operationWithRequestCompressionRequest) throws AwsServiceException, - SdkClientException, JsonException { + OperationWithRequestCompressionRequest operationWithRequestCompressionRequest) throws AwsServiceException, + SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, OperationWithRequestCompressionResponse::builder); + operationMetadata, OperationWithRequestCompressionResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithRequestCompressionRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - operationWithRequestCompressionRequest.overrideConfiguration().orElse(null)); + operationWithRequestCompressionRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithRequestCompression"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithRequestCompression") - .withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withInput(operationWithRequestCompressionRequest) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute(SdkInternalExecutionAttribute.REQUEST_COMPRESSION, - RequestCompression.builder().encodings("gzip").isStreaming(false).build()) - .withMarshaller(new OperationWithRequestCompressionRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("OperationWithRequestCompression") + .withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withInput(operationWithRequestCompressionRequest) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute(SdkInternalExecutionAttribute.REQUEST_COMPRESSION, + RequestCompression.builder().encodings("gzip").isStreaming(false).build()) + .withMarshaller(new OperationWithRequestCompressionRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -571,41 +592,44 @@ public OperationWithRequestCompressionResponse operationWithRequestCompression( */ @Override public PaginatedOperationWithResultKeyResponse paginatedOperationWithResultKey( - PaginatedOperationWithResultKeyRequest paginatedOperationWithResultKeyRequest) throws AwsServiceException, - SdkClientException, JsonException { + PaginatedOperationWithResultKeyRequest paginatedOperationWithResultKeyRequest) throws AwsServiceException, + SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, PaginatedOperationWithResultKeyResponse::builder); + operationMetadata, PaginatedOperationWithResultKeyResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(paginatedOperationWithResultKeyRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - paginatedOperationWithResultKeyRequest.overrideConfiguration().orElse(null)); + paginatedOperationWithResultKeyRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PaginatedOperationWithResultKey"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("PaginatedOperationWithResultKey").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(paginatedOperationWithResultKeyRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new PaginatedOperationWithResultKeyRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("PaginatedOperationWithResultKey").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(paginatedOperationWithResultKeyRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new PaginatedOperationWithResultKeyRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -629,41 +653,44 @@ public PaginatedOperationWithResultKeyResponse paginatedOperationWithResultKey( */ @Override public PaginatedOperationWithoutResultKeyResponse paginatedOperationWithoutResultKey( - PaginatedOperationWithoutResultKeyRequest paginatedOperationWithoutResultKeyRequest) throws AwsServiceException, - SdkClientException, JsonException { + PaginatedOperationWithoutResultKeyRequest paginatedOperationWithoutResultKeyRequest) throws AwsServiceException, + SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, PaginatedOperationWithoutResultKeyResponse::builder); + operationMetadata, PaginatedOperationWithoutResultKeyResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(paginatedOperationWithoutResultKeyRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - paginatedOperationWithoutResultKeyRequest.overrideConfiguration().orElse(null)); + paginatedOperationWithoutResultKeyRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PaginatedOperationWithoutResultKey"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("PaginatedOperationWithoutResultKey").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(paginatedOperationWithoutResultKeyRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new PaginatedOperationWithoutResultKeyRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("PaginatedOperationWithoutResultKey").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(paginatedOperationWithoutResultKeyRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new PaginatedOperationWithoutResultKeyRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -713,58 +740,61 @@ public PaginatedOperationWithoutResultKeyResponse paginatedOperationWithoutResul */ @Override public ReturnT putOperationWithChecksum(PutOperationWithChecksumRequest putOperationWithChecksumRequest, - RequestBody requestBody, ResponseTransformer responseTransformer) - throws AwsServiceException, SdkClientException, JsonException { + RequestBody requestBody, ResponseTransformer responseTransformer) + throws AwsServiceException, SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(true) - .isPayloadJson(false).build(); + .isPayloadJson(false).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, PutOperationWithChecksumResponse::builder); + operationMetadata, PutOperationWithChecksumResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putOperationWithChecksumRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, putOperationWithChecksumRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PutOperationWithChecksum"); return clientHandler.execute( - new ClientExecutionParams() - .withOperationName("PutOperationWithChecksum") - .withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withInput(putOperationWithChecksumRequest) - .withMetricCollector(apiCallMetricCollector) - .putExecutionAttribute( - SdkInternalExecutionAttribute.HTTP_CHECKSUM, - HttpChecksum - .builder() - .requestChecksumRequired(false) - .isRequestStreaming(true) - .requestValidationMode(putOperationWithChecksumRequest.checksumModeAsString()) - .responseAlgorithmsV2(DefaultChecksumAlgorithm.CRC32C, - DefaultChecksumAlgorithm.CRC32, DefaultChecksumAlgorithm.SHA1, - DefaultChecksumAlgorithm.SHA256).build()) - .withRequestBody(requestBody) - .withMarshaller( - StreamingRequestMarshaller.builder() - .delegateMarshaller(new PutOperationWithChecksumRequestMarshaller(protocolFactory)) - .requestBody(requestBody).build()), responseTransformer); + new ClientExecutionParams() + .withOperationName("PutOperationWithChecksum") + .withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withInput(putOperationWithChecksumRequest) + .withMetricCollector(apiCallMetricCollector) + .putExecutionAttribute( + SdkInternalExecutionAttribute.HTTP_CHECKSUM, + HttpChecksum + .builder() + .requestChecksumRequired(false) + .isRequestStreaming(true) + .requestValidationMode(putOperationWithChecksumRequest.checksumModeAsString()) + .responseAlgorithmsV2(DefaultChecksumAlgorithm.CRC32C, + DefaultChecksumAlgorithm.CRC32, DefaultChecksumAlgorithm.SHA1, + DefaultChecksumAlgorithm.SHA256).build()) + .withRequestBody(requestBody) + .withMarshaller( + StreamingRequestMarshaller.builder() + .delegateMarshaller(new PutOperationWithChecksumRequestMarshaller(protocolFactory)) + .requestBody(requestBody).build()), responseTransformer); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -799,47 +829,50 @@ public ReturnT putOperationWithChecksum(PutOperationWithChecksumReques */ @Override public StreamingInputOperationResponse streamingInputOperation(StreamingInputOperationRequest streamingInputOperationRequest, - RequestBody requestBody) throws AwsServiceException, SdkClientException, JsonException { + RequestBody requestBody) throws AwsServiceException, SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, StreamingInputOperationResponse::builder); + operationMetadata, StreamingInputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingInputOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingInputOperation"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("StreamingInputOperation") - .withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withInput(streamingInputOperationRequest) - .withMetricCollector(apiCallMetricCollector) - .withRequestBody(requestBody) - .withMarshaller( - StreamingRequestMarshaller.builder() - .delegateMarshaller(new StreamingInputOperationRequestMarshaller(protocolFactory)) - .requestBody(requestBody).build())); + .execute(new ClientExecutionParams() + .withOperationName("StreamingInputOperation") + .withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withInput(streamingInputOperationRequest) + .withMetricCollector(apiCallMetricCollector) + .withRequestBody(requestBody) + .withMarshaller( + StreamingRequestMarshaller.builder() + .delegateMarshaller(new StreamingInputOperationRequestMarshaller(protocolFactory)) + .requestBody(requestBody).build())); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -881,53 +914,56 @@ public StreamingInputOperationResponse streamingInputOperation(StreamingInputOpe */ @Override public ReturnT streamingInputOutputOperation( - StreamingInputOutputOperationRequest streamingInputOutputOperationRequest, RequestBody requestBody, - ResponseTransformer responseTransformer) throws AwsServiceException, - SdkClientException, JsonException { + StreamingInputOutputOperationRequest streamingInputOutputOperationRequest, RequestBody requestBody, + ResponseTransformer responseTransformer) throws AwsServiceException, + SdkClientException, JsonException { streamingInputOutputOperationRequest = applySignerOverride(streamingInputOutputOperationRequest, - Aws4UnsignedPayloadSigner.create()); + Aws4UnsignedPayloadSigner.create()); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(true) - .isPayloadJson(false).build(); + .isPayloadJson(false).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, StreamingInputOutputOperationResponse::builder); + operationMetadata, StreamingInputOutputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingInputOutputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - streamingInputOutputOperationRequest.overrideConfiguration().orElse(null)); + streamingInputOutputOperationRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingInputOutputOperation"); return clientHandler.execute( - new ClientExecutionParams() - .withOperationName("StreamingInputOutputOperation") - .withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withInput(streamingInputOutputOperationRequest) - .withMetricCollector(apiCallMetricCollector) - .withRequestBody(requestBody) - .withMarshaller( - StreamingRequestMarshaller - .builder() - .delegateMarshaller( - new StreamingInputOutputOperationRequestMarshaller(protocolFactory)) - .requestBody(requestBody).transferEncoding(true).build()), responseTransformer); + new ClientExecutionParams() + .withOperationName("StreamingInputOutputOperation") + .withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withInput(streamingInputOutputOperationRequest) + .withMetricCollector(apiCallMetricCollector) + .withRequestBody(requestBody) + .withMarshaller( + StreamingRequestMarshaller + .builder() + .delegateMarshaller( + new StreamingInputOutputOperationRequestMarshaller(protocolFactory)) + .requestBody(requestBody).transferEncoding(true).build()), responseTransformer); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -958,41 +994,44 @@ public ReturnT streamingInputOutputOperation( */ @Override public ReturnT streamingOutputOperation(StreamingOutputOperationRequest streamingOutputOperationRequest, - ResponseTransformer responseTransformer) throws AwsServiceException, - SdkClientException, JsonException { + ResponseTransformer responseTransformer) throws AwsServiceException, + SdkClientException, JsonException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(true) - .isPayloadJson(false).build(); + .isPayloadJson(false).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, StreamingOutputOperationResponse::builder); + operationMetadata, StreamingOutputOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(streamingOutputOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, streamingOutputOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingOutputOperation"); return clientHandler.execute( - new ClientExecutionParams() - .withOperationName("StreamingOutputOperation").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(streamingOutputOperationRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new StreamingOutputOperationRequestMarshaller(protocolFactory)), responseTransformer); + new ClientExecutionParams() + .withOperationName("StreamingOutputOperation").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(streamingOutputOperationRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new StreamingOutputOperationRequestMarshaller(protocolFactory)), responseTransformer); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -1012,8 +1051,8 @@ private T applySignerOverride(T request, Signer signer) } Consumer signerOverride = b -> b.signer(signer).build(); AwsRequestOverrideConfiguration overrideConfiguration = request.overrideConfiguration() - .map(c -> c.toBuilder().applyMutation(signerOverride).build()) - .orElse((AwsRequestOverrideConfiguration.builder().applyMutation(signerOverride).build())); + .map(c -> c.toBuilder().applyMutation(signerOverride).build()) + .orElse((AwsRequestOverrideConfiguration.builder().applyMutation(signerOverride).build())); return (T) request.toBuilder().overrideConfiguration(overrideConfiguration).build(); } @@ -1023,7 +1062,7 @@ public final String serviceName() { } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, - RequestOverrideConfiguration requestOverrideConfiguration) { + RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); @@ -1038,7 +1077,7 @@ private static List resolveMetricPublishers(SdkClientConfigurat } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, - JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { + JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); } @@ -1081,7 +1120,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, private > T init(T builder) { return builder.clientConfiguration(clientConfiguration).defaultServiceExceptionSupplier(JsonException::builder) - .protocol(AwsJsonProtocol.REST_JSON).protocolVersion("1.1"); + .protocol(AwsJsonProtocol.REST_JSON).protocolVersion("1.1"); } @Override 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 index d360658456eb..046b072b3c34 100644 --- 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 @@ -94,7 +94,7 @@ final class DefaultSmithyRpcV2ProtocolAsyncClient implements SmithyRpcV2Protocol private static final Logger log = LoggerFactory.getLogger(DefaultSmithyRpcV2ProtocolAsyncClient.class); private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder() - .serviceProtocol(AwsServiceProtocol.SMITHY_RPC_V2_CBOR).build(); + .serviceProtocol(AwsServiceProtocol.SMITHY_RPC_V2_CBOR).build(); private final AsyncClientHandler clientHandler; @@ -131,44 +131,47 @@ protected DefaultSmithyRpcV2ProtocolAsyncClient(SdkClientConfiguration clientCon @Override public CompletableFuture emptyInputOutput(EmptyInputOutputRequest emptyInputOutputRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(emptyInputOutputRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, emptyInputOutputRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "EmptyInputOutput"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, EmptyInputOutputResponse::builder); + operationMetadata, EmptyInputOutputResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "ValidationException": - return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") - .exceptionBuilderSupplier(ValidationException::builder).build()); - case "InvalidGreeting": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") - .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); - case "ComplexError": - return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") - .exceptionBuilderSupplier(ComplexErrorException::builder).build()); - default: - return Optional.empty(); + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("EmptyInputOutput").withProtocolMetadata(protocolMetadata) - .withMarshaller(new EmptyInputOutputRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(emptyInputOutputRequest)); + .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())); }); @@ -204,41 +207,44 @@ public CompletableFuture emptyInputOutput(EmptyInputOu public CompletableFuture float16(Float16Request float16Request) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(float16Request, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, float16Request - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "Float16"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, - Float16Response::builder); + Float16Response::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "ValidationException": - return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") - .exceptionBuilderSupplier(ValidationException::builder).build()); - case "InvalidGreeting": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") - .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); - case "ComplexError": - return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") - .exceptionBuilderSupplier(ComplexErrorException::builder).build()); - default: - return Optional.empty(); + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams().withOperationName("Float16") - .withProtocolMetadata(protocolMetadata).withMarshaller(new Float16RequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(float16Request)); + .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())); }); @@ -273,44 +279,47 @@ public CompletableFuture float16(Float16Request float16Request) @Override public CompletableFuture fractionalSeconds(FractionalSecondsRequest fractionalSecondsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(fractionalSecondsRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, fractionalSecondsRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "FractionalSeconds"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, FractionalSecondsResponse::builder); + operationMetadata, FractionalSecondsResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "ValidationException": - return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") - .exceptionBuilderSupplier(ValidationException::builder).build()); - case "InvalidGreeting": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") - .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); - case "ComplexError": - return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") - .exceptionBuilderSupplier(ComplexErrorException::builder).build()); - default: - return Optional.empty(); + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("FractionalSeconds").withProtocolMetadata(protocolMetadata) - .withMarshaller(new FractionalSecondsRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(fractionalSecondsRequest)); + .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())); }); @@ -347,44 +356,47 @@ public CompletableFuture fractionalSeconds(Fractional @Override public CompletableFuture greetingWithErrors(GreetingWithErrorsRequest greetingWithErrorsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(greetingWithErrorsRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, greetingWithErrorsRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GreetingWithErrors"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, GreetingWithErrorsResponse::builder); + operationMetadata, GreetingWithErrorsResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "ValidationException": - return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") - .exceptionBuilderSupplier(ValidationException::builder).build()); - case "InvalidGreeting": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") - .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); - case "ComplexError": - return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") - .exceptionBuilderSupplier(ComplexErrorException::builder).build()); - default: - return Optional.empty(); + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("GreetingWithErrors").withProtocolMetadata(protocolMetadata) - .withMarshaller(new GreetingWithErrorsRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(greetingWithErrorsRequest)); + .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())); }); @@ -420,42 +432,45 @@ public CompletableFuture greetingWithErrors(Greeting public CompletableFuture noInputOutput(NoInputOutputRequest noInputOutputRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(noInputOutputRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, noInputOutputRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "NoInputOutput"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, - NoInputOutputResponse::builder); + NoInputOutputResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "ValidationException": - return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") - .exceptionBuilderSupplier(ValidationException::builder).build()); - case "InvalidGreeting": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") - .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); - case "ComplexError": - return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") - .exceptionBuilderSupplier(ComplexErrorException::builder).build()); - default: - return Optional.empty(); + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("NoInputOutput").withProtocolMetadata(protocolMetadata) - .withMarshaller(new NoInputOutputRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(noInputOutputRequest)); + .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())); }); @@ -490,46 +505,49 @@ public CompletableFuture noInputOutput(NoInputOutputReque */ @Override public CompletableFuture operationWithDefaults( - OperationWithDefaultsRequest operationWithDefaultsRequest) { + OperationWithDefaultsRequest operationWithDefaultsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithDefaultsRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithDefaultsRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithDefaults"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, OperationWithDefaultsResponse::builder); + operationMetadata, OperationWithDefaultsResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "ValidationException": - return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") - .exceptionBuilderSupplier(ValidationException::builder).build()); - case "InvalidGreeting": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") - .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); - case "ComplexError": - return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") - .exceptionBuilderSupplier(ComplexErrorException::builder).build()); - default: - return Optional.empty(); + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OperationWithDefaults").withProtocolMetadata(protocolMetadata) - .withMarshaller(new OperationWithDefaultsRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(operationWithDefaultsRequest)); + .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())); }); @@ -563,46 +581,49 @@ public CompletableFuture operationWithDefaults( */ @Override public CompletableFuture optionalInputOutput( - OptionalInputOutputRequest optionalInputOutputRequest) { + OptionalInputOutputRequest optionalInputOutputRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(optionalInputOutputRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, optionalInputOutputRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OptionalInputOutput"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, OptionalInputOutputResponse::builder); + operationMetadata, OptionalInputOutputResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "ValidationException": - return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") - .exceptionBuilderSupplier(ValidationException::builder).build()); - case "InvalidGreeting": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") - .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); - case "ComplexError": - return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") - .exceptionBuilderSupplier(ComplexErrorException::builder).build()); - default: - return Optional.empty(); + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("OptionalInputOutput").withProtocolMetadata(protocolMetadata) - .withMarshaller(new OptionalInputOutputRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(optionalInputOutputRequest)); + .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())); }); @@ -637,44 +658,47 @@ public CompletableFuture optionalInputOutput( @Override public CompletableFuture recursiveShapes(RecursiveShapesRequest recursiveShapesRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(recursiveShapesRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, recursiveShapesRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "RecursiveShapes"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, RecursiveShapesResponse::builder); + operationMetadata, RecursiveShapesResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "ValidationException": - return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") - .exceptionBuilderSupplier(ValidationException::builder).build()); - case "InvalidGreeting": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") - .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); - case "ComplexError": - return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") - .exceptionBuilderSupplier(ComplexErrorException::builder).build()); - default: - return Optional.empty(); + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("RecursiveShapes").withProtocolMetadata(protocolMetadata) - .withMarshaller(new RecursiveShapesRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(recursiveShapesRequest)); + .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())); }); @@ -710,44 +734,47 @@ public CompletableFuture recursiveShapes(RecursiveShape @Override public CompletableFuture rpcV2CborDenseMaps(RpcV2CborDenseMapsRequest rpcV2CborDenseMapsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(rpcV2CborDenseMapsRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, rpcV2CborDenseMapsRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "RpcV2CborDenseMaps"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, RpcV2CborDenseMapsResponse::builder); + operationMetadata, RpcV2CborDenseMapsResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "ValidationException": - return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") - .exceptionBuilderSupplier(ValidationException::builder).build()); - case "InvalidGreeting": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") - .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); - case "ComplexError": - return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") - .exceptionBuilderSupplier(ComplexErrorException::builder).build()); - default: - return Optional.empty(); + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("RpcV2CborDenseMaps").withProtocolMetadata(protocolMetadata) - .withMarshaller(new RpcV2CborDenseMapsRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(rpcV2CborDenseMapsRequest)); + .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())); }); @@ -784,42 +811,45 @@ public CompletableFuture rpcV2CborDenseMaps(RpcV2Cbo public CompletableFuture rpcV2CborLists(RpcV2CborListsRequest rpcV2CborListsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(rpcV2CborListsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, rpcV2CborListsRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "RpcV2CborLists"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, RpcV2CborListsResponse::builder); + operationMetadata, RpcV2CborListsResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "ValidationException": - return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") - .exceptionBuilderSupplier(ValidationException::builder).build()); - case "InvalidGreeting": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") - .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); - case "ComplexError": - return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") - .exceptionBuilderSupplier(ComplexErrorException::builder).build()); - default: - return Optional.empty(); + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("RpcV2CborLists").withProtocolMetadata(protocolMetadata) - .withMarshaller(new RpcV2CborListsRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(rpcV2CborListsRequest)); + .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())); }); @@ -854,46 +884,49 @@ public CompletableFuture rpcV2CborLists(RpcV2CborListsRe */ @Override public CompletableFuture rpcV2CborSparseMaps( - RpcV2CborSparseMapsRequest rpcV2CborSparseMapsRequest) { + RpcV2CborSparseMapsRequest rpcV2CborSparseMapsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(rpcV2CborSparseMapsRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, rpcV2CborSparseMapsRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "RpcV2CborSparseMaps"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, RpcV2CborSparseMapsResponse::builder); + operationMetadata, RpcV2CborSparseMapsResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "ValidationException": - return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") - .exceptionBuilderSupplier(ValidationException::builder).build()); - case "InvalidGreeting": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") - .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); - case "ComplexError": - return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") - .exceptionBuilderSupplier(ComplexErrorException::builder).build()); - default: - return Optional.empty(); + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("RpcV2CborSparseMaps").withProtocolMetadata(protocolMetadata) - .withMarshaller(new RpcV2CborSparseMapsRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(rpcV2CborSparseMapsRequest)); + .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())); }); @@ -927,46 +960,49 @@ public CompletableFuture rpcV2CborSparseMaps( */ @Override public CompletableFuture simpleScalarProperties( - SimpleScalarPropertiesRequest simpleScalarPropertiesRequest) { + SimpleScalarPropertiesRequest simpleScalarPropertiesRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(simpleScalarPropertiesRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, simpleScalarPropertiesRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "SimpleScalarProperties"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, SimpleScalarPropertiesResponse::builder); + operationMetadata, SimpleScalarPropertiesResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "ValidationException": - return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") - .exceptionBuilderSupplier(ValidationException::builder).build()); - case "InvalidGreeting": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") - .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); - case "ComplexError": - return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") - .exceptionBuilderSupplier(ComplexErrorException::builder).build()); - default: - return Optional.empty(); + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("SimpleScalarProperties").withProtocolMetadata(protocolMetadata) - .withMarshaller(new SimpleScalarPropertiesRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(simpleScalarPropertiesRequest)); + .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())); }); @@ -1000,46 +1036,49 @@ public CompletableFuture simpleScalarProperties( */ @Override public CompletableFuture sparseNullsOperation( - SparseNullsOperationRequest sparseNullsOperationRequest) { + SparseNullsOperationRequest sparseNullsOperationRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(sparseNullsOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, sparseNullsOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SmithyRpcV2Protocol"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "SparseNullsOperation"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, SparseNullsOperationResponse::builder); + operationMetadata, SparseNullsOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "ValidationException": - return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") - .exceptionBuilderSupplier(ValidationException::builder).build()); - case "InvalidGreeting": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") - .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); - case "ComplexError": - return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") - .exceptionBuilderSupplier(ComplexErrorException::builder).build()); - default: - return Optional.empty(); + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("SparseNullsOperation").withProtocolMetadata(protocolMetadata) - .withMarshaller(new SparseNullsOperationRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(sparseNullsOperationRequest)); + .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())); }); @@ -1063,12 +1102,12 @@ public final String serviceName() { private > T init(T builder) { return builder.clientConfiguration(clientConfiguration) - .defaultServiceExceptionSupplier(SmithyRpcV2ProtocolException::builder) - .protocol(AwsJsonProtocol.SMITHY_RPC_V2_CBOR).protocolVersion("1.1"); + .defaultServiceExceptionSupplier(SmithyRpcV2ProtocolException::builder) + .protocol(AwsJsonProtocol.SMITHY_RPC_V2_CBOR).protocolVersion("1.1"); } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, - RequestOverrideConfiguration requestOverrideConfiguration) { + RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); @@ -1112,7 +1151,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, return configuration.build(); } SmithyRpcV2ProtocolServiceClientConfigurationBuilder serviceConfigBuilder = new SmithyRpcV2ProtocolServiceClientConfigurationBuilder( - configuration); + configuration); for (SdkPlugin plugin : plugins) { plugin.configureClient(serviceConfigBuilder); } @@ -1121,7 +1160,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, - JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { + JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); } @@ -1129,4 +1168,4 @@ private HttpResponseHandler createErrorResponseHandler(Base public void close() { clientHandler.close(); } -} +} \ No newline at end of file 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 index 5ef0371a3e73..fe4cc2f7b0eb 100644 --- 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 @@ -90,7 +90,7 @@ final class DefaultSmithyRpcV2ProtocolClient implements SmithyRpcV2ProtocolClien private static final Logger log = Logger.loggerFor(DefaultSmithyRpcV2ProtocolClient.class); private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder() - .serviceProtocol(AwsServiceProtocol.SMITHY_RPC_V2_CBOR).build(); + .serviceProtocol(AwsServiceProtocol.SMITHY_RPC_V2_CBOR).build(); private final SyncClientHandler clientHandler; @@ -122,45 +122,48 @@ protected DefaultSmithyRpcV2ProtocolClient(SdkClientConfiguration clientConfigur */ @Override public EmptyInputOutputResponse emptyInputOutput(EmptyInputOutputRequest emptyInputOutputRequest) throws AwsServiceException, - SdkClientException, SmithyRpcV2ProtocolException { + SdkClientException, SmithyRpcV2ProtocolException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, - EmptyInputOutputResponse::builder); + EmptyInputOutputResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "ValidationException": - return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") - .exceptionBuilderSupplier(ValidationException::builder).build()); - case "InvalidGreeting": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") - .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); - case "ComplexError": - return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") - .exceptionBuilderSupplier(ComplexErrorException::builder).build()); - default: - return Optional.empty(); + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(emptyInputOutputRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, emptyInputOutputRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .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))); + .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())); } @@ -184,43 +187,46 @@ public EmptyInputOutputResponse emptyInputOutput(EmptyInputOutputRequest emptyIn */ @Override public Float16Response float16(Float16Request float16Request) throws AwsServiceException, SdkClientException, - SmithyRpcV2ProtocolException { + SmithyRpcV2ProtocolException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, - Float16Response::builder); + Float16Response::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "ValidationException": - return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") - .exceptionBuilderSupplier(ValidationException::builder).build()); - case "InvalidGreeting": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") - .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); - case "ComplexError": - return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") - .exceptionBuilderSupplier(ComplexErrorException::builder).build()); - default: - return Optional.empty(); + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(float16Request, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, float16Request - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .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))); + .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())); } @@ -244,45 +250,48 @@ public Float16Response float16(Float16Request float16Request) throws AwsServiceE */ @Override public FractionalSecondsResponse fractionalSeconds(FractionalSecondsRequest fractionalSecondsRequest) - throws AwsServiceException, SdkClientException, SmithyRpcV2ProtocolException { + throws AwsServiceException, SdkClientException, SmithyRpcV2ProtocolException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, - FractionalSecondsResponse::builder); + FractionalSecondsResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "ValidationException": - return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") - .exceptionBuilderSupplier(ValidationException::builder).build()); - case "InvalidGreeting": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") - .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); - case "ComplexError": - return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") - .exceptionBuilderSupplier(ComplexErrorException::builder).build()); - default: - return Optional.empty(); + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(fractionalSecondsRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, fractionalSecondsRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .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))); + .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())); } @@ -308,46 +317,49 @@ public FractionalSecondsResponse fractionalSeconds(FractionalSecondsRequest frac */ @Override public GreetingWithErrorsResponse greetingWithErrors(GreetingWithErrorsRequest greetingWithErrorsRequest) - throws ComplexErrorException, InvalidGreetingException, AwsServiceException, SdkClientException, - SmithyRpcV2ProtocolException { + throws ComplexErrorException, InvalidGreetingException, AwsServiceException, SdkClientException, + SmithyRpcV2ProtocolException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, GreetingWithErrorsResponse::builder); + operationMetadata, GreetingWithErrorsResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "ValidationException": - return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") - .exceptionBuilderSupplier(ValidationException::builder).build()); - case "InvalidGreeting": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") - .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); - case "ComplexError": - return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") - .exceptionBuilderSupplier(ComplexErrorException::builder).build()); - default: - return Optional.empty(); + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(greetingWithErrorsRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, greetingWithErrorsRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .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))); + .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())); } @@ -371,44 +383,47 @@ public GreetingWithErrorsResponse greetingWithErrors(GreetingWithErrorsRequest g */ @Override public NoInputOutputResponse noInputOutput(NoInputOutputRequest noInputOutputRequest) throws AwsServiceException, - SdkClientException, SmithyRpcV2ProtocolException { + SdkClientException, SmithyRpcV2ProtocolException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, - NoInputOutputResponse::builder); + NoInputOutputResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "ValidationException": - return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") - .exceptionBuilderSupplier(ValidationException::builder).build()); - case "InvalidGreeting": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") - .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); - case "ComplexError": - return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") - .exceptionBuilderSupplier(ComplexErrorException::builder).build()); - default: - return Optional.empty(); + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(noInputOutputRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, noInputOutputRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .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))); + .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())); } @@ -433,45 +448,48 @@ public NoInputOutputResponse noInputOutput(NoInputOutputRequest noInputOutputReq */ @Override public OperationWithDefaultsResponse operationWithDefaults(OperationWithDefaultsRequest operationWithDefaultsRequest) - throws ValidationException, AwsServiceException, SdkClientException, SmithyRpcV2ProtocolException { + throws ValidationException, AwsServiceException, SdkClientException, SmithyRpcV2ProtocolException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, OperationWithDefaultsResponse::builder); + operationMetadata, OperationWithDefaultsResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "ValidationException": - return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") - .exceptionBuilderSupplier(ValidationException::builder).build()); - case "InvalidGreeting": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") - .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); - case "ComplexError": - return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") - .exceptionBuilderSupplier(ComplexErrorException::builder).build()); - default: - return Optional.empty(); + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithDefaultsRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithDefaultsRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .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))); + .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())); } @@ -495,45 +513,48 @@ public OperationWithDefaultsResponse operationWithDefaults(OperationWithDefaults */ @Override public OptionalInputOutputResponse optionalInputOutput(OptionalInputOutputRequest optionalInputOutputRequest) - throws AwsServiceException, SdkClientException, SmithyRpcV2ProtocolException { + throws AwsServiceException, SdkClientException, SmithyRpcV2ProtocolException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, OptionalInputOutputResponse::builder); + operationMetadata, OptionalInputOutputResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "ValidationException": - return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") - .exceptionBuilderSupplier(ValidationException::builder).build()); - case "InvalidGreeting": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") - .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); - case "ComplexError": - return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") - .exceptionBuilderSupplier(ComplexErrorException::builder).build()); - default: - return Optional.empty(); + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(optionalInputOutputRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, optionalInputOutputRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .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))); + .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())); } @@ -557,45 +578,48 @@ public OptionalInputOutputResponse optionalInputOutput(OptionalInputOutputReques */ @Override public RecursiveShapesResponse recursiveShapes(RecursiveShapesRequest recursiveShapesRequest) throws AwsServiceException, - SdkClientException, SmithyRpcV2ProtocolException { + SdkClientException, SmithyRpcV2ProtocolException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, - RecursiveShapesResponse::builder); + RecursiveShapesResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "ValidationException": - return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") - .exceptionBuilderSupplier(ValidationException::builder).build()); - case "InvalidGreeting": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") - .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); - case "ComplexError": - return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") - .exceptionBuilderSupplier(ComplexErrorException::builder).build()); - default: - return Optional.empty(); + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(recursiveShapesRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, recursiveShapesRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .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))); + .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())); } @@ -620,45 +644,48 @@ public RecursiveShapesResponse recursiveShapes(RecursiveShapesRequest recursiveS */ @Override public RpcV2CborDenseMapsResponse rpcV2CborDenseMaps(RpcV2CborDenseMapsRequest rpcV2CborDenseMapsRequest) - throws ValidationException, AwsServiceException, SdkClientException, SmithyRpcV2ProtocolException { + throws ValidationException, AwsServiceException, SdkClientException, SmithyRpcV2ProtocolException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, RpcV2CborDenseMapsResponse::builder); + operationMetadata, RpcV2CborDenseMapsResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "ValidationException": - return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") - .exceptionBuilderSupplier(ValidationException::builder).build()); - case "InvalidGreeting": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") - .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); - case "ComplexError": - return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") - .exceptionBuilderSupplier(ComplexErrorException::builder).build()); - default: - return Optional.empty(); + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(rpcV2CborDenseMapsRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, rpcV2CborDenseMapsRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .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))); + .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())); } @@ -683,44 +710,47 @@ public RpcV2CborDenseMapsResponse rpcV2CborDenseMaps(RpcV2CborDenseMapsRequest r */ @Override public RpcV2CborListsResponse rpcV2CborLists(RpcV2CborListsRequest rpcV2CborListsRequest) throws ValidationException, - AwsServiceException, SdkClientException, SmithyRpcV2ProtocolException { + AwsServiceException, SdkClientException, SmithyRpcV2ProtocolException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, - RpcV2CborListsResponse::builder); + RpcV2CborListsResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "ValidationException": - return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") - .exceptionBuilderSupplier(ValidationException::builder).build()); - case "InvalidGreeting": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") - .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); - case "ComplexError": - return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") - .exceptionBuilderSupplier(ComplexErrorException::builder).build()); - default: - return Optional.empty(); + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(rpcV2CborListsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, rpcV2CborListsRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .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))); + .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())); } @@ -745,45 +775,48 @@ public RpcV2CborListsResponse rpcV2CborLists(RpcV2CborListsRequest rpcV2CborList */ @Override public RpcV2CborSparseMapsResponse rpcV2CborSparseMaps(RpcV2CborSparseMapsRequest rpcV2CborSparseMapsRequest) - throws ValidationException, AwsServiceException, SdkClientException, SmithyRpcV2ProtocolException { + throws ValidationException, AwsServiceException, SdkClientException, SmithyRpcV2ProtocolException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, RpcV2CborSparseMapsResponse::builder); + operationMetadata, RpcV2CborSparseMapsResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "ValidationException": - return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") - .exceptionBuilderSupplier(ValidationException::builder).build()); - case "InvalidGreeting": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") - .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); - case "ComplexError": - return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") - .exceptionBuilderSupplier(ComplexErrorException::builder).build()); - default: - return Optional.empty(); + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(rpcV2CborSparseMapsRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, rpcV2CborSparseMapsRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .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))); + .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())); } @@ -807,46 +840,49 @@ public RpcV2CborSparseMapsResponse rpcV2CborSparseMaps(RpcV2CborSparseMapsReques */ @Override public SimpleScalarPropertiesResponse simpleScalarProperties(SimpleScalarPropertiesRequest simpleScalarPropertiesRequest) - throws AwsServiceException, SdkClientException, SmithyRpcV2ProtocolException { + throws AwsServiceException, SdkClientException, SmithyRpcV2ProtocolException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, SimpleScalarPropertiesResponse::builder); + operationMetadata, SimpleScalarPropertiesResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "ValidationException": - return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") - .exceptionBuilderSupplier(ValidationException::builder).build()); - case "InvalidGreeting": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") - .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); - case "ComplexError": - return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") - .exceptionBuilderSupplier(ComplexErrorException::builder).build()); - default: - return Optional.empty(); + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(simpleScalarPropertiesRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, simpleScalarPropertiesRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .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))); + .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())); } @@ -870,45 +906,48 @@ public SimpleScalarPropertiesResponse simpleScalarProperties(SimpleScalarPropert */ @Override public SparseNullsOperationResponse sparseNullsOperation(SparseNullsOperationRequest sparseNullsOperationRequest) - throws AwsServiceException, SdkClientException, SmithyRpcV2ProtocolException { + throws AwsServiceException, SdkClientException, SmithyRpcV2ProtocolException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, SparseNullsOperationResponse::builder); + operationMetadata, SparseNullsOperationResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "ValidationException": - return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") - .exceptionBuilderSupplier(ValidationException::builder).build()); - case "InvalidGreeting": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") - .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); - case "ComplexError": - return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") - .exceptionBuilderSupplier(ComplexErrorException::builder).build()); - default: - return Optional.empty(); + case "ValidationException": + return Optional.of(ExceptionMetadata.builder().errorCode("ValidationException") + .exceptionBuilderSupplier(ValidationException::builder).build()); + case "InvalidGreeting": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidGreeting") + .exceptionBuilderSupplier(InvalidGreetingException::builder).build()); + case "ComplexError": + return Optional.of(ExceptionMetadata.builder().errorCode("ComplexError") + .exceptionBuilderSupplier(ComplexErrorException::builder).build()); + default: + return Optional.empty(); } }; HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(sparseNullsOperationRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, sparseNullsOperationRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .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))); + .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())); } @@ -920,7 +959,7 @@ public final String serviceName() { } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, - RequestOverrideConfiguration requestOverrideConfiguration) { + RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); @@ -935,7 +974,7 @@ private static List resolveMetricPublishers(SdkClientConfigurat } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, - JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { + JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); } @@ -969,7 +1008,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, return configuration.build(); } SmithyRpcV2ProtocolServiceClientConfigurationBuilder serviceConfigBuilder = new SmithyRpcV2ProtocolServiceClientConfigurationBuilder( - configuration); + configuration); for (SdkPlugin plugin : plugins) { plugin.configureClient(serviceConfigBuilder); } @@ -979,8 +1018,8 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, private > T init(T builder) { return builder.clientConfiguration(clientConfiguration) - .defaultServiceExceptionSupplier(SmithyRpcV2ProtocolException::builder) - .protocol(AwsJsonProtocol.SMITHY_RPC_V2_CBOR).protocolVersion("1.1"); + .defaultServiceExceptionSupplier(SmithyRpcV2ProtocolException::builder) + .protocol(AwsJsonProtocol.SMITHY_RPC_V2_CBOR).protocolVersion("1.1"); } @Override diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-async-client-class.java index 1db56c43e67b..81f2c6ffd395 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-async-client-class.java @@ -92,7 +92,7 @@ final class DefaultDatabaseAsyncClient implements DatabaseAsyncClient { private static final Logger log = LoggerFactory.getLogger(DefaultDatabaseAsyncClient.class); private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder() - .serviceProtocol(AwsServiceProtocol.REST_JSON).build(); + .serviceProtocol(AwsServiceProtocol.REST_JSON).build(); private final AsyncClientHandler clientHandler; @@ -134,36 +134,38 @@ protected DefaultDatabaseAsyncClient(SdkClientConfiguration clientConfiguration) public CompletableFuture deleteRow(DeleteRowRequest deleteRowRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteRowRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteRowRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Database Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteRow"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, - DeleteRowResponse::builder); + DeleteRowResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams().withOperationName("DeleteRow") - .withProtocolMetadata(protocolMetadata) - .withMarshaller(new DeleteRowRequestMarshaller(protocolFactory)).withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) - .withMetricCollector(apiCallMetricCollector).withInput(deleteRowRequest)); + .execute(new ClientExecutionParams().withOperationName("DeleteRow") + .withProtocolMetadata(protocolMetadata) + .withMarshaller(new DeleteRowRequestMarshaller(protocolFactory)).withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) + .withMetricCollector(apiCallMetricCollector).withInput(deleteRowRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -203,36 +205,38 @@ public CompletableFuture deleteRow(DeleteRowRequest deleteRow public CompletableFuture getRow(GetRowRequest getRowRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getRowRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getRowRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Database Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetRow"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, - GetRowResponse::builder); + GetRowResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams().withOperationName("GetRow") - .withProtocolMetadata(protocolMetadata).withMarshaller(new GetRowRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(getRowRequest)); + .execute(new ClientExecutionParams().withOperationName("GetRow") + .withProtocolMetadata(protocolMetadata).withMarshaller(new GetRowRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(getRowRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -272,41 +276,43 @@ public CompletableFuture getRow(GetRowRequest getRowRequest) { */ @Override public CompletableFuture opWithSigv4AndSigv4aUnSignedPayload( - OpWithSigv4AndSigv4AUnSignedPayloadRequest opWithSigv4AndSigv4AUnSignedPayloadRequest) { + OpWithSigv4AndSigv4AUnSignedPayloadRequest opWithSigv4AndSigv4AUnSignedPayloadRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(opWithSigv4AndSigv4AUnSignedPayloadRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - opWithSigv4AndSigv4AUnSignedPayloadRequest.overrideConfiguration().orElse(null)); + opWithSigv4AndSigv4AUnSignedPayloadRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Database Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "opWithSigv4AndSigv4aUnSignedPayload"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(operationMetadata, OpWithSigv4AndSigv4AUnSignedPayloadResponse::builder); + .createResponseHandler(operationMetadata, OpWithSigv4AndSigv4AUnSignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("opWithSigv4AndSigv4aUnSignedPayload").withProtocolMetadata(protocolMetadata) - .withMarshaller(new OpWithSigv4AndSigv4AUnSignedPayloadRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(opWithSigv4AndSigv4AUnSignedPayloadRequest)); + .execute(new ClientExecutionParams() + .withOperationName("opWithSigv4AndSigv4aUnSignedPayload").withProtocolMetadata(protocolMetadata) + .withMarshaller(new OpWithSigv4AndSigv4AUnSignedPayloadRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(opWithSigv4AndSigv4AUnSignedPayloadRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -344,41 +350,43 @@ public CompletableFuture opWithSigv */ @Override public CompletableFuture opWithSigv4SignedPayload( - OpWithSigv4SignedPayloadRequest opWithSigv4SignedPayloadRequest) { + OpWithSigv4SignedPayloadRequest opWithSigv4SignedPayloadRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(opWithSigv4SignedPayloadRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, opWithSigv4SignedPayloadRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Database Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "opWithSigv4SignedPayload"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, OpWithSigv4SignedPayloadResponse::builder); + operationMetadata, OpWithSigv4SignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("opWithSigv4SignedPayload").withProtocolMetadata(protocolMetadata) - .withMarshaller(new OpWithSigv4SignedPayloadRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(opWithSigv4SignedPayloadRequest)); + .execute(new ClientExecutionParams() + .withOperationName("opWithSigv4SignedPayload").withProtocolMetadata(protocolMetadata) + .withMarshaller(new OpWithSigv4SignedPayloadRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(opWithSigv4SignedPayloadRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -416,41 +424,43 @@ public CompletableFuture opWithSigv4SignedPayl */ @Override public CompletableFuture opWithSigv4UnSignedPayload( - OpWithSigv4UnSignedPayloadRequest opWithSigv4UnSignedPayloadRequest) { + OpWithSigv4UnSignedPayloadRequest opWithSigv4UnSignedPayloadRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(opWithSigv4UnSignedPayloadRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, opWithSigv4UnSignedPayloadRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Database Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "opWithSigv4UnSignedPayload"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, OpWithSigv4UnSignedPayloadResponse::builder); + operationMetadata, OpWithSigv4UnSignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("opWithSigv4UnSignedPayload").withProtocolMetadata(protocolMetadata) - .withMarshaller(new OpWithSigv4UnSignedPayloadRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(opWithSigv4UnSignedPayloadRequest)); + .execute(new ClientExecutionParams() + .withOperationName("opWithSigv4UnSignedPayload").withProtocolMetadata(protocolMetadata) + .withMarshaller(new OpWithSigv4UnSignedPayloadRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(opWithSigv4UnSignedPayloadRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -495,56 +505,58 @@ public CompletableFuture opWithSigv4UnSigned */ @Override public CompletableFuture opWithSigv4UnSignedPayloadAndStreaming( - OpWithSigv4UnSignedPayloadAndStreamingRequest opWithSigv4UnSignedPayloadAndStreamingRequest, - AsyncRequestBody requestBody) { + OpWithSigv4UnSignedPayloadAndStreamingRequest opWithSigv4UnSignedPayloadAndStreamingRequest, + AsyncRequestBody requestBody) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(opWithSigv4UnSignedPayloadAndStreamingRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - opWithSigv4UnSignedPayloadAndStreamingRequest.overrideConfiguration().orElse(null)); + opWithSigv4UnSignedPayloadAndStreamingRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Database Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "opWithSigv4UnSignedPayloadAndStreaming"); if (!isSignerOverridden(clientConfiguration)) { opWithSigv4UnSignedPayloadAndStreamingRequest = applySignerOverride( - opWithSigv4UnSignedPayloadAndStreamingRequest, AsyncAws4Signer.create()); + opWithSigv4UnSignedPayloadAndStreamingRequest, AsyncAws4Signer.create()); } JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(operationMetadata, OpWithSigv4UnSignedPayloadAndStreamingResponse::builder); + .createResponseHandler(operationMetadata, OpWithSigv4UnSignedPayloadAndStreamingResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("opWithSigv4UnSignedPayloadAndStreaming") - .withProtocolMetadata(protocolMetadata) - .withMarshaller( - AsyncStreamingRequestMarshaller - .builder() - .delegateMarshaller( - new OpWithSigv4UnSignedPayloadAndStreamingRequestMarshaller(protocolFactory)) - .asyncRequestBody(requestBody).transferEncoding(true).build()) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withAsyncRequestBody(requestBody).withInput(opWithSigv4UnSignedPayloadAndStreamingRequest)); + .execute(new ClientExecutionParams() + .withOperationName("opWithSigv4UnSignedPayloadAndStreaming") + .withProtocolMetadata(protocolMetadata) + .withMarshaller( + AsyncStreamingRequestMarshaller + .builder() + .delegateMarshaller( + new OpWithSigv4UnSignedPayloadAndStreamingRequestMarshaller(protocolFactory)) + .asyncRequestBody(requestBody).transferEncoding(true).build()) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withAsyncRequestBody(requestBody).withInput(opWithSigv4UnSignedPayloadAndStreamingRequest)); CompletableFuture whenCompleted = executeFuture - .whenComplete((r, e) -> { - metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); - }); + .whenComplete((r, e) -> { + metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); + }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { @@ -579,41 +591,43 @@ public CompletableFuture opWithS */ @Override public CompletableFuture opWithSigv4aSignedPayload( - OpWithSigv4ASignedPayloadRequest opWithSigv4ASignedPayloadRequest) { + OpWithSigv4ASignedPayloadRequest opWithSigv4ASignedPayloadRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(opWithSigv4ASignedPayloadRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, opWithSigv4ASignedPayloadRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Database Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "opWithSigv4aSignedPayload"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, OpWithSigv4ASignedPayloadResponse::builder); + operationMetadata, OpWithSigv4ASignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("opWithSigv4aSignedPayload").withProtocolMetadata(protocolMetadata) - .withMarshaller(new OpWithSigv4ASignedPayloadRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(opWithSigv4ASignedPayloadRequest)); + .execute(new ClientExecutionParams() + .withOperationName("opWithSigv4aSignedPayload").withProtocolMetadata(protocolMetadata) + .withMarshaller(new OpWithSigv4ASignedPayloadRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(opWithSigv4ASignedPayloadRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -651,41 +665,43 @@ public CompletableFuture opWithSigv4aSignedPa */ @Override public CompletableFuture opWithSigv4aUnSignedPayload( - OpWithSigv4AUnSignedPayloadRequest opWithSigv4AUnSignedPayloadRequest) { + OpWithSigv4AUnSignedPayloadRequest opWithSigv4AUnSignedPayloadRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(opWithSigv4AUnSignedPayloadRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, opWithSigv4AUnSignedPayloadRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Database Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "opWithSigv4aUnSignedPayload"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, OpWithSigv4AUnSignedPayloadResponse::builder); + operationMetadata, OpWithSigv4AUnSignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("opWithSigv4aUnSignedPayload").withProtocolMetadata(protocolMetadata) - .withMarshaller(new OpWithSigv4AUnSignedPayloadRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(opWithSigv4AUnSignedPayloadRequest)); + .execute(new ClientExecutionParams() + .withOperationName("opWithSigv4aUnSignedPayload").withProtocolMetadata(protocolMetadata) + .withMarshaller(new OpWithSigv4AUnSignedPayloadRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(opWithSigv4AUnSignedPayloadRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -725,41 +741,43 @@ public CompletableFuture opWithSigv4aUnSign */ @Override public CompletableFuture opsWithSigv4andSigv4aSignedPayload( - OpsWithSigv4AndSigv4ASignedPayloadRequest opsWithSigv4AndSigv4ASignedPayloadRequest) { + OpsWithSigv4AndSigv4ASignedPayloadRequest opsWithSigv4AndSigv4ASignedPayloadRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(opsWithSigv4AndSigv4ASignedPayloadRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - opsWithSigv4AndSigv4ASignedPayloadRequest.overrideConfiguration().orElse(null)); + opsWithSigv4AndSigv4ASignedPayloadRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Database Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "opsWithSigv4andSigv4aSignedPayload"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(operationMetadata, OpsWithSigv4AndSigv4ASignedPayloadResponse::builder); + .createResponseHandler(operationMetadata, OpsWithSigv4AndSigv4ASignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("opsWithSigv4andSigv4aSignedPayload").withProtocolMetadata(protocolMetadata) - .withMarshaller(new OpsWithSigv4AndSigv4ASignedPayloadRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(opsWithSigv4AndSigv4ASignedPayloadRequest)); + .execute(new ClientExecutionParams() + .withOperationName("opsWithSigv4andSigv4aSignedPayload").withProtocolMetadata(protocolMetadata) + .withMarshaller(new OpsWithSigv4AndSigv4ASignedPayloadRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(opsWithSigv4AndSigv4ASignedPayloadRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -799,36 +817,38 @@ public CompletableFuture opsWithSigv public CompletableFuture putRow(PutRowRequest putRowRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putRowRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, putRowRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Database Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PutRow"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, - PutRowResponse::builder); + PutRowResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams().withOperationName("PutRow") - .withProtocolMetadata(protocolMetadata).withMarshaller(new PutRowRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(putRowRequest)); + .execute(new ClientExecutionParams().withOperationName("PutRow") + .withProtocolMetadata(protocolMetadata).withMarshaller(new PutRowRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(putRowRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); @@ -868,45 +888,47 @@ public CompletableFuture putRow(PutRowRequest putRowRequest) { */ @Override public CompletableFuture secondOpsWithSigv4andSigv4aSignedPayload( - SecondOpsWithSigv4AndSigv4ASignedPayloadRequest secondOpsWithSigv4AndSigv4ASignedPayloadRequest) { + SecondOpsWithSigv4AndSigv4ASignedPayloadRequest secondOpsWithSigv4AndSigv4ASignedPayloadRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration( - secondOpsWithSigv4AndSigv4ASignedPayloadRequest, this.clientConfiguration); + secondOpsWithSigv4AndSigv4ASignedPayloadRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - secondOpsWithSigv4AndSigv4ASignedPayloadRequest.overrideConfiguration().orElse(null)); + secondOpsWithSigv4AndSigv4ASignedPayloadRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Database Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "secondOpsWithSigv4andSigv4aSignedPayload"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(operationMetadata, SecondOpsWithSigv4AndSigv4ASignedPayloadResponse::builder); + .createResponseHandler(operationMetadata, SecondOpsWithSigv4AndSigv4ASignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); CompletableFuture executeFuture = clientHandler - .execute(new ClientExecutionParams() - .withOperationName("secondOpsWithSigv4andSigv4aSignedPayload").withProtocolMetadata(protocolMetadata) - .withMarshaller(new SecondOpsWithSigv4AndSigv4ASignedPayloadRequestMarshaller(protocolFactory)) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) - .withInput(secondOpsWithSigv4AndSigv4ASignedPayloadRequest)); + .execute(new ClientExecutionParams() + .withOperationName("secondOpsWithSigv4andSigv4aSignedPayload").withProtocolMetadata(protocolMetadata) + .withMarshaller(new SecondOpsWithSigv4AndSigv4ASignedPayloadRequestMarshaller(protocolFactory)) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) + .withInput(secondOpsWithSigv4AndSigv4ASignedPayloadRequest)); CompletableFuture whenCompleted = executeFuture - .whenComplete((r, e) -> { - metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); - }); + .whenComplete((r, e) -> { + metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); + }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { @@ -927,11 +949,11 @@ public final String serviceName() { private > T init(T builder) { return builder.clientConfiguration(clientConfiguration).defaultServiceExceptionSupplier(DatabaseException::builder) - .protocol(AwsJsonProtocol.REST_JSON).protocolVersion("1.1"); + .protocol(AwsJsonProtocol.REST_JSON).protocolVersion("1.1"); } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, - RequestOverrideConfiguration requestOverrideConfiguration) { + RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); @@ -951,8 +973,8 @@ private T applySignerOverride(T request, Signer sign } Consumer signerOverride = b -> b.signer(signer).build(); AwsRequestOverrideConfiguration overrideConfiguration = request.overrideConfiguration() - .map(c -> c.toBuilder().applyMutation(signerOverride).build()) - .orElse((AwsRequestOverrideConfiguration.builder().applyMutation(signerOverride).build())); + .map(c -> c.toBuilder().applyMutation(signerOverride).build()) + .orElse((AwsRequestOverrideConfiguration.builder().applyMutation(signerOverride).build())); return (T) request.toBuilder().overrideConfiguration(overrideConfiguration).build(); } @@ -990,7 +1012,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, return configuration.build(); } DatabaseServiceClientConfigurationBuilder serviceConfigBuilder = new DatabaseServiceClientConfigurationBuilder( - configuration); + configuration); for (SdkPlugin plugin : plugins) { plugin.configureClient(serviceConfigBuilder); } @@ -999,7 +1021,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, - JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { + JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); } diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-sync-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-sync-client-class.java index 265edeb3ee00..656846b6a453 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-sync-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-unsigned-payload-trait-sync-client-class.java @@ -84,7 +84,7 @@ final class DefaultDatabaseClient implements DatabaseClient { private static final Logger log = Logger.loggerFor(DefaultDatabaseClient.class); private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder() - .serviceProtocol(AwsServiceProtocol.REST_JSON).build(); + .serviceProtocol(AwsServiceProtocol.REST_JSON).build(); private final SyncClientHandler clientHandler; @@ -120,38 +120,40 @@ protected DefaultDatabaseClient(SdkClientConfiguration clientConfiguration) { */ @Override public DeleteRowResponse deleteRow(DeleteRowRequest deleteRowRequest) throws InvalidInputException, AwsServiceException, - SdkClientException, DatabaseException { + SdkClientException, DatabaseException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, - DeleteRowResponse::builder); + DeleteRowResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteRowRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteRowRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Database Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteRow"); return clientHandler.execute(new ClientExecutionParams() - .withOperationName("DeleteRow").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) - .withInput(deleteRowRequest).withMetricCollector(apiCallMetricCollector) - .withMarshaller(new DeleteRowRequestMarshaller(protocolFactory))); + .withOperationName("DeleteRow").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) + .withInput(deleteRowRequest).withMetricCollector(apiCallMetricCollector) + .withMarshaller(new DeleteRowRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -179,38 +181,40 @@ public DeleteRowResponse deleteRow(DeleteRowRequest deleteRowRequest) throws Inv */ @Override public GetRowResponse getRow(GetRowRequest getRowRequest) throws InvalidInputException, AwsServiceException, - SdkClientException, DatabaseException { + SdkClientException, DatabaseException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, - GetRowResponse::builder); + GetRowResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getRowRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getRowRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Database Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetRow"); return clientHandler.execute(new ClientExecutionParams().withOperationName("GetRow") - .withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) - .withInput(getRowRequest).withMetricCollector(apiCallMetricCollector) - .withMarshaller(new GetRowRequestMarshaller(protocolFactory))); + .withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) + .withInput(getRowRequest).withMetricCollector(apiCallMetricCollector) + .withMarshaller(new GetRowRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -238,38 +242,40 @@ public GetRowResponse getRow(GetRowRequest getRowRequest) throws InvalidInputExc */ @Override public PutRowResponse putRow(PutRowRequest putRowRequest) throws InvalidInputException, AwsServiceException, - SdkClientException, DatabaseException { + SdkClientException, DatabaseException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, - PutRowResponse::builder); + PutRowResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putRowRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, putRowRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Database Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PutRow"); return clientHandler.execute(new ClientExecutionParams().withOperationName("PutRow") - .withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) - .withInput(putRowRequest).withMetricCollector(apiCallMetricCollector) - .withMarshaller(new PutRowRequestMarshaller(protocolFactory))); + .withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) + .withInput(putRowRequest).withMetricCollector(apiCallMetricCollector) + .withMarshaller(new PutRowRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -298,42 +304,44 @@ public PutRowResponse putRow(PutRowRequest putRowRequest) throws InvalidInputExc */ @Override public OpWithSigv4AndSigv4AUnSignedPayloadResponse opWithSigv4AndSigv4aUnSignedPayload( - OpWithSigv4AndSigv4AUnSignedPayloadRequest opWithSigv4AndSigv4AUnSignedPayloadRequest) throws InvalidInputException, - AwsServiceException, SdkClientException, DatabaseException { + OpWithSigv4AndSigv4AUnSignedPayloadRequest opWithSigv4AndSigv4AUnSignedPayloadRequest) throws InvalidInputException, + AwsServiceException, SdkClientException, DatabaseException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, OpWithSigv4AndSigv4AUnSignedPayloadResponse::builder); + operationMetadata, OpWithSigv4AndSigv4AUnSignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(opWithSigv4AndSigv4AUnSignedPayloadRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - opWithSigv4AndSigv4AUnSignedPayloadRequest.overrideConfiguration().orElse(null)); + opWithSigv4AndSigv4AUnSignedPayloadRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Database Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "opWithSigv4AndSigv4aUnSignedPayload"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("opWithSigv4AndSigv4aUnSignedPayload").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(opWithSigv4AndSigv4AUnSignedPayloadRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new OpWithSigv4AndSigv4AUnSignedPayloadRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("opWithSigv4AndSigv4aUnSignedPayload").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(opWithSigv4AndSigv4AUnSignedPayloadRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new OpWithSigv4AndSigv4AUnSignedPayloadRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -361,42 +369,44 @@ public OpWithSigv4AndSigv4AUnSignedPayloadResponse opWithSigv4AndSigv4aUnSignedP */ @Override public OpWithSigv4SignedPayloadResponse opWithSigv4SignedPayload( - OpWithSigv4SignedPayloadRequest opWithSigv4SignedPayloadRequest) throws InvalidInputException, AwsServiceException, - SdkClientException, DatabaseException { + OpWithSigv4SignedPayloadRequest opWithSigv4SignedPayloadRequest) throws InvalidInputException, AwsServiceException, + SdkClientException, DatabaseException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, OpWithSigv4SignedPayloadResponse::builder); + operationMetadata, OpWithSigv4SignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(opWithSigv4SignedPayloadRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, opWithSigv4SignedPayloadRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Database Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "opWithSigv4SignedPayload"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("opWithSigv4SignedPayload").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(opWithSigv4SignedPayloadRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new OpWithSigv4SignedPayloadRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("opWithSigv4SignedPayload").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(opWithSigv4SignedPayloadRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new OpWithSigv4SignedPayloadRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -424,42 +434,44 @@ public OpWithSigv4SignedPayloadResponse opWithSigv4SignedPayload( */ @Override public OpWithSigv4UnSignedPayloadResponse opWithSigv4UnSignedPayload( - OpWithSigv4UnSignedPayloadRequest opWithSigv4UnSignedPayloadRequest) throws InvalidInputException, - AwsServiceException, SdkClientException, DatabaseException { + OpWithSigv4UnSignedPayloadRequest opWithSigv4UnSignedPayloadRequest) throws InvalidInputException, + AwsServiceException, SdkClientException, DatabaseException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, OpWithSigv4UnSignedPayloadResponse::builder); + operationMetadata, OpWithSigv4UnSignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(opWithSigv4UnSignedPayloadRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, opWithSigv4UnSignedPayloadRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Database Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "opWithSigv4UnSignedPayload"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("opWithSigv4UnSignedPayload").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(opWithSigv4UnSignedPayloadRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new OpWithSigv4UnSignedPayloadRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("opWithSigv4UnSignedPayload").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(opWithSigv4UnSignedPayloadRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new OpWithSigv4UnSignedPayloadRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -499,51 +511,53 @@ public OpWithSigv4UnSignedPayloadResponse opWithSigv4UnSignedPayload( */ @Override public OpWithSigv4UnSignedPayloadAndStreamingResponse opWithSigv4UnSignedPayloadAndStreaming( - OpWithSigv4UnSignedPayloadAndStreamingRequest opWithSigv4UnSignedPayloadAndStreamingRequest, RequestBody requestBody) - throws InvalidInputException, AwsServiceException, SdkClientException, DatabaseException { + OpWithSigv4UnSignedPayloadAndStreamingRequest opWithSigv4UnSignedPayloadAndStreamingRequest, RequestBody requestBody) + throws InvalidInputException, AwsServiceException, SdkClientException, DatabaseException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(operationMetadata, OpWithSigv4UnSignedPayloadAndStreamingResponse::builder); + .createResponseHandler(operationMetadata, OpWithSigv4UnSignedPayloadAndStreamingResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(opWithSigv4UnSignedPayloadAndStreamingRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - opWithSigv4UnSignedPayloadAndStreamingRequest.overrideConfiguration().orElse(null)); + opWithSigv4UnSignedPayloadAndStreamingRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Database Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "opWithSigv4UnSignedPayloadAndStreaming"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("opWithSigv4UnSignedPayloadAndStreaming") - .withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler) - .withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withInput(opWithSigv4UnSignedPayloadAndStreamingRequest) - .withMetricCollector(apiCallMetricCollector) - .withRequestBody(requestBody) - .withMarshaller( - StreamingRequestMarshaller - .builder() - .delegateMarshaller( - new OpWithSigv4UnSignedPayloadAndStreamingRequestMarshaller(protocolFactory)) - .requestBody(requestBody).transferEncoding(true).build())); + .execute(new ClientExecutionParams() + .withOperationName("opWithSigv4UnSignedPayloadAndStreaming") + .withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler) + .withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withInput(opWithSigv4UnSignedPayloadAndStreamingRequest) + .withMetricCollector(apiCallMetricCollector) + .withRequestBody(requestBody) + .withMarshaller( + StreamingRequestMarshaller + .builder() + .delegateMarshaller( + new OpWithSigv4UnSignedPayloadAndStreamingRequestMarshaller(protocolFactory)) + .requestBody(requestBody).transferEncoding(true).build())); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -571,42 +585,44 @@ public OpWithSigv4UnSignedPayloadAndStreamingResponse opWithSigv4UnSignedPayload */ @Override public OpWithSigv4ASignedPayloadResponse opWithSigv4aSignedPayload( - OpWithSigv4ASignedPayloadRequest opWithSigv4ASignedPayloadRequest) throws InvalidInputException, AwsServiceException, - SdkClientException, DatabaseException { + OpWithSigv4ASignedPayloadRequest opWithSigv4ASignedPayloadRequest) throws InvalidInputException, AwsServiceException, + SdkClientException, DatabaseException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, OpWithSigv4ASignedPayloadResponse::builder); + operationMetadata, OpWithSigv4ASignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(opWithSigv4ASignedPayloadRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, opWithSigv4ASignedPayloadRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Database Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "opWithSigv4aSignedPayload"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("opWithSigv4aSignedPayload").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(opWithSigv4ASignedPayloadRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new OpWithSigv4ASignedPayloadRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("opWithSigv4aSignedPayload").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(opWithSigv4ASignedPayloadRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new OpWithSigv4ASignedPayloadRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -634,42 +650,44 @@ public OpWithSigv4ASignedPayloadResponse opWithSigv4aSignedPayload( */ @Override public OpWithSigv4AUnSignedPayloadResponse opWithSigv4aUnSignedPayload( - OpWithSigv4AUnSignedPayloadRequest opWithSigv4AUnSignedPayloadRequest) throws InvalidInputException, - AwsServiceException, SdkClientException, DatabaseException { + OpWithSigv4AUnSignedPayloadRequest opWithSigv4AUnSignedPayloadRequest) throws InvalidInputException, + AwsServiceException, SdkClientException, DatabaseException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, OpWithSigv4AUnSignedPayloadResponse::builder); + operationMetadata, OpWithSigv4AUnSignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(opWithSigv4AUnSignedPayloadRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, opWithSigv4AUnSignedPayloadRequest - .overrideConfiguration().orElse(null)); + .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Database Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "opWithSigv4aUnSignedPayload"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("opWithSigv4aUnSignedPayload").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(opWithSigv4AUnSignedPayloadRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new OpWithSigv4AUnSignedPayloadRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("opWithSigv4aUnSignedPayload").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(opWithSigv4AUnSignedPayloadRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new OpWithSigv4AUnSignedPayloadRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -698,42 +716,44 @@ public OpWithSigv4AUnSignedPayloadResponse opWithSigv4aUnSignedPayload( */ @Override public OpsWithSigv4AndSigv4ASignedPayloadResponse opsWithSigv4andSigv4aSignedPayload( - OpsWithSigv4AndSigv4ASignedPayloadRequest opsWithSigv4AndSigv4ASignedPayloadRequest) throws InvalidInputException, - AwsServiceException, SdkClientException, DatabaseException { + OpsWithSigv4AndSigv4ASignedPayloadRequest opsWithSigv4AndSigv4ASignedPayloadRequest) throws InvalidInputException, + AwsServiceException, SdkClientException, DatabaseException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( - operationMetadata, OpsWithSigv4AndSigv4ASignedPayloadResponse::builder); + operationMetadata, OpsWithSigv4AndSigv4ASignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(opsWithSigv4AndSigv4ASignedPayloadRequest, - this.clientConfiguration); + this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - opsWithSigv4AndSigv4ASignedPayloadRequest.overrideConfiguration().orElse(null)); + opsWithSigv4AndSigv4ASignedPayloadRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Database Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "opsWithSigv4andSigv4aSignedPayload"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("opsWithSigv4andSigv4aSignedPayload").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration).withInput(opsWithSigv4AndSigv4ASignedPayloadRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new OpsWithSigv4AndSigv4ASignedPayloadRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("opsWithSigv4andSigv4aSignedPayload").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration).withInput(opsWithSigv4AndSigv4ASignedPayloadRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new OpsWithSigv4AndSigv4ASignedPayloadRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -762,43 +782,45 @@ public OpsWithSigv4AndSigv4ASignedPayloadResponse opsWithSigv4andSigv4aSignedPay */ @Override public SecondOpsWithSigv4AndSigv4ASignedPayloadResponse secondOpsWithSigv4andSigv4aSignedPayload( - SecondOpsWithSigv4AndSigv4ASignedPayloadRequest secondOpsWithSigv4AndSigv4ASignedPayloadRequest) - throws InvalidInputException, AwsServiceException, SdkClientException, DatabaseException { + SecondOpsWithSigv4AndSigv4ASignedPayloadRequest secondOpsWithSigv4AndSigv4ASignedPayloadRequest) + throws InvalidInputException, AwsServiceException, SdkClientException, DatabaseException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) - .isPayloadJson(true).build(); + .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory - .createResponseHandler(operationMetadata, SecondOpsWithSigv4AndSigv4ASignedPayloadResponse::builder); + .createResponseHandler(operationMetadata, SecondOpsWithSigv4AndSigv4ASignedPayloadResponse::builder); Function> exceptionMetadataMapper = errorCode -> { + if (errorCode == null) { + return Optional.empty(); + } switch (errorCode) { - case "InvalidInput": - return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) - .exceptionBuilderSupplier(InvalidInputException::builder).build()); - default: - return Optional.empty(); + case "InvalidInput": + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) + .exceptionBuilderSupplier(InvalidInputException::builder).build()); + default: + return Optional.empty(); } }; - HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, - operationMetadata, exceptionMetadataMapper); + operationMetadata, exceptionMetadataMapper); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration( - secondOpsWithSigv4AndSigv4ASignedPayloadRequest, this.clientConfiguration); + secondOpsWithSigv4AndSigv4ASignedPayloadRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, - secondOpsWithSigv4AndSigv4ASignedPayloadRequest.overrideConfiguration().orElse(null)); + secondOpsWithSigv4AndSigv4ASignedPayloadRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector - .create("ApiCall"); + .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Database Service"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "secondOpsWithSigv4andSigv4aSignedPayload"); return clientHandler - .execute(new ClientExecutionParams() - .withOperationName("secondOpsWithSigv4andSigv4aSignedPayload").withProtocolMetadata(protocolMetadata) - .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) - .withRequestConfiguration(clientConfiguration) - .withInput(secondOpsWithSigv4AndSigv4ASignedPayloadRequest) - .withMetricCollector(apiCallMetricCollector) - .withMarshaller(new SecondOpsWithSigv4AndSigv4ASignedPayloadRequestMarshaller(protocolFactory))); + .execute(new ClientExecutionParams() + .withOperationName("secondOpsWithSigv4andSigv4aSignedPayload").withProtocolMetadata(protocolMetadata) + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) + .withRequestConfiguration(clientConfiguration) + .withInput(secondOpsWithSigv4AndSigv4ASignedPayloadRequest) + .withMetricCollector(apiCallMetricCollector) + .withMarshaller(new SecondOpsWithSigv4AndSigv4ASignedPayloadRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } @@ -810,7 +832,7 @@ public final String serviceName() { } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, - RequestOverrideConfiguration requestOverrideConfiguration) { + RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); @@ -825,7 +847,7 @@ private static List resolveMetricPublishers(SdkClientConfigurat } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, - JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { + JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); } @@ -859,7 +881,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, return configuration.build(); } DatabaseServiceClientConfigurationBuilder serviceConfigBuilder = new DatabaseServiceClientConfigurationBuilder( - configuration); + configuration); for (SdkPlugin plugin : plugins) { plugin.configureClient(serviceConfigBuilder); } @@ -869,7 +891,7 @@ private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, private > T init(T builder) { return builder.clientConfiguration(clientConfiguration).defaultServiceExceptionSupplier(DatabaseException::builder) - .protocol(AwsJsonProtocol.REST_JSON).protocolVersion("1.1"); + .protocol(AwsJsonProtocol.REST_JSON).protocolVersion("1.1"); } @Override diff --git a/services/kinesis/src/it/java/software/amazon/awssdk/services/kinesis/KinesisExceptionTest.java b/services/kinesis/src/it/java/software/amazon/awssdk/services/kinesis/KinesisExceptionTest.java index eb9d1809ee3f..88eb9111df5f 100644 --- a/services/kinesis/src/it/java/software/amazon/awssdk/services/kinesis/KinesisExceptionTest.java +++ b/services/kinesis/src/it/java/software/amazon/awssdk/services/kinesis/KinesisExceptionTest.java @@ -15,44 +15,95 @@ package software.amazon.awssdk.services.kinesis; +import com.github.tomakehurst.wiremock.WireMockServer; +import com.github.tomakehurst.wiremock.client.WireMock; +import com.github.tomakehurst.wiremock.core.WireMockConfiguration; +import org.junit.After; import org.junit.Before; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import software.amazon.awssdk.auth.credentials.AwsBasicCredentials; +import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider; import software.amazon.awssdk.regions.Region; -import software.amazon.awssdk.services.kinesis.model.*; +import software.amazon.awssdk.services.kinesis.model.GetRecordsRequest; +import software.amazon.awssdk.services.kinesis.model.InvalidArgumentException; +import software.amazon.awssdk.services.kinesis.model.ResourceNotFoundException; + +import java.net.URI; import static org.junit.Assert.assertEquals; +import static com.github.tomakehurst.wiremock.client.WireMock.*; public class KinesisExceptionTest { private static final Logger logger = LoggerFactory.getLogger(KinesisExceptionTest.class); + private WireMockServer wireMock; private KinesisClient client; @Before public void setup() { + wireMock = new WireMockServer(WireMockConfiguration.wireMockConfig().dynamicPort()); + wireMock.start(); + client = KinesisClient.builder() + .endpointOverride(URI.create(wireMock.baseUrl())) .region(Region.US_WEST_2) + .credentialsProvider(StaticCredentialsProvider.create( + AwsBasicCredentials.create("fake-key", "fake-secret"))) .build(); } - @Test - public void testInvalidArgumentException() { - try { - GetRecordsRequest request = GetRecordsRequest.builder() - .shardIterator("Invalid-Shard-Iterator") - .build(); + @After + public void tearDown() { + wireMock.stop(); + } - client.getRecords(request); + @Test + public void testInvalidArgumentException() { + wireMock.stubFor(WireMock.post(WireMock.urlPathEqualTo("/")) + .willReturn(WireMock.aResponse() + .withStatus(400) + .withHeader("x-amzn-ErrorType", "InvalidArgumentException") + .withBody("{\"__type\":\"InvalidArgumentException\",\"message\":\"Invalid shard iterator\"}"))); - } catch (InvalidArgumentException e) { - logger.info("Caught expected exception: {}", e.getClass().getSimpleName()); - logger.info("Status Code: {}", e.statusCode()); - logger.info("Error Code: {}", e.awsErrorDetails().errorCode()); - logger.info("Error Message: {}", e.awsErrorDetails().errorMessage()); + try { + GetRecordsRequest request = GetRecordsRequest.builder() + .shardIterator("Invalid-Shard-Iterator") + .build(); - assertEquals(400, e.statusCode()); - assertEquals("InvalidArgumentException", e.awsErrorDetails().errorCode()); - } + client.getRecords(request); + } catch (InvalidArgumentException e) { + logger.info("Caught expected exception: {}", e.getClass().getSimpleName()); + logger.info("Status Code: {}", e.statusCode()); + logger.info("Error Code: {}", e.awsErrorDetails().errorCode()); + logger.info("Error Message: {}", e.awsErrorDetails().errorMessage()); + + assertEquals(400, e.statusCode()); + assertEquals("InvalidArgumentException", e.awsErrorDetails().errorCode()); } + } + @Test + public void testResourceNotFoundException() { + wireMock.stubFor(WireMock.post(WireMock.urlPathEqualTo("/")) + .willReturn(WireMock.aResponse() + .withStatus(400) + .withHeader("x-amzn-ErrorType", "ResourceNotFoundException"))); + + try { + GetRecordsRequest request = GetRecordsRequest.builder() + .shardIterator("NonExistent-Shard-Iterator") + .build(); + + client.getRecords(request); + } catch (ResourceNotFoundException e) { + logger.info("Caught expected exception: {}", e.getClass().getSimpleName()); + logger.info("Status Code: {}", e.statusCode()); + logger.info("Error Code: {}", e.awsErrorDetails().errorCode()); + logger.info("Error Message: {}", e.awsErrorDetails().errorMessage()); + + assertEquals(400, e.statusCode()); + assertEquals("ResourceNotFoundException", e.awsErrorDetails().errorCode()); + } } +} From 736e40193176607a637da7bf20071b0e06c647ff Mon Sep 17 00:00:00 2001 From: Bole1155 <49867651+Fred1155@users.noreply.github.com> Date: Wed, 9 Apr 2025 09:37:03 -0700 Subject: [PATCH 13/22] fixed typo (#6002) --- .../amazon/awssdk/enhanced/dynamodb/model/WriteBatch.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services-custom/dynamodb-enhanced/src/main/java/software/amazon/awssdk/enhanced/dynamodb/model/WriteBatch.java b/services-custom/dynamodb-enhanced/src/main/java/software/amazon/awssdk/enhanced/dynamodb/model/WriteBatch.java index c65e26e4fc99..0bbd013953d6 100644 --- a/services-custom/dynamodb-enhanced/src/main/java/software/amazon/awssdk/enhanced/dynamodb/model/WriteBatch.java +++ b/services-custom/dynamodb-enhanced/src/main/java/software/amazon/awssdk/enhanced/dynamodb/model/WriteBatch.java @@ -73,7 +73,7 @@ public String tableName() { } /** - * Returns the collection of write requests in this writek batch. + * Returns the collection of write requests in this write batch. */ public Collection writeRequests() { return writeRequests; From f79236ce306fa5486b17ce28996ed6b218941595 Mon Sep 17 00:00:00 2001 From: AWS <> Date: Wed, 9 Apr 2025 18:23:52 +0000 Subject: [PATCH 14/22] AWS Transfer Family Update: This launch includes 2 enhancements to SFTP connectors user-experience: 1) Customers can self-serve concurrent connections setting for their connectors, and 2) Customers can discover the public host key of remote servers using their SFTP connectors. --- .../feature-AWSTransferFamily-111e3bb.json | 6 +++ .../codegen-resources/service-2.json | 37 +++++++++++++++++-- 2 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 .changes/next-release/feature-AWSTransferFamily-111e3bb.json diff --git a/.changes/next-release/feature-AWSTransferFamily-111e3bb.json b/.changes/next-release/feature-AWSTransferFamily-111e3bb.json new file mode 100644 index 000000000000..52da4d3d6645 --- /dev/null +++ b/.changes/next-release/feature-AWSTransferFamily-111e3bb.json @@ -0,0 +1,6 @@ +{ + "type": "feature", + "category": "AWS Transfer Family", + "contributor": "", + "description": "This launch includes 2 enhancements to SFTP connectors user-experience: 1) Customers can self-serve concurrent connections setting for their connectors, and 2) Customers can discover the public host key of remote servers using their SFTP connectors." +} diff --git a/services/transfer/src/main/resources/codegen-resources/service-2.json b/services/transfer/src/main/resources/codegen-resources/service-2.json index 1d09fc0769a5..9472ae7d1373 100644 --- a/services/transfer/src/main/resources/codegen-resources/service-2.json +++ b/services/transfer/src/main/resources/codegen-resources/service-2.json @@ -4478,6 +4478,12 @@ "DIRECTORY" ] }, + "MaxConcurrentConnections":{ + "type":"integer", + "documentation":"

The number of concurrent connections that the connector will create to the remote server.

", + "box":true, + "min":1 + }, "MaxItems":{ "type":"integer", "box":true, @@ -4979,14 +4985,33 @@ "members":{ "UserSecretId":{ "shape":"SecretId", - "documentation":"

The identifier for the secret (in Amazon Web Services Secrets Manager) that contains the SFTP user's private key, password, or both. The identifier must be the Amazon Resource Name (ARN) of the secret.

" + "documentation":"

The identifier for the secret (in Amazon Web Services Secrets Manager) that contains the SFTP user's private key, password, or both. The identifier must be the Amazon Resource Name (ARN) of the secret.

  • Required when creating an SFTP connector

  • Optional when updating an existing SFTP connector

" }, "TrustedHostKeys":{ "shape":"SftpConnectorTrustedHostKeyList", - "documentation":"

The public portion of the host key, or keys, that are used to identify the external server to which you are connecting. You can use the ssh-keyscan command against the SFTP server to retrieve the necessary key.

The three standard SSH public key format elements are <key type>, <body base64>, and an optional <comment>, with spaces between each element. Specify only the <key type> and <body base64>: do not enter the <comment> portion of the key.

For the trusted host key, Transfer Family accepts RSA and ECDSA keys.

  • For RSA keys, the <key type> string is ssh-rsa.

  • For ECDSA keys, the <key type> string is either ecdsa-sha2-nistp256, ecdsa-sha2-nistp384, or ecdsa-sha2-nistp521, depending on the size of the key you generated.

Run this command to retrieve the SFTP server host key, where your SFTP server name is ftp.host.com.

ssh-keyscan ftp.host.com

This prints the public host key to standard output.

ftp.host.com ssh-rsa AAAAB3Nza...<long-string-for-public-key

Copy and paste this string into the TrustedHostKeys field for the create-connector command or into the Trusted host keys field in the console.

" + "documentation":"

The public portion of the host key, or keys, that are used to identify the external server to which you are connecting. You can use the ssh-keyscan command against the SFTP server to retrieve the necessary key.

TrustedHostKeys is optional for CreateConnector. If not provided, you can use TestConnection to retrieve the server host key during the initial connection attempt, and subsequently update the connector with the observed host key.

The three standard SSH public key format elements are <key type>, <body base64>, and an optional <comment>, with spaces between each element. Specify only the <key type> and <body base64>: do not enter the <comment> portion of the key.

For the trusted host key, Transfer Family accepts RSA and ECDSA keys.

  • For RSA keys, the <key type> string is ssh-rsa.

  • For ECDSA keys, the <key type> string is either ecdsa-sha2-nistp256, ecdsa-sha2-nistp384, or ecdsa-sha2-nistp521, depending on the size of the key you generated.

Run this command to retrieve the SFTP server host key, where your SFTP server name is ftp.host.com.

ssh-keyscan ftp.host.com

This prints the public host key to standard output.

ftp.host.com ssh-rsa AAAAB3Nza...<long-string-for-public-key

Copy and paste this string into the TrustedHostKeys field for the create-connector command or into the Trusted host keys field in the console.

" + }, + "MaxConcurrentConnections":{ + "shape":"MaxConcurrentConnections", + "documentation":"

Specify the number of concurrent connections that your connector creates to the remote server. The default value is 5 (this is also the maximum value allowed).

This parameter specifies the number of active connections that your connector can establish with the remote server at the same time. Increasing this value can enhance connector performance when transferring large file batches by enabling parallel operations.

" + } + }, + "documentation":"

Contains the details for an SFTP connector object. The connector object is used for transferring files to and from a partner's SFTP server.

" + }, + "SftpConnectorConnectionDetails":{ + "type":"structure", + "members":{ + "HostKey":{ + "shape":"SftpConnectorHostKey", + "documentation":"

The SSH public key of the remote SFTP server. This is returned during the initial connection attempt when you call TestConnection. It allows you to retrieve the valid server host key to update the connector when you are unable to obtain it in advance.

" } }, - "documentation":"

Contains the details for an SFTP connector object. The connector object is used for transferring files to and from a partner's SFTP server.

Because the SftpConnectorConfig data type is used for both creating and updating SFTP connectors, its parameters, TrustedHostKeys and UserSecretId are marked as not required. This is a bit misleading, as they are not required when you are updating an existing SFTP connector, but are required when you are creating a new SFTP connector.

" + "documentation":"

Contains the details for an SFTP connector connection.

" + }, + "SftpConnectorHostKey":{ + "type":"string", + "max":2048, + "min":1 }, "SftpConnectorTrustedHostKey":{ "type":"string", @@ -4997,7 +5022,7 @@ "type":"list", "member":{"shape":"SftpConnectorTrustedHostKey"}, "max":10, - "min":1 + "min":0 }, "SigningAlg":{ "type":"string", @@ -5353,6 +5378,10 @@ "StatusMessage":{ "shape":"Message", "documentation":"

Returns Connection succeeded if the test is successful. Or, returns a descriptive error message if the test fails. The following list provides troubleshooting details, depending on the error message that you receive.

  • Verify that your secret name aligns with the one in Transfer Role permissions.

  • Verify the server URL in the connector configuration , and verify that the login credentials work successfully outside of the connector.

  • Verify that the secret exists and is formatted correctly.

  • Verify that the trusted host key in the connector configuration matches the ssh-keyscan output.

" + }, + "SftpConnectionDetails":{ + "shape":"SftpConnectorConnectionDetails", + "documentation":"

Structure that contains the SFTP connector host key.

" } } }, From 549a9aef93dd20b827cf7a280b3038bb1d191348 Mon Sep 17 00:00:00 2001 From: AWS <> Date: Wed, 9 Apr 2025 18:23:58 +0000 Subject: [PATCH 15/22] AWS Glue Update: The TableOptimizer APIs in AWS Glue now return the DpuHours field in each TableOptimizerRun, providing clients visibility to the DPU-hours used for billing in managed Apache Iceberg table compaction optimization. --- .../next-release/feature-AWSGlue-ddf4d6a.json | 6 ++++++ .../codegen-resources/service-2.json | 21 +++++++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 .changes/next-release/feature-AWSGlue-ddf4d6a.json diff --git a/.changes/next-release/feature-AWSGlue-ddf4d6a.json b/.changes/next-release/feature-AWSGlue-ddf4d6a.json new file mode 100644 index 000000000000..116a7f93b96e --- /dev/null +++ b/.changes/next-release/feature-AWSGlue-ddf4d6a.json @@ -0,0 +1,6 @@ +{ + "type": "feature", + "category": "AWS Glue", + "contributor": "", + "description": "The TableOptimizer APIs in AWS Glue now return the DpuHours field in each TableOptimizerRun, providing clients visibility to the DPU-hours used for billing in managed Apache Iceberg table compaction optimization." +} diff --git a/services/glue/src/main/resources/codegen-resources/service-2.json b/services/glue/src/main/resources/codegen-resources/service-2.json index c8904506b687..b651065b8fa3 100644 --- a/services/glue/src/main/resources/codegen-resources/service-2.json +++ b/services/glue/src/main/resources/codegen-resources/service-2.json @@ -16469,9 +16469,13 @@ "shape":"metricCounts", "documentation":"

The number of files removed by the compaction job run.

" }, + "DpuHours":{ + "shape":"dpuHours", + "documentation":"

The number of DPU hours consumed by the job.

" + }, "NumberOfDpus":{ "shape":"dpuCounts", - "documentation":"

The number of DPU hours consumed by the job.

" + "documentation":"

The number of DPUs consumed by the job, rounded up to the nearest whole number.

" }, "JobDurationInHour":{ "shape":"dpuDurationInHour", @@ -16516,9 +16520,13 @@ "shape":"metricCounts", "documentation":"

The number of orphan files deleted by the orphan file deletion job run.

" }, + "DpuHours":{ + "shape":"dpuHours", + "documentation":"

The number of DPU hours consumed by the job.

" + }, "NumberOfDpus":{ "shape":"dpuCounts", - "documentation":"

The number of DPU hours consumed by the job.

" + "documentation":"

The number of DPUs consumed by the job, rounded up to the nearest whole number.

" }, "JobDurationInHour":{ "shape":"dpuDurationInHour", @@ -16560,9 +16568,13 @@ "shape":"metricCounts", "documentation":"

The number of manifest lists deleted by the retention job run.

" }, + "DpuHours":{ + "shape":"dpuHours", + "documentation":"

The number of DPU hours consumed by the job.

" + }, "NumberOfDpus":{ "shape":"dpuCounts", - "documentation":"

The number of DPU hours consumed by the job.

" + "documentation":"

The number of DPUs consumed by the job, rounded up to the nearest whole number.

" }, "JobDurationInHour":{ "shape":"dpuDurationInHour", @@ -21584,7 +21596,7 @@ }, "NumberOfDpus":{ "shape":"MessageString", - "documentation":"

The number of DPU hours consumed by the job.

" + "documentation":"

The number of DPUs consumed by the job, rounded up to the nearest whole number.

" }, "JobDurationInHour":{ "shape":"MessageString", @@ -27294,6 +27306,7 @@ "double":{"type":"double"}, "dpuCounts":{"type":"integer"}, "dpuDurationInHour":{"type":"double"}, + "dpuHours":{"type":"double"}, "glueConnectionNameString":{ "type":"string", "min":1 From 72529afb23f1c8032087a36a35d186097b15559c Mon Sep 17 00:00:00 2001 From: AWS <> Date: Wed, 9 Apr 2025 18:23:58 +0000 Subject: [PATCH 16/22] AWS Control Catalog Update: The GetControl API now surfaces a control's Severity, CreateTime, and Identifier for a control's Implementation. The ListControls API now surfaces a control's Behavior, Severity, CreateTime, and Identifier for a control's Implementation. --- .../feature-AWSControlCatalog-7dc64d2.json | 6 ++ .../codegen-resources/service-2.json | 58 +++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 .changes/next-release/feature-AWSControlCatalog-7dc64d2.json diff --git a/.changes/next-release/feature-AWSControlCatalog-7dc64d2.json b/.changes/next-release/feature-AWSControlCatalog-7dc64d2.json new file mode 100644 index 000000000000..06de0195896d --- /dev/null +++ b/.changes/next-release/feature-AWSControlCatalog-7dc64d2.json @@ -0,0 +1,6 @@ +{ + "type": "feature", + "category": "AWS Control Catalog", + "contributor": "", + "description": "The GetControl API now surfaces a control's Severity, CreateTime, and Identifier for a control's Implementation. The ListControls API now surfaces a control's Behavior, Severity, CreateTime, and Identifier for a control's Implementation." +} diff --git a/services/controlcatalog/src/main/resources/codegen-resources/service-2.json b/services/controlcatalog/src/main/resources/codegen-resources/service-2.json index a558178afd9e..7a2f6a6de542 100644 --- a/services/controlcatalog/src/main/resources/codegen-resources/service-2.json +++ b/services/controlcatalog/src/main/resources/codegen-resources/service-2.json @@ -240,6 +240,15 @@ "REGIONAL" ] }, + "ControlSeverity":{ + "type":"string", + "enum":[ + "LOW", + "MEDIUM", + "HIGH", + "CRITICAL" + ] + }, "ControlSummary":{ "type":"structure", "required":[ @@ -259,6 +268,22 @@ "Description":{ "shape":"String", "documentation":"

A description of the control, as it may appear in the console. Describes the functionality of the control.

" + }, + "Behavior":{ + "shape":"ControlBehavior", + "documentation":"

An enumerated type, with the following possible values:

" + }, + "Severity":{ + "shape":"ControlSeverity", + "documentation":"

An enumerated type, with the following possible values:

" + }, + "Implementation":{ + "shape":"ImplementationSummary", + "documentation":"

An object of type ImplementationSummary that describes how the control is implemented.

" + }, + "CreateTime":{ + "shape":"Timestamp", + "documentation":"

A timestamp that notes the time when the control was released (start of its life) as a governance capability in Amazon Web Services.

" } }, "documentation":"

Overview of information about a control.

" @@ -364,6 +389,10 @@ "shape":"ControlBehavior", "documentation":"

A term that identifies the control's functional behavior. One of Preventive, Detective, Proactive

" }, + "Severity":{ + "shape":"ControlSeverity", + "documentation":"

An enumerated type, with the following possible values:

" + }, "RegionConfiguration":{"shape":"RegionConfiguration"}, "Implementation":{ "shape":"ImplementationDetails", @@ -372,6 +401,10 @@ "Parameters":{ "shape":"ControlParameters", "documentation":"

Returns an array of ControlParameter objects that specify the parameters a control supports. An empty list is returned for controls that don’t support parameters.

" + }, + "CreateTime":{ + "shape":"Timestamp", + "documentation":"

A timestamp that notes the time when the control was released (start of its life) as a governance capability in Amazon Web Services.

" } } }, @@ -382,10 +415,35 @@ "Type":{ "shape":"ImplementationType", "documentation":"

A string that describes a control's implementation type.

" + }, + "Identifier":{ + "shape":"ImplementationIdentifier", + "documentation":"

A service-specific identifier for the control, assigned by the service that implemented the control. For example, this identifier could be an Amazon Web Services Config Rule ID or a Security Hub Control ID.

" } }, "documentation":"

An object that describes the implementation type for a control.

Our ImplementationDetails Type format has three required segments:

  • SERVICE-PROVIDER::SERVICE-NAME::RESOURCE-NAME

For example, AWS::Config::ConfigRule or AWS::SecurityHub::SecurityControl resources have the format with three required segments.

Our ImplementationDetails Type format has an optional fourth segment, which is present for applicable implementation types. The format is as follows:

  • SERVICE-PROVIDER::SERVICE-NAME::RESOURCE-NAME::RESOURCE-TYPE-DESCRIPTION

For example, AWS::Organizations::Policy::SERVICE_CONTROL_POLICY or AWS::CloudFormation::Type::HOOK have the format with four segments.

Although the format is similar, the values for the Type field do not match any Amazon Web Services CloudFormation values.

" }, + "ImplementationIdentifier":{ + "type":"string", + "max":256, + "min":1, + "pattern":"[a-z0-9-]+" + }, + "ImplementationSummary":{ + "type":"structure", + "required":["Type"], + "members":{ + "Type":{ + "shape":"ImplementationType", + "documentation":"

A string that represents the Amazon Web Services service that implements this control. For example, a value of AWS::Config::ConfigRule indicates that the control is implemented by Amazon Web Services Config, and AWS::SecurityHub::SecurityControl indicates implementation by Amazon Web Services Security Hub.

" + }, + "Identifier":{ + "shape":"ImplementationIdentifier", + "documentation":"

The identifier originally assigned by the Amazon Web Services service that implements the control. For example, CODEPIPELINE_DEPLOYMENT_COUNT_CHECK.

" + } + }, + "documentation":"

A summary of how the control is implemented, including the Amazon Web Services service that enforces the control and its service-specific identifier. For example, the value of this field could indicate that the control is implemented as an Amazon Web Services Config Rule or an Amazon Web Services Security Hub control.

" + }, "ImplementationType":{ "type":"string", "max":2048, From e2ba8bb78e1147f79ab15b8ca59ae56c5ba74f59 Mon Sep 17 00:00:00 2001 From: AWS <> Date: Wed, 9 Apr 2025 18:24:02 +0000 Subject: [PATCH 17/22] AWS Ground Station Update: Support tagging Agents and adjust input field validations --- .../feature-AWSGroundStation-47b8700.json | 6 ++ .../codegen-resources/service-2.json | 82 ++++++++++++------- 2 files changed, 59 insertions(+), 29 deletions(-) create mode 100644 .changes/next-release/feature-AWSGroundStation-47b8700.json diff --git a/.changes/next-release/feature-AWSGroundStation-47b8700.json b/.changes/next-release/feature-AWSGroundStation-47b8700.json new file mode 100644 index 000000000000..c9f22445adb5 --- /dev/null +++ b/.changes/next-release/feature-AWSGroundStation-47b8700.json @@ -0,0 +1,6 @@ +{ + "type": "feature", + "category": "AWS Ground Station", + "contributor": "", + "description": "Support tagging Agents and adjust input field validations" +} diff --git a/services/groundstation/src/main/resources/codegen-resources/service-2.json b/services/groundstation/src/main/resources/codegen-resources/service-2.json index 1dcc0df61e6b..4102804ab4eb 100644 --- a/services/groundstation/src/main/resources/codegen-resources/service-2.json +++ b/services/groundstation/src/main/resources/codegen-resources/service-2.json @@ -780,8 +780,8 @@ "CapabilityHealth":{ "type":"string", "enum":[ - "UNHEALTHY", - "HEALTHY" + "HEALTHY", + "UNHEALTHY" ] }, "CapabilityHealthReason":{ @@ -876,15 +876,20 @@ "max":20, "min":1 }, - "ConfigArn":{"type":"string"}, + "ConfigArn":{ + "type":"string", + "max":424, + "min":82, + "pattern":"^arn:aws:groundstation:[-a-z0-9]{1,50}:[0-9]{12}:config/[a-z0-9]+(-[a-z0-9]+){0,4}/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}(/.{1,256})?$" + }, "ConfigCapabilityType":{ "type":"string", "enum":[ "antenna-downlink", "antenna-downlink-demod-decode", - "antenna-uplink", - "dataflow-endpoint", "tracking", + "dataflow-endpoint", + "antenna-uplink", "uplink-echo", "s3-recording" ] @@ -1082,19 +1087,19 @@ "ContactStatus":{ "type":"string", "enum":[ - "AVAILABLE", - "AWS_CANCELLED", - "AWS_FAILED", - "CANCELLED", - "CANCELLING", - "COMPLETED", - "FAILED", + "SCHEDULING", "FAILED_TO_SCHEDULE", + "SCHEDULED", + "CANCELLED", + "AWS_CANCELLED", + "PREPASS", "PASS", "POSTPASS", - "PREPASS", - "SCHEDULED", - "SCHEDULING" + "COMPLETED", + "FAILED", + "AVAILABLE", + "CANCELLING", + "AWS_FAILED" ] }, "CreateConfigRequest":{ @@ -1133,7 +1138,7 @@ }, "endpointDetails":{ "shape":"EndpointDetailsList", - "documentation":"

Endpoint details of each endpoint in the dataflow endpoint group.

" + "documentation":"

Endpoint details of each endpoint in the dataflow endpoint group.

 All dataflow endpoints within a single dataflow endpoint group must be of the same type. You cannot mix <a href="https://docs.aws.amazon.com/ground-station/latest/APIReference/API_AwsGroundStationAgentEndpoint.html"> AWS Ground Station Agent endpoints</a> with <a href="https://docs.aws.amazon.com/ground-station/latest/APIReference/API_DataflowEndpoint.html">Dataflow endpoints</a> in the same group. If your use case requires both types of endpoints, you must create separate dataflow endpoint groups for each type. </p> 
" }, "tags":{ "shape":"TagsMap", @@ -1234,9 +1239,9 @@ "Criticality":{ "type":"string", "enum":[ + "REQUIRED", "PREFERRED", - "REMOVED", - "REQUIRED" + "REMOVED" ] }, "CustomerEphemerisPriority":{ @@ -1306,7 +1311,12 @@ }, "documentation":"

Information about the dataflow endpoint Config.

" }, - "DataflowEndpointGroupArn":{"type":"string"}, + "DataflowEndpointGroupArn":{ + "type":"string", + "max":146, + "min":97, + "pattern":"^arn:aws:groundstation:[-a-z0-9]{1,50}:[0-9]{12}:dataflow-endpoint-group/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$" + }, "DataflowEndpointGroupDurationInSeconds":{ "type":"integer", "box":true, @@ -2288,13 +2298,13 @@ "type":"string", "max":8192, "min":2, - "pattern":"^[{}\\[\\]:.,\"0-9A-z\\-_\\s]{2,8192}$" + "pattern":"^[{}\\[\\]:.,\"0-9A-Za-z\\-_\\s]{2,8192}$" }, "KeyAliasArn":{ "type":"string", "max":512, "min":1, - "pattern":"^arn:aws[a-zA-Z-]{0,16}:kms:[a-z]{2}(-[a-z]{1,16}){1,3}-\\d{1}:\\d{12}:((alias/[a-zA-Z0-9:/_-]{1,256}))$" + "pattern":"^arn:aws[a-zA-Z-]{0,16}:kms:[-a-z0-9]{1,50}:[0-9]{12}:((alias/[a-zA-Z0-9:/_-]{1,256}))$" }, "KeyAliasName":{ "type":"string", @@ -2319,7 +2329,7 @@ "documentation":"

KMS Key Arn.

" } }, - "documentation":"

AWS Key Management Service (KMS) Key.

", + "documentation":"

KMS key info.

", "union":true }, "ListConfigsRequest":{ @@ -2623,7 +2633,12 @@ "type":"long", "box":true }, - "MissionProfileArn":{"type":"string"}, + "MissionProfileArn":{ + "type":"string", + "max":138, + "min":89, + "pattern":"^arn:aws:groundstation:[-a-z0-9]{1,50}:[0-9]{12}:mission-profile/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$" + }, "MissionProfileIdResponse":{ "type":"structure", "members":{ @@ -2684,7 +2699,7 @@ "type":"integer", "box":true, "max":100, - "min":0 + "min":1 }, "PaginationToken":{ "type":"string", @@ -2695,9 +2710,9 @@ "Polarization":{ "type":"string", "enum":[ + "RIGHT_HAND", "LEFT_HAND", - "NONE", - "RIGHT_HAND" + "NONE" ] }, "PositiveDurationInSeconds":{ @@ -2759,6 +2774,10 @@ "discoveryData":{ "shape":"DiscoveryData", "documentation":"

Data for associating an agent with the capabilities it is managing.

" + }, + "tags":{ + "shape":"TagsMap", + "documentation":"

Tags assigned to an Agent.

" } } }, @@ -3389,8 +3408,8 @@ }, "Uuid":{ "type":"string", - "max":128, - "min":1, + "max":36, + "min":36, "pattern":"^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$" }, "VersionString":{ @@ -3416,7 +3435,12 @@ "max":99999, "min":0 }, - "satelliteArn":{"type":"string"} + "satelliteArn":{ + "type":"string", + "max":132, + "min":82, + "pattern":"^arn:aws:groundstation:([-a-z0-9]{1,50})?:[0-9]{12}:satellite/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$" + } }, "documentation":"

Welcome to the AWS Ground Station API Reference. AWS Ground Station is a fully managed service that enables you to control satellite communications, downlink and process satellite data, and scale your satellite operations efficiently and cost-effectively without having to build or manage your own ground station infrastructure.

" } From 3fd0675bc4d79caa8a29a632c3000cbbd775d9c8 Mon Sep 17 00:00:00 2001 From: AWS <> Date: Wed, 9 Apr 2025 18:24:05 +0000 Subject: [PATCH 18/22] Amazon DynamoDB Update: Documentation update for secondary indexes and Create_Table. --- .../feature-AmazonDynamoDB-3881005.json | 6 + .../dynamodb/endpoint-rule-set.json | 4 +- .../dynamodb/endpoint-tests.json | 180 +++++++++--------- .../codegen-resources/dynamodb/service-2.json | 24 +-- 4 files changed, 110 insertions(+), 104 deletions(-) create mode 100644 .changes/next-release/feature-AmazonDynamoDB-3881005.json diff --git a/.changes/next-release/feature-AmazonDynamoDB-3881005.json b/.changes/next-release/feature-AmazonDynamoDB-3881005.json new file mode 100644 index 000000000000..dcf96679f74e --- /dev/null +++ b/.changes/next-release/feature-AmazonDynamoDB-3881005.json @@ -0,0 +1,6 @@ +{ + "type": "feature", + "category": "Amazon DynamoDB", + "contributor": "", + "description": "Documentation update for secondary indexes and Create_Table." +} diff --git a/services/dynamodb/src/main/resources/codegen-resources/dynamodb/endpoint-rule-set.json b/services/dynamodb/src/main/resources/codegen-resources/dynamodb/endpoint-rule-set.json index b5b8297d316a..e26b84833998 100644 --- a/services/dynamodb/src/main/resources/codegen-resources/dynamodb/endpoint-rule-set.json +++ b/services/dynamodb/src/main/resources/codegen-resources/dynamodb/endpoint-rule-set.json @@ -180,9 +180,9 @@ "properties": { "authSchemes": [ { - "signingRegion": "us-east-1", + "name": "sigv4", "signingName": "dynamodb", - "name": "sigv4" + "signingRegion": "us-east-1" } ] }, diff --git a/services/dynamodb/src/main/resources/codegen-resources/dynamodb/endpoint-tests.json b/services/dynamodb/src/main/resources/codegen-resources/dynamodb/endpoint-tests.json index 6c38cd611222..1ed1345cbfb1 100644 --- a/services/dynamodb/src/main/resources/codegen-resources/dynamodb/endpoint-tests.json +++ b/services/dynamodb/src/main/resources/codegen-resources/dynamodb/endpoint-tests.json @@ -2794,9 +2794,9 @@ "properties": { "authSchemes": [ { - "signingName": "dynamodb", + "signingRegion": "us-east-1", "name": "sigv4", - "signingRegion": "us-east-1" + "signingName": "dynamodb" } ] }, @@ -2830,9 +2830,9 @@ "properties": { "authSchemes": [ { - "signingName": "dynamodb", + "signingRegion": "us-east-1", "name": "sigv4", - "signingRegion": "us-east-1" + "signingName": "dynamodb" } ] }, @@ -2882,9 +2882,9 @@ "properties": { "authSchemes": [ { - "signingName": "dynamodb", + "signingRegion": "us-east-1", "name": "sigv4", - "signingRegion": "us-east-1" + "signingName": "dynamodb" } ] }, @@ -2910,9 +2910,9 @@ "properties": { "authSchemes": [ { - "signingName": "dynamodb", + "signingRegion": "us-east-1", "name": "sigv4", - "signingRegion": "us-east-1" + "signingName": "dynamodb" } ] }, @@ -2938,9 +2938,9 @@ "properties": { "authSchemes": [ { - "signingName": "dynamodb", + "signingRegion": "us-east-1", "name": "sigv4", - "signingRegion": "us-east-1" + "signingName": "dynamodb" } ] }, @@ -2966,9 +2966,9 @@ "properties": { "authSchemes": [ { - "signingName": "dynamodb", + "signingRegion": "us-east-1", "name": "sigv4", - "signingRegion": "us-east-1" + "signingName": "dynamodb" } ] }, @@ -2994,9 +2994,9 @@ "properties": { "authSchemes": [ { - "signingName": "dynamodb", + "signingRegion": "us-east-1", "name": "sigv4", - "signingRegion": "us-east-1" + "signingName": "dynamodb" } ] }, @@ -3022,9 +3022,9 @@ "properties": { "authSchemes": [ { - "signingName": "dynamodb", + "signingRegion": "us-east-1", "name": "sigv4", - "signingRegion": "us-east-1" + "signingName": "dynamodb" } ] }, @@ -3097,9 +3097,9 @@ "properties": { "authSchemes": [ { - "signingName": "dynamodb", + "signingRegion": "us-east-1", "name": "sigv4", - "signingRegion": "us-east-1" + "signingName": "dynamodb" } ] }, @@ -3135,9 +3135,9 @@ "properties": { "authSchemes": [ { - "signingName": "dynamodb", + "signingRegion": "us-east-1", "name": "sigv4", - "signingRegion": "us-east-1" + "signingName": "dynamodb" } ] }, @@ -3173,9 +3173,9 @@ "properties": { "authSchemes": [ { - "signingName": "dynamodb", + "signingRegion": "us-east-1", "name": "sigv4", - "signingRegion": "us-east-1" + "signingName": "dynamodb" } ] }, @@ -3211,9 +3211,9 @@ "properties": { "authSchemes": [ { - "signingName": "dynamodb", + "signingRegion": "us-east-1", "name": "sigv4", - "signingRegion": "us-east-1" + "signingName": "dynamodb" } ] }, @@ -3280,9 +3280,9 @@ "properties": { "authSchemes": [ { - "signingName": "dynamodb", + "signingRegion": "us-east-1", "name": "sigv4", - "signingRegion": "us-east-1" + "signingName": "dynamodb" } ] }, @@ -3330,9 +3330,9 @@ "properties": { "authSchemes": [ { - "signingName": "dynamodb", + "signingRegion": "us-east-1", "name": "sigv4", - "signingRegion": "us-east-1" + "signingName": "dynamodb" } ] }, @@ -3357,9 +3357,9 @@ "properties": { "authSchemes": [ { - "signingName": "dynamodb", + "signingRegion": "us-east-1", "name": "sigv4", - "signingRegion": "us-east-1" + "signingName": "dynamodb" } ] }, @@ -3419,9 +3419,9 @@ "properties": { "authSchemes": [ { - "signingName": "dynamodb", + "signingRegion": "us-east-1", "name": "sigv4", - "signingRegion": "us-east-1" + "signingName": "dynamodb" } ] }, @@ -3455,9 +3455,9 @@ "properties": { "authSchemes": [ { - "signingName": "dynamodb", + "signingRegion": "us-east-1", "name": "sigv4", - "signingRegion": "us-east-1" + "signingName": "dynamodb" } ] }, @@ -3507,9 +3507,9 @@ "properties": { "authSchemes": [ { - "signingName": "dynamodb", + "signingRegion": "us-east-1", "name": "sigv4", - "signingRegion": "us-east-1" + "signingName": "dynamodb" } ] }, @@ -3535,9 +3535,9 @@ "properties": { "authSchemes": [ { - "signingName": "dynamodb", + "signingRegion": "us-east-1", "name": "sigv4", - "signingRegion": "us-east-1" + "signingName": "dynamodb" } ] }, @@ -3563,9 +3563,9 @@ "properties": { "authSchemes": [ { - "signingName": "dynamodb", + "signingRegion": "us-east-1", "name": "sigv4", - "signingRegion": "us-east-1" + "signingName": "dynamodb" } ] }, @@ -3591,9 +3591,9 @@ "properties": { "authSchemes": [ { - "signingName": "dynamodb", + "signingRegion": "us-east-1", "name": "sigv4", - "signingRegion": "us-east-1" + "signingName": "dynamodb" } ] }, @@ -3619,9 +3619,9 @@ "properties": { "authSchemes": [ { - "signingName": "dynamodb", + "signingRegion": "us-east-1", "name": "sigv4", - "signingRegion": "us-east-1" + "signingName": "dynamodb" } ] }, @@ -3647,9 +3647,9 @@ "properties": { "authSchemes": [ { - "signingName": "dynamodb", + "signingRegion": "us-east-1", "name": "sigv4", - "signingRegion": "us-east-1" + "signingName": "dynamodb" } ] }, @@ -3722,9 +3722,9 @@ "properties": { "authSchemes": [ { - "signingName": "dynamodb", + "signingRegion": "us-east-1", "name": "sigv4", - "signingRegion": "us-east-1" + "signingName": "dynamodb" } ] }, @@ -3760,9 +3760,9 @@ "properties": { "authSchemes": [ { - "signingName": "dynamodb", + "signingRegion": "us-east-1", "name": "sigv4", - "signingRegion": "us-east-1" + "signingName": "dynamodb" } ] }, @@ -3798,9 +3798,9 @@ "properties": { "authSchemes": [ { - "signingName": "dynamodb", + "signingRegion": "us-east-1", "name": "sigv4", - "signingRegion": "us-east-1" + "signingName": "dynamodb" } ] }, @@ -3836,9 +3836,9 @@ "properties": { "authSchemes": [ { - "signingName": "dynamodb", + "signingRegion": "us-east-1", "name": "sigv4", - "signingRegion": "us-east-1" + "signingName": "dynamodb" } ] }, @@ -3905,9 +3905,9 @@ "properties": { "authSchemes": [ { - "signingName": "dynamodb", + "signingRegion": "us-east-1", "name": "sigv4", - "signingRegion": "us-east-1" + "signingName": "dynamodb" } ] }, @@ -3955,9 +3955,9 @@ "properties": { "authSchemes": [ { - "signingName": "dynamodb", + "signingRegion": "us-east-1", "name": "sigv4", - "signingRegion": "us-east-1" + "signingName": "dynamodb" } ] }, @@ -3982,9 +3982,9 @@ "properties": { "authSchemes": [ { - "signingName": "dynamodb", + "signingRegion": "us-east-1", "name": "sigv4", - "signingRegion": "us-east-1" + "signingName": "dynamodb" } ] }, @@ -4044,9 +4044,9 @@ "properties": { "authSchemes": [ { - "signingName": "dynamodb", + "signingRegion": "us-east-1", "name": "sigv4", - "signingRegion": "us-east-1" + "signingName": "dynamodb" } ] }, @@ -4080,9 +4080,9 @@ "properties": { "authSchemes": [ { - "signingName": "dynamodb", + "signingRegion": "us-east-1", "name": "sigv4", - "signingRegion": "us-east-1" + "signingName": "dynamodb" } ] }, @@ -4132,9 +4132,9 @@ "properties": { "authSchemes": [ { - "signingName": "dynamodb", + "signingRegion": "us-east-1", "name": "sigv4", - "signingRegion": "us-east-1" + "signingName": "dynamodb" } ] }, @@ -4160,9 +4160,9 @@ "properties": { "authSchemes": [ { - "signingName": "dynamodb", + "signingRegion": "us-east-1", "name": "sigv4", - "signingRegion": "us-east-1" + "signingName": "dynamodb" } ] }, @@ -4188,9 +4188,9 @@ "properties": { "authSchemes": [ { - "signingName": "dynamodb", + "signingRegion": "us-east-1", "name": "sigv4", - "signingRegion": "us-east-1" + "signingName": "dynamodb" } ] }, @@ -4216,9 +4216,9 @@ "properties": { "authSchemes": [ { - "signingName": "dynamodb", + "signingRegion": "us-east-1", "name": "sigv4", - "signingRegion": "us-east-1" + "signingName": "dynamodb" } ] }, @@ -4244,9 +4244,9 @@ "properties": { "authSchemes": [ { - "signingName": "dynamodb", + "signingRegion": "us-east-1", "name": "sigv4", - "signingRegion": "us-east-1" + "signingName": "dynamodb" } ] }, @@ -4272,9 +4272,9 @@ "properties": { "authSchemes": [ { - "signingName": "dynamodb", + "signingRegion": "us-east-1", "name": "sigv4", - "signingRegion": "us-east-1" + "signingName": "dynamodb" } ] }, @@ -4347,9 +4347,9 @@ "properties": { "authSchemes": [ { - "signingName": "dynamodb", + "signingRegion": "us-east-1", "name": "sigv4", - "signingRegion": "us-east-1" + "signingName": "dynamodb" } ] }, @@ -4385,9 +4385,9 @@ "properties": { "authSchemes": [ { - "signingName": "dynamodb", + "signingRegion": "us-east-1", "name": "sigv4", - "signingRegion": "us-east-1" + "signingName": "dynamodb" } ] }, @@ -4423,9 +4423,9 @@ "properties": { "authSchemes": [ { - "signingName": "dynamodb", + "signingRegion": "us-east-1", "name": "sigv4", - "signingRegion": "us-east-1" + "signingName": "dynamodb" } ] }, @@ -4461,9 +4461,9 @@ "properties": { "authSchemes": [ { - "signingName": "dynamodb", + "signingRegion": "us-east-1", "name": "sigv4", - "signingRegion": "us-east-1" + "signingName": "dynamodb" } ] }, @@ -4530,9 +4530,9 @@ "properties": { "authSchemes": [ { - "signingName": "dynamodb", + "signingRegion": "us-east-1", "name": "sigv4", - "signingRegion": "us-east-1" + "signingName": "dynamodb" } ] }, @@ -4580,9 +4580,9 @@ "properties": { "authSchemes": [ { - "signingName": "dynamodb", + "signingRegion": "us-east-1", "name": "sigv4", - "signingRegion": "us-east-1" + "signingName": "dynamodb" } ] }, @@ -4607,9 +4607,9 @@ "properties": { "authSchemes": [ { - "signingName": "dynamodb", + "signingRegion": "us-east-1", "name": "sigv4", - "signingRegion": "us-east-1" + "signingName": "dynamodb" } ] }, diff --git a/services/dynamodb/src/main/resources/codegen-resources/dynamodb/service-2.json b/services/dynamodb/src/main/resources/codegen-resources/dynamodb/service-2.json index 85473b6e6222..35ac106acf26 100644 --- a/services/dynamodb/src/main/resources/codegen-resources/dynamodb/service-2.json +++ b/services/dynamodb/src/main/resources/codegen-resources/dynamodb/service-2.json @@ -854,7 +854,7 @@ {"shape":"ContinuousBackupsUnavailableException"}, {"shape":"InternalServerError"} ], - "documentation":"

UpdateContinuousBackups enables or disables point in time recovery for the specified table. A successful UpdateContinuousBackups call returns the current ContinuousBackupsDescription. Continuous backups are ENABLED on all tables at table creation. If point in time recovery is enabled, PointInTimeRecoveryStatus will be set to ENABLED.

Once continuous backups and point in time recovery are enabled, you can restore to any point in time within EarliestRestorableDateTime and LatestRestorableDateTime.

LatestRestorableDateTime is typically 5 minutes before the current time. You can restore your table to any point in time in the last 35 days. You can set the recovery period to any value between 1 and 35 days.

", + "documentation":"

UpdateContinuousBackups enables or disables point in time recovery for the specified table. A successful UpdateContinuousBackups call returns the current ContinuousBackupsDescription. Continuous backups are ENABLED on all tables at table creation. If point in time recovery is enabled, PointInTimeRecoveryStatus will be set to ENABLED.

Once continuous backups and point in time recovery are enabled, you can restore to any point in time within EarliestRestorableDateTime and LatestRestorableDateTime.

LatestRestorableDateTime is typically 5 minutes before the current time. You can restore your table to any point in time in the last 35 days. You can set the RecoveryPeriodInDays to any value between 1 and 35 days.

", "endpointdiscovery":{ } }, @@ -1811,7 +1811,7 @@ "documentation":"

Item which caused the ConditionalCheckFailedException.

" } }, - "documentation":"

A condition specified in the operation could not be evaluated.

", + "documentation":"

A condition specified in the operation failed to be evaluated.

", "exception":true }, "ConditionalOperator":{ @@ -2093,15 +2093,15 @@ }, "LocalSecondaryIndexes":{ "shape":"LocalSecondaryIndexList", - "documentation":"

One or more local secondary indexes (the maximum is 5) to be created on the table. Each index is scoped to a given partition key value. There is a 10 GB size limit per partition key value; otherwise, the size of a local secondary index is unconstrained.

Each local secondary index in the array includes the following:

  • IndexName - The name of the local secondary index. Must be unique only for this table.

  • KeySchema - Specifies the key schema for the local secondary index. The key schema must begin with the same partition key as the table.

  • Projection - Specifies attributes that are copied (projected) from the table into the index. These are in addition to the primary key attributes and index key attributes, which are automatically projected. Each attribute specification is composed of:

    • ProjectionType - One of the following:

      • KEYS_ONLY - Only the index and primary keys are projected into the index.

      • INCLUDE - Only the specified table attributes are projected into the index. The list of projected attributes is in NonKeyAttributes.

      • ALL - All of the table attributes are projected into the index.

    • NonKeyAttributes - A list of one or more non-key attribute names that are projected into the secondary index. The total count of attributes provided in NonKeyAttributes, summed across all of the secondary indexes, must not exceed 100. If you project the same attribute into two different indexes, this counts as two distinct attributes when determining the total.

" + "documentation":"

One or more local secondary indexes (the maximum is 5) to be created on the table. Each index is scoped to a given partition key value. There is a 10 GB size limit per partition key value; otherwise, the size of a local secondary index is unconstrained.

Each local secondary index in the array includes the following:

  • IndexName - The name of the local secondary index. Must be unique only for this table.

  • KeySchema - Specifies the key schema for the local secondary index. The key schema must begin with the same partition key as the table.

  • Projection - Specifies attributes that are copied (projected) from the table into the index. These are in addition to the primary key attributes and index key attributes, which are automatically projected. Each attribute specification is composed of:

    • ProjectionType - One of the following:

      • KEYS_ONLY - Only the index and primary keys are projected into the index.

      • INCLUDE - Only the specified table attributes are projected into the index. The list of projected attributes is in NonKeyAttributes.

      • ALL - All of the table attributes are projected into the index.

    • NonKeyAttributes - A list of one or more non-key attribute names that are projected into the secondary index. The total count of attributes provided in NonKeyAttributes, summed across all of the secondary indexes, must not exceed 100. If you project the same attribute into two different indexes, this counts as two distinct attributes when determining the total. This limit only applies when you specify the ProjectionType of INCLUDE. You still can specify the ProjectionType of ALL to project all attributes from the source table, even if the table has more than 100 attributes.

" }, "GlobalSecondaryIndexes":{ "shape":"GlobalSecondaryIndexList", - "documentation":"

One or more global secondary indexes (the maximum is 20) to be created on the table. Each global secondary index in the array includes the following:

  • IndexName - The name of the global secondary index. Must be unique only for this table.

  • KeySchema - Specifies the key schema for the global secondary index.

  • Projection - Specifies attributes that are copied (projected) from the table into the index. These are in addition to the primary key attributes and index key attributes, which are automatically projected. Each attribute specification is composed of:

    • ProjectionType - One of the following:

      • KEYS_ONLY - Only the index and primary keys are projected into the index.

      • INCLUDE - Only the specified table attributes are projected into the index. The list of projected attributes is in NonKeyAttributes.

      • ALL - All of the table attributes are projected into the index.

    • NonKeyAttributes - A list of one or more non-key attribute names that are projected into the secondary index. The total count of attributes provided in NonKeyAttributes, summed across all of the secondary indexes, must not exceed 100. If you project the same attribute into two different indexes, this counts as two distinct attributes when determining the total.

  • ProvisionedThroughput - The provisioned throughput settings for the global secondary index, consisting of read and write capacity units.

" + "documentation":"

One or more global secondary indexes (the maximum is 20) to be created on the table. Each global secondary index in the array includes the following:

  • IndexName - The name of the global secondary index. Must be unique only for this table.

  • KeySchema - Specifies the key schema for the global secondary index.

  • Projection - Specifies attributes that are copied (projected) from the table into the index. These are in addition to the primary key attributes and index key attributes, which are automatically projected. Each attribute specification is composed of:

    • ProjectionType - One of the following:

      • KEYS_ONLY - Only the index and primary keys are projected into the index.

      • INCLUDE - Only the specified table attributes are projected into the index. The list of projected attributes is in NonKeyAttributes.

      • ALL - All of the table attributes are projected into the index.

    • NonKeyAttributes - A list of one or more non-key attribute names that are projected into the secondary index. The total count of attributes provided in NonKeyAttributes, summed across all of the secondary indexes, must not exceed 100. If you project the same attribute into two different indexes, this counts as two distinct attributes when determining the total. This limit only applies when you specify the ProjectionType of INCLUDE. You still can specify the ProjectionType of ALL to project all attributes from the source table, even if the table has more than 100 attributes.

  • ProvisionedThroughput - The provisioned throughput settings for the global secondary index, consisting of read and write capacity units.

" }, "BillingMode":{ "shape":"BillingMode", - "documentation":"

Controls how you are charged for read and write throughput and how you manage capacity. This setting can be changed later.

  • PROVISIONED - We recommend using PROVISIONED for predictable workloads. PROVISIONED sets the billing mode to Provisioned capacity mode.

  • PAY_PER_REQUEST - We recommend using PAY_PER_REQUEST for unpredictable workloads. PAY_PER_REQUEST sets the billing mode to On-demand capacity mode.

" + "documentation":"

Controls how you are charged for read and write throughput and how you manage capacity. This setting can be changed later.

  • PAY_PER_REQUEST - We recommend using PAY_PER_REQUEST for most DynamoDB workloads. PAY_PER_REQUEST sets the billing mode to On-demand capacity mode.

  • PROVISIONED - We recommend using PROVISIONED for steady workloads with predictable growth where capacity requirements can be reliably forecasted. PROVISIONED sets the billing mode to Provisioned capacity mode.

" }, "ProvisionedThroughput":{ "shape":"ProvisionedThroughput", @@ -4492,7 +4492,7 @@ }, "RecoveryPeriodInDays":{ "shape":"RecoveryPeriodInDays", - "documentation":"

The number of preceding days for which continuous backups are taken and maintained. Your table data is only recoverable to any point-in-time from within the configured recovery period. This parameter is optional. If no value is provided, the value will default to 35.

" + "documentation":"

The number of preceding days for which continuous backups are taken and maintained. Your table data is only recoverable to any point-in-time from within the configured recovery period. This parameter is optional.

" }, "EarliestRestorableDateTime":{ "shape":"Date", @@ -4574,7 +4574,7 @@ }, "NonKeyAttributes":{ "shape":"NonKeyAttributeNameList", - "documentation":"

Represents the non-key attribute names which will be projected into the index.

For local secondary indexes, the total count of NonKeyAttributes summed across all of the local secondary indexes, must not exceed 100. If you project the same attribute into two different indexes, this counts as two distinct attributes when determining the total.

" + "documentation":"

Represents the non-key attribute names which will be projected into the index.

For global and local secondary indexes, the total count of NonKeyAttributes summed across all of the secondary indexes, must not exceed 100. If you project the same attribute into two different indexes, this counts as two distinct attributes when determining the total. This limit only applies when you specify the ProjectionType of INCLUDE. You still can specify the ProjectionType of ALL to project all attributes from the source table, even if the table has more than 100 attributes.

" } }, "documentation":"

Represents attributes that are copied (projected) from the table into an index. These are in addition to the primary key attributes and index key attributes, which are automatically projected.

" @@ -5329,7 +5329,7 @@ "members":{ "message":{"shape":"ErrorMessage"} }, - "documentation":"

Throughput exceeds the current throughput quota for your account. Please contact Amazon Web Services Support to request a quota increase.

", + "documentation":"

Throughput exceeds the current throughput quota for your account. Please contact Amazon Web ServicesSupport to request a quota increase.

", "exception":true }, "ResourceArnString":{ @@ -6002,11 +6002,11 @@ }, "LocalSecondaryIndexes":{ "shape":"LocalSecondaryIndexDescriptionList", - "documentation":"

Represents one or more local secondary indexes on the table. Each index is scoped to a given partition key value. Tables with one or more local secondary indexes are subject to an item collection size limit, where the amount of data within a given item collection cannot exceed 10 GB. Each element is composed of:

  • IndexName - The name of the local secondary index.

  • KeySchema - Specifies the complete index key schema. The attribute names in the key schema must be between 1 and 255 characters (inclusive). The key schema must begin with the same partition key as the table.

  • Projection - Specifies attributes that are copied (projected) from the table into the index. These are in addition to the primary key attributes and index key attributes, which are automatically projected. Each attribute specification is composed of:

    • ProjectionType - One of the following:

      • KEYS_ONLY - Only the index and primary keys are projected into the index.

      • INCLUDE - Only the specified table attributes are projected into the index. The list of projected attributes is in NonKeyAttributes.

      • ALL - All of the table attributes are projected into the index.

    • NonKeyAttributes - A list of one or more non-key attribute names that are projected into the secondary index. The total count of attributes provided in NonKeyAttributes, summed across all of the secondary indexes, must not exceed 100. If you project the same attribute into two different indexes, this counts as two distinct attributes when determining the total.

  • IndexSizeBytes - Represents the total size of the index, in bytes. DynamoDB updates this value approximately every six hours. Recent changes might not be reflected in this value.

  • ItemCount - Represents the number of items in the index. DynamoDB updates this value approximately every six hours. Recent changes might not be reflected in this value.

If the table is in the DELETING state, no information about indexes will be returned.

" + "documentation":"

Represents one or more local secondary indexes on the table. Each index is scoped to a given partition key value. Tables with one or more local secondary indexes are subject to an item collection size limit, where the amount of data within a given item collection cannot exceed 10 GB. Each element is composed of:

  • IndexName - The name of the local secondary index.

  • KeySchema - Specifies the complete index key schema. The attribute names in the key schema must be between 1 and 255 characters (inclusive). The key schema must begin with the same partition key as the table.

  • Projection - Specifies attributes that are copied (projected) from the table into the index. These are in addition to the primary key attributes and index key attributes, which are automatically projected. Each attribute specification is composed of:

    • ProjectionType - One of the following:

      • KEYS_ONLY - Only the index and primary keys are projected into the index.

      • INCLUDE - Only the specified table attributes are projected into the index. The list of projected attributes is in NonKeyAttributes.

      • ALL - All of the table attributes are projected into the index.

    • NonKeyAttributes - A list of one or more non-key attribute names that are projected into the secondary index. The total count of attributes provided in NonKeyAttributes, summed across all of the secondary indexes, must not exceed 100. If you project the same attribute into two different indexes, this counts as two distinct attributes when determining the total. This limit only applies when you specify the ProjectionType of INCLUDE. You still can specify the ProjectionType of ALL to project all attributes from the source table, even if the table has more than 100 attributes.

  • IndexSizeBytes - Represents the total size of the index, in bytes. DynamoDB updates this value approximately every six hours. Recent changes might not be reflected in this value.

  • ItemCount - Represents the number of items in the index. DynamoDB updates this value approximately every six hours. Recent changes might not be reflected in this value.

If the table is in the DELETING state, no information about indexes will be returned.

" }, "GlobalSecondaryIndexes":{ "shape":"GlobalSecondaryIndexDescriptionList", - "documentation":"

The global secondary indexes, if any, on the table. Each index is scoped to a given partition key value. Each element is composed of:

  • Backfilling - If true, then the index is currently in the backfilling phase. Backfilling occurs only when a new global secondary index is added to the table. It is the process by which DynamoDB populates the new index with data from the table. (This attribute does not appear for indexes that were created during a CreateTable operation.)

    You can delete an index that is being created during the Backfilling phase when IndexStatus is set to CREATING and Backfilling is true. You can't delete the index that is being created when IndexStatus is set to CREATING and Backfilling is false. (This attribute does not appear for indexes that were created during a CreateTable operation.)

  • IndexName - The name of the global secondary index.

  • IndexSizeBytes - The total size of the global secondary index, in bytes. DynamoDB updates this value approximately every six hours. Recent changes might not be reflected in this value.

  • IndexStatus - The current status of the global secondary index:

    • CREATING - The index is being created.

    • UPDATING - The index is being updated.

    • DELETING - The index is being deleted.

    • ACTIVE - The index is ready for use.

  • ItemCount - The number of items in the global secondary index. DynamoDB updates this value approximately every six hours. Recent changes might not be reflected in this value.

  • KeySchema - Specifies the complete index key schema. The attribute names in the key schema must be between 1 and 255 characters (inclusive). The key schema must begin with the same partition key as the table.

  • Projection - Specifies attributes that are copied (projected) from the table into the index. These are in addition to the primary key attributes and index key attributes, which are automatically projected. Each attribute specification is composed of:

    • ProjectionType - One of the following:

      • KEYS_ONLY - Only the index and primary keys are projected into the index.

      • INCLUDE - In addition to the attributes described in KEYS_ONLY, the secondary index will include other non-key attributes that you specify.

      • ALL - All of the table attributes are projected into the index.

    • NonKeyAttributes - A list of one or more non-key attribute names that are projected into the secondary index. The total count of attributes provided in NonKeyAttributes, summed across all of the secondary indexes, must not exceed 100. If you project the same attribute into two different indexes, this counts as two distinct attributes when determining the total.

  • ProvisionedThroughput - The provisioned throughput settings for the global secondary index, consisting of read and write capacity units, along with data about increases and decreases.

If the table is in the DELETING state, no information about indexes will be returned.

" + "documentation":"

The global secondary indexes, if any, on the table. Each index is scoped to a given partition key value. Each element is composed of:

  • Backfilling - If true, then the index is currently in the backfilling phase. Backfilling occurs only when a new global secondary index is added to the table. It is the process by which DynamoDB populates the new index with data from the table. (This attribute does not appear for indexes that were created during a CreateTable operation.)

    You can delete an index that is being created during the Backfilling phase when IndexStatus is set to CREATING and Backfilling is true. You can't delete the index that is being created when IndexStatus is set to CREATING and Backfilling is false. (This attribute does not appear for indexes that were created during a CreateTable operation.)

  • IndexName - The name of the global secondary index.

  • IndexSizeBytes - The total size of the global secondary index, in bytes. DynamoDB updates this value approximately every six hours. Recent changes might not be reflected in this value.

  • IndexStatus - The current status of the global secondary index:

    • CREATING - The index is being created.

    • UPDATING - The index is being updated.

    • DELETING - The index is being deleted.

    • ACTIVE - The index is ready for use.

  • ItemCount - The number of items in the global secondary index. DynamoDB updates this value approximately every six hours. Recent changes might not be reflected in this value.

  • KeySchema - Specifies the complete index key schema. The attribute names in the key schema must be between 1 and 255 characters (inclusive). The key schema must begin with the same partition key as the table.

  • Projection - Specifies attributes that are copied (projected) from the table into the index. These are in addition to the primary key attributes and index key attributes, which are automatically projected. Each attribute specification is composed of:

    • ProjectionType - One of the following:

      • KEYS_ONLY - Only the index and primary keys are projected into the index.

      • INCLUDE - In addition to the attributes described in KEYS_ONLY, the secondary index will include other non-key attributes that you specify.

      • ALL - All of the table attributes are projected into the index.

    • NonKeyAttributes - A list of one or more non-key attribute names that are projected into the secondary index. The total count of attributes provided in NonKeyAttributes, summed across all of the secondary indexes, must not exceed 100. If you project the same attribute into two different indexes, this counts as two distinct attributes when determining the total. This limit only applies when you specify the ProjectionType of INCLUDE. You still can specify the ProjectionType of ALL to project all attributes from the source table, even if the table has more than 100 attributes.

  • ProvisionedThroughput - The provisioned throughput settings for the global secondary index, consisting of read and write capacity units, along with data about increases and decreases.

If the table is in the DELETING state, no information about indexes will be returned.

" }, "StreamSpecification":{ "shape":"StreamSpecification", @@ -6754,7 +6754,7 @@ }, "BillingMode":{ "shape":"BillingMode", - "documentation":"

Controls how you are charged for read and write throughput and how you manage capacity. When switching from pay-per-request to provisioned capacity, initial provisioned capacity values must be set. The initial provisioned capacity values are estimated based on the consumed read and write capacity of your table and global secondary indexes over the past 30 minutes.

  • PROVISIONED - We recommend using PROVISIONED for predictable workloads. PROVISIONED sets the billing mode to Provisioned capacity mode.

  • PAY_PER_REQUEST - We recommend using PAY_PER_REQUEST for unpredictable workloads. PAY_PER_REQUEST sets the billing mode to On-demand capacity mode.

" + "documentation":"

Controls how you are charged for read and write throughput and how you manage capacity. When switching from pay-per-request to provisioned capacity, initial provisioned capacity values must be set. The initial provisioned capacity values are estimated based on the consumed read and write capacity of your table and global secondary indexes over the past 30 minutes.

  • PAY_PER_REQUEST - We recommend using PAY_PER_REQUEST for most DynamoDB workloads. PAY_PER_REQUEST sets the billing mode to On-demand capacity mode.

  • PROVISIONED - We recommend using PROVISIONED for steady workloads with predictable growth where capacity requirements can be reliably forecasted. PROVISIONED sets the billing mode to Provisioned capacity mode.

" }, "ProvisionedThroughput":{ "shape":"ProvisionedThroughput", @@ -6786,7 +6786,7 @@ }, "MultiRegionConsistency":{ "shape":"MultiRegionConsistency", - "documentation":"

Specifies the consistency mode for a new global table. This parameter is only valid when you create a global table by specifying one or more Create actions in the ReplicaUpdates action list.

You can specify one of the following consistency modes:

  • EVENTUAL: Configures a new global table for multi-Region eventual consistency. This is the default consistency mode for global tables.

  • STRONG: Configures a new global table for multi-Region strong consistency (preview).

    Multi-Region strong consistency (MRSC) is a new DynamoDB global tables capability currently available in preview mode. For more information, see Global tables multi-Region strong consistency.

If you don't specify this parameter, the global table consistency mode defaults to EVENTUAL.

" + "documentation":"

Specifies the consistency mode for a new global table. This parameter is only valid when you create a global table by specifying one or more Create actions in the ReplicaUpdates action list.

You can specify one of the following consistency modes:

  • EVENTUAL: Configures a new global table for multi-Region eventual consistency. This is the default consistency mode for global tables.

  • STRONG: Configures a new global table for multi-Region strong consistency (preview).

    Multi-Region strong consistency (MRSC) is a new DynamoDB global tables capability currently available in preview mode. For more information, see Global tables multi-Region strong consistency.

If you don't specify this parameter, the global table consistency mode defaults to EVENTUAL.

" }, "OnDemandThroughput":{ "shape":"OnDemandThroughput", From df03e333dbb1227c771e3b074ddd5682232e5f83 Mon Sep 17 00:00:00 2001 From: AWS <> Date: Wed, 9 Apr 2025 18:25:20 +0000 Subject: [PATCH 19/22] Updated endpoints.json and partitions.json. --- .../feature-AWSSDKforJavav2-0443982.json | 6 +++++ .../regions/internal/region/endpoints.json | 22 ++++++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 .changes/next-release/feature-AWSSDKforJavav2-0443982.json diff --git a/.changes/next-release/feature-AWSSDKforJavav2-0443982.json b/.changes/next-release/feature-AWSSDKforJavav2-0443982.json new file mode 100644 index 000000000000..e5b5ee3ca5e3 --- /dev/null +++ b/.changes/next-release/feature-AWSSDKforJavav2-0443982.json @@ -0,0 +1,6 @@ +{ + "type": "feature", + "category": "AWS SDK for Java v2", + "contributor": "", + "description": "Updated endpoint and partition metadata." +} diff --git a/core/regions/src/main/resources/software/amazon/awssdk/regions/internal/region/endpoints.json b/core/regions/src/main/resources/software/amazon/awssdk/regions/internal/region/endpoints.json index da604a61d27c..f0ab7d891772 100644 --- a/core/regions/src/main/resources/software/amazon/awssdk/regions/internal/region/endpoints.json +++ b/core/regions/src/main/resources/software/amazon/awssdk/regions/internal/region/endpoints.json @@ -10122,6 +10122,7 @@ "tags" : [ "fips" ] } ] }, + "ca-west-1" : { }, "eu-central-1" : { }, "eu-north-1" : { }, "eu-south-1" : { }, @@ -17848,6 +17849,7 @@ "ca-central-1" : { }, "eu-central-1" : { }, "eu-north-1" : { }, + "eu-south-2" : { }, "eu-west-1" : { }, "eu-west-2" : { }, "sa-east-1" : { }, @@ -29354,7 +29356,11 @@ "region" : "cn-northwest-1" }, "hostname" : "entitlement-marketplace.cn-northwest-1.amazonaws.com.cn", - "protocols" : [ "https" ] + "protocols" : [ "https" ], + "variants" : [ { + "hostname" : "entitlement-marketplace.cn-northwest-1.api.amazonwebservices.com.cn", + "tags" : [ "dualstack" ] + } ] } } }, @@ -33774,8 +33780,18 @@ } }, "endpoints" : { - "us-gov-east-1" : { }, - "us-gov-west-1" : { } + "us-gov-east-1" : { + "variants" : [ { + "hostname" : "metering-marketplace.us-gov-east-1.api.aws", + "tags" : [ "dualstack" ] + } ] + }, + "us-gov-west-1" : { + "variants" : [ { + "hostname" : "metering-marketplace.us-gov-west-1.api.aws", + "tags" : [ "dualstack" ] + } ] + } } }, "metrics.sagemaker" : { From 9428f673e6f5dbfacb605de3ed9457b31be535f7 Mon Sep 17 00:00:00 2001 From: AWS <> Date: Wed, 9 Apr 2025 18:26:38 +0000 Subject: [PATCH 20/22] Release 2.31.19. Updated CHANGELOG.md, README.md and all pom.xml. --- .changes/2.31.19.json | 42 +++++++++++++++++++ .../feature-AWSControlCatalog-7dc64d2.json | 6 --- .../next-release/feature-AWSGlue-ddf4d6a.json | 6 --- .../feature-AWSGroundStation-47b8700.json | 6 --- .../feature-AWSSDKforJavav2-0443982.json | 6 --- .../feature-AWSTransferFamily-111e3bb.json | 6 --- .../feature-AmazonDynamoDB-3881005.json | 6 --- CHANGELOG.md | 25 +++++++++++ README.md | 8 ++-- archetypes/archetype-app-quickstart/pom.xml | 2 +- archetypes/archetype-lambda/pom.xml | 2 +- archetypes/archetype-tools/pom.xml | 2 +- archetypes/pom.xml | 2 +- aws-sdk-java/pom.xml | 2 +- bom-internal/pom.xml | 2 +- bom/pom.xml | 2 +- bundle-logging-bridge/pom.xml | 2 +- bundle-sdk/pom.xml | 2 +- bundle/pom.xml | 2 +- codegen-lite-maven-plugin/pom.xml | 2 +- codegen-lite/pom.xml | 2 +- codegen-maven-plugin/pom.xml | 2 +- codegen/pom.xml | 2 +- core/annotations/pom.xml | 2 +- core/arns/pom.xml | 2 +- core/auth-crt/pom.xml | 2 +- core/auth/pom.xml | 2 +- core/aws-core/pom.xml | 2 +- core/checksums-spi/pom.xml | 2 +- core/checksums/pom.xml | 2 +- core/crt-core/pom.xml | 2 +- core/endpoints-spi/pom.xml | 2 +- core/http-auth-aws-crt/pom.xml | 2 +- core/http-auth-aws-eventstream/pom.xml | 2 +- core/http-auth-aws/pom.xml | 2 +- core/http-auth-spi/pom.xml | 2 +- core/http-auth/pom.xml | 2 +- core/identity-spi/pom.xml | 2 +- core/imds/pom.xml | 2 +- core/json-utils/pom.xml | 2 +- core/metrics-spi/pom.xml | 2 +- core/pom.xml | 2 +- core/profiles/pom.xml | 2 +- core/protocols/aws-cbor-protocol/pom.xml | 2 +- core/protocols/aws-json-protocol/pom.xml | 2 +- core/protocols/aws-query-protocol/pom.xml | 2 +- core/protocols/aws-xml-protocol/pom.xml | 2 +- core/protocols/pom.xml | 2 +- core/protocols/protocol-core/pom.xml | 2 +- core/protocols/smithy-rpcv2-protocol/pom.xml | 2 +- core/regions/pom.xml | 2 +- core/retries-spi/pom.xml | 2 +- core/retries/pom.xml | 2 +- core/sdk-core/pom.xml | 2 +- http-client-spi/pom.xml | 2 +- http-clients/apache-client/pom.xml | 2 +- http-clients/aws-crt-client/pom.xml | 2 +- http-clients/netty-nio-client/pom.xml | 2 +- http-clients/pom.xml | 2 +- http-clients/url-connection-client/pom.xml | 2 +- .../cloudwatch-metric-publisher/pom.xml | 2 +- .../emf-metric-logging-publisher/pom.xml | 2 +- metric-publishers/pom.xml | 2 +- pom.xml | 2 +- release-scripts/pom.xml | 2 +- services-custom/dynamodb-enhanced/pom.xml | 2 +- services-custom/iam-policy-builder/pom.xml | 2 +- services-custom/pom.xml | 2 +- .../s3-event-notifications/pom.xml | 2 +- services-custom/s3-transfer-manager/pom.xml | 2 +- services/accessanalyzer/pom.xml | 2 +- services/account/pom.xml | 2 +- services/acm/pom.xml | 2 +- services/acmpca/pom.xml | 2 +- services/amp/pom.xml | 2 +- services/amplify/pom.xml | 2 +- services/amplifybackend/pom.xml | 2 +- services/amplifyuibuilder/pom.xml | 2 +- services/apigateway/pom.xml | 2 +- services/apigatewaymanagementapi/pom.xml | 2 +- services/apigatewayv2/pom.xml | 2 +- services/appconfig/pom.xml | 2 +- services/appconfigdata/pom.xml | 2 +- services/appfabric/pom.xml | 2 +- services/appflow/pom.xml | 2 +- services/appintegrations/pom.xml | 2 +- services/applicationautoscaling/pom.xml | 2 +- services/applicationcostprofiler/pom.xml | 2 +- services/applicationdiscovery/pom.xml | 2 +- services/applicationinsights/pom.xml | 2 +- services/applicationsignals/pom.xml | 2 +- services/appmesh/pom.xml | 2 +- services/apprunner/pom.xml | 2 +- services/appstream/pom.xml | 2 +- services/appsync/pom.xml | 2 +- services/apptest/pom.xml | 2 +- services/arczonalshift/pom.xml | 2 +- services/artifact/pom.xml | 2 +- services/athena/pom.xml | 2 +- services/auditmanager/pom.xml | 2 +- services/autoscaling/pom.xml | 2 +- services/autoscalingplans/pom.xml | 2 +- services/b2bi/pom.xml | 2 +- services/backup/pom.xml | 2 +- services/backupgateway/pom.xml | 2 +- services/backupsearch/pom.xml | 2 +- services/batch/pom.xml | 2 +- services/bcmdataexports/pom.xml | 2 +- services/bcmpricingcalculator/pom.xml | 2 +- services/bedrock/pom.xml | 2 +- services/bedrockagent/pom.xml | 2 +- services/bedrockagentruntime/pom.xml | 2 +- services/bedrockdataautomation/pom.xml | 2 +- services/bedrockdataautomationruntime/pom.xml | 2 +- services/bedrockruntime/pom.xml | 2 +- services/billing/pom.xml | 2 +- services/billingconductor/pom.xml | 2 +- services/braket/pom.xml | 2 +- services/budgets/pom.xml | 2 +- services/chatbot/pom.xml | 2 +- services/chime/pom.xml | 2 +- services/chimesdkidentity/pom.xml | 2 +- services/chimesdkmediapipelines/pom.xml | 2 +- services/chimesdkmeetings/pom.xml | 2 +- services/chimesdkmessaging/pom.xml | 2 +- services/chimesdkvoice/pom.xml | 2 +- services/cleanrooms/pom.xml | 2 +- services/cleanroomsml/pom.xml | 2 +- services/cloud9/pom.xml | 2 +- services/cloudcontrol/pom.xml | 2 +- services/clouddirectory/pom.xml | 2 +- services/cloudformation/pom.xml | 2 +- services/cloudfront/pom.xml | 2 +- services/cloudfrontkeyvaluestore/pom.xml | 2 +- services/cloudhsm/pom.xml | 2 +- services/cloudhsmv2/pom.xml | 2 +- services/cloudsearch/pom.xml | 2 +- services/cloudsearchdomain/pom.xml | 2 +- services/cloudtrail/pom.xml | 2 +- services/cloudtraildata/pom.xml | 2 +- services/cloudwatch/pom.xml | 2 +- services/cloudwatchevents/pom.xml | 2 +- services/cloudwatchlogs/pom.xml | 2 +- services/codeartifact/pom.xml | 2 +- services/codebuild/pom.xml | 2 +- services/codecatalyst/pom.xml | 2 +- services/codecommit/pom.xml | 2 +- services/codeconnections/pom.xml | 2 +- services/codedeploy/pom.xml | 2 +- services/codeguruprofiler/pom.xml | 2 +- services/codegurureviewer/pom.xml | 2 +- services/codegurusecurity/pom.xml | 2 +- services/codepipeline/pom.xml | 2 +- services/codestarconnections/pom.xml | 2 +- services/codestarnotifications/pom.xml | 2 +- services/cognitoidentity/pom.xml | 2 +- services/cognitoidentityprovider/pom.xml | 2 +- services/cognitosync/pom.xml | 2 +- services/comprehend/pom.xml | 2 +- services/comprehendmedical/pom.xml | 2 +- services/computeoptimizer/pom.xml | 2 +- services/config/pom.xml | 2 +- services/connect/pom.xml | 2 +- services/connectcampaigns/pom.xml | 2 +- services/connectcampaignsv2/pom.xml | 2 +- services/connectcases/pom.xml | 2 +- services/connectcontactlens/pom.xml | 2 +- services/connectparticipant/pom.xml | 2 +- services/controlcatalog/pom.xml | 2 +- services/controltower/pom.xml | 2 +- services/costandusagereport/pom.xml | 2 +- services/costexplorer/pom.xml | 2 +- services/costoptimizationhub/pom.xml | 2 +- services/customerprofiles/pom.xml | 2 +- services/databasemigration/pom.xml | 2 +- services/databrew/pom.xml | 2 +- services/dataexchange/pom.xml | 2 +- services/datapipeline/pom.xml | 2 +- services/datasync/pom.xml | 2 +- services/datazone/pom.xml | 2 +- services/dax/pom.xml | 2 +- services/deadline/pom.xml | 2 +- services/detective/pom.xml | 2 +- services/devicefarm/pom.xml | 2 +- services/devopsguru/pom.xml | 2 +- services/directconnect/pom.xml | 2 +- services/directory/pom.xml | 2 +- services/directoryservicedata/pom.xml | 2 +- services/dlm/pom.xml | 2 +- services/docdb/pom.xml | 2 +- services/docdbelastic/pom.xml | 2 +- services/drs/pom.xml | 2 +- services/dsql/pom.xml | 2 +- services/dynamodb/pom.xml | 2 +- services/ebs/pom.xml | 2 +- services/ec2/pom.xml | 2 +- services/ec2instanceconnect/pom.xml | 2 +- services/ecr/pom.xml | 2 +- services/ecrpublic/pom.xml | 2 +- services/ecs/pom.xml | 2 +- services/efs/pom.xml | 2 +- services/eks/pom.xml | 2 +- services/eksauth/pom.xml | 2 +- services/elasticache/pom.xml | 2 +- services/elasticbeanstalk/pom.xml | 2 +- services/elasticloadbalancing/pom.xml | 2 +- services/elasticloadbalancingv2/pom.xml | 2 +- services/elasticsearch/pom.xml | 2 +- services/elastictranscoder/pom.xml | 2 +- services/emr/pom.xml | 2 +- services/emrcontainers/pom.xml | 2 +- services/emrserverless/pom.xml | 2 +- services/entityresolution/pom.xml | 2 +- services/eventbridge/pom.xml | 2 +- services/evidently/pom.xml | 2 +- services/finspace/pom.xml | 2 +- services/finspacedata/pom.xml | 2 +- services/firehose/pom.xml | 2 +- services/fis/pom.xml | 2 +- services/fms/pom.xml | 2 +- services/forecast/pom.xml | 2 +- services/forecastquery/pom.xml | 2 +- services/frauddetector/pom.xml | 2 +- services/freetier/pom.xml | 2 +- services/fsx/pom.xml | 2 +- services/gamelift/pom.xml | 2 +- services/gameliftstreams/pom.xml | 2 +- services/geomaps/pom.xml | 2 +- services/geoplaces/pom.xml | 2 +- services/georoutes/pom.xml | 2 +- services/glacier/pom.xml | 2 +- services/globalaccelerator/pom.xml | 2 +- services/glue/pom.xml | 2 +- services/grafana/pom.xml | 2 +- services/greengrass/pom.xml | 2 +- services/greengrassv2/pom.xml | 2 +- services/groundstation/pom.xml | 2 +- services/guardduty/pom.xml | 2 +- services/health/pom.xml | 2 +- services/healthlake/pom.xml | 2 +- services/iam/pom.xml | 2 +- services/identitystore/pom.xml | 2 +- services/imagebuilder/pom.xml | 2 +- services/inspector/pom.xml | 2 +- services/inspector2/pom.xml | 2 +- services/inspectorscan/pom.xml | 2 +- services/internetmonitor/pom.xml | 2 +- services/invoicing/pom.xml | 2 +- services/iot/pom.xml | 2 +- services/iotanalytics/pom.xml | 2 +- services/iotdataplane/pom.xml | 2 +- services/iotdeviceadvisor/pom.xml | 2 +- services/iotevents/pom.xml | 2 +- services/ioteventsdata/pom.xml | 2 +- services/iotfleethub/pom.xml | 2 +- services/iotfleetwise/pom.xml | 2 +- services/iotjobsdataplane/pom.xml | 2 +- services/iotmanagedintegrations/pom.xml | 2 +- services/iotsecuretunneling/pom.xml | 2 +- services/iotsitewise/pom.xml | 2 +- services/iotthingsgraph/pom.xml | 2 +- services/iottwinmaker/pom.xml | 2 +- services/iotwireless/pom.xml | 2 +- services/ivs/pom.xml | 2 +- services/ivschat/pom.xml | 2 +- services/ivsrealtime/pom.xml | 2 +- services/kafka/pom.xml | 2 +- services/kafkaconnect/pom.xml | 2 +- services/kendra/pom.xml | 2 +- services/kendraranking/pom.xml | 2 +- services/keyspaces/pom.xml | 2 +- services/kinesis/pom.xml | 2 +- services/kinesisanalytics/pom.xml | 2 +- services/kinesisanalyticsv2/pom.xml | 2 +- services/kinesisvideo/pom.xml | 2 +- services/kinesisvideoarchivedmedia/pom.xml | 2 +- services/kinesisvideomedia/pom.xml | 2 +- services/kinesisvideosignaling/pom.xml | 2 +- services/kinesisvideowebrtcstorage/pom.xml | 2 +- services/kms/pom.xml | 2 +- services/lakeformation/pom.xml | 2 +- services/lambda/pom.xml | 2 +- services/launchwizard/pom.xml | 2 +- services/lexmodelbuilding/pom.xml | 2 +- services/lexmodelsv2/pom.xml | 2 +- services/lexruntime/pom.xml | 2 +- services/lexruntimev2/pom.xml | 2 +- services/licensemanager/pom.xml | 2 +- .../licensemanagerlinuxsubscriptions/pom.xml | 2 +- .../licensemanagerusersubscriptions/pom.xml | 2 +- services/lightsail/pom.xml | 2 +- services/location/pom.xml | 2 +- services/lookoutequipment/pom.xml | 2 +- services/lookoutmetrics/pom.xml | 2 +- services/lookoutvision/pom.xml | 2 +- services/m2/pom.xml | 2 +- services/machinelearning/pom.xml | 2 +- services/macie2/pom.xml | 2 +- services/mailmanager/pom.xml | 2 +- services/managedblockchain/pom.xml | 2 +- services/managedblockchainquery/pom.xml | 2 +- services/marketplaceagreement/pom.xml | 2 +- services/marketplacecatalog/pom.xml | 2 +- services/marketplacecommerceanalytics/pom.xml | 2 +- services/marketplacedeployment/pom.xml | 2 +- services/marketplaceentitlement/pom.xml | 2 +- services/marketplacemetering/pom.xml | 2 +- services/marketplacereporting/pom.xml | 2 +- services/mediaconnect/pom.xml | 2 +- services/mediaconvert/pom.xml | 2 +- services/medialive/pom.xml | 2 +- services/mediapackage/pom.xml | 2 +- services/mediapackagev2/pom.xml | 2 +- services/mediapackagevod/pom.xml | 2 +- services/mediastore/pom.xml | 2 +- services/mediastoredata/pom.xml | 2 +- services/mediatailor/pom.xml | 2 +- services/medicalimaging/pom.xml | 2 +- services/memorydb/pom.xml | 2 +- services/mgn/pom.xml | 2 +- services/migrationhub/pom.xml | 2 +- services/migrationhubconfig/pom.xml | 2 +- services/migrationhuborchestrator/pom.xml | 2 +- services/migrationhubrefactorspaces/pom.xml | 2 +- services/migrationhubstrategy/pom.xml | 2 +- services/mq/pom.xml | 2 +- services/mturk/pom.xml | 2 +- services/mwaa/pom.xml | 2 +- services/neptune/pom.xml | 2 +- services/neptunedata/pom.xml | 2 +- services/neptunegraph/pom.xml | 2 +- services/networkfirewall/pom.xml | 2 +- services/networkflowmonitor/pom.xml | 2 +- services/networkmanager/pom.xml | 2 +- services/networkmonitor/pom.xml | 2 +- services/notifications/pom.xml | 2 +- services/notificationscontacts/pom.xml | 2 +- services/oam/pom.xml | 2 +- services/observabilityadmin/pom.xml | 2 +- services/omics/pom.xml | 2 +- services/opensearch/pom.xml | 2 +- services/opensearchserverless/pom.xml | 2 +- services/opsworks/pom.xml | 2 +- services/opsworkscm/pom.xml | 2 +- services/organizations/pom.xml | 2 +- services/osis/pom.xml | 2 +- services/outposts/pom.xml | 2 +- services/panorama/pom.xml | 2 +- services/partnercentralselling/pom.xml | 2 +- services/paymentcryptography/pom.xml | 2 +- services/paymentcryptographydata/pom.xml | 2 +- services/pcaconnectorad/pom.xml | 2 +- services/pcaconnectorscep/pom.xml | 2 +- services/pcs/pom.xml | 2 +- services/personalize/pom.xml | 2 +- services/personalizeevents/pom.xml | 2 +- services/personalizeruntime/pom.xml | 2 +- services/pi/pom.xml | 2 +- services/pinpoint/pom.xml | 2 +- services/pinpointemail/pom.xml | 2 +- services/pinpointsmsvoice/pom.xml | 2 +- services/pinpointsmsvoicev2/pom.xml | 2 +- services/pipes/pom.xml | 2 +- services/polly/pom.xml | 2 +- services/pom.xml | 2 +- services/pricing/pom.xml | 2 +- services/privatenetworks/pom.xml | 2 +- services/proton/pom.xml | 2 +- services/qapps/pom.xml | 2 +- services/qbusiness/pom.xml | 2 +- services/qconnect/pom.xml | 2 +- services/qldb/pom.xml | 2 +- services/qldbsession/pom.xml | 2 +- services/quicksight/pom.xml | 2 +- services/ram/pom.xml | 2 +- services/rbin/pom.xml | 2 +- services/rds/pom.xml | 2 +- services/rdsdata/pom.xml | 2 +- services/redshift/pom.xml | 2 +- services/redshiftdata/pom.xml | 2 +- services/redshiftserverless/pom.xml | 2 +- services/rekognition/pom.xml | 2 +- services/repostspace/pom.xml | 2 +- services/resiliencehub/pom.xml | 2 +- services/resourceexplorer2/pom.xml | 2 +- services/resourcegroups/pom.xml | 2 +- services/resourcegroupstaggingapi/pom.xml | 2 +- services/robomaker/pom.xml | 2 +- services/rolesanywhere/pom.xml | 2 +- services/route53/pom.xml | 2 +- services/route53domains/pom.xml | 2 +- services/route53profiles/pom.xml | 2 +- services/route53recoverycluster/pom.xml | 2 +- services/route53recoverycontrolconfig/pom.xml | 2 +- services/route53recoveryreadiness/pom.xml | 2 +- services/route53resolver/pom.xml | 2 +- services/rum/pom.xml | 2 +- services/s3/pom.xml | 2 +- services/s3control/pom.xml | 2 +- services/s3outposts/pom.xml | 2 +- services/s3tables/pom.xml | 2 +- services/sagemaker/pom.xml | 2 +- services/sagemakera2iruntime/pom.xml | 2 +- services/sagemakeredge/pom.xml | 2 +- services/sagemakerfeaturestoreruntime/pom.xml | 2 +- services/sagemakergeospatial/pom.xml | 2 +- services/sagemakermetrics/pom.xml | 2 +- services/sagemakerruntime/pom.xml | 2 +- services/savingsplans/pom.xml | 2 +- services/scheduler/pom.xml | 2 +- services/schemas/pom.xml | 2 +- services/secretsmanager/pom.xml | 2 +- services/securityhub/pom.xml | 2 +- services/securityir/pom.xml | 2 +- services/securitylake/pom.xml | 2 +- .../serverlessapplicationrepository/pom.xml | 2 +- services/servicecatalog/pom.xml | 2 +- services/servicecatalogappregistry/pom.xml | 2 +- services/servicediscovery/pom.xml | 2 +- services/servicequotas/pom.xml | 2 +- services/ses/pom.xml | 2 +- services/sesv2/pom.xml | 2 +- services/sfn/pom.xml | 2 +- services/shield/pom.xml | 2 +- services/signer/pom.xml | 2 +- services/simspaceweaver/pom.xml | 2 +- services/sms/pom.xml | 2 +- services/snowball/pom.xml | 2 +- services/snowdevicemanagement/pom.xml | 2 +- services/sns/pom.xml | 2 +- services/socialmessaging/pom.xml | 2 +- services/sqs/pom.xml | 2 +- services/ssm/pom.xml | 2 +- services/ssmcontacts/pom.xml | 2 +- services/ssmincidents/pom.xml | 2 +- services/ssmquicksetup/pom.xml | 2 +- services/ssmsap/pom.xml | 2 +- services/sso/pom.xml | 2 +- services/ssoadmin/pom.xml | 2 +- services/ssooidc/pom.xml | 2 +- services/storagegateway/pom.xml | 2 +- services/sts/pom.xml | 2 +- services/supplychain/pom.xml | 2 +- services/support/pom.xml | 2 +- services/supportapp/pom.xml | 2 +- services/swf/pom.xml | 2 +- services/synthetics/pom.xml | 2 +- services/taxsettings/pom.xml | 2 +- services/textract/pom.xml | 2 +- services/timestreaminfluxdb/pom.xml | 2 +- services/timestreamquery/pom.xml | 2 +- services/timestreamwrite/pom.xml | 2 +- services/tnb/pom.xml | 2 +- services/transcribe/pom.xml | 2 +- services/transcribestreaming/pom.xml | 2 +- services/transfer/pom.xml | 2 +- services/translate/pom.xml | 2 +- services/trustedadvisor/pom.xml | 2 +- services/verifiedpermissions/pom.xml | 2 +- services/voiceid/pom.xml | 2 +- services/vpclattice/pom.xml | 2 +- services/waf/pom.xml | 2 +- services/wafv2/pom.xml | 2 +- services/wellarchitected/pom.xml | 2 +- services/wisdom/pom.xml | 2 +- services/workdocs/pom.xml | 2 +- services/workmail/pom.xml | 2 +- services/workmailmessageflow/pom.xml | 2 +- services/workspaces/pom.xml | 2 +- services/workspacesthinclient/pom.xml | 2 +- services/workspacesweb/pom.xml | 2 +- services/xray/pom.xml | 2 +- test/architecture-tests/pom.xml | 2 +- test/auth-tests/pom.xml | 2 +- .../pom.xml | 2 +- test/bundle-shading-tests/pom.xml | 2 +- test/codegen-generated-classes-test/pom.xml | 2 +- test/crt-unavailable-tests/pom.xml | 2 +- test/http-client-tests/pom.xml | 2 +- test/module-path-tests/pom.xml | 2 +- .../pom.xml | 2 +- test/protocol-tests-core/pom.xml | 2 +- test/protocol-tests/pom.xml | 2 +- test/region-testing/pom.xml | 2 +- test/ruleset-testing-core/pom.xml | 2 +- test/s3-benchmarks/pom.xml | 2 +- test/s3-tests/pom.xml | 2 +- test/sdk-benchmarks/pom.xml | 2 +- test/sdk-native-image-test/pom.xml | 2 +- test/service-test-utils/pom.xml | 2 +- test/stability-tests/pom.xml | 2 +- test/test-utils/pom.xml | 2 +- test/tests-coverage-reporting/pom.xml | 2 +- test/v2-migration-tests/pom.xml | 2 +- third-party/pom.xml | 2 +- third-party/third-party-jackson-core/pom.xml | 2 +- .../pom.xml | 2 +- third-party/third-party-slf4j-api/pom.xml | 2 +- utils/pom.xml | 2 +- v2-migration/pom.xml | 2 +- 500 files changed, 562 insertions(+), 531 deletions(-) create mode 100644 .changes/2.31.19.json delete mode 100644 .changes/next-release/feature-AWSControlCatalog-7dc64d2.json delete mode 100644 .changes/next-release/feature-AWSGlue-ddf4d6a.json delete mode 100644 .changes/next-release/feature-AWSGroundStation-47b8700.json delete mode 100644 .changes/next-release/feature-AWSSDKforJavav2-0443982.json delete mode 100644 .changes/next-release/feature-AWSTransferFamily-111e3bb.json delete mode 100644 .changes/next-release/feature-AmazonDynamoDB-3881005.json diff --git a/.changes/2.31.19.json b/.changes/2.31.19.json new file mode 100644 index 000000000000..430d77bc7f39 --- /dev/null +++ b/.changes/2.31.19.json @@ -0,0 +1,42 @@ +{ + "version": "2.31.19", + "date": "2025-04-09", + "entries": [ + { + "type": "feature", + "category": "AWS Control Catalog", + "contributor": "", + "description": "The GetControl API now surfaces a control's Severity, CreateTime, and Identifier for a control's Implementation. The ListControls API now surfaces a control's Behavior, Severity, CreateTime, and Identifier for a control's Implementation." + }, + { + "type": "feature", + "category": "AWS Glue", + "contributor": "", + "description": "The TableOptimizer APIs in AWS Glue now return the DpuHours field in each TableOptimizerRun, providing clients visibility to the DPU-hours used for billing in managed Apache Iceberg table compaction optimization." + }, + { + "type": "feature", + "category": "AWS Ground Station", + "contributor": "", + "description": "Support tagging Agents and adjust input field validations" + }, + { + "type": "feature", + "category": "AWS Transfer Family", + "contributor": "", + "description": "This launch includes 2 enhancements to SFTP connectors user-experience: 1) Customers can self-serve concurrent connections setting for their connectors, and 2) Customers can discover the public host key of remote servers using their SFTP connectors." + }, + { + "type": "feature", + "category": "Amazon DynamoDB", + "contributor": "", + "description": "Documentation update for secondary indexes and Create_Table." + }, + { + "type": "feature", + "category": "AWS SDK for Java v2", + "contributor": "", + "description": "Updated endpoint and partition metadata." + } + ] +} \ No newline at end of file diff --git a/.changes/next-release/feature-AWSControlCatalog-7dc64d2.json b/.changes/next-release/feature-AWSControlCatalog-7dc64d2.json deleted file mode 100644 index 06de0195896d..000000000000 --- a/.changes/next-release/feature-AWSControlCatalog-7dc64d2.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "type": "feature", - "category": "AWS Control Catalog", - "contributor": "", - "description": "The GetControl API now surfaces a control's Severity, CreateTime, and Identifier for a control's Implementation. The ListControls API now surfaces a control's Behavior, Severity, CreateTime, and Identifier for a control's Implementation." -} diff --git a/.changes/next-release/feature-AWSGlue-ddf4d6a.json b/.changes/next-release/feature-AWSGlue-ddf4d6a.json deleted file mode 100644 index 116a7f93b96e..000000000000 --- a/.changes/next-release/feature-AWSGlue-ddf4d6a.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "type": "feature", - "category": "AWS Glue", - "contributor": "", - "description": "The TableOptimizer APIs in AWS Glue now return the DpuHours field in each TableOptimizerRun, providing clients visibility to the DPU-hours used for billing in managed Apache Iceberg table compaction optimization." -} diff --git a/.changes/next-release/feature-AWSGroundStation-47b8700.json b/.changes/next-release/feature-AWSGroundStation-47b8700.json deleted file mode 100644 index c9f22445adb5..000000000000 --- a/.changes/next-release/feature-AWSGroundStation-47b8700.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "type": "feature", - "category": "AWS Ground Station", - "contributor": "", - "description": "Support tagging Agents and adjust input field validations" -} diff --git a/.changes/next-release/feature-AWSSDKforJavav2-0443982.json b/.changes/next-release/feature-AWSSDKforJavav2-0443982.json deleted file mode 100644 index e5b5ee3ca5e3..000000000000 --- a/.changes/next-release/feature-AWSSDKforJavav2-0443982.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "type": "feature", - "category": "AWS SDK for Java v2", - "contributor": "", - "description": "Updated endpoint and partition metadata." -} diff --git a/.changes/next-release/feature-AWSTransferFamily-111e3bb.json b/.changes/next-release/feature-AWSTransferFamily-111e3bb.json deleted file mode 100644 index 52da4d3d6645..000000000000 --- a/.changes/next-release/feature-AWSTransferFamily-111e3bb.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "type": "feature", - "category": "AWS Transfer Family", - "contributor": "", - "description": "This launch includes 2 enhancements to SFTP connectors user-experience: 1) Customers can self-serve concurrent connections setting for their connectors, and 2) Customers can discover the public host key of remote servers using their SFTP connectors." -} diff --git a/.changes/next-release/feature-AmazonDynamoDB-3881005.json b/.changes/next-release/feature-AmazonDynamoDB-3881005.json deleted file mode 100644 index dcf96679f74e..000000000000 --- a/.changes/next-release/feature-AmazonDynamoDB-3881005.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "type": "feature", - "category": "Amazon DynamoDB", - "contributor": "", - "description": "Documentation update for secondary indexes and Create_Table." -} diff --git a/CHANGELOG.md b/CHANGELOG.md index c8ea8052fce1..93a1f1f940d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,29 @@ #### 👋 _Looking for changelogs for older versions? You can find them in the [changelogs](./changelogs) directory._ +# __2.31.19__ __2025-04-09__ +## __AWS Control Catalog__ + - ### Features + - The GetControl API now surfaces a control's Severity, CreateTime, and Identifier for a control's Implementation. The ListControls API now surfaces a control's Behavior, Severity, CreateTime, and Identifier for a control's Implementation. + +## __AWS Glue__ + - ### Features + - The TableOptimizer APIs in AWS Glue now return the DpuHours field in each TableOptimizerRun, providing clients visibility to the DPU-hours used for billing in managed Apache Iceberg table compaction optimization. + +## __AWS Ground Station__ + - ### Features + - Support tagging Agents and adjust input field validations + +## __AWS SDK for Java v2__ + - ### Features + - Updated endpoint and partition metadata. + +## __AWS Transfer Family__ + - ### Features + - This launch includes 2 enhancements to SFTP connectors user-experience: 1) Customers can self-serve concurrent connections setting for their connectors, and 2) Customers can discover the public host key of remote servers using their SFTP connectors. + +## __Amazon DynamoDB__ + - ### Features + - Documentation update for secondary indexes and Create_Table. + # __2.31.18__ __2025-04-08__ ## __AWS Cost Explorer Service__ - ### Features diff --git a/README.md b/README.md index 87f3abf45c5a..f7c4d635bb1b 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ To automatically manage module versions (currently all modules have the same ver software.amazon.awssdk bom - 2.31.18 + 2.31.19 pom import @@ -85,12 +85,12 @@ Alternatively you can add dependencies for the specific services you use only: software.amazon.awssdk ec2 - 2.31.18 + 2.31.19 software.amazon.awssdk s3 - 2.31.18 + 2.31.19 ``` @@ -102,7 +102,7 @@ You can import the whole SDK into your project (includes *ALL* services). Please software.amazon.awssdk aws-sdk-java - 2.31.18 + 2.31.19 ``` diff --git a/archetypes/archetype-app-quickstart/pom.xml b/archetypes/archetype-app-quickstart/pom.xml index d4ecbebd1775..f1f6722c09be 100644 --- a/archetypes/archetype-app-quickstart/pom.xml +++ b/archetypes/archetype-app-quickstart/pom.xml @@ -20,7 +20,7 @@ archetypes software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 diff --git a/archetypes/archetype-lambda/pom.xml b/archetypes/archetype-lambda/pom.xml index 646c744f2fca..41848c1de2cf 100644 --- a/archetypes/archetype-lambda/pom.xml +++ b/archetypes/archetype-lambda/pom.xml @@ -20,7 +20,7 @@ archetypes software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 archetype-lambda diff --git a/archetypes/archetype-tools/pom.xml b/archetypes/archetype-tools/pom.xml index 52150cac118d..4a9833cd6d88 100644 --- a/archetypes/archetype-tools/pom.xml +++ b/archetypes/archetype-tools/pom.xml @@ -20,7 +20,7 @@ archetypes software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 diff --git a/archetypes/pom.xml b/archetypes/pom.xml index e09e2a845892..3d5c886059e5 100644 --- a/archetypes/pom.xml +++ b/archetypes/pom.xml @@ -20,7 +20,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 archetypes diff --git a/aws-sdk-java/pom.xml b/aws-sdk-java/pom.xml index 16218f37deaf..d66545bff05e 100644 --- a/aws-sdk-java/pom.xml +++ b/aws-sdk-java/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk aws-sdk-java-pom - 2.31.19-SNAPSHOT + 2.31.19 ../pom.xml aws-sdk-java diff --git a/bom-internal/pom.xml b/bom-internal/pom.xml index 0cf21f5e9212..affc13842fa1 100644 --- a/bom-internal/pom.xml +++ b/bom-internal/pom.xml @@ -20,7 +20,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 diff --git a/bom/pom.xml b/bom/pom.xml index c0fce7688fd9..9eee4a29aa4c 100644 --- a/bom/pom.xml +++ b/bom/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk aws-sdk-java-pom - 2.31.19-SNAPSHOT + 2.31.19 ../pom.xml bom diff --git a/bundle-logging-bridge/pom.xml b/bundle-logging-bridge/pom.xml index 294c010d1770..1175acb567eb 100644 --- a/bundle-logging-bridge/pom.xml +++ b/bundle-logging-bridge/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk aws-sdk-java-pom - 2.31.19-SNAPSHOT + 2.31.19 bundle-logging-bridge jar diff --git a/bundle-sdk/pom.xml b/bundle-sdk/pom.xml index 409d0fe22055..162b39108bfd 100644 --- a/bundle-sdk/pom.xml +++ b/bundle-sdk/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk aws-sdk-java-pom - 2.31.19-SNAPSHOT + 2.31.19 bundle-sdk jar diff --git a/bundle/pom.xml b/bundle/pom.xml index 2aab0eb2ace7..927721a356bc 100644 --- a/bundle/pom.xml +++ b/bundle/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk aws-sdk-java-pom - 2.31.19-SNAPSHOT + 2.31.19 bundle jar diff --git a/codegen-lite-maven-plugin/pom.xml b/codegen-lite-maven-plugin/pom.xml index 3e49d5ac31b4..cf7e28328764 100644 --- a/codegen-lite-maven-plugin/pom.xml +++ b/codegen-lite-maven-plugin/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk aws-sdk-java-pom - 2.31.19-SNAPSHOT + 2.31.19 ../pom.xml codegen-lite-maven-plugin diff --git a/codegen-lite/pom.xml b/codegen-lite/pom.xml index 99bf7a84217f..a5e276d67ef8 100644 --- a/codegen-lite/pom.xml +++ b/codegen-lite/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk aws-sdk-java-pom - 2.31.19-SNAPSHOT + 2.31.19 codegen-lite AWS Java SDK :: Code Generator Lite diff --git a/codegen-maven-plugin/pom.xml b/codegen-maven-plugin/pom.xml index 2e0adc46c1e5..1d343b5b9b04 100644 --- a/codegen-maven-plugin/pom.xml +++ b/codegen-maven-plugin/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk aws-sdk-java-pom - 2.31.19-SNAPSHOT + 2.31.19 ../pom.xml codegen-maven-plugin diff --git a/codegen/pom.xml b/codegen/pom.xml index f5401616dce5..f8bf6945a6b6 100644 --- a/codegen/pom.xml +++ b/codegen/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk aws-sdk-java-pom - 2.31.19-SNAPSHOT + 2.31.19 codegen AWS Java SDK :: Code Generator diff --git a/core/annotations/pom.xml b/core/annotations/pom.xml index 787bed2ad160..1d74f7482d41 100644 --- a/core/annotations/pom.xml +++ b/core/annotations/pom.xml @@ -20,7 +20,7 @@ core software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 diff --git a/core/arns/pom.xml b/core/arns/pom.xml index 78e890a9ea88..622ba5937de4 100644 --- a/core/arns/pom.xml +++ b/core/arns/pom.xml @@ -20,7 +20,7 @@ core software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 diff --git a/core/auth-crt/pom.xml b/core/auth-crt/pom.xml index 2a12a94f45b7..18f0fb76b1ff 100644 --- a/core/auth-crt/pom.xml +++ b/core/auth-crt/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk core - 2.31.19-SNAPSHOT + 2.31.19 auth-crt diff --git a/core/auth/pom.xml b/core/auth/pom.xml index c180a04298d2..a5acb15ec5b6 100644 --- a/core/auth/pom.xml +++ b/core/auth/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk core - 2.31.19-SNAPSHOT + 2.31.19 auth diff --git a/core/aws-core/pom.xml b/core/aws-core/pom.xml index b0bcaca3d4cc..0d8916b62e38 100644 --- a/core/aws-core/pom.xml +++ b/core/aws-core/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk core - 2.31.19-SNAPSHOT + 2.31.19 aws-core diff --git a/core/checksums-spi/pom.xml b/core/checksums-spi/pom.xml index a7c04290af39..46125cec3c0c 100644 --- a/core/checksums-spi/pom.xml +++ b/core/checksums-spi/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk core - 2.31.19-SNAPSHOT + 2.31.19 checksums-spi diff --git a/core/checksums/pom.xml b/core/checksums/pom.xml index de3fbc1d8faa..b188a5c7a1ab 100644 --- a/core/checksums/pom.xml +++ b/core/checksums/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk core - 2.31.19-SNAPSHOT + 2.31.19 checksums diff --git a/core/crt-core/pom.xml b/core/crt-core/pom.xml index 734e8baca94a..fc957d247c49 100644 --- a/core/crt-core/pom.xml +++ b/core/crt-core/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk core - 2.31.19-SNAPSHOT + 2.31.19 crt-core diff --git a/core/endpoints-spi/pom.xml b/core/endpoints-spi/pom.xml index 8e88f103ccd7..ec2937509189 100644 --- a/core/endpoints-spi/pom.xml +++ b/core/endpoints-spi/pom.xml @@ -20,7 +20,7 @@ core software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 diff --git a/core/http-auth-aws-crt/pom.xml b/core/http-auth-aws-crt/pom.xml index f35b802b1445..57382d4a335c 100644 --- a/core/http-auth-aws-crt/pom.xml +++ b/core/http-auth-aws-crt/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk core - 2.31.19-SNAPSHOT + 2.31.19 http-auth-aws-crt diff --git a/core/http-auth-aws-eventstream/pom.xml b/core/http-auth-aws-eventstream/pom.xml index 28ea7bc33e8e..16a58a70e537 100644 --- a/core/http-auth-aws-eventstream/pom.xml +++ b/core/http-auth-aws-eventstream/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk core - 2.31.19-SNAPSHOT + 2.31.19 http-auth-aws-eventstream diff --git a/core/http-auth-aws/pom.xml b/core/http-auth-aws/pom.xml index c78d93c6a60c..932b81b46a4e 100644 --- a/core/http-auth-aws/pom.xml +++ b/core/http-auth-aws/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk core - 2.31.19-SNAPSHOT + 2.31.19 http-auth-aws diff --git a/core/http-auth-spi/pom.xml b/core/http-auth-spi/pom.xml index 00ce4f56b52f..6b39638863d6 100644 --- a/core/http-auth-spi/pom.xml +++ b/core/http-auth-spi/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk core - 2.31.19-SNAPSHOT + 2.31.19 http-auth-spi diff --git a/core/http-auth/pom.xml b/core/http-auth/pom.xml index 6e4c1ea4eef2..a13383fe4113 100644 --- a/core/http-auth/pom.xml +++ b/core/http-auth/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk core - 2.31.19-SNAPSHOT + 2.31.19 http-auth diff --git a/core/identity-spi/pom.xml b/core/identity-spi/pom.xml index c21031a1e392..cdf979dd325f 100644 --- a/core/identity-spi/pom.xml +++ b/core/identity-spi/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk core - 2.31.19-SNAPSHOT + 2.31.19 identity-spi diff --git a/core/imds/pom.xml b/core/imds/pom.xml index 007f3dbd5dd5..cb32535fd0c0 100644 --- a/core/imds/pom.xml +++ b/core/imds/pom.xml @@ -20,7 +20,7 @@ core software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 imds diff --git a/core/json-utils/pom.xml b/core/json-utils/pom.xml index 4a78ab842ef5..505cfeacacd3 100644 --- a/core/json-utils/pom.xml +++ b/core/json-utils/pom.xml @@ -20,7 +20,7 @@ core software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 diff --git a/core/metrics-spi/pom.xml b/core/metrics-spi/pom.xml index 466e50f780fd..d5cd0b4efb49 100644 --- a/core/metrics-spi/pom.xml +++ b/core/metrics-spi/pom.xml @@ -5,7 +5,7 @@ core software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 diff --git a/core/pom.xml b/core/pom.xml index 8299dbccac31..253a356e5227 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -21,7 +21,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 core diff --git a/core/profiles/pom.xml b/core/profiles/pom.xml index 7e705af493cb..ca1477e47ba7 100644 --- a/core/profiles/pom.xml +++ b/core/profiles/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk core - 2.31.19-SNAPSHOT + 2.31.19 profiles diff --git a/core/protocols/aws-cbor-protocol/pom.xml b/core/protocols/aws-cbor-protocol/pom.xml index 7ba9e77048c7..de4d61bf2ab8 100644 --- a/core/protocols/aws-cbor-protocol/pom.xml +++ b/core/protocols/aws-cbor-protocol/pom.xml @@ -20,7 +20,7 @@ protocols software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 diff --git a/core/protocols/aws-json-protocol/pom.xml b/core/protocols/aws-json-protocol/pom.xml index a8032594fcf8..30b572c47a1e 100644 --- a/core/protocols/aws-json-protocol/pom.xml +++ b/core/protocols/aws-json-protocol/pom.xml @@ -20,7 +20,7 @@ protocols software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 diff --git a/core/protocols/aws-query-protocol/pom.xml b/core/protocols/aws-query-protocol/pom.xml index dd6b97b8b649..c7df440a8e7f 100644 --- a/core/protocols/aws-query-protocol/pom.xml +++ b/core/protocols/aws-query-protocol/pom.xml @@ -20,7 +20,7 @@ protocols software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 diff --git a/core/protocols/aws-xml-protocol/pom.xml b/core/protocols/aws-xml-protocol/pom.xml index 09fc943c84f5..177b836a3dae 100644 --- a/core/protocols/aws-xml-protocol/pom.xml +++ b/core/protocols/aws-xml-protocol/pom.xml @@ -20,7 +20,7 @@ protocols software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 diff --git a/core/protocols/pom.xml b/core/protocols/pom.xml index 1f1c20558f85..71d672f203e8 100644 --- a/core/protocols/pom.xml +++ b/core/protocols/pom.xml @@ -20,7 +20,7 @@ core software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 diff --git a/core/protocols/protocol-core/pom.xml b/core/protocols/protocol-core/pom.xml index 272a3ec75a1c..cb4bdbaa400a 100644 --- a/core/protocols/protocol-core/pom.xml +++ b/core/protocols/protocol-core/pom.xml @@ -20,7 +20,7 @@ protocols software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 diff --git a/core/protocols/smithy-rpcv2-protocol/pom.xml b/core/protocols/smithy-rpcv2-protocol/pom.xml index 4d0d2b092f03..e20e3df0f48d 100644 --- a/core/protocols/smithy-rpcv2-protocol/pom.xml +++ b/core/protocols/smithy-rpcv2-protocol/pom.xml @@ -20,7 +20,7 @@ protocols software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 diff --git a/core/regions/pom.xml b/core/regions/pom.xml index 2582d7f82867..b9ae1f9cbce4 100644 --- a/core/regions/pom.xml +++ b/core/regions/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk core - 2.31.19-SNAPSHOT + 2.31.19 regions diff --git a/core/retries-spi/pom.xml b/core/retries-spi/pom.xml index 0c524dceece8..9a26371065f8 100644 --- a/core/retries-spi/pom.xml +++ b/core/retries-spi/pom.xml @@ -20,7 +20,7 @@ core software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 diff --git a/core/retries/pom.xml b/core/retries/pom.xml index 914c3b46093f..504b6754f9c6 100644 --- a/core/retries/pom.xml +++ b/core/retries/pom.xml @@ -21,7 +21,7 @@ core software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 diff --git a/core/sdk-core/pom.xml b/core/sdk-core/pom.xml index b5ef536c3846..2f5a8cf1b06e 100644 --- a/core/sdk-core/pom.xml +++ b/core/sdk-core/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk core - 2.31.19-SNAPSHOT + 2.31.19 sdk-core AWS Java SDK :: SDK Core diff --git a/http-client-spi/pom.xml b/http-client-spi/pom.xml index 4a21834cb447..03ebf902fe32 100644 --- a/http-client-spi/pom.xml +++ b/http-client-spi/pom.xml @@ -22,7 +22,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 http-client-spi AWS Java SDK :: HTTP Client Interface diff --git a/http-clients/apache-client/pom.xml b/http-clients/apache-client/pom.xml index 32f7794998c0..5d9f6923d7d1 100644 --- a/http-clients/apache-client/pom.xml +++ b/http-clients/apache-client/pom.xml @@ -21,7 +21,7 @@ http-clients software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 apache-client diff --git a/http-clients/aws-crt-client/pom.xml b/http-clients/aws-crt-client/pom.xml index 1ce89658996e..dd8942f42efa 100644 --- a/http-clients/aws-crt-client/pom.xml +++ b/http-clients/aws-crt-client/pom.xml @@ -21,7 +21,7 @@ http-clients software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 diff --git a/http-clients/netty-nio-client/pom.xml b/http-clients/netty-nio-client/pom.xml index ae1f672bf64f..51c698b866f2 100644 --- a/http-clients/netty-nio-client/pom.xml +++ b/http-clients/netty-nio-client/pom.xml @@ -20,7 +20,7 @@ http-clients software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 diff --git a/http-clients/pom.xml b/http-clients/pom.xml index 1e2fe0ea4368..b5b3ac187817 100644 --- a/http-clients/pom.xml +++ b/http-clients/pom.xml @@ -21,7 +21,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 diff --git a/http-clients/url-connection-client/pom.xml b/http-clients/url-connection-client/pom.xml index e4a3f4d72901..7964b608ae15 100644 --- a/http-clients/url-connection-client/pom.xml +++ b/http-clients/url-connection-client/pom.xml @@ -20,7 +20,7 @@ http-clients software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 diff --git a/metric-publishers/cloudwatch-metric-publisher/pom.xml b/metric-publishers/cloudwatch-metric-publisher/pom.xml index 455825a8e5b5..786d4d42f02f 100644 --- a/metric-publishers/cloudwatch-metric-publisher/pom.xml +++ b/metric-publishers/cloudwatch-metric-publisher/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk metric-publishers - 2.31.19-SNAPSHOT + 2.31.19 cloudwatch-metric-publisher diff --git a/metric-publishers/emf-metric-logging-publisher/pom.xml b/metric-publishers/emf-metric-logging-publisher/pom.xml index 0d3f8b7dd910..453dc8caa49f 100644 --- a/metric-publishers/emf-metric-logging-publisher/pom.xml +++ b/metric-publishers/emf-metric-logging-publisher/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk metric-publishers - 2.31.19-SNAPSHOT + 2.31.19 emf-metric-logging-publisher diff --git a/metric-publishers/pom.xml b/metric-publishers/pom.xml index 4a295290c98c..c8133a599e49 100644 --- a/metric-publishers/pom.xml +++ b/metric-publishers/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk aws-sdk-java-pom - 2.31.19-SNAPSHOT + 2.31.19 metric-publishers diff --git a/pom.xml b/pom.xml index 46a3f2e0e3a5..115897e6c1eb 100644 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ 4.0.0 software.amazon.awssdk aws-sdk-java-pom - 2.31.19-SNAPSHOT + 2.31.19 pom AWS Java SDK :: Parent The Amazon Web Services SDK for Java provides Java APIs diff --git a/release-scripts/pom.xml b/release-scripts/pom.xml index 8d79c8e29c53..c4f6379d8ef6 100644 --- a/release-scripts/pom.xml +++ b/release-scripts/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk aws-sdk-java-pom - 2.31.19-SNAPSHOT + 2.31.19 ../pom.xml release-scripts diff --git a/services-custom/dynamodb-enhanced/pom.xml b/services-custom/dynamodb-enhanced/pom.xml index 0f464b49125f..47b6c2c5a10b 100644 --- a/services-custom/dynamodb-enhanced/pom.xml +++ b/services-custom/dynamodb-enhanced/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services-custom - 2.31.19-SNAPSHOT + 2.31.19 dynamodb-enhanced AWS Java SDK :: DynamoDB :: Enhanced Client diff --git a/services-custom/iam-policy-builder/pom.xml b/services-custom/iam-policy-builder/pom.xml index 6f3ff8e34fb6..449f940ca96a 100644 --- a/services-custom/iam-policy-builder/pom.xml +++ b/services-custom/iam-policy-builder/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk aws-sdk-java-pom - 2.31.19-SNAPSHOT + 2.31.19 ../../pom.xml iam-policy-builder diff --git a/services-custom/pom.xml b/services-custom/pom.xml index 495271ee5135..12ceb07dfe6f 100644 --- a/services-custom/pom.xml +++ b/services-custom/pom.xml @@ -19,7 +19,7 @@ software.amazon.awssdk aws-sdk-java-pom - 2.31.19-SNAPSHOT + 2.31.19 services-custom AWS Java SDK :: Custom Services diff --git a/services-custom/s3-event-notifications/pom.xml b/services-custom/s3-event-notifications/pom.xml index 426d895cfb21..3d098e996844 100644 --- a/services-custom/s3-event-notifications/pom.xml +++ b/services-custom/s3-event-notifications/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk aws-sdk-java-pom - 2.31.19-SNAPSHOT + 2.31.19 ../../pom.xml s3-event-notifications diff --git a/services-custom/s3-transfer-manager/pom.xml b/services-custom/s3-transfer-manager/pom.xml index 49974ef78048..8984d400b5ad 100644 --- a/services-custom/s3-transfer-manager/pom.xml +++ b/services-custom/s3-transfer-manager/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk aws-sdk-java-pom - 2.31.19-SNAPSHOT + 2.31.19 ../../pom.xml s3-transfer-manager diff --git a/services/accessanalyzer/pom.xml b/services/accessanalyzer/pom.xml index 7d9b62859072..2bcce08e78b5 100644 --- a/services/accessanalyzer/pom.xml +++ b/services/accessanalyzer/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 accessanalyzer AWS Java SDK :: Services :: AccessAnalyzer diff --git a/services/account/pom.xml b/services/account/pom.xml index 4e6f54634190..2b99092f7639 100644 --- a/services/account/pom.xml +++ b/services/account/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 account AWS Java SDK :: Services :: Account diff --git a/services/acm/pom.xml b/services/acm/pom.xml index 28f87fc8ac23..163a88911625 100644 --- a/services/acm/pom.xml +++ b/services/acm/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 acm AWS Java SDK :: Services :: AWS Certificate Manager diff --git a/services/acmpca/pom.xml b/services/acmpca/pom.xml index 8d5313bf9b56..5cb5dc1531b3 100644 --- a/services/acmpca/pom.xml +++ b/services/acmpca/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 acmpca AWS Java SDK :: Services :: ACM PCA diff --git a/services/amp/pom.xml b/services/amp/pom.xml index cbd1e9281b13..9f4ecb5befb9 100644 --- a/services/amp/pom.xml +++ b/services/amp/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 amp AWS Java SDK :: Services :: Amp diff --git a/services/amplify/pom.xml b/services/amplify/pom.xml index 6a022fd08beb..0767a7fd91f4 100644 --- a/services/amplify/pom.xml +++ b/services/amplify/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 amplify AWS Java SDK :: Services :: Amplify diff --git a/services/amplifybackend/pom.xml b/services/amplifybackend/pom.xml index 6e05ba20ac72..622654871311 100644 --- a/services/amplifybackend/pom.xml +++ b/services/amplifybackend/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 amplifybackend AWS Java SDK :: Services :: Amplify Backend diff --git a/services/amplifyuibuilder/pom.xml b/services/amplifyuibuilder/pom.xml index 1e506336b61f..a7f23e2be541 100644 --- a/services/amplifyuibuilder/pom.xml +++ b/services/amplifyuibuilder/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 amplifyuibuilder AWS Java SDK :: Services :: Amplify UI Builder diff --git a/services/apigateway/pom.xml b/services/apigateway/pom.xml index cb4a46fb31ad..1ee2b5213dc1 100644 --- a/services/apigateway/pom.xml +++ b/services/apigateway/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 apigateway AWS Java SDK :: Services :: Amazon API Gateway diff --git a/services/apigatewaymanagementapi/pom.xml b/services/apigatewaymanagementapi/pom.xml index 1fe9c845b858..8f9e7de19664 100644 --- a/services/apigatewaymanagementapi/pom.xml +++ b/services/apigatewaymanagementapi/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 apigatewaymanagementapi AWS Java SDK :: Services :: ApiGatewayManagementApi diff --git a/services/apigatewayv2/pom.xml b/services/apigatewayv2/pom.xml index 2c62c0646b43..7eca5dd4eb3c 100644 --- a/services/apigatewayv2/pom.xml +++ b/services/apigatewayv2/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 apigatewayv2 AWS Java SDK :: Services :: ApiGatewayV2 diff --git a/services/appconfig/pom.xml b/services/appconfig/pom.xml index 7773ac287704..71c315c6ad65 100644 --- a/services/appconfig/pom.xml +++ b/services/appconfig/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 appconfig AWS Java SDK :: Services :: AppConfig diff --git a/services/appconfigdata/pom.xml b/services/appconfigdata/pom.xml index 1c8e023d1e15..7c63a250ca53 100644 --- a/services/appconfigdata/pom.xml +++ b/services/appconfigdata/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 appconfigdata AWS Java SDK :: Services :: App Config Data diff --git a/services/appfabric/pom.xml b/services/appfabric/pom.xml index 3e13b11e4646..693460583867 100644 --- a/services/appfabric/pom.xml +++ b/services/appfabric/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 appfabric AWS Java SDK :: Services :: App Fabric diff --git a/services/appflow/pom.xml b/services/appflow/pom.xml index a2fba7018435..5e481ba8f410 100644 --- a/services/appflow/pom.xml +++ b/services/appflow/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 appflow AWS Java SDK :: Services :: Appflow diff --git a/services/appintegrations/pom.xml b/services/appintegrations/pom.xml index bf17a669aa97..4b177d48145f 100644 --- a/services/appintegrations/pom.xml +++ b/services/appintegrations/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 appintegrations AWS Java SDK :: Services :: App Integrations diff --git a/services/applicationautoscaling/pom.xml b/services/applicationautoscaling/pom.xml index 9f23d2f9a3bb..ba7971b836e0 100644 --- a/services/applicationautoscaling/pom.xml +++ b/services/applicationautoscaling/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 applicationautoscaling AWS Java SDK :: Services :: AWS Application Auto Scaling diff --git a/services/applicationcostprofiler/pom.xml b/services/applicationcostprofiler/pom.xml index a097e3d8e7ea..9ae5369a0599 100644 --- a/services/applicationcostprofiler/pom.xml +++ b/services/applicationcostprofiler/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 applicationcostprofiler AWS Java SDK :: Services :: Application Cost Profiler diff --git a/services/applicationdiscovery/pom.xml b/services/applicationdiscovery/pom.xml index d7cb11365f4c..a0c6170ff912 100644 --- a/services/applicationdiscovery/pom.xml +++ b/services/applicationdiscovery/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 applicationdiscovery AWS Java SDK :: Services :: AWS Application Discovery Service diff --git a/services/applicationinsights/pom.xml b/services/applicationinsights/pom.xml index 44fca542a362..2c0e33bed240 100644 --- a/services/applicationinsights/pom.xml +++ b/services/applicationinsights/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 applicationinsights AWS Java SDK :: Services :: Application Insights diff --git a/services/applicationsignals/pom.xml b/services/applicationsignals/pom.xml index 2b7d95b92907..46a98a8c92ff 100644 --- a/services/applicationsignals/pom.xml +++ b/services/applicationsignals/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 applicationsignals AWS Java SDK :: Services :: Application Signals diff --git a/services/appmesh/pom.xml b/services/appmesh/pom.xml index d17d97eaa0ed..70b01748474b 100644 --- a/services/appmesh/pom.xml +++ b/services/appmesh/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 appmesh AWS Java SDK :: Services :: App Mesh diff --git a/services/apprunner/pom.xml b/services/apprunner/pom.xml index 050bd53bc2d1..f569041aa8d2 100644 --- a/services/apprunner/pom.xml +++ b/services/apprunner/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 apprunner AWS Java SDK :: Services :: App Runner diff --git a/services/appstream/pom.xml b/services/appstream/pom.xml index d72042a75f61..014765ba99e8 100644 --- a/services/appstream/pom.xml +++ b/services/appstream/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 appstream AWS Java SDK :: Services :: Amazon AppStream diff --git a/services/appsync/pom.xml b/services/appsync/pom.xml index d9992efa5054..1c4c358a85e1 100644 --- a/services/appsync/pom.xml +++ b/services/appsync/pom.xml @@ -21,7 +21,7 @@ services software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 appsync diff --git a/services/apptest/pom.xml b/services/apptest/pom.xml index e665f41cfb10..71df19ce4312 100644 --- a/services/apptest/pom.xml +++ b/services/apptest/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 apptest AWS Java SDK :: Services :: App Test diff --git a/services/arczonalshift/pom.xml b/services/arczonalshift/pom.xml index a4fbd32b385a..a1fdb01a09c4 100644 --- a/services/arczonalshift/pom.xml +++ b/services/arczonalshift/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 arczonalshift AWS Java SDK :: Services :: ARC Zonal Shift diff --git a/services/artifact/pom.xml b/services/artifact/pom.xml index 669ac2bc06fd..c0b9403aedc2 100644 --- a/services/artifact/pom.xml +++ b/services/artifact/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 artifact AWS Java SDK :: Services :: Artifact diff --git a/services/athena/pom.xml b/services/athena/pom.xml index f8fbc240151d..dfa991618506 100644 --- a/services/athena/pom.xml +++ b/services/athena/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 athena AWS Java SDK :: Services :: Amazon Athena diff --git a/services/auditmanager/pom.xml b/services/auditmanager/pom.xml index 5850553817b6..49212c32a563 100644 --- a/services/auditmanager/pom.xml +++ b/services/auditmanager/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 auditmanager AWS Java SDK :: Services :: Audit Manager diff --git a/services/autoscaling/pom.xml b/services/autoscaling/pom.xml index 0ce7298d5de2..9bb82cab5fd3 100644 --- a/services/autoscaling/pom.xml +++ b/services/autoscaling/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 autoscaling AWS Java SDK :: Services :: Auto Scaling diff --git a/services/autoscalingplans/pom.xml b/services/autoscalingplans/pom.xml index eff8634fdae0..1ecafd55b5fe 100644 --- a/services/autoscalingplans/pom.xml +++ b/services/autoscalingplans/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 autoscalingplans AWS Java SDK :: Services :: Auto Scaling Plans diff --git a/services/b2bi/pom.xml b/services/b2bi/pom.xml index f8c45777f2ce..25d11d28d8eb 100644 --- a/services/b2bi/pom.xml +++ b/services/b2bi/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 b2bi AWS Java SDK :: Services :: B2 Bi diff --git a/services/backup/pom.xml b/services/backup/pom.xml index 25f25a0f0345..87436c8768ea 100644 --- a/services/backup/pom.xml +++ b/services/backup/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 backup AWS Java SDK :: Services :: Backup diff --git a/services/backupgateway/pom.xml b/services/backupgateway/pom.xml index e14b05c80c1d..9d29bb6a31f6 100644 --- a/services/backupgateway/pom.xml +++ b/services/backupgateway/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 backupgateway AWS Java SDK :: Services :: Backup Gateway diff --git a/services/backupsearch/pom.xml b/services/backupsearch/pom.xml index 5e03486e3e95..a922f21de829 100644 --- a/services/backupsearch/pom.xml +++ b/services/backupsearch/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 backupsearch AWS Java SDK :: Services :: Backup Search diff --git a/services/batch/pom.xml b/services/batch/pom.xml index f447e8f98788..bc79eb430e2b 100644 --- a/services/batch/pom.xml +++ b/services/batch/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 batch AWS Java SDK :: Services :: AWS Batch diff --git a/services/bcmdataexports/pom.xml b/services/bcmdataexports/pom.xml index 080b3eac096e..274de8ad9ae8 100644 --- a/services/bcmdataexports/pom.xml +++ b/services/bcmdataexports/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 bcmdataexports AWS Java SDK :: Services :: BCM Data Exports diff --git a/services/bcmpricingcalculator/pom.xml b/services/bcmpricingcalculator/pom.xml index 8761f8b18f49..4a3930e9fce8 100644 --- a/services/bcmpricingcalculator/pom.xml +++ b/services/bcmpricingcalculator/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 bcmpricingcalculator AWS Java SDK :: Services :: BCM Pricing Calculator diff --git a/services/bedrock/pom.xml b/services/bedrock/pom.xml index 10e7c8f02b45..670ddc8999af 100644 --- a/services/bedrock/pom.xml +++ b/services/bedrock/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 bedrock AWS Java SDK :: Services :: Bedrock diff --git a/services/bedrockagent/pom.xml b/services/bedrockagent/pom.xml index 32444ad93ea0..3ffe90fe418f 100644 --- a/services/bedrockagent/pom.xml +++ b/services/bedrockagent/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 bedrockagent AWS Java SDK :: Services :: Bedrock Agent diff --git a/services/bedrockagentruntime/pom.xml b/services/bedrockagentruntime/pom.xml index 823459a750a3..eb1b9127542f 100644 --- a/services/bedrockagentruntime/pom.xml +++ b/services/bedrockagentruntime/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 bedrockagentruntime AWS Java SDK :: Services :: Bedrock Agent Runtime diff --git a/services/bedrockdataautomation/pom.xml b/services/bedrockdataautomation/pom.xml index e505237dd56a..a3414ce7e67a 100644 --- a/services/bedrockdataautomation/pom.xml +++ b/services/bedrockdataautomation/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 bedrockdataautomation AWS Java SDK :: Services :: Bedrock Data Automation diff --git a/services/bedrockdataautomationruntime/pom.xml b/services/bedrockdataautomationruntime/pom.xml index 3f2cc7fbddae..df1e34117b04 100644 --- a/services/bedrockdataautomationruntime/pom.xml +++ b/services/bedrockdataautomationruntime/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 bedrockdataautomationruntime AWS Java SDK :: Services :: Bedrock Data Automation Runtime diff --git a/services/bedrockruntime/pom.xml b/services/bedrockruntime/pom.xml index b2e21a6d4967..f64a4db1e0d8 100644 --- a/services/bedrockruntime/pom.xml +++ b/services/bedrockruntime/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 bedrockruntime AWS Java SDK :: Services :: Bedrock Runtime diff --git a/services/billing/pom.xml b/services/billing/pom.xml index f39ac48b985c..900b041c5f26 100644 --- a/services/billing/pom.xml +++ b/services/billing/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 billing AWS Java SDK :: Services :: Billing diff --git a/services/billingconductor/pom.xml b/services/billingconductor/pom.xml index b64bd406c6f9..5f33fe20e5ef 100644 --- a/services/billingconductor/pom.xml +++ b/services/billingconductor/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 billingconductor AWS Java SDK :: Services :: Billingconductor diff --git a/services/braket/pom.xml b/services/braket/pom.xml index d8393a6de53b..a8711159725a 100644 --- a/services/braket/pom.xml +++ b/services/braket/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 braket AWS Java SDK :: Services :: Braket diff --git a/services/budgets/pom.xml b/services/budgets/pom.xml index e19b693f82f2..a4f63cebdb99 100644 --- a/services/budgets/pom.xml +++ b/services/budgets/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 budgets AWS Java SDK :: Services :: AWS Budgets diff --git a/services/chatbot/pom.xml b/services/chatbot/pom.xml index 87d6389e3aea..63c0ddc78e13 100644 --- a/services/chatbot/pom.xml +++ b/services/chatbot/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 chatbot AWS Java SDK :: Services :: Chatbot diff --git a/services/chime/pom.xml b/services/chime/pom.xml index 32ee6e9a096c..6e4a60a4f2b0 100644 --- a/services/chime/pom.xml +++ b/services/chime/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 chime AWS Java SDK :: Services :: Chime diff --git a/services/chimesdkidentity/pom.xml b/services/chimesdkidentity/pom.xml index 52c1140882e4..5b2494033f9a 100644 --- a/services/chimesdkidentity/pom.xml +++ b/services/chimesdkidentity/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 chimesdkidentity AWS Java SDK :: Services :: Chime SDK Identity diff --git a/services/chimesdkmediapipelines/pom.xml b/services/chimesdkmediapipelines/pom.xml index 69a8c029136d..77efc9f544f0 100644 --- a/services/chimesdkmediapipelines/pom.xml +++ b/services/chimesdkmediapipelines/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 chimesdkmediapipelines AWS Java SDK :: Services :: Chime SDK Media Pipelines diff --git a/services/chimesdkmeetings/pom.xml b/services/chimesdkmeetings/pom.xml index a85de3fb018f..dd648cddf3be 100644 --- a/services/chimesdkmeetings/pom.xml +++ b/services/chimesdkmeetings/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 chimesdkmeetings AWS Java SDK :: Services :: Chime SDK Meetings diff --git a/services/chimesdkmessaging/pom.xml b/services/chimesdkmessaging/pom.xml index a1fe74960af5..bad7bda09124 100644 --- a/services/chimesdkmessaging/pom.xml +++ b/services/chimesdkmessaging/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 chimesdkmessaging AWS Java SDK :: Services :: Chime SDK Messaging diff --git a/services/chimesdkvoice/pom.xml b/services/chimesdkvoice/pom.xml index f8e84928e154..617c10a557b8 100644 --- a/services/chimesdkvoice/pom.xml +++ b/services/chimesdkvoice/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 chimesdkvoice AWS Java SDK :: Services :: Chime SDK Voice diff --git a/services/cleanrooms/pom.xml b/services/cleanrooms/pom.xml index a5fac2add35f..1875ced74aa6 100644 --- a/services/cleanrooms/pom.xml +++ b/services/cleanrooms/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 cleanrooms AWS Java SDK :: Services :: Clean Rooms diff --git a/services/cleanroomsml/pom.xml b/services/cleanroomsml/pom.xml index 761409788c14..02312b22bc2f 100644 --- a/services/cleanroomsml/pom.xml +++ b/services/cleanroomsml/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 cleanroomsml AWS Java SDK :: Services :: Clean Rooms ML diff --git a/services/cloud9/pom.xml b/services/cloud9/pom.xml index ebd0ecbbfa8f..31d07bddb3d9 100644 --- a/services/cloud9/pom.xml +++ b/services/cloud9/pom.xml @@ -20,7 +20,7 @@ services software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 cloud9 diff --git a/services/cloudcontrol/pom.xml b/services/cloudcontrol/pom.xml index ab7030e2d10b..00ff4ac1e62d 100644 --- a/services/cloudcontrol/pom.xml +++ b/services/cloudcontrol/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 cloudcontrol AWS Java SDK :: Services :: Cloud Control diff --git a/services/clouddirectory/pom.xml b/services/clouddirectory/pom.xml index 45bcf9903f1a..6356e4b939af 100644 --- a/services/clouddirectory/pom.xml +++ b/services/clouddirectory/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 clouddirectory AWS Java SDK :: Services :: Amazon CloudDirectory diff --git a/services/cloudformation/pom.xml b/services/cloudformation/pom.xml index ad7079b5730e..fcf95863bef6 100644 --- a/services/cloudformation/pom.xml +++ b/services/cloudformation/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 cloudformation AWS Java SDK :: Services :: AWS CloudFormation diff --git a/services/cloudfront/pom.xml b/services/cloudfront/pom.xml index e881be5fa402..f58a1cbde94c 100644 --- a/services/cloudfront/pom.xml +++ b/services/cloudfront/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 cloudfront AWS Java SDK :: Services :: Amazon CloudFront diff --git a/services/cloudfrontkeyvaluestore/pom.xml b/services/cloudfrontkeyvaluestore/pom.xml index eeb88f484695..498973192558 100644 --- a/services/cloudfrontkeyvaluestore/pom.xml +++ b/services/cloudfrontkeyvaluestore/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 cloudfrontkeyvaluestore AWS Java SDK :: Services :: Cloud Front Key Value Store diff --git a/services/cloudhsm/pom.xml b/services/cloudhsm/pom.xml index c476fb87f23b..b1d4c0127e6f 100644 --- a/services/cloudhsm/pom.xml +++ b/services/cloudhsm/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 cloudhsm AWS Java SDK :: Services :: AWS CloudHSM diff --git a/services/cloudhsmv2/pom.xml b/services/cloudhsmv2/pom.xml index fc1e3e845f0a..3c0547072716 100644 --- a/services/cloudhsmv2/pom.xml +++ b/services/cloudhsmv2/pom.xml @@ -20,7 +20,7 @@ services software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 cloudhsmv2 diff --git a/services/cloudsearch/pom.xml b/services/cloudsearch/pom.xml index d474b3be1928..a3cd3062b8e9 100644 --- a/services/cloudsearch/pom.xml +++ b/services/cloudsearch/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 cloudsearch AWS Java SDK :: Services :: Amazon CloudSearch diff --git a/services/cloudsearchdomain/pom.xml b/services/cloudsearchdomain/pom.xml index f9a7dcc69f61..a51e4ceee599 100644 --- a/services/cloudsearchdomain/pom.xml +++ b/services/cloudsearchdomain/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 cloudsearchdomain AWS Java SDK :: Services :: Amazon CloudSearch Domain diff --git a/services/cloudtrail/pom.xml b/services/cloudtrail/pom.xml index f2645a529e07..5a1af9294704 100644 --- a/services/cloudtrail/pom.xml +++ b/services/cloudtrail/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 cloudtrail AWS Java SDK :: Services :: AWS CloudTrail diff --git a/services/cloudtraildata/pom.xml b/services/cloudtraildata/pom.xml index e57d52ab3516..5bafc04225ff 100644 --- a/services/cloudtraildata/pom.xml +++ b/services/cloudtraildata/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 cloudtraildata AWS Java SDK :: Services :: Cloud Trail Data diff --git a/services/cloudwatch/pom.xml b/services/cloudwatch/pom.xml index f4734c0b5f21..2d4e9fd86f8e 100644 --- a/services/cloudwatch/pom.xml +++ b/services/cloudwatch/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 cloudwatch AWS Java SDK :: Services :: Amazon CloudWatch diff --git a/services/cloudwatchevents/pom.xml b/services/cloudwatchevents/pom.xml index 4786a74a3dbd..dd1e39af5ff2 100644 --- a/services/cloudwatchevents/pom.xml +++ b/services/cloudwatchevents/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 cloudwatchevents AWS Java SDK :: Services :: Amazon CloudWatch Events diff --git a/services/cloudwatchlogs/pom.xml b/services/cloudwatchlogs/pom.xml index 5d949cf035fa..187c829bcbd4 100644 --- a/services/cloudwatchlogs/pom.xml +++ b/services/cloudwatchlogs/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 cloudwatchlogs AWS Java SDK :: Services :: Amazon CloudWatch Logs diff --git a/services/codeartifact/pom.xml b/services/codeartifact/pom.xml index 9350cea2b91a..523e5e313a84 100644 --- a/services/codeartifact/pom.xml +++ b/services/codeartifact/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 codeartifact AWS Java SDK :: Services :: Codeartifact diff --git a/services/codebuild/pom.xml b/services/codebuild/pom.xml index f91528c73c8c..4890e2711cbd 100644 --- a/services/codebuild/pom.xml +++ b/services/codebuild/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 codebuild AWS Java SDK :: Services :: AWS Code Build diff --git a/services/codecatalyst/pom.xml b/services/codecatalyst/pom.xml index 5f4fb980ba0c..be4ed9516fc0 100644 --- a/services/codecatalyst/pom.xml +++ b/services/codecatalyst/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 codecatalyst AWS Java SDK :: Services :: Code Catalyst diff --git a/services/codecommit/pom.xml b/services/codecommit/pom.xml index 409c92e088d4..7e7b854222f4 100644 --- a/services/codecommit/pom.xml +++ b/services/codecommit/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 codecommit AWS Java SDK :: Services :: AWS CodeCommit diff --git a/services/codeconnections/pom.xml b/services/codeconnections/pom.xml index 232c664b645f..1dddeb867b28 100644 --- a/services/codeconnections/pom.xml +++ b/services/codeconnections/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 codeconnections AWS Java SDK :: Services :: Code Connections diff --git a/services/codedeploy/pom.xml b/services/codedeploy/pom.xml index e1075bf76943..78c3648f5fb2 100644 --- a/services/codedeploy/pom.xml +++ b/services/codedeploy/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 codedeploy AWS Java SDK :: Services :: AWS CodeDeploy diff --git a/services/codeguruprofiler/pom.xml b/services/codeguruprofiler/pom.xml index cca2cebb11d2..fb1531b0b8df 100644 --- a/services/codeguruprofiler/pom.xml +++ b/services/codeguruprofiler/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 codeguruprofiler AWS Java SDK :: Services :: CodeGuruProfiler diff --git a/services/codegurureviewer/pom.xml b/services/codegurureviewer/pom.xml index f72e81924362..24da3d0c1935 100644 --- a/services/codegurureviewer/pom.xml +++ b/services/codegurureviewer/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 codegurureviewer AWS Java SDK :: Services :: CodeGuru Reviewer diff --git a/services/codegurusecurity/pom.xml b/services/codegurusecurity/pom.xml index b75593bbb604..1dc7a1631615 100644 --- a/services/codegurusecurity/pom.xml +++ b/services/codegurusecurity/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 codegurusecurity AWS Java SDK :: Services :: Code Guru Security diff --git a/services/codepipeline/pom.xml b/services/codepipeline/pom.xml index 6d76c32fc169..54084d72de77 100644 --- a/services/codepipeline/pom.xml +++ b/services/codepipeline/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 codepipeline AWS Java SDK :: Services :: AWS CodePipeline diff --git a/services/codestarconnections/pom.xml b/services/codestarconnections/pom.xml index 148d7aae6f28..ae39437b3a97 100644 --- a/services/codestarconnections/pom.xml +++ b/services/codestarconnections/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 codestarconnections AWS Java SDK :: Services :: CodeStar connections diff --git a/services/codestarnotifications/pom.xml b/services/codestarnotifications/pom.xml index 13a02ee7878d..4f138860cdc2 100644 --- a/services/codestarnotifications/pom.xml +++ b/services/codestarnotifications/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 codestarnotifications AWS Java SDK :: Services :: Codestar Notifications diff --git a/services/cognitoidentity/pom.xml b/services/cognitoidentity/pom.xml index 89215cfe24f8..5ab3ba96d2de 100644 --- a/services/cognitoidentity/pom.xml +++ b/services/cognitoidentity/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 cognitoidentity AWS Java SDK :: Services :: Amazon Cognito Identity diff --git a/services/cognitoidentityprovider/pom.xml b/services/cognitoidentityprovider/pom.xml index cbbdcf9db0dd..b0a1ef7d7051 100644 --- a/services/cognitoidentityprovider/pom.xml +++ b/services/cognitoidentityprovider/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 cognitoidentityprovider AWS Java SDK :: Services :: Amazon Cognito Identity Provider Service diff --git a/services/cognitosync/pom.xml b/services/cognitosync/pom.xml index 1ca6ec433a1b..a21d6eba05f3 100644 --- a/services/cognitosync/pom.xml +++ b/services/cognitosync/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 cognitosync AWS Java SDK :: Services :: Amazon Cognito Sync diff --git a/services/comprehend/pom.xml b/services/comprehend/pom.xml index d301bafb090e..f67a7a9ef476 100644 --- a/services/comprehend/pom.xml +++ b/services/comprehend/pom.xml @@ -20,7 +20,7 @@ services software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 comprehend diff --git a/services/comprehendmedical/pom.xml b/services/comprehendmedical/pom.xml index e94601df7c92..dc6fb75c664c 100644 --- a/services/comprehendmedical/pom.xml +++ b/services/comprehendmedical/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 comprehendmedical AWS Java SDK :: Services :: ComprehendMedical diff --git a/services/computeoptimizer/pom.xml b/services/computeoptimizer/pom.xml index a4e33e773e91..c5ab910a35db 100644 --- a/services/computeoptimizer/pom.xml +++ b/services/computeoptimizer/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 computeoptimizer AWS Java SDK :: Services :: Compute Optimizer diff --git a/services/config/pom.xml b/services/config/pom.xml index f9adc5847ac5..06a4a055badd 100644 --- a/services/config/pom.xml +++ b/services/config/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 config AWS Java SDK :: Services :: AWS Config diff --git a/services/connect/pom.xml b/services/connect/pom.xml index d3a9a6e14f07..8aca2d51bbe1 100644 --- a/services/connect/pom.xml +++ b/services/connect/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 connect AWS Java SDK :: Services :: Connect diff --git a/services/connectcampaigns/pom.xml b/services/connectcampaigns/pom.xml index 8a73d5dee812..8e1ccbe8b397 100644 --- a/services/connectcampaigns/pom.xml +++ b/services/connectcampaigns/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 connectcampaigns AWS Java SDK :: Services :: Connect Campaigns diff --git a/services/connectcampaignsv2/pom.xml b/services/connectcampaignsv2/pom.xml index ee86b9a3703a..6603c4cb977a 100644 --- a/services/connectcampaignsv2/pom.xml +++ b/services/connectcampaignsv2/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 connectcampaignsv2 AWS Java SDK :: Services :: Connect Campaigns V2 diff --git a/services/connectcases/pom.xml b/services/connectcases/pom.xml index 066823ce15b3..dbf5365e3649 100644 --- a/services/connectcases/pom.xml +++ b/services/connectcases/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 connectcases AWS Java SDK :: Services :: Connect Cases diff --git a/services/connectcontactlens/pom.xml b/services/connectcontactlens/pom.xml index 471a73c81537..e4a804b9e839 100644 --- a/services/connectcontactlens/pom.xml +++ b/services/connectcontactlens/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 connectcontactlens AWS Java SDK :: Services :: Connect Contact Lens diff --git a/services/connectparticipant/pom.xml b/services/connectparticipant/pom.xml index 997fc16aec20..530295dcf2e0 100644 --- a/services/connectparticipant/pom.xml +++ b/services/connectparticipant/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 connectparticipant AWS Java SDK :: Services :: ConnectParticipant diff --git a/services/controlcatalog/pom.xml b/services/controlcatalog/pom.xml index 105ea53e29e2..c8c7e5476fbc 100644 --- a/services/controlcatalog/pom.xml +++ b/services/controlcatalog/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 controlcatalog AWS Java SDK :: Services :: Control Catalog diff --git a/services/controltower/pom.xml b/services/controltower/pom.xml index f1bcbe6677b3..3fc5d39474be 100644 --- a/services/controltower/pom.xml +++ b/services/controltower/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 controltower AWS Java SDK :: Services :: Control Tower diff --git a/services/costandusagereport/pom.xml b/services/costandusagereport/pom.xml index 1011934853da..7d677ea9210d 100644 --- a/services/costandusagereport/pom.xml +++ b/services/costandusagereport/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 costandusagereport AWS Java SDK :: Services :: AWS Cost and Usage Report diff --git a/services/costexplorer/pom.xml b/services/costexplorer/pom.xml index 2515ac8c457c..6cafece6d447 100644 --- a/services/costexplorer/pom.xml +++ b/services/costexplorer/pom.xml @@ -20,7 +20,7 @@ services software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 costexplorer diff --git a/services/costoptimizationhub/pom.xml b/services/costoptimizationhub/pom.xml index a22f8c70268e..7b772bb9bb6c 100644 --- a/services/costoptimizationhub/pom.xml +++ b/services/costoptimizationhub/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 costoptimizationhub AWS Java SDK :: Services :: Cost Optimization Hub diff --git a/services/customerprofiles/pom.xml b/services/customerprofiles/pom.xml index 8cb9edbc57f0..ac24212178f2 100644 --- a/services/customerprofiles/pom.xml +++ b/services/customerprofiles/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 customerprofiles AWS Java SDK :: Services :: Customer Profiles diff --git a/services/databasemigration/pom.xml b/services/databasemigration/pom.xml index 65b800fa0bbc..5fb66865e014 100644 --- a/services/databasemigration/pom.xml +++ b/services/databasemigration/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 databasemigration AWS Java SDK :: Services :: AWS Database Migration Service diff --git a/services/databrew/pom.xml b/services/databrew/pom.xml index cd232b65155a..f426c26f4fc2 100644 --- a/services/databrew/pom.xml +++ b/services/databrew/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 databrew AWS Java SDK :: Services :: Data Brew diff --git a/services/dataexchange/pom.xml b/services/dataexchange/pom.xml index 1b438080721c..1c354c12a597 100644 --- a/services/dataexchange/pom.xml +++ b/services/dataexchange/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 dataexchange AWS Java SDK :: Services :: DataExchange diff --git a/services/datapipeline/pom.xml b/services/datapipeline/pom.xml index d7469cc67d2a..be873dfb4e27 100644 --- a/services/datapipeline/pom.xml +++ b/services/datapipeline/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 datapipeline AWS Java SDK :: Services :: AWS Data Pipeline diff --git a/services/datasync/pom.xml b/services/datasync/pom.xml index d3fb362a6ef9..41e50beb2b03 100644 --- a/services/datasync/pom.xml +++ b/services/datasync/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 datasync AWS Java SDK :: Services :: DataSync diff --git a/services/datazone/pom.xml b/services/datazone/pom.xml index e478ef5137ea..cd7939eb314c 100644 --- a/services/datazone/pom.xml +++ b/services/datazone/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 datazone AWS Java SDK :: Services :: Data Zone diff --git a/services/dax/pom.xml b/services/dax/pom.xml index 53e3a52a7c8b..020978534b86 100644 --- a/services/dax/pom.xml +++ b/services/dax/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 dax AWS Java SDK :: Services :: Amazon DynamoDB Accelerator (DAX) diff --git a/services/deadline/pom.xml b/services/deadline/pom.xml index f45cc1a12705..e40a181ee76c 100644 --- a/services/deadline/pom.xml +++ b/services/deadline/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 deadline AWS Java SDK :: Services :: Deadline diff --git a/services/detective/pom.xml b/services/detective/pom.xml index 8db46111de66..63f30db7988b 100644 --- a/services/detective/pom.xml +++ b/services/detective/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 detective AWS Java SDK :: Services :: Detective diff --git a/services/devicefarm/pom.xml b/services/devicefarm/pom.xml index cded405772de..41fe218f59a2 100644 --- a/services/devicefarm/pom.xml +++ b/services/devicefarm/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 devicefarm AWS Java SDK :: Services :: AWS Device Farm diff --git a/services/devopsguru/pom.xml b/services/devopsguru/pom.xml index c426486f8910..784cbbac861f 100644 --- a/services/devopsguru/pom.xml +++ b/services/devopsguru/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 devopsguru AWS Java SDK :: Services :: Dev Ops Guru diff --git a/services/directconnect/pom.xml b/services/directconnect/pom.xml index 6e1d173603f8..898bae6b3655 100644 --- a/services/directconnect/pom.xml +++ b/services/directconnect/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 directconnect AWS Java SDK :: Services :: AWS Direct Connect diff --git a/services/directory/pom.xml b/services/directory/pom.xml index 5f670508c0e4..62121edeecf6 100644 --- a/services/directory/pom.xml +++ b/services/directory/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 directory AWS Java SDK :: Services :: AWS Directory Service diff --git a/services/directoryservicedata/pom.xml b/services/directoryservicedata/pom.xml index a76bca186da9..416b4cfad6e4 100644 --- a/services/directoryservicedata/pom.xml +++ b/services/directoryservicedata/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 directoryservicedata AWS Java SDK :: Services :: Directory Service Data diff --git a/services/dlm/pom.xml b/services/dlm/pom.xml index 860fd6c65d61..ad3fcdc19c06 100644 --- a/services/dlm/pom.xml +++ b/services/dlm/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 dlm AWS Java SDK :: Services :: DLM diff --git a/services/docdb/pom.xml b/services/docdb/pom.xml index 0451bcd25f92..496ac0828fda 100644 --- a/services/docdb/pom.xml +++ b/services/docdb/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 docdb AWS Java SDK :: Services :: DocDB diff --git a/services/docdbelastic/pom.xml b/services/docdbelastic/pom.xml index 17ef96de283d..83861a587825 100644 --- a/services/docdbelastic/pom.xml +++ b/services/docdbelastic/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 docdbelastic AWS Java SDK :: Services :: Doc DB Elastic diff --git a/services/drs/pom.xml b/services/drs/pom.xml index 362fb5dd888b..56f3dc00f3ee 100644 --- a/services/drs/pom.xml +++ b/services/drs/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 drs AWS Java SDK :: Services :: Drs diff --git a/services/dsql/pom.xml b/services/dsql/pom.xml index 6f14f08f0d82..93a86e12ca8f 100644 --- a/services/dsql/pom.xml +++ b/services/dsql/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 dsql AWS Java SDK :: Services :: DSQL diff --git a/services/dynamodb/pom.xml b/services/dynamodb/pom.xml index 110177bb599a..2db49683d587 100644 --- a/services/dynamodb/pom.xml +++ b/services/dynamodb/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 dynamodb AWS Java SDK :: Services :: Amazon DynamoDB diff --git a/services/ebs/pom.xml b/services/ebs/pom.xml index 61ba6b4d0c83..c4f06cb93386 100644 --- a/services/ebs/pom.xml +++ b/services/ebs/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 ebs AWS Java SDK :: Services :: EBS diff --git a/services/ec2/pom.xml b/services/ec2/pom.xml index 25a1c7e82932..d47a507bef88 100644 --- a/services/ec2/pom.xml +++ b/services/ec2/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 ec2 AWS Java SDK :: Services :: Amazon EC2 diff --git a/services/ec2instanceconnect/pom.xml b/services/ec2instanceconnect/pom.xml index 0dbadd2ac0cd..893ca1746af5 100644 --- a/services/ec2instanceconnect/pom.xml +++ b/services/ec2instanceconnect/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 ec2instanceconnect AWS Java SDK :: Services :: EC2 Instance Connect diff --git a/services/ecr/pom.xml b/services/ecr/pom.xml index 73560fe97c8b..67e10069de4b 100644 --- a/services/ecr/pom.xml +++ b/services/ecr/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 ecr AWS Java SDK :: Services :: Amazon EC2 Container Registry diff --git a/services/ecrpublic/pom.xml b/services/ecrpublic/pom.xml index 0fb2fed652a4..689a1d61e358 100644 --- a/services/ecrpublic/pom.xml +++ b/services/ecrpublic/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 ecrpublic AWS Java SDK :: Services :: ECR PUBLIC diff --git a/services/ecs/pom.xml b/services/ecs/pom.xml index d6aa494e678e..9bbacb42d37a 100644 --- a/services/ecs/pom.xml +++ b/services/ecs/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 ecs AWS Java SDK :: Services :: Amazon EC2 Container Service diff --git a/services/efs/pom.xml b/services/efs/pom.xml index 233f6c681660..372f245ab4a3 100644 --- a/services/efs/pom.xml +++ b/services/efs/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 efs AWS Java SDK :: Services :: Amazon Elastic File System diff --git a/services/eks/pom.xml b/services/eks/pom.xml index 05f1290ed663..386ef83e38cf 100644 --- a/services/eks/pom.xml +++ b/services/eks/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 eks AWS Java SDK :: Services :: EKS diff --git a/services/eksauth/pom.xml b/services/eksauth/pom.xml index dfa384de7a3f..d731de4a0402 100644 --- a/services/eksauth/pom.xml +++ b/services/eksauth/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 eksauth AWS Java SDK :: Services :: EKS Auth diff --git a/services/elasticache/pom.xml b/services/elasticache/pom.xml index 8db5443d0278..a62ad7eeaee4 100644 --- a/services/elasticache/pom.xml +++ b/services/elasticache/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 elasticache AWS Java SDK :: Services :: Amazon ElastiCache diff --git a/services/elasticbeanstalk/pom.xml b/services/elasticbeanstalk/pom.xml index eae7b0da7afb..9f1f6fdb49c8 100644 --- a/services/elasticbeanstalk/pom.xml +++ b/services/elasticbeanstalk/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 elasticbeanstalk AWS Java SDK :: Services :: AWS Elastic Beanstalk diff --git a/services/elasticloadbalancing/pom.xml b/services/elasticloadbalancing/pom.xml index 4b54b5c3f2e8..abe9b3a93c6b 100644 --- a/services/elasticloadbalancing/pom.xml +++ b/services/elasticloadbalancing/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 elasticloadbalancing AWS Java SDK :: Services :: Elastic Load Balancing diff --git a/services/elasticloadbalancingv2/pom.xml b/services/elasticloadbalancingv2/pom.xml index 835d8edf2011..10d31cc23812 100644 --- a/services/elasticloadbalancingv2/pom.xml +++ b/services/elasticloadbalancingv2/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 elasticloadbalancingv2 AWS Java SDK :: Services :: Elastic Load Balancing V2 diff --git a/services/elasticsearch/pom.xml b/services/elasticsearch/pom.xml index be6af337f1f7..058995cc84bb 100644 --- a/services/elasticsearch/pom.xml +++ b/services/elasticsearch/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 elasticsearch AWS Java SDK :: Services :: Amazon Elasticsearch Service diff --git a/services/elastictranscoder/pom.xml b/services/elastictranscoder/pom.xml index 32244201f806..2d37c4b44fc8 100644 --- a/services/elastictranscoder/pom.xml +++ b/services/elastictranscoder/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 elastictranscoder AWS Java SDK :: Services :: Amazon Elastic Transcoder diff --git a/services/emr/pom.xml b/services/emr/pom.xml index b94462791307..992eb3aa7f6a 100644 --- a/services/emr/pom.xml +++ b/services/emr/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 emr AWS Java SDK :: Services :: Amazon EMR diff --git a/services/emrcontainers/pom.xml b/services/emrcontainers/pom.xml index 0d9448a0a401..c1288cb02824 100644 --- a/services/emrcontainers/pom.xml +++ b/services/emrcontainers/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 emrcontainers AWS Java SDK :: Services :: EMR Containers diff --git a/services/emrserverless/pom.xml b/services/emrserverless/pom.xml index 7a18e6803434..ee484cdffa82 100644 --- a/services/emrserverless/pom.xml +++ b/services/emrserverless/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 emrserverless AWS Java SDK :: Services :: EMR Serverless diff --git a/services/entityresolution/pom.xml b/services/entityresolution/pom.xml index 13310a408319..d6a8b9c81a27 100644 --- a/services/entityresolution/pom.xml +++ b/services/entityresolution/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 entityresolution AWS Java SDK :: Services :: Entity Resolution diff --git a/services/eventbridge/pom.xml b/services/eventbridge/pom.xml index c0f672f5cca3..208901f4ba16 100644 --- a/services/eventbridge/pom.xml +++ b/services/eventbridge/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 eventbridge AWS Java SDK :: Services :: EventBridge diff --git a/services/evidently/pom.xml b/services/evidently/pom.xml index f12820c0fb7a..2aa38ffc4c8c 100644 --- a/services/evidently/pom.xml +++ b/services/evidently/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 evidently AWS Java SDK :: Services :: Evidently diff --git a/services/finspace/pom.xml b/services/finspace/pom.xml index c9cd80fb276e..3b95ca0936cd 100644 --- a/services/finspace/pom.xml +++ b/services/finspace/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 finspace AWS Java SDK :: Services :: Finspace diff --git a/services/finspacedata/pom.xml b/services/finspacedata/pom.xml index 02a874bce845..90ca09208a2d 100644 --- a/services/finspacedata/pom.xml +++ b/services/finspacedata/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 finspacedata AWS Java SDK :: Services :: Finspace Data diff --git a/services/firehose/pom.xml b/services/firehose/pom.xml index 06fee904cca0..e273c89bd51a 100644 --- a/services/firehose/pom.xml +++ b/services/firehose/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 firehose AWS Java SDK :: Services :: Amazon Kinesis Firehose diff --git a/services/fis/pom.xml b/services/fis/pom.xml index 313782637280..686545e2e97c 100644 --- a/services/fis/pom.xml +++ b/services/fis/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 fis AWS Java SDK :: Services :: Fis diff --git a/services/fms/pom.xml b/services/fms/pom.xml index f0d333b08c55..aac0246e414c 100644 --- a/services/fms/pom.xml +++ b/services/fms/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 fms AWS Java SDK :: Services :: FMS diff --git a/services/forecast/pom.xml b/services/forecast/pom.xml index aba651b46b6a..e49c532a01c2 100644 --- a/services/forecast/pom.xml +++ b/services/forecast/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 forecast AWS Java SDK :: Services :: Forecast diff --git a/services/forecastquery/pom.xml b/services/forecastquery/pom.xml index d59f4a7ce7f0..96a09fb975a9 100644 --- a/services/forecastquery/pom.xml +++ b/services/forecastquery/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 forecastquery AWS Java SDK :: Services :: Forecastquery diff --git a/services/frauddetector/pom.xml b/services/frauddetector/pom.xml index b1c01f7508c9..37c555dd5720 100644 --- a/services/frauddetector/pom.xml +++ b/services/frauddetector/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 frauddetector AWS Java SDK :: Services :: FraudDetector diff --git a/services/freetier/pom.xml b/services/freetier/pom.xml index ecca95ef0c3a..81f75d62eb46 100644 --- a/services/freetier/pom.xml +++ b/services/freetier/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 freetier AWS Java SDK :: Services :: Free Tier diff --git a/services/fsx/pom.xml b/services/fsx/pom.xml index b8444fce3d23..e34933deeb1c 100644 --- a/services/fsx/pom.xml +++ b/services/fsx/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 fsx AWS Java SDK :: Services :: FSx diff --git a/services/gamelift/pom.xml b/services/gamelift/pom.xml index 825dab9e059c..e5dfd60971dc 100644 --- a/services/gamelift/pom.xml +++ b/services/gamelift/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 gamelift AWS Java SDK :: Services :: AWS GameLift diff --git a/services/gameliftstreams/pom.xml b/services/gameliftstreams/pom.xml index f2bc9341d6f2..d738200bc220 100644 --- a/services/gameliftstreams/pom.xml +++ b/services/gameliftstreams/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 gameliftstreams AWS Java SDK :: Services :: Game Lift Streams diff --git a/services/geomaps/pom.xml b/services/geomaps/pom.xml index 317613f8a883..7c42f526186a 100644 --- a/services/geomaps/pom.xml +++ b/services/geomaps/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 geomaps AWS Java SDK :: Services :: Geo Maps diff --git a/services/geoplaces/pom.xml b/services/geoplaces/pom.xml index 99f28e7b166d..2f4f68110ebd 100644 --- a/services/geoplaces/pom.xml +++ b/services/geoplaces/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 geoplaces AWS Java SDK :: Services :: Geo Places diff --git a/services/georoutes/pom.xml b/services/georoutes/pom.xml index 204e2c0f6476..20a995df55b5 100644 --- a/services/georoutes/pom.xml +++ b/services/georoutes/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 georoutes AWS Java SDK :: Services :: Geo Routes diff --git a/services/glacier/pom.xml b/services/glacier/pom.xml index 0c4aa067d5ed..433a8812fcd6 100644 --- a/services/glacier/pom.xml +++ b/services/glacier/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 glacier AWS Java SDK :: Services :: Amazon Glacier diff --git a/services/globalaccelerator/pom.xml b/services/globalaccelerator/pom.xml index 9295cbca2c07..327a4f817b3f 100644 --- a/services/globalaccelerator/pom.xml +++ b/services/globalaccelerator/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 globalaccelerator AWS Java SDK :: Services :: Global Accelerator diff --git a/services/glue/pom.xml b/services/glue/pom.xml index ec8ee8e5f871..166498f191a3 100644 --- a/services/glue/pom.xml +++ b/services/glue/pom.xml @@ -20,7 +20,7 @@ services software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 glue diff --git a/services/grafana/pom.xml b/services/grafana/pom.xml index 71e3e5e9a215..89835714d2cc 100644 --- a/services/grafana/pom.xml +++ b/services/grafana/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 grafana AWS Java SDK :: Services :: Grafana diff --git a/services/greengrass/pom.xml b/services/greengrass/pom.xml index f010144d7349..d25805e636f9 100644 --- a/services/greengrass/pom.xml +++ b/services/greengrass/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 greengrass AWS Java SDK :: Services :: AWS Greengrass diff --git a/services/greengrassv2/pom.xml b/services/greengrassv2/pom.xml index 2078c91a9c4c..9f1a321ee4a1 100644 --- a/services/greengrassv2/pom.xml +++ b/services/greengrassv2/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 greengrassv2 AWS Java SDK :: Services :: Greengrass V2 diff --git a/services/groundstation/pom.xml b/services/groundstation/pom.xml index 9d870461e142..803255bb3e1b 100644 --- a/services/groundstation/pom.xml +++ b/services/groundstation/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 groundstation AWS Java SDK :: Services :: GroundStation diff --git a/services/guardduty/pom.xml b/services/guardduty/pom.xml index 07295bcd436d..0f55792a7773 100644 --- a/services/guardduty/pom.xml +++ b/services/guardduty/pom.xml @@ -20,7 +20,7 @@ services software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 guardduty diff --git a/services/health/pom.xml b/services/health/pom.xml index 1782aebc45eb..9d8b9f3499ef 100644 --- a/services/health/pom.xml +++ b/services/health/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 health AWS Java SDK :: Services :: AWS Health APIs and Notifications diff --git a/services/healthlake/pom.xml b/services/healthlake/pom.xml index 6b9fc630b144..7328515f2d19 100644 --- a/services/healthlake/pom.xml +++ b/services/healthlake/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 healthlake AWS Java SDK :: Services :: Health Lake diff --git a/services/iam/pom.xml b/services/iam/pom.xml index 667ec181e3a3..154772ddb366 100644 --- a/services/iam/pom.xml +++ b/services/iam/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 iam AWS Java SDK :: Services :: AWS IAM diff --git a/services/identitystore/pom.xml b/services/identitystore/pom.xml index 750086017752..d3d1c9382507 100644 --- a/services/identitystore/pom.xml +++ b/services/identitystore/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 identitystore AWS Java SDK :: Services :: Identitystore diff --git a/services/imagebuilder/pom.xml b/services/imagebuilder/pom.xml index 1ba19217cd97..19be768764f0 100644 --- a/services/imagebuilder/pom.xml +++ b/services/imagebuilder/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 imagebuilder AWS Java SDK :: Services :: Imagebuilder diff --git a/services/inspector/pom.xml b/services/inspector/pom.xml index 4824de1f5052..5676793320f4 100644 --- a/services/inspector/pom.xml +++ b/services/inspector/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 inspector AWS Java SDK :: Services :: Amazon Inspector Service diff --git a/services/inspector2/pom.xml b/services/inspector2/pom.xml index acb5c23b560b..2e52390f4f33 100644 --- a/services/inspector2/pom.xml +++ b/services/inspector2/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 inspector2 AWS Java SDK :: Services :: Inspector2 diff --git a/services/inspectorscan/pom.xml b/services/inspectorscan/pom.xml index cc30ed5b8dbb..ba63d2b5fbb4 100644 --- a/services/inspectorscan/pom.xml +++ b/services/inspectorscan/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 inspectorscan AWS Java SDK :: Services :: Inspector Scan diff --git a/services/internetmonitor/pom.xml b/services/internetmonitor/pom.xml index 82e6435f3e99..5d04f4eab0ad 100644 --- a/services/internetmonitor/pom.xml +++ b/services/internetmonitor/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 internetmonitor AWS Java SDK :: Services :: Internet Monitor diff --git a/services/invoicing/pom.xml b/services/invoicing/pom.xml index 244a92a3ece9..d3d9c2b0f2ff 100644 --- a/services/invoicing/pom.xml +++ b/services/invoicing/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 invoicing AWS Java SDK :: Services :: Invoicing diff --git a/services/iot/pom.xml b/services/iot/pom.xml index 89b39a04aaba..883140e1ff6c 100644 --- a/services/iot/pom.xml +++ b/services/iot/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 iot AWS Java SDK :: Services :: AWS IoT diff --git a/services/iotanalytics/pom.xml b/services/iotanalytics/pom.xml index 7baf0cc8b4b6..9800a3d6c8f4 100644 --- a/services/iotanalytics/pom.xml +++ b/services/iotanalytics/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 iotanalytics AWS Java SDK :: Services :: IoTAnalytics diff --git a/services/iotdataplane/pom.xml b/services/iotdataplane/pom.xml index 76c37ed683de..756f4198b861 100644 --- a/services/iotdataplane/pom.xml +++ b/services/iotdataplane/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 iotdataplane AWS Java SDK :: Services :: AWS IoT Data Plane diff --git a/services/iotdeviceadvisor/pom.xml b/services/iotdeviceadvisor/pom.xml index 5c881aa0da6e..42f61575f843 100644 --- a/services/iotdeviceadvisor/pom.xml +++ b/services/iotdeviceadvisor/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 iotdeviceadvisor AWS Java SDK :: Services :: Iot Device Advisor diff --git a/services/iotevents/pom.xml b/services/iotevents/pom.xml index 43c709ccac5d..be3a5a093f26 100644 --- a/services/iotevents/pom.xml +++ b/services/iotevents/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 iotevents AWS Java SDK :: Services :: IoT Events diff --git a/services/ioteventsdata/pom.xml b/services/ioteventsdata/pom.xml index 6bceba4e6a7f..a87a739351fb 100644 --- a/services/ioteventsdata/pom.xml +++ b/services/ioteventsdata/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 ioteventsdata AWS Java SDK :: Services :: IoT Events Data diff --git a/services/iotfleethub/pom.xml b/services/iotfleethub/pom.xml index 9f63887ded63..e481e05d939a 100644 --- a/services/iotfleethub/pom.xml +++ b/services/iotfleethub/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 iotfleethub AWS Java SDK :: Services :: Io T Fleet Hub diff --git a/services/iotfleetwise/pom.xml b/services/iotfleetwise/pom.xml index c54dc49638f1..cdec1c3d3ef8 100644 --- a/services/iotfleetwise/pom.xml +++ b/services/iotfleetwise/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 iotfleetwise AWS Java SDK :: Services :: Io T Fleet Wise diff --git a/services/iotjobsdataplane/pom.xml b/services/iotjobsdataplane/pom.xml index 0aa26734b963..3e74c306b6a5 100644 --- a/services/iotjobsdataplane/pom.xml +++ b/services/iotjobsdataplane/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 iotjobsdataplane AWS Java SDK :: Services :: IoT Jobs Data Plane diff --git a/services/iotmanagedintegrations/pom.xml b/services/iotmanagedintegrations/pom.xml index 725d1c4142fd..b9d7618fd64a 100644 --- a/services/iotmanagedintegrations/pom.xml +++ b/services/iotmanagedintegrations/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 iotmanagedintegrations AWS Java SDK :: Services :: IoT Managed Integrations diff --git a/services/iotsecuretunneling/pom.xml b/services/iotsecuretunneling/pom.xml index fe0ae58732c9..1d75be06fd25 100644 --- a/services/iotsecuretunneling/pom.xml +++ b/services/iotsecuretunneling/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 iotsecuretunneling AWS Java SDK :: Services :: IoTSecureTunneling diff --git a/services/iotsitewise/pom.xml b/services/iotsitewise/pom.xml index d3b5f29aeda5..bb51f26bdf97 100644 --- a/services/iotsitewise/pom.xml +++ b/services/iotsitewise/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 iotsitewise AWS Java SDK :: Services :: Io T Site Wise diff --git a/services/iotthingsgraph/pom.xml b/services/iotthingsgraph/pom.xml index 386f2b3880eb..2d17f7f26658 100644 --- a/services/iotthingsgraph/pom.xml +++ b/services/iotthingsgraph/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 iotthingsgraph AWS Java SDK :: Services :: IoTThingsGraph diff --git a/services/iottwinmaker/pom.xml b/services/iottwinmaker/pom.xml index c04147ab1eee..44dc60aa6be1 100644 --- a/services/iottwinmaker/pom.xml +++ b/services/iottwinmaker/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 iottwinmaker AWS Java SDK :: Services :: Io T Twin Maker diff --git a/services/iotwireless/pom.xml b/services/iotwireless/pom.xml index c65995636c7f..ad37e079f34b 100644 --- a/services/iotwireless/pom.xml +++ b/services/iotwireless/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 iotwireless AWS Java SDK :: Services :: IoT Wireless diff --git a/services/ivs/pom.xml b/services/ivs/pom.xml index 437e7a389567..de599aaecb30 100644 --- a/services/ivs/pom.xml +++ b/services/ivs/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 ivs AWS Java SDK :: Services :: Ivs diff --git a/services/ivschat/pom.xml b/services/ivschat/pom.xml index 0e9fd8e1e8d0..c0c1011c6a68 100644 --- a/services/ivschat/pom.xml +++ b/services/ivschat/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 ivschat AWS Java SDK :: Services :: Ivschat diff --git a/services/ivsrealtime/pom.xml b/services/ivsrealtime/pom.xml index 21df9ef13521..a099d207577d 100644 --- a/services/ivsrealtime/pom.xml +++ b/services/ivsrealtime/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 ivsrealtime AWS Java SDK :: Services :: IVS Real Time diff --git a/services/kafka/pom.xml b/services/kafka/pom.xml index 8c8e5a71c13f..904341e1f9a6 100644 --- a/services/kafka/pom.xml +++ b/services/kafka/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 kafka AWS Java SDK :: Services :: Kafka diff --git a/services/kafkaconnect/pom.xml b/services/kafkaconnect/pom.xml index 69313a66efd7..6cb7b77fd231 100644 --- a/services/kafkaconnect/pom.xml +++ b/services/kafkaconnect/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 kafkaconnect AWS Java SDK :: Services :: Kafka Connect diff --git a/services/kendra/pom.xml b/services/kendra/pom.xml index 56bbf74139c8..25f16f473831 100644 --- a/services/kendra/pom.xml +++ b/services/kendra/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 kendra AWS Java SDK :: Services :: Kendra diff --git a/services/kendraranking/pom.xml b/services/kendraranking/pom.xml index 94b281ef4eb8..eeec0c3386d0 100644 --- a/services/kendraranking/pom.xml +++ b/services/kendraranking/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 kendraranking AWS Java SDK :: Services :: Kendra Ranking diff --git a/services/keyspaces/pom.xml b/services/keyspaces/pom.xml index f60a20ffb273..ee37a98dc9f4 100644 --- a/services/keyspaces/pom.xml +++ b/services/keyspaces/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 keyspaces AWS Java SDK :: Services :: Keyspaces diff --git a/services/kinesis/pom.xml b/services/kinesis/pom.xml index fefb3ef1594e..5012199604ad 100644 --- a/services/kinesis/pom.xml +++ b/services/kinesis/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 kinesis AWS Java SDK :: Services :: Amazon Kinesis diff --git a/services/kinesisanalytics/pom.xml b/services/kinesisanalytics/pom.xml index 43dbd006770c..a71fbbebdec1 100644 --- a/services/kinesisanalytics/pom.xml +++ b/services/kinesisanalytics/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 kinesisanalytics AWS Java SDK :: Services :: Amazon Kinesis Analytics diff --git a/services/kinesisanalyticsv2/pom.xml b/services/kinesisanalyticsv2/pom.xml index ef64dad5eecb..4b07edc09c0a 100644 --- a/services/kinesisanalyticsv2/pom.xml +++ b/services/kinesisanalyticsv2/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 kinesisanalyticsv2 AWS Java SDK :: Services :: Kinesis Analytics V2 diff --git a/services/kinesisvideo/pom.xml b/services/kinesisvideo/pom.xml index 6cbaf327b35d..eb6ff24b0b96 100644 --- a/services/kinesisvideo/pom.xml +++ b/services/kinesisvideo/pom.xml @@ -20,7 +20,7 @@ services software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 kinesisvideo diff --git a/services/kinesisvideoarchivedmedia/pom.xml b/services/kinesisvideoarchivedmedia/pom.xml index cc46643095f9..9c58f3bc156d 100644 --- a/services/kinesisvideoarchivedmedia/pom.xml +++ b/services/kinesisvideoarchivedmedia/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 kinesisvideoarchivedmedia AWS Java SDK :: Services :: Kinesis Video Archived Media diff --git a/services/kinesisvideomedia/pom.xml b/services/kinesisvideomedia/pom.xml index 19b87fb39af7..06af46e8a659 100644 --- a/services/kinesisvideomedia/pom.xml +++ b/services/kinesisvideomedia/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 kinesisvideomedia AWS Java SDK :: Services :: Kinesis Video Media diff --git a/services/kinesisvideosignaling/pom.xml b/services/kinesisvideosignaling/pom.xml index 90af0839708a..c72a78f9d817 100644 --- a/services/kinesisvideosignaling/pom.xml +++ b/services/kinesisvideosignaling/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 kinesisvideosignaling AWS Java SDK :: Services :: Kinesis Video Signaling diff --git a/services/kinesisvideowebrtcstorage/pom.xml b/services/kinesisvideowebrtcstorage/pom.xml index ba32d00aac2a..dae4950aa34c 100644 --- a/services/kinesisvideowebrtcstorage/pom.xml +++ b/services/kinesisvideowebrtcstorage/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 kinesisvideowebrtcstorage AWS Java SDK :: Services :: Kinesis Video Web RTC Storage diff --git a/services/kms/pom.xml b/services/kms/pom.xml index c7c7ce1e6e78..f821c174dc24 100644 --- a/services/kms/pom.xml +++ b/services/kms/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 kms AWS Java SDK :: Services :: AWS KMS diff --git a/services/lakeformation/pom.xml b/services/lakeformation/pom.xml index 060c15b4e347..a3164498d8bc 100644 --- a/services/lakeformation/pom.xml +++ b/services/lakeformation/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 lakeformation AWS Java SDK :: Services :: LakeFormation diff --git a/services/lambda/pom.xml b/services/lambda/pom.xml index 7d565831901b..f4e471a922cd 100644 --- a/services/lambda/pom.xml +++ b/services/lambda/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 lambda AWS Java SDK :: Services :: AWS Lambda diff --git a/services/launchwizard/pom.xml b/services/launchwizard/pom.xml index f3efdd1c5699..87eee2ab23bd 100644 --- a/services/launchwizard/pom.xml +++ b/services/launchwizard/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 launchwizard AWS Java SDK :: Services :: Launch Wizard diff --git a/services/lexmodelbuilding/pom.xml b/services/lexmodelbuilding/pom.xml index c85657afbe39..fb182e4757ac 100644 --- a/services/lexmodelbuilding/pom.xml +++ b/services/lexmodelbuilding/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 lexmodelbuilding AWS Java SDK :: Services :: Amazon Lex Model Building diff --git a/services/lexmodelsv2/pom.xml b/services/lexmodelsv2/pom.xml index 92c78abb4fd5..1a3ff1e861ca 100644 --- a/services/lexmodelsv2/pom.xml +++ b/services/lexmodelsv2/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 lexmodelsv2 AWS Java SDK :: Services :: Lex Models V2 diff --git a/services/lexruntime/pom.xml b/services/lexruntime/pom.xml index c284f702065e..4168f88389ef 100644 --- a/services/lexruntime/pom.xml +++ b/services/lexruntime/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 lexruntime AWS Java SDK :: Services :: Amazon Lex Runtime diff --git a/services/lexruntimev2/pom.xml b/services/lexruntimev2/pom.xml index a181e0b03f56..937db99af56d 100644 --- a/services/lexruntimev2/pom.xml +++ b/services/lexruntimev2/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 lexruntimev2 AWS Java SDK :: Services :: Lex Runtime V2 diff --git a/services/licensemanager/pom.xml b/services/licensemanager/pom.xml index 459dcc0133e1..3784e6cee68d 100644 --- a/services/licensemanager/pom.xml +++ b/services/licensemanager/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 licensemanager AWS Java SDK :: Services :: License Manager diff --git a/services/licensemanagerlinuxsubscriptions/pom.xml b/services/licensemanagerlinuxsubscriptions/pom.xml index c1b5eef38f99..1d032064927b 100644 --- a/services/licensemanagerlinuxsubscriptions/pom.xml +++ b/services/licensemanagerlinuxsubscriptions/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 licensemanagerlinuxsubscriptions AWS Java SDK :: Services :: License Manager Linux Subscriptions diff --git a/services/licensemanagerusersubscriptions/pom.xml b/services/licensemanagerusersubscriptions/pom.xml index c3135d6102b8..ef8993c5e088 100644 --- a/services/licensemanagerusersubscriptions/pom.xml +++ b/services/licensemanagerusersubscriptions/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 licensemanagerusersubscriptions AWS Java SDK :: Services :: License Manager User Subscriptions diff --git a/services/lightsail/pom.xml b/services/lightsail/pom.xml index 1f28d25abc20..17e4dde3df6b 100644 --- a/services/lightsail/pom.xml +++ b/services/lightsail/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 lightsail AWS Java SDK :: Services :: Amazon Lightsail diff --git a/services/location/pom.xml b/services/location/pom.xml index a4ae70d6f279..7d10d6a0377d 100644 --- a/services/location/pom.xml +++ b/services/location/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 location AWS Java SDK :: Services :: Location diff --git a/services/lookoutequipment/pom.xml b/services/lookoutequipment/pom.xml index 8f0c7aba2d7f..291e0be75799 100644 --- a/services/lookoutequipment/pom.xml +++ b/services/lookoutequipment/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 lookoutequipment AWS Java SDK :: Services :: Lookout Equipment diff --git a/services/lookoutmetrics/pom.xml b/services/lookoutmetrics/pom.xml index ea373ab5fec4..aee2e6a62bc9 100644 --- a/services/lookoutmetrics/pom.xml +++ b/services/lookoutmetrics/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 lookoutmetrics AWS Java SDK :: Services :: Lookout Metrics diff --git a/services/lookoutvision/pom.xml b/services/lookoutvision/pom.xml index df996da84d15..b6998b486471 100644 --- a/services/lookoutvision/pom.xml +++ b/services/lookoutvision/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 lookoutvision AWS Java SDK :: Services :: Lookout Vision diff --git a/services/m2/pom.xml b/services/m2/pom.xml index 3ac70489feb9..5b678c1f0855 100644 --- a/services/m2/pom.xml +++ b/services/m2/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 m2 AWS Java SDK :: Services :: M2 diff --git a/services/machinelearning/pom.xml b/services/machinelearning/pom.xml index 0a2b6ef09fb6..8e12b0b4ddd6 100644 --- a/services/machinelearning/pom.xml +++ b/services/machinelearning/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 machinelearning AWS Java SDK :: Services :: Amazon Machine Learning diff --git a/services/macie2/pom.xml b/services/macie2/pom.xml index 01691aec8ae9..bc11fe9cdef9 100644 --- a/services/macie2/pom.xml +++ b/services/macie2/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 macie2 AWS Java SDK :: Services :: Macie2 diff --git a/services/mailmanager/pom.xml b/services/mailmanager/pom.xml index da96c7568b4f..bbce22e48335 100644 --- a/services/mailmanager/pom.xml +++ b/services/mailmanager/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 mailmanager AWS Java SDK :: Services :: Mail Manager diff --git a/services/managedblockchain/pom.xml b/services/managedblockchain/pom.xml index fb68d834fc74..6d4e12188fdb 100644 --- a/services/managedblockchain/pom.xml +++ b/services/managedblockchain/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 managedblockchain AWS Java SDK :: Services :: ManagedBlockchain diff --git a/services/managedblockchainquery/pom.xml b/services/managedblockchainquery/pom.xml index 86f2f8349eb0..b15d638ec6b3 100644 --- a/services/managedblockchainquery/pom.xml +++ b/services/managedblockchainquery/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 managedblockchainquery AWS Java SDK :: Services :: Managed Blockchain Query diff --git a/services/marketplaceagreement/pom.xml b/services/marketplaceagreement/pom.xml index a0d29e28c469..92a761b31434 100644 --- a/services/marketplaceagreement/pom.xml +++ b/services/marketplaceagreement/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 marketplaceagreement AWS Java SDK :: Services :: Marketplace Agreement diff --git a/services/marketplacecatalog/pom.xml b/services/marketplacecatalog/pom.xml index 887c0df3cd33..5dc36a0a4d97 100644 --- a/services/marketplacecatalog/pom.xml +++ b/services/marketplacecatalog/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 marketplacecatalog AWS Java SDK :: Services :: Marketplace Catalog diff --git a/services/marketplacecommerceanalytics/pom.xml b/services/marketplacecommerceanalytics/pom.xml index ded8ec16b4ac..3dbd88a618d6 100644 --- a/services/marketplacecommerceanalytics/pom.xml +++ b/services/marketplacecommerceanalytics/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 marketplacecommerceanalytics AWS Java SDK :: Services :: AWS Marketplace Commerce Analytics diff --git a/services/marketplacedeployment/pom.xml b/services/marketplacedeployment/pom.xml index d38dd5f577c6..d28cdf2225d0 100644 --- a/services/marketplacedeployment/pom.xml +++ b/services/marketplacedeployment/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 marketplacedeployment AWS Java SDK :: Services :: Marketplace Deployment diff --git a/services/marketplaceentitlement/pom.xml b/services/marketplaceentitlement/pom.xml index aacb1c7822a7..ea54a1d68462 100644 --- a/services/marketplaceentitlement/pom.xml +++ b/services/marketplaceentitlement/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 marketplaceentitlement AWS Java SDK :: Services :: AWS Marketplace Entitlement diff --git a/services/marketplacemetering/pom.xml b/services/marketplacemetering/pom.xml index 5357614dc659..2444793f4655 100644 --- a/services/marketplacemetering/pom.xml +++ b/services/marketplacemetering/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 marketplacemetering AWS Java SDK :: Services :: AWS Marketplace Metering Service diff --git a/services/marketplacereporting/pom.xml b/services/marketplacereporting/pom.xml index 4b041c09ef8d..7480bb625f98 100644 --- a/services/marketplacereporting/pom.xml +++ b/services/marketplacereporting/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 marketplacereporting AWS Java SDK :: Services :: Marketplace Reporting diff --git a/services/mediaconnect/pom.xml b/services/mediaconnect/pom.xml index 503d212f4ef8..16b6925086af 100644 --- a/services/mediaconnect/pom.xml +++ b/services/mediaconnect/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 mediaconnect AWS Java SDK :: Services :: MediaConnect diff --git a/services/mediaconvert/pom.xml b/services/mediaconvert/pom.xml index 28c3602e7cac..834e6b3a2990 100644 --- a/services/mediaconvert/pom.xml +++ b/services/mediaconvert/pom.xml @@ -20,7 +20,7 @@ services software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 mediaconvert diff --git a/services/medialive/pom.xml b/services/medialive/pom.xml index bacddb0c07a9..dffe6a08b6df 100644 --- a/services/medialive/pom.xml +++ b/services/medialive/pom.xml @@ -20,7 +20,7 @@ services software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 medialive diff --git a/services/mediapackage/pom.xml b/services/mediapackage/pom.xml index 4a8846183cbf..218dcb0f4c61 100644 --- a/services/mediapackage/pom.xml +++ b/services/mediapackage/pom.xml @@ -20,7 +20,7 @@ services software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 mediapackage diff --git a/services/mediapackagev2/pom.xml b/services/mediapackagev2/pom.xml index 9a5fc318221c..b8103fc41c9e 100644 --- a/services/mediapackagev2/pom.xml +++ b/services/mediapackagev2/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 mediapackagev2 AWS Java SDK :: Services :: Media Package V2 diff --git a/services/mediapackagevod/pom.xml b/services/mediapackagevod/pom.xml index 5b2fad252105..89e4ad0b55c0 100644 --- a/services/mediapackagevod/pom.xml +++ b/services/mediapackagevod/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 mediapackagevod AWS Java SDK :: Services :: MediaPackage Vod diff --git a/services/mediastore/pom.xml b/services/mediastore/pom.xml index d9625954407d..7c6bc50f47f9 100644 --- a/services/mediastore/pom.xml +++ b/services/mediastore/pom.xml @@ -20,7 +20,7 @@ services software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 mediastore diff --git a/services/mediastoredata/pom.xml b/services/mediastoredata/pom.xml index 7f090af49527..e67ad4600e10 100644 --- a/services/mediastoredata/pom.xml +++ b/services/mediastoredata/pom.xml @@ -20,7 +20,7 @@ services software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 mediastoredata diff --git a/services/mediatailor/pom.xml b/services/mediatailor/pom.xml index 21ad86aa2f63..c926453445f2 100644 --- a/services/mediatailor/pom.xml +++ b/services/mediatailor/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 mediatailor AWS Java SDK :: Services :: MediaTailor diff --git a/services/medicalimaging/pom.xml b/services/medicalimaging/pom.xml index 9bca65b3f6e6..59c14522ec63 100644 --- a/services/medicalimaging/pom.xml +++ b/services/medicalimaging/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 medicalimaging AWS Java SDK :: Services :: Medical Imaging diff --git a/services/memorydb/pom.xml b/services/memorydb/pom.xml index 440995ca96a4..303d847c5f8d 100644 --- a/services/memorydb/pom.xml +++ b/services/memorydb/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 memorydb AWS Java SDK :: Services :: Memory DB diff --git a/services/mgn/pom.xml b/services/mgn/pom.xml index 2a1332efcf36..71c614ba5717 100644 --- a/services/mgn/pom.xml +++ b/services/mgn/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 mgn AWS Java SDK :: Services :: Mgn diff --git a/services/migrationhub/pom.xml b/services/migrationhub/pom.xml index c870bac0ae26..6714ccdb1d39 100644 --- a/services/migrationhub/pom.xml +++ b/services/migrationhub/pom.xml @@ -20,7 +20,7 @@ services software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 migrationhub diff --git a/services/migrationhubconfig/pom.xml b/services/migrationhubconfig/pom.xml index 0fac907d36d2..3f7b21b337d3 100644 --- a/services/migrationhubconfig/pom.xml +++ b/services/migrationhubconfig/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 migrationhubconfig AWS Java SDK :: Services :: MigrationHub Config diff --git a/services/migrationhuborchestrator/pom.xml b/services/migrationhuborchestrator/pom.xml index 3a9ca722ae0f..65eed46d7ad5 100644 --- a/services/migrationhuborchestrator/pom.xml +++ b/services/migrationhuborchestrator/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 migrationhuborchestrator AWS Java SDK :: Services :: Migration Hub Orchestrator diff --git a/services/migrationhubrefactorspaces/pom.xml b/services/migrationhubrefactorspaces/pom.xml index db96a4b48af6..f88511626ae2 100644 --- a/services/migrationhubrefactorspaces/pom.xml +++ b/services/migrationhubrefactorspaces/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 migrationhubrefactorspaces AWS Java SDK :: Services :: Migration Hub Refactor Spaces diff --git a/services/migrationhubstrategy/pom.xml b/services/migrationhubstrategy/pom.xml index 6d5fff998b1a..349c37956890 100644 --- a/services/migrationhubstrategy/pom.xml +++ b/services/migrationhubstrategy/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 migrationhubstrategy AWS Java SDK :: Services :: Migration Hub Strategy diff --git a/services/mq/pom.xml b/services/mq/pom.xml index 6b502691bfff..4328499c57f9 100644 --- a/services/mq/pom.xml +++ b/services/mq/pom.xml @@ -20,7 +20,7 @@ services software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 mq diff --git a/services/mturk/pom.xml b/services/mturk/pom.xml index 2205d4a9e4ba..8f8cfef18c4e 100644 --- a/services/mturk/pom.xml +++ b/services/mturk/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 mturk AWS Java SDK :: Services :: Amazon Mechanical Turk Requester diff --git a/services/mwaa/pom.xml b/services/mwaa/pom.xml index 8e47b3e7f912..d1f84bdcfbb2 100644 --- a/services/mwaa/pom.xml +++ b/services/mwaa/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 mwaa AWS Java SDK :: Services :: MWAA diff --git a/services/neptune/pom.xml b/services/neptune/pom.xml index 80cc3c28ec2e..d74107706d61 100644 --- a/services/neptune/pom.xml +++ b/services/neptune/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 neptune AWS Java SDK :: Services :: Neptune diff --git a/services/neptunedata/pom.xml b/services/neptunedata/pom.xml index b25e34d6f662..9f9c257cacd1 100644 --- a/services/neptunedata/pom.xml +++ b/services/neptunedata/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 neptunedata AWS Java SDK :: Services :: Neptunedata diff --git a/services/neptunegraph/pom.xml b/services/neptunegraph/pom.xml index 0b3393cd753c..38c8ea1bef0b 100644 --- a/services/neptunegraph/pom.xml +++ b/services/neptunegraph/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 neptunegraph AWS Java SDK :: Services :: Neptune Graph diff --git a/services/networkfirewall/pom.xml b/services/networkfirewall/pom.xml index a5155af629a0..849f10d0179b 100644 --- a/services/networkfirewall/pom.xml +++ b/services/networkfirewall/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 networkfirewall AWS Java SDK :: Services :: Network Firewall diff --git a/services/networkflowmonitor/pom.xml b/services/networkflowmonitor/pom.xml index 7dc2a70bb1a4..75d2877f8bb0 100644 --- a/services/networkflowmonitor/pom.xml +++ b/services/networkflowmonitor/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 networkflowmonitor AWS Java SDK :: Services :: Network Flow Monitor diff --git a/services/networkmanager/pom.xml b/services/networkmanager/pom.xml index ab04c1b22b65..8490d732ce9b 100644 --- a/services/networkmanager/pom.xml +++ b/services/networkmanager/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 networkmanager AWS Java SDK :: Services :: NetworkManager diff --git a/services/networkmonitor/pom.xml b/services/networkmonitor/pom.xml index 83ac20d902d0..d081ea6632ca 100644 --- a/services/networkmonitor/pom.xml +++ b/services/networkmonitor/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 networkmonitor AWS Java SDK :: Services :: Network Monitor diff --git a/services/notifications/pom.xml b/services/notifications/pom.xml index ba0284debac9..68a69d44beb1 100644 --- a/services/notifications/pom.xml +++ b/services/notifications/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 notifications AWS Java SDK :: Services :: Notifications diff --git a/services/notificationscontacts/pom.xml b/services/notificationscontacts/pom.xml index 9ebef121d600..b0368d39e313 100644 --- a/services/notificationscontacts/pom.xml +++ b/services/notificationscontacts/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 notificationscontacts AWS Java SDK :: Services :: Notifications Contacts diff --git a/services/oam/pom.xml b/services/oam/pom.xml index f88efd4311ba..706042d8e8f1 100644 --- a/services/oam/pom.xml +++ b/services/oam/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 oam AWS Java SDK :: Services :: OAM diff --git a/services/observabilityadmin/pom.xml b/services/observabilityadmin/pom.xml index 9327ac15a2df..5ab4be82fe24 100644 --- a/services/observabilityadmin/pom.xml +++ b/services/observabilityadmin/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 observabilityadmin AWS Java SDK :: Services :: Observability Admin diff --git a/services/omics/pom.xml b/services/omics/pom.xml index dbf04f8128a8..73b5b98abc7a 100644 --- a/services/omics/pom.xml +++ b/services/omics/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 omics AWS Java SDK :: Services :: Omics diff --git a/services/opensearch/pom.xml b/services/opensearch/pom.xml index d88289b1f87c..37c69ce054b4 100644 --- a/services/opensearch/pom.xml +++ b/services/opensearch/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 opensearch AWS Java SDK :: Services :: Open Search diff --git a/services/opensearchserverless/pom.xml b/services/opensearchserverless/pom.xml index d5315584bdf1..21685c2f17ae 100644 --- a/services/opensearchserverless/pom.xml +++ b/services/opensearchserverless/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 opensearchserverless AWS Java SDK :: Services :: Open Search Serverless diff --git a/services/opsworks/pom.xml b/services/opsworks/pom.xml index 8cbe6a3909a4..cee6fc336ad3 100644 --- a/services/opsworks/pom.xml +++ b/services/opsworks/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 opsworks AWS Java SDK :: Services :: AWS OpsWorks diff --git a/services/opsworkscm/pom.xml b/services/opsworkscm/pom.xml index ae9eaac7831a..3f917639b51d 100644 --- a/services/opsworkscm/pom.xml +++ b/services/opsworkscm/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 opsworkscm AWS Java SDK :: Services :: AWS OpsWorks for Chef Automate diff --git a/services/organizations/pom.xml b/services/organizations/pom.xml index be8a6464561e..8033ceca7e65 100644 --- a/services/organizations/pom.xml +++ b/services/organizations/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 organizations AWS Java SDK :: Services :: AWS Organizations diff --git a/services/osis/pom.xml b/services/osis/pom.xml index 65bb864be395..0bec41aeab55 100644 --- a/services/osis/pom.xml +++ b/services/osis/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 osis AWS Java SDK :: Services :: OSIS diff --git a/services/outposts/pom.xml b/services/outposts/pom.xml index 01e56dfced43..665db76346ea 100644 --- a/services/outposts/pom.xml +++ b/services/outposts/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 outposts AWS Java SDK :: Services :: Outposts diff --git a/services/panorama/pom.xml b/services/panorama/pom.xml index 9a74019aa6a2..cea94a711d15 100644 --- a/services/panorama/pom.xml +++ b/services/panorama/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 panorama AWS Java SDK :: Services :: Panorama diff --git a/services/partnercentralselling/pom.xml b/services/partnercentralselling/pom.xml index 7302b9fec6be..0aa0c5581cd7 100644 --- a/services/partnercentralselling/pom.xml +++ b/services/partnercentralselling/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 partnercentralselling AWS Java SDK :: Services :: Partner Central Selling diff --git a/services/paymentcryptography/pom.xml b/services/paymentcryptography/pom.xml index 699a3b7921ff..9d1776de5767 100644 --- a/services/paymentcryptography/pom.xml +++ b/services/paymentcryptography/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 paymentcryptography AWS Java SDK :: Services :: Payment Cryptography diff --git a/services/paymentcryptographydata/pom.xml b/services/paymentcryptographydata/pom.xml index f81c14ae68e2..38d960bfb951 100644 --- a/services/paymentcryptographydata/pom.xml +++ b/services/paymentcryptographydata/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 paymentcryptographydata AWS Java SDK :: Services :: Payment Cryptography Data diff --git a/services/pcaconnectorad/pom.xml b/services/pcaconnectorad/pom.xml index cbd3eecf1ef0..5319258f6d83 100644 --- a/services/pcaconnectorad/pom.xml +++ b/services/pcaconnectorad/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 pcaconnectorad AWS Java SDK :: Services :: Pca Connector Ad diff --git a/services/pcaconnectorscep/pom.xml b/services/pcaconnectorscep/pom.xml index 044cd96331ec..52921ceaf3e9 100644 --- a/services/pcaconnectorscep/pom.xml +++ b/services/pcaconnectorscep/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 pcaconnectorscep AWS Java SDK :: Services :: Pca Connector Scep diff --git a/services/pcs/pom.xml b/services/pcs/pom.xml index c12cdb50b32f..d05f0d8acf57 100644 --- a/services/pcs/pom.xml +++ b/services/pcs/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 pcs AWS Java SDK :: Services :: PCS diff --git a/services/personalize/pom.xml b/services/personalize/pom.xml index 014fd9b07fa5..084ab2ce7bf6 100644 --- a/services/personalize/pom.xml +++ b/services/personalize/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 personalize AWS Java SDK :: Services :: Personalize diff --git a/services/personalizeevents/pom.xml b/services/personalizeevents/pom.xml index 6e3a902d8029..a4d3c7f78beb 100644 --- a/services/personalizeevents/pom.xml +++ b/services/personalizeevents/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 personalizeevents AWS Java SDK :: Services :: Personalize Events diff --git a/services/personalizeruntime/pom.xml b/services/personalizeruntime/pom.xml index b9deabe48c5d..ab72d14fcd21 100644 --- a/services/personalizeruntime/pom.xml +++ b/services/personalizeruntime/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 personalizeruntime AWS Java SDK :: Services :: Personalize Runtime diff --git a/services/pi/pom.xml b/services/pi/pom.xml index f061354df5af..f9a1f9d6b584 100644 --- a/services/pi/pom.xml +++ b/services/pi/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 pi AWS Java SDK :: Services :: PI diff --git a/services/pinpoint/pom.xml b/services/pinpoint/pom.xml index 7e960ed74954..08861eec4fc9 100644 --- a/services/pinpoint/pom.xml +++ b/services/pinpoint/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 pinpoint AWS Java SDK :: Services :: Amazon Pinpoint diff --git a/services/pinpointemail/pom.xml b/services/pinpointemail/pom.xml index 5ced50f205cd..7cbbb3c7fc31 100644 --- a/services/pinpointemail/pom.xml +++ b/services/pinpointemail/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 pinpointemail AWS Java SDK :: Services :: Pinpoint Email diff --git a/services/pinpointsmsvoice/pom.xml b/services/pinpointsmsvoice/pom.xml index e19f4046ff1d..0b16dc7b1a98 100644 --- a/services/pinpointsmsvoice/pom.xml +++ b/services/pinpointsmsvoice/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 pinpointsmsvoice AWS Java SDK :: Services :: Pinpoint SMS Voice diff --git a/services/pinpointsmsvoicev2/pom.xml b/services/pinpointsmsvoicev2/pom.xml index 96e197487bf1..3d342609c842 100644 --- a/services/pinpointsmsvoicev2/pom.xml +++ b/services/pinpointsmsvoicev2/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 pinpointsmsvoicev2 AWS Java SDK :: Services :: Pinpoint SMS Voice V2 diff --git a/services/pipes/pom.xml b/services/pipes/pom.xml index de48c02eca18..b22ff2c0e557 100644 --- a/services/pipes/pom.xml +++ b/services/pipes/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 pipes AWS Java SDK :: Services :: Pipes diff --git a/services/polly/pom.xml b/services/polly/pom.xml index 4ba3e46a25fc..5315d10c3aec 100644 --- a/services/polly/pom.xml +++ b/services/polly/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 polly AWS Java SDK :: Services :: Amazon Polly diff --git a/services/pom.xml b/services/pom.xml index 2ece052a7283..b494b04d645f 100644 --- a/services/pom.xml +++ b/services/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk aws-sdk-java-pom - 2.31.19-SNAPSHOT + 2.31.19 services AWS Java SDK :: Services diff --git a/services/pricing/pom.xml b/services/pricing/pom.xml index ce5b57f0b928..4baaa3072780 100644 --- a/services/pricing/pom.xml +++ b/services/pricing/pom.xml @@ -20,7 +20,7 @@ services software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 pricing diff --git a/services/privatenetworks/pom.xml b/services/privatenetworks/pom.xml index f2e891f97a25..3d8870d3c6ca 100644 --- a/services/privatenetworks/pom.xml +++ b/services/privatenetworks/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 privatenetworks AWS Java SDK :: Services :: Private Networks diff --git a/services/proton/pom.xml b/services/proton/pom.xml index b35fcfdbac08..804f626dcca5 100644 --- a/services/proton/pom.xml +++ b/services/proton/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 proton AWS Java SDK :: Services :: Proton diff --git a/services/qapps/pom.xml b/services/qapps/pom.xml index 6c2022aca473..074512c0c2e9 100644 --- a/services/qapps/pom.xml +++ b/services/qapps/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 qapps AWS Java SDK :: Services :: Q Apps diff --git a/services/qbusiness/pom.xml b/services/qbusiness/pom.xml index 70603e6bdebd..da171c18ddea 100644 --- a/services/qbusiness/pom.xml +++ b/services/qbusiness/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 qbusiness AWS Java SDK :: Services :: Q Business diff --git a/services/qconnect/pom.xml b/services/qconnect/pom.xml index 88906f983d8d..7e41d52288c5 100644 --- a/services/qconnect/pom.xml +++ b/services/qconnect/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 qconnect AWS Java SDK :: Services :: Q Connect diff --git a/services/qldb/pom.xml b/services/qldb/pom.xml index 8fe1eda3cb03..3f4c4f78c9e1 100644 --- a/services/qldb/pom.xml +++ b/services/qldb/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 qldb AWS Java SDK :: Services :: QLDB diff --git a/services/qldbsession/pom.xml b/services/qldbsession/pom.xml index 426081664ed8..be92d5c8c34b 100644 --- a/services/qldbsession/pom.xml +++ b/services/qldbsession/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 qldbsession AWS Java SDK :: Services :: QLDB Session diff --git a/services/quicksight/pom.xml b/services/quicksight/pom.xml index 1d450cf4377e..b5a784565e23 100644 --- a/services/quicksight/pom.xml +++ b/services/quicksight/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 quicksight AWS Java SDK :: Services :: QuickSight diff --git a/services/ram/pom.xml b/services/ram/pom.xml index 83adc32360f2..7e55be6ef8b5 100644 --- a/services/ram/pom.xml +++ b/services/ram/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 ram AWS Java SDK :: Services :: RAM diff --git a/services/rbin/pom.xml b/services/rbin/pom.xml index b5b5c3385b9b..dad62eb2d60d 100644 --- a/services/rbin/pom.xml +++ b/services/rbin/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 rbin AWS Java SDK :: Services :: Rbin diff --git a/services/rds/pom.xml b/services/rds/pom.xml index a09b8daa1e4a..d944513985ac 100644 --- a/services/rds/pom.xml +++ b/services/rds/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 rds AWS Java SDK :: Services :: Amazon RDS diff --git a/services/rdsdata/pom.xml b/services/rdsdata/pom.xml index 317e8fd66882..49018fda5fa2 100644 --- a/services/rdsdata/pom.xml +++ b/services/rdsdata/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 rdsdata AWS Java SDK :: Services :: RDS Data diff --git a/services/redshift/pom.xml b/services/redshift/pom.xml index b789e3332ab3..98006d313286 100644 --- a/services/redshift/pom.xml +++ b/services/redshift/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 redshift AWS Java SDK :: Services :: Amazon Redshift diff --git a/services/redshiftdata/pom.xml b/services/redshiftdata/pom.xml index 91002ed782bf..68df927befce 100644 --- a/services/redshiftdata/pom.xml +++ b/services/redshiftdata/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 redshiftdata AWS Java SDK :: Services :: Redshift Data diff --git a/services/redshiftserverless/pom.xml b/services/redshiftserverless/pom.xml index e5cdc50853db..cb48f4ea619e 100644 --- a/services/redshiftserverless/pom.xml +++ b/services/redshiftserverless/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 redshiftserverless AWS Java SDK :: Services :: Redshift Serverless diff --git a/services/rekognition/pom.xml b/services/rekognition/pom.xml index 28cb9fadd370..73393fda561b 100644 --- a/services/rekognition/pom.xml +++ b/services/rekognition/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 rekognition AWS Java SDK :: Services :: Amazon Rekognition diff --git a/services/repostspace/pom.xml b/services/repostspace/pom.xml index 4844e9c817ca..54ca510d2811 100644 --- a/services/repostspace/pom.xml +++ b/services/repostspace/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 repostspace AWS Java SDK :: Services :: Repostspace diff --git a/services/resiliencehub/pom.xml b/services/resiliencehub/pom.xml index 613bfd315915..9bf41faf2df7 100644 --- a/services/resiliencehub/pom.xml +++ b/services/resiliencehub/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 resiliencehub AWS Java SDK :: Services :: Resiliencehub diff --git a/services/resourceexplorer2/pom.xml b/services/resourceexplorer2/pom.xml index 218815132d08..db00b6192cd5 100644 --- a/services/resourceexplorer2/pom.xml +++ b/services/resourceexplorer2/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 resourceexplorer2 AWS Java SDK :: Services :: Resource Explorer 2 diff --git a/services/resourcegroups/pom.xml b/services/resourcegroups/pom.xml index 3b8245cef972..a09c96558b7b 100644 --- a/services/resourcegroups/pom.xml +++ b/services/resourcegroups/pom.xml @@ -20,7 +20,7 @@ services software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 resourcegroups diff --git a/services/resourcegroupstaggingapi/pom.xml b/services/resourcegroupstaggingapi/pom.xml index 0d191909fd62..5df9da7ece84 100644 --- a/services/resourcegroupstaggingapi/pom.xml +++ b/services/resourcegroupstaggingapi/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 resourcegroupstaggingapi AWS Java SDK :: Services :: AWS Resource Groups Tagging API diff --git a/services/robomaker/pom.xml b/services/robomaker/pom.xml index 21bb64331384..4e5335090766 100644 --- a/services/robomaker/pom.xml +++ b/services/robomaker/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 robomaker AWS Java SDK :: Services :: RoboMaker diff --git a/services/rolesanywhere/pom.xml b/services/rolesanywhere/pom.xml index 4d3023d4ef4c..0dd775cf8870 100644 --- a/services/rolesanywhere/pom.xml +++ b/services/rolesanywhere/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 rolesanywhere AWS Java SDK :: Services :: Roles Anywhere diff --git a/services/route53/pom.xml b/services/route53/pom.xml index 869bf5eb0daf..9df81ce38039 100644 --- a/services/route53/pom.xml +++ b/services/route53/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 route53 AWS Java SDK :: Services :: Amazon Route53 diff --git a/services/route53domains/pom.xml b/services/route53domains/pom.xml index 1b9f7397d6c6..7b8bde987665 100644 --- a/services/route53domains/pom.xml +++ b/services/route53domains/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 route53domains AWS Java SDK :: Services :: Amazon Route53 Domains diff --git a/services/route53profiles/pom.xml b/services/route53profiles/pom.xml index 7e6a5e6c5666..7e4ffaa904de 100644 --- a/services/route53profiles/pom.xml +++ b/services/route53profiles/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 route53profiles AWS Java SDK :: Services :: Route53 Profiles diff --git a/services/route53recoverycluster/pom.xml b/services/route53recoverycluster/pom.xml index c510f4ec1f0f..92bdc37e6030 100644 --- a/services/route53recoverycluster/pom.xml +++ b/services/route53recoverycluster/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 route53recoverycluster AWS Java SDK :: Services :: Route53 Recovery Cluster diff --git a/services/route53recoverycontrolconfig/pom.xml b/services/route53recoverycontrolconfig/pom.xml index e672609c937b..0dec645fd6c4 100644 --- a/services/route53recoverycontrolconfig/pom.xml +++ b/services/route53recoverycontrolconfig/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 route53recoverycontrolconfig AWS Java SDK :: Services :: Route53 Recovery Control Config diff --git a/services/route53recoveryreadiness/pom.xml b/services/route53recoveryreadiness/pom.xml index a1ee285d2f04..25ea8bcf7c00 100644 --- a/services/route53recoveryreadiness/pom.xml +++ b/services/route53recoveryreadiness/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 route53recoveryreadiness AWS Java SDK :: Services :: Route53 Recovery Readiness diff --git a/services/route53resolver/pom.xml b/services/route53resolver/pom.xml index 359c5cbc2de9..3e2c5d57b796 100644 --- a/services/route53resolver/pom.xml +++ b/services/route53resolver/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 route53resolver AWS Java SDK :: Services :: Route53Resolver diff --git a/services/rum/pom.xml b/services/rum/pom.xml index 01d7e95471a2..eb67f4b756b9 100644 --- a/services/rum/pom.xml +++ b/services/rum/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 rum AWS Java SDK :: Services :: RUM diff --git a/services/s3/pom.xml b/services/s3/pom.xml index 0099ee8cf907..4bc0089f97fb 100644 --- a/services/s3/pom.xml +++ b/services/s3/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 s3 AWS Java SDK :: Services :: Amazon S3 diff --git a/services/s3control/pom.xml b/services/s3control/pom.xml index 88c78e9ee4d1..30c15cdedd9c 100644 --- a/services/s3control/pom.xml +++ b/services/s3control/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 s3control AWS Java SDK :: Services :: Amazon S3 Control diff --git a/services/s3outposts/pom.xml b/services/s3outposts/pom.xml index 786f0f95b8f9..7cdf5b47b08c 100644 --- a/services/s3outposts/pom.xml +++ b/services/s3outposts/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 s3outposts AWS Java SDK :: Services :: S3 Outposts diff --git a/services/s3tables/pom.xml b/services/s3tables/pom.xml index 9e54136cd73c..31ddf61f5a7a 100644 --- a/services/s3tables/pom.xml +++ b/services/s3tables/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 s3tables AWS Java SDK :: Services :: S3 Tables diff --git a/services/sagemaker/pom.xml b/services/sagemaker/pom.xml index 0141548d5992..0930cdb7a87e 100644 --- a/services/sagemaker/pom.xml +++ b/services/sagemaker/pom.xml @@ -20,7 +20,7 @@ services software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 sagemaker diff --git a/services/sagemakera2iruntime/pom.xml b/services/sagemakera2iruntime/pom.xml index 6b6862e22f2c..5c149ee718f8 100644 --- a/services/sagemakera2iruntime/pom.xml +++ b/services/sagemakera2iruntime/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 sagemakera2iruntime AWS Java SDK :: Services :: SageMaker A2I Runtime diff --git a/services/sagemakeredge/pom.xml b/services/sagemakeredge/pom.xml index 059e31296c33..8cee9b916d4f 100644 --- a/services/sagemakeredge/pom.xml +++ b/services/sagemakeredge/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 sagemakeredge AWS Java SDK :: Services :: Sagemaker Edge diff --git a/services/sagemakerfeaturestoreruntime/pom.xml b/services/sagemakerfeaturestoreruntime/pom.xml index 026f90a7fad9..c8f1b8908804 100644 --- a/services/sagemakerfeaturestoreruntime/pom.xml +++ b/services/sagemakerfeaturestoreruntime/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 sagemakerfeaturestoreruntime AWS Java SDK :: Services :: Sage Maker Feature Store Runtime diff --git a/services/sagemakergeospatial/pom.xml b/services/sagemakergeospatial/pom.xml index 4b5c317a0602..839a23833241 100644 --- a/services/sagemakergeospatial/pom.xml +++ b/services/sagemakergeospatial/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 sagemakergeospatial AWS Java SDK :: Services :: Sage Maker Geospatial diff --git a/services/sagemakermetrics/pom.xml b/services/sagemakermetrics/pom.xml index 83c8d44ace7a..39f5da09b976 100644 --- a/services/sagemakermetrics/pom.xml +++ b/services/sagemakermetrics/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 sagemakermetrics AWS Java SDK :: Services :: Sage Maker Metrics diff --git a/services/sagemakerruntime/pom.xml b/services/sagemakerruntime/pom.xml index a1abfc9da56f..47988eaa7372 100644 --- a/services/sagemakerruntime/pom.xml +++ b/services/sagemakerruntime/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 sagemakerruntime AWS Java SDK :: Services :: SageMaker Runtime diff --git a/services/savingsplans/pom.xml b/services/savingsplans/pom.xml index 332928d0a662..5a4b0041800f 100644 --- a/services/savingsplans/pom.xml +++ b/services/savingsplans/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 savingsplans AWS Java SDK :: Services :: Savingsplans diff --git a/services/scheduler/pom.xml b/services/scheduler/pom.xml index 6a19ea6c897a..75f119dfbc06 100644 --- a/services/scheduler/pom.xml +++ b/services/scheduler/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 scheduler AWS Java SDK :: Services :: Scheduler diff --git a/services/schemas/pom.xml b/services/schemas/pom.xml index d1869149336b..973055e59033 100644 --- a/services/schemas/pom.xml +++ b/services/schemas/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 schemas AWS Java SDK :: Services :: Schemas diff --git a/services/secretsmanager/pom.xml b/services/secretsmanager/pom.xml index e63dd213bc7e..8c6b5a3b26f5 100644 --- a/services/secretsmanager/pom.xml +++ b/services/secretsmanager/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 secretsmanager AWS Java SDK :: Services :: AWS Secrets Manager diff --git a/services/securityhub/pom.xml b/services/securityhub/pom.xml index aab919188bfe..e8e692b6838c 100644 --- a/services/securityhub/pom.xml +++ b/services/securityhub/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 securityhub AWS Java SDK :: Services :: SecurityHub diff --git a/services/securityir/pom.xml b/services/securityir/pom.xml index 780333190ce7..8a233eed7cca 100644 --- a/services/securityir/pom.xml +++ b/services/securityir/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 securityir AWS Java SDK :: Services :: Security IR diff --git a/services/securitylake/pom.xml b/services/securitylake/pom.xml index 4d8e81097764..aee7a6ce0f26 100644 --- a/services/securitylake/pom.xml +++ b/services/securitylake/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 securitylake AWS Java SDK :: Services :: Security Lake diff --git a/services/serverlessapplicationrepository/pom.xml b/services/serverlessapplicationrepository/pom.xml index eec0c28d9f8e..d12a701fb84e 100644 --- a/services/serverlessapplicationrepository/pom.xml +++ b/services/serverlessapplicationrepository/pom.xml @@ -20,7 +20,7 @@ services software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 serverlessapplicationrepository diff --git a/services/servicecatalog/pom.xml b/services/servicecatalog/pom.xml index 7713139405ab..24f4bf0d22f0 100644 --- a/services/servicecatalog/pom.xml +++ b/services/servicecatalog/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 servicecatalog AWS Java SDK :: Services :: AWS Service Catalog diff --git a/services/servicecatalogappregistry/pom.xml b/services/servicecatalogappregistry/pom.xml index fb42b41936ba..924bf207f808 100644 --- a/services/servicecatalogappregistry/pom.xml +++ b/services/servicecatalogappregistry/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 servicecatalogappregistry AWS Java SDK :: Services :: Service Catalog App Registry diff --git a/services/servicediscovery/pom.xml b/services/servicediscovery/pom.xml index 4c310871f515..de1ae157122a 100644 --- a/services/servicediscovery/pom.xml +++ b/services/servicediscovery/pom.xml @@ -20,7 +20,7 @@ services software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 servicediscovery diff --git a/services/servicequotas/pom.xml b/services/servicequotas/pom.xml index 40989dffeb02..c37ce9848dda 100644 --- a/services/servicequotas/pom.xml +++ b/services/servicequotas/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 servicequotas AWS Java SDK :: Services :: Service Quotas diff --git a/services/ses/pom.xml b/services/ses/pom.xml index 25fd5643df18..a9f630cf92c6 100644 --- a/services/ses/pom.xml +++ b/services/ses/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 ses AWS Java SDK :: Services :: Amazon SES diff --git a/services/sesv2/pom.xml b/services/sesv2/pom.xml index 5c5c8a47d848..41489722cbe4 100644 --- a/services/sesv2/pom.xml +++ b/services/sesv2/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 sesv2 AWS Java SDK :: Services :: SESv2 diff --git a/services/sfn/pom.xml b/services/sfn/pom.xml index f3ed0aca2770..4dcc34842ee8 100644 --- a/services/sfn/pom.xml +++ b/services/sfn/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 sfn AWS Java SDK :: Services :: AWS Step Functions diff --git a/services/shield/pom.xml b/services/shield/pom.xml index 60a2ee923bd4..9ed0818316d5 100644 --- a/services/shield/pom.xml +++ b/services/shield/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 shield AWS Java SDK :: Services :: AWS Shield diff --git a/services/signer/pom.xml b/services/signer/pom.xml index c1bb7f3fd1be..8b721bdb8f73 100644 --- a/services/signer/pom.xml +++ b/services/signer/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 signer AWS Java SDK :: Services :: Signer diff --git a/services/simspaceweaver/pom.xml b/services/simspaceweaver/pom.xml index de7b826a4836..99100e35c78b 100644 --- a/services/simspaceweaver/pom.xml +++ b/services/simspaceweaver/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 simspaceweaver AWS Java SDK :: Services :: Sim Space Weaver diff --git a/services/sms/pom.xml b/services/sms/pom.xml index 2ef36165479f..255739b42807 100644 --- a/services/sms/pom.xml +++ b/services/sms/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 sms AWS Java SDK :: Services :: AWS Server Migration diff --git a/services/snowball/pom.xml b/services/snowball/pom.xml index c6b420827e1e..1fe8c00adbf9 100644 --- a/services/snowball/pom.xml +++ b/services/snowball/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 snowball AWS Java SDK :: Services :: Amazon Snowball diff --git a/services/snowdevicemanagement/pom.xml b/services/snowdevicemanagement/pom.xml index db9c54130c0a..58e9f9902c5a 100644 --- a/services/snowdevicemanagement/pom.xml +++ b/services/snowdevicemanagement/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 snowdevicemanagement AWS Java SDK :: Services :: Snow Device Management diff --git a/services/sns/pom.xml b/services/sns/pom.xml index c7c70b71e006..c820b268c784 100644 --- a/services/sns/pom.xml +++ b/services/sns/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 sns AWS Java SDK :: Services :: Amazon SNS diff --git a/services/socialmessaging/pom.xml b/services/socialmessaging/pom.xml index cb5ff1c2629b..1ffbec9fe60e 100644 --- a/services/socialmessaging/pom.xml +++ b/services/socialmessaging/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 socialmessaging AWS Java SDK :: Services :: Social Messaging diff --git a/services/sqs/pom.xml b/services/sqs/pom.xml index a92b132f5d97..0f5858165643 100644 --- a/services/sqs/pom.xml +++ b/services/sqs/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 sqs AWS Java SDK :: Services :: Amazon SQS diff --git a/services/ssm/pom.xml b/services/ssm/pom.xml index 21f9c7013f6b..1ae67f60b199 100644 --- a/services/ssm/pom.xml +++ b/services/ssm/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 ssm AWS Java SDK :: Services :: AWS Simple Systems Management (SSM) diff --git a/services/ssmcontacts/pom.xml b/services/ssmcontacts/pom.xml index 13ce0571b8a5..7758e74065ab 100644 --- a/services/ssmcontacts/pom.xml +++ b/services/ssmcontacts/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 ssmcontacts AWS Java SDK :: Services :: SSM Contacts diff --git a/services/ssmincidents/pom.xml b/services/ssmincidents/pom.xml index 0419990449bc..764fea515ca3 100644 --- a/services/ssmincidents/pom.xml +++ b/services/ssmincidents/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 ssmincidents AWS Java SDK :: Services :: SSM Incidents diff --git a/services/ssmquicksetup/pom.xml b/services/ssmquicksetup/pom.xml index 29a83d198063..83fb05ba231e 100644 --- a/services/ssmquicksetup/pom.xml +++ b/services/ssmquicksetup/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 ssmquicksetup AWS Java SDK :: Services :: SSM Quick Setup diff --git a/services/ssmsap/pom.xml b/services/ssmsap/pom.xml index 2955c895a033..61a1a2590678 100644 --- a/services/ssmsap/pom.xml +++ b/services/ssmsap/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 ssmsap AWS Java SDK :: Services :: Ssm Sap diff --git a/services/sso/pom.xml b/services/sso/pom.xml index 1fab7c4479ad..4e7492873b45 100644 --- a/services/sso/pom.xml +++ b/services/sso/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 sso AWS Java SDK :: Services :: SSO diff --git a/services/ssoadmin/pom.xml b/services/ssoadmin/pom.xml index 5cc65dce30dc..c883678e1d9d 100644 --- a/services/ssoadmin/pom.xml +++ b/services/ssoadmin/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 ssoadmin AWS Java SDK :: Services :: SSO Admin diff --git a/services/ssooidc/pom.xml b/services/ssooidc/pom.xml index 2e99aa483c0a..a11ce6638bce 100644 --- a/services/ssooidc/pom.xml +++ b/services/ssooidc/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 ssooidc AWS Java SDK :: Services :: SSO OIDC diff --git a/services/storagegateway/pom.xml b/services/storagegateway/pom.xml index 5c686493bc89..1e60b5052b34 100644 --- a/services/storagegateway/pom.xml +++ b/services/storagegateway/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 storagegateway AWS Java SDK :: Services :: AWS Storage Gateway diff --git a/services/sts/pom.xml b/services/sts/pom.xml index 1f343b8b6a43..48f9ba92dd99 100644 --- a/services/sts/pom.xml +++ b/services/sts/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 sts AWS Java SDK :: Services :: AWS STS diff --git a/services/supplychain/pom.xml b/services/supplychain/pom.xml index 5d33c5a80d4a..23d6ef8a9752 100644 --- a/services/supplychain/pom.xml +++ b/services/supplychain/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 supplychain AWS Java SDK :: Services :: Supply Chain diff --git a/services/support/pom.xml b/services/support/pom.xml index 5020dd58c381..00d4d387e2ed 100644 --- a/services/support/pom.xml +++ b/services/support/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 support AWS Java SDK :: Services :: AWS Support diff --git a/services/supportapp/pom.xml b/services/supportapp/pom.xml index fa362a370cad..0523f1b5a27b 100644 --- a/services/supportapp/pom.xml +++ b/services/supportapp/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 supportapp AWS Java SDK :: Services :: Support App diff --git a/services/swf/pom.xml b/services/swf/pom.xml index 4b681fd1b5bd..0e67f871d6be 100644 --- a/services/swf/pom.xml +++ b/services/swf/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 swf AWS Java SDK :: Services :: Amazon SWF diff --git a/services/synthetics/pom.xml b/services/synthetics/pom.xml index 7a7afe243855..0155a839fc95 100644 --- a/services/synthetics/pom.xml +++ b/services/synthetics/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 synthetics AWS Java SDK :: Services :: Synthetics diff --git a/services/taxsettings/pom.xml b/services/taxsettings/pom.xml index 085847c1dad1..9673e2d29f9f 100644 --- a/services/taxsettings/pom.xml +++ b/services/taxsettings/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 taxsettings AWS Java SDK :: Services :: Tax Settings diff --git a/services/textract/pom.xml b/services/textract/pom.xml index 7246c0b6b3b3..b8be7f6dabdb 100644 --- a/services/textract/pom.xml +++ b/services/textract/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 textract AWS Java SDK :: Services :: Textract diff --git a/services/timestreaminfluxdb/pom.xml b/services/timestreaminfluxdb/pom.xml index 03582e3d1233..c54200527827 100644 --- a/services/timestreaminfluxdb/pom.xml +++ b/services/timestreaminfluxdb/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 timestreaminfluxdb AWS Java SDK :: Services :: Timestream Influx DB diff --git a/services/timestreamquery/pom.xml b/services/timestreamquery/pom.xml index 05249185b6f9..0295088ad6c8 100644 --- a/services/timestreamquery/pom.xml +++ b/services/timestreamquery/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 timestreamquery AWS Java SDK :: Services :: Timestream Query diff --git a/services/timestreamwrite/pom.xml b/services/timestreamwrite/pom.xml index bc0da2717de6..9928c643575e 100644 --- a/services/timestreamwrite/pom.xml +++ b/services/timestreamwrite/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 timestreamwrite AWS Java SDK :: Services :: Timestream Write diff --git a/services/tnb/pom.xml b/services/tnb/pom.xml index 23016fe4f48b..f27e923e4419 100644 --- a/services/tnb/pom.xml +++ b/services/tnb/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 tnb AWS Java SDK :: Services :: Tnb diff --git a/services/transcribe/pom.xml b/services/transcribe/pom.xml index a5b5fccf354d..73669d23a17f 100644 --- a/services/transcribe/pom.xml +++ b/services/transcribe/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 transcribe AWS Java SDK :: Services :: Transcribe diff --git a/services/transcribestreaming/pom.xml b/services/transcribestreaming/pom.xml index fe6e5eaad751..1520b325886c 100644 --- a/services/transcribestreaming/pom.xml +++ b/services/transcribestreaming/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 transcribestreaming AWS Java SDK :: Services :: AWS Transcribe Streaming diff --git a/services/transfer/pom.xml b/services/transfer/pom.xml index 5695bd77de1b..ae19e41ec1d8 100644 --- a/services/transfer/pom.xml +++ b/services/transfer/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 transfer AWS Java SDK :: Services :: Transfer diff --git a/services/translate/pom.xml b/services/translate/pom.xml index b32ba83bd3b1..cb01ede1e887 100644 --- a/services/translate/pom.xml +++ b/services/translate/pom.xml @@ -20,7 +20,7 @@ services software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 translate diff --git a/services/trustedadvisor/pom.xml b/services/trustedadvisor/pom.xml index ed8493f2042e..68cf88acf7e6 100644 --- a/services/trustedadvisor/pom.xml +++ b/services/trustedadvisor/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 trustedadvisor AWS Java SDK :: Services :: Trusted Advisor diff --git a/services/verifiedpermissions/pom.xml b/services/verifiedpermissions/pom.xml index 536e91e48b62..ce1109ad15c2 100644 --- a/services/verifiedpermissions/pom.xml +++ b/services/verifiedpermissions/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 verifiedpermissions AWS Java SDK :: Services :: Verified Permissions diff --git a/services/voiceid/pom.xml b/services/voiceid/pom.xml index 046e3ce09275..8814aa91bd3b 100644 --- a/services/voiceid/pom.xml +++ b/services/voiceid/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 voiceid AWS Java SDK :: Services :: Voice ID diff --git a/services/vpclattice/pom.xml b/services/vpclattice/pom.xml index 79e5fe9c33b8..29d7910e078a 100644 --- a/services/vpclattice/pom.xml +++ b/services/vpclattice/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 vpclattice AWS Java SDK :: Services :: VPC Lattice diff --git a/services/waf/pom.xml b/services/waf/pom.xml index 4aa4c81ba322..c132e90623b4 100644 --- a/services/waf/pom.xml +++ b/services/waf/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 waf AWS Java SDK :: Services :: AWS WAF diff --git a/services/wafv2/pom.xml b/services/wafv2/pom.xml index 95e1147094c5..1e4437c2ae19 100644 --- a/services/wafv2/pom.xml +++ b/services/wafv2/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 wafv2 AWS Java SDK :: Services :: WAFV2 diff --git a/services/wellarchitected/pom.xml b/services/wellarchitected/pom.xml index 7da46467cc8d..381d5a9ab7d7 100644 --- a/services/wellarchitected/pom.xml +++ b/services/wellarchitected/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 wellarchitected AWS Java SDK :: Services :: Well Architected diff --git a/services/wisdom/pom.xml b/services/wisdom/pom.xml index d801fd81806b..1c3db55d2850 100644 --- a/services/wisdom/pom.xml +++ b/services/wisdom/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 wisdom AWS Java SDK :: Services :: Wisdom diff --git a/services/workdocs/pom.xml b/services/workdocs/pom.xml index de8a4676f5af..205b1d708a13 100644 --- a/services/workdocs/pom.xml +++ b/services/workdocs/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 workdocs AWS Java SDK :: Services :: Amazon WorkDocs diff --git a/services/workmail/pom.xml b/services/workmail/pom.xml index adaa0bdaffd4..46522b8c969a 100644 --- a/services/workmail/pom.xml +++ b/services/workmail/pom.xml @@ -20,7 +20,7 @@ services software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 workmail diff --git a/services/workmailmessageflow/pom.xml b/services/workmailmessageflow/pom.xml index 6dd19aba843e..8efe306c7617 100644 --- a/services/workmailmessageflow/pom.xml +++ b/services/workmailmessageflow/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 workmailmessageflow AWS Java SDK :: Services :: WorkMailMessageFlow diff --git a/services/workspaces/pom.xml b/services/workspaces/pom.xml index a8ecda4e55a7..f22d12128cf4 100644 --- a/services/workspaces/pom.xml +++ b/services/workspaces/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 workspaces AWS Java SDK :: Services :: Amazon WorkSpaces diff --git a/services/workspacesthinclient/pom.xml b/services/workspacesthinclient/pom.xml index d4fdd2b9f56d..dd53805ee8e4 100644 --- a/services/workspacesthinclient/pom.xml +++ b/services/workspacesthinclient/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 workspacesthinclient AWS Java SDK :: Services :: Work Spaces Thin Client diff --git a/services/workspacesweb/pom.xml b/services/workspacesweb/pom.xml index 6ee2138d34e5..284aba97f6ea 100644 --- a/services/workspacesweb/pom.xml +++ b/services/workspacesweb/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 workspacesweb AWS Java SDK :: Services :: Work Spaces Web diff --git a/services/xray/pom.xml b/services/xray/pom.xml index 219132026829..52e2772f1547 100644 --- a/services/xray/pom.xml +++ b/services/xray/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19-SNAPSHOT + 2.31.19 xray AWS Java SDK :: Services :: AWS X-Ray diff --git a/test/architecture-tests/pom.xml b/test/architecture-tests/pom.xml index 4e64b6ec8ad1..6608902e237e 100644 --- a/test/architecture-tests/pom.xml +++ b/test/architecture-tests/pom.xml @@ -21,7 +21,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 ../../pom.xml diff --git a/test/auth-tests/pom.xml b/test/auth-tests/pom.xml index 125e7ac8a17e..607fb559373f 100644 --- a/test/auth-tests/pom.xml +++ b/test/auth-tests/pom.xml @@ -20,7 +20,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 ../../pom.xml 4.0.0 diff --git a/test/bundle-logging-bridge-binding-test/pom.xml b/test/bundle-logging-bridge-binding-test/pom.xml index 6ab93a26982f..ed3e751bf076 100644 --- a/test/bundle-logging-bridge-binding-test/pom.xml +++ b/test/bundle-logging-bridge-binding-test/pom.xml @@ -20,7 +20,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 ../../pom.xml 4.0.0 diff --git a/test/bundle-shading-tests/pom.xml b/test/bundle-shading-tests/pom.xml index c823d2663aeb..b10c7bc9874b 100644 --- a/test/bundle-shading-tests/pom.xml +++ b/test/bundle-shading-tests/pom.xml @@ -20,7 +20,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 ../../pom.xml 4.0.0 diff --git a/test/codegen-generated-classes-test/pom.xml b/test/codegen-generated-classes-test/pom.xml index afd54db07b55..1df337534c3b 100644 --- a/test/codegen-generated-classes-test/pom.xml +++ b/test/codegen-generated-classes-test/pom.xml @@ -21,7 +21,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 ../../pom.xml diff --git a/test/crt-unavailable-tests/pom.xml b/test/crt-unavailable-tests/pom.xml index 1b6d01ca08be..432a44834075 100644 --- a/test/crt-unavailable-tests/pom.xml +++ b/test/crt-unavailable-tests/pom.xml @@ -20,7 +20,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 ../../pom.xml 4.0.0 diff --git a/test/http-client-tests/pom.xml b/test/http-client-tests/pom.xml index a81a75128b38..070b066818de 100644 --- a/test/http-client-tests/pom.xml +++ b/test/http-client-tests/pom.xml @@ -21,7 +21,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 ../../pom.xml http-client-tests diff --git a/test/module-path-tests/pom.xml b/test/module-path-tests/pom.xml index 0dae0609ed22..4291e7cc8d15 100644 --- a/test/module-path-tests/pom.xml +++ b/test/module-path-tests/pom.xml @@ -20,7 +20,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 ../../pom.xml 4.0.0 diff --git a/test/old-client-version-compatibility-test/pom.xml b/test/old-client-version-compatibility-test/pom.xml index 7adacb966e8c..2e9427c473a1 100644 --- a/test/old-client-version-compatibility-test/pom.xml +++ b/test/old-client-version-compatibility-test/pom.xml @@ -21,7 +21,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 ../../pom.xml diff --git a/test/protocol-tests-core/pom.xml b/test/protocol-tests-core/pom.xml index 014bd2aa7bb6..e189619424ea 100644 --- a/test/protocol-tests-core/pom.xml +++ b/test/protocol-tests-core/pom.xml @@ -20,7 +20,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 ../../pom.xml 4.0.0 diff --git a/test/protocol-tests/pom.xml b/test/protocol-tests/pom.xml index 25300824d112..684533be34c1 100644 --- a/test/protocol-tests/pom.xml +++ b/test/protocol-tests/pom.xml @@ -20,7 +20,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 ../../pom.xml 4.0.0 diff --git a/test/region-testing/pom.xml b/test/region-testing/pom.xml index 150b1b850c1d..8b087424aaba 100644 --- a/test/region-testing/pom.xml +++ b/test/region-testing/pom.xml @@ -20,7 +20,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 ../../pom.xml 4.0.0 diff --git a/test/ruleset-testing-core/pom.xml b/test/ruleset-testing-core/pom.xml index b67ce83b91b2..1fa20a0fde9b 100644 --- a/test/ruleset-testing-core/pom.xml +++ b/test/ruleset-testing-core/pom.xml @@ -20,7 +20,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 ../../pom.xml 4.0.0 diff --git a/test/s3-benchmarks/pom.xml b/test/s3-benchmarks/pom.xml index 9501a95d39d9..04cbf75c2480 100644 --- a/test/s3-benchmarks/pom.xml +++ b/test/s3-benchmarks/pom.xml @@ -20,7 +20,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 ../../pom.xml 4.0.0 diff --git a/test/s3-tests/pom.xml b/test/s3-tests/pom.xml index 059fb75ec81c..2afb2ced5e15 100644 --- a/test/s3-tests/pom.xml +++ b/test/s3-tests/pom.xml @@ -20,7 +20,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 ../../pom.xml 4.0.0 diff --git a/test/sdk-benchmarks/pom.xml b/test/sdk-benchmarks/pom.xml index e7a16fc41336..49af2069ffcb 100644 --- a/test/sdk-benchmarks/pom.xml +++ b/test/sdk-benchmarks/pom.xml @@ -19,7 +19,7 @@ software.amazon.awssdk aws-sdk-java-pom - 2.31.19-SNAPSHOT + 2.31.19 ../../pom.xml diff --git a/test/sdk-native-image-test/pom.xml b/test/sdk-native-image-test/pom.xml index 5899a86b01db..3a7e8eee44ef 100644 --- a/test/sdk-native-image-test/pom.xml +++ b/test/sdk-native-image-test/pom.xml @@ -20,7 +20,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 ../../pom.xml 4.0.0 diff --git a/test/service-test-utils/pom.xml b/test/service-test-utils/pom.xml index f525564ee597..76241a3408db 100644 --- a/test/service-test-utils/pom.xml +++ b/test/service-test-utils/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk aws-sdk-java-pom - 2.31.19-SNAPSHOT + 2.31.19 ../../pom.xml service-test-utils diff --git a/test/stability-tests/pom.xml b/test/stability-tests/pom.xml index d0ad1451571c..2aadc1395c5a 100644 --- a/test/stability-tests/pom.xml +++ b/test/stability-tests/pom.xml @@ -20,7 +20,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 ../../pom.xml 4.0.0 diff --git a/test/test-utils/pom.xml b/test/test-utils/pom.xml index df3b6bf7fdf1..202d560358e2 100644 --- a/test/test-utils/pom.xml +++ b/test/test-utils/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk aws-sdk-java-pom - 2.31.19-SNAPSHOT + 2.31.19 ../../pom.xml test-utils diff --git a/test/tests-coverage-reporting/pom.xml b/test/tests-coverage-reporting/pom.xml index de2d4ba6b33a..05a5b98a5363 100644 --- a/test/tests-coverage-reporting/pom.xml +++ b/test/tests-coverage-reporting/pom.xml @@ -20,7 +20,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 ../../pom.xml 4.0.0 diff --git a/test/v2-migration-tests/pom.xml b/test/v2-migration-tests/pom.xml index 590c58c46255..39c848074afa 100644 --- a/test/v2-migration-tests/pom.xml +++ b/test/v2-migration-tests/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk aws-sdk-java-pom - 2.31.19-SNAPSHOT + 2.31.19 ../.. diff --git a/third-party/pom.xml b/third-party/pom.xml index 8793baa98773..ffb5bcebfa6d 100644 --- a/third-party/pom.xml +++ b/third-party/pom.xml @@ -21,7 +21,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 third-party diff --git a/third-party/third-party-jackson-core/pom.xml b/third-party/third-party-jackson-core/pom.xml index b87ddfc69f79..9a7743c5c15e 100644 --- a/third-party/third-party-jackson-core/pom.xml +++ b/third-party/third-party-jackson-core/pom.xml @@ -20,7 +20,7 @@ third-party software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 diff --git a/third-party/third-party-jackson-dataformat-cbor/pom.xml b/third-party/third-party-jackson-dataformat-cbor/pom.xml index b963e22d20c6..285c4b102396 100644 --- a/third-party/third-party-jackson-dataformat-cbor/pom.xml +++ b/third-party/third-party-jackson-dataformat-cbor/pom.xml @@ -20,7 +20,7 @@ third-party software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 diff --git a/third-party/third-party-slf4j-api/pom.xml b/third-party/third-party-slf4j-api/pom.xml index fec51202bf65..dc4025ab03b8 100644 --- a/third-party/third-party-slf4j-api/pom.xml +++ b/third-party/third-party-slf4j-api/pom.xml @@ -20,7 +20,7 @@ third-party software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 diff --git a/utils/pom.xml b/utils/pom.xml index 8d5caa511b75..0c7de0b45b00 100644 --- a/utils/pom.xml +++ b/utils/pom.xml @@ -20,7 +20,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19-SNAPSHOT + 2.31.19 4.0.0 diff --git a/v2-migration/pom.xml b/v2-migration/pom.xml index 0d34bff35881..f64c1414d354 100644 --- a/v2-migration/pom.xml +++ b/v2-migration/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk aws-sdk-java-pom - 2.31.19-SNAPSHOT + 2.31.19 ../pom.xml From 66852390d7e9e9dfe87ca45b39591997ff76f116 Mon Sep 17 00:00:00 2001 From: AWS <> Date: Wed, 9 Apr 2025 20:19:29 +0000 Subject: [PATCH 21/22] Update to next snapshot version: 2.31.20-SNAPSHOT --- archetypes/archetype-app-quickstart/pom.xml | 2 +- archetypes/archetype-lambda/pom.xml | 2 +- archetypes/archetype-tools/pom.xml | 2 +- archetypes/pom.xml | 2 +- aws-sdk-java/pom.xml | 2 +- bom-internal/pom.xml | 2 +- bom/pom.xml | 2 +- bundle-logging-bridge/pom.xml | 2 +- bundle-sdk/pom.xml | 2 +- bundle/pom.xml | 2 +- codegen-lite-maven-plugin/pom.xml | 2 +- codegen-lite/pom.xml | 2 +- codegen-maven-plugin/pom.xml | 2 +- codegen/pom.xml | 2 +- core/annotations/pom.xml | 2 +- core/arns/pom.xml | 2 +- core/auth-crt/pom.xml | 2 +- core/auth/pom.xml | 2 +- core/aws-core/pom.xml | 2 +- core/checksums-spi/pom.xml | 2 +- core/checksums/pom.xml | 2 +- core/crt-core/pom.xml | 2 +- core/endpoints-spi/pom.xml | 2 +- core/http-auth-aws-crt/pom.xml | 2 +- core/http-auth-aws-eventstream/pom.xml | 2 +- core/http-auth-aws/pom.xml | 2 +- core/http-auth-spi/pom.xml | 2 +- core/http-auth/pom.xml | 2 +- core/identity-spi/pom.xml | 2 +- core/imds/pom.xml | 2 +- core/json-utils/pom.xml | 2 +- core/metrics-spi/pom.xml | 2 +- core/pom.xml | 2 +- core/profiles/pom.xml | 2 +- core/protocols/aws-cbor-protocol/pom.xml | 2 +- core/protocols/aws-json-protocol/pom.xml | 2 +- core/protocols/aws-query-protocol/pom.xml | 2 +- core/protocols/aws-xml-protocol/pom.xml | 2 +- core/protocols/pom.xml | 2 +- core/protocols/protocol-core/pom.xml | 2 +- core/protocols/smithy-rpcv2-protocol/pom.xml | 2 +- core/regions/pom.xml | 2 +- core/retries-spi/pom.xml | 2 +- core/retries/pom.xml | 2 +- core/sdk-core/pom.xml | 2 +- http-client-spi/pom.xml | 2 +- http-clients/apache-client/pom.xml | 2 +- http-clients/aws-crt-client/pom.xml | 2 +- http-clients/netty-nio-client/pom.xml | 2 +- http-clients/pom.xml | 2 +- http-clients/url-connection-client/pom.xml | 2 +- metric-publishers/cloudwatch-metric-publisher/pom.xml | 2 +- metric-publishers/emf-metric-logging-publisher/pom.xml | 2 +- metric-publishers/pom.xml | 2 +- pom.xml | 4 ++-- release-scripts/pom.xml | 2 +- services-custom/dynamodb-enhanced/pom.xml | 2 +- services-custom/iam-policy-builder/pom.xml | 2 +- services-custom/pom.xml | 2 +- services-custom/s3-event-notifications/pom.xml | 2 +- services-custom/s3-transfer-manager/pom.xml | 2 +- services/accessanalyzer/pom.xml | 2 +- services/account/pom.xml | 2 +- services/acm/pom.xml | 2 +- services/acmpca/pom.xml | 2 +- services/amp/pom.xml | 2 +- services/amplify/pom.xml | 2 +- services/amplifybackend/pom.xml | 2 +- services/amplifyuibuilder/pom.xml | 2 +- services/apigateway/pom.xml | 2 +- services/apigatewaymanagementapi/pom.xml | 2 +- services/apigatewayv2/pom.xml | 2 +- services/appconfig/pom.xml | 2 +- services/appconfigdata/pom.xml | 2 +- services/appfabric/pom.xml | 2 +- services/appflow/pom.xml | 2 +- services/appintegrations/pom.xml | 2 +- services/applicationautoscaling/pom.xml | 2 +- services/applicationcostprofiler/pom.xml | 2 +- services/applicationdiscovery/pom.xml | 2 +- services/applicationinsights/pom.xml | 2 +- services/applicationsignals/pom.xml | 2 +- services/appmesh/pom.xml | 2 +- services/apprunner/pom.xml | 2 +- services/appstream/pom.xml | 2 +- services/appsync/pom.xml | 2 +- services/apptest/pom.xml | 2 +- services/arczonalshift/pom.xml | 2 +- services/artifact/pom.xml | 2 +- services/athena/pom.xml | 2 +- services/auditmanager/pom.xml | 2 +- services/autoscaling/pom.xml | 2 +- services/autoscalingplans/pom.xml | 2 +- services/b2bi/pom.xml | 2 +- services/backup/pom.xml | 2 +- services/backupgateway/pom.xml | 2 +- services/backupsearch/pom.xml | 2 +- services/batch/pom.xml | 2 +- services/bcmdataexports/pom.xml | 2 +- services/bcmpricingcalculator/pom.xml | 2 +- services/bedrock/pom.xml | 2 +- services/bedrockagent/pom.xml | 2 +- services/bedrockagentruntime/pom.xml | 2 +- services/bedrockdataautomation/pom.xml | 2 +- services/bedrockdataautomationruntime/pom.xml | 2 +- services/bedrockruntime/pom.xml | 2 +- services/billing/pom.xml | 2 +- services/billingconductor/pom.xml | 2 +- services/braket/pom.xml | 2 +- services/budgets/pom.xml | 2 +- services/chatbot/pom.xml | 2 +- services/chime/pom.xml | 2 +- services/chimesdkidentity/pom.xml | 2 +- services/chimesdkmediapipelines/pom.xml | 2 +- services/chimesdkmeetings/pom.xml | 2 +- services/chimesdkmessaging/pom.xml | 2 +- services/chimesdkvoice/pom.xml | 2 +- services/cleanrooms/pom.xml | 2 +- services/cleanroomsml/pom.xml | 2 +- services/cloud9/pom.xml | 2 +- services/cloudcontrol/pom.xml | 2 +- services/clouddirectory/pom.xml | 2 +- services/cloudformation/pom.xml | 2 +- services/cloudfront/pom.xml | 2 +- services/cloudfrontkeyvaluestore/pom.xml | 2 +- services/cloudhsm/pom.xml | 2 +- services/cloudhsmv2/pom.xml | 2 +- services/cloudsearch/pom.xml | 2 +- services/cloudsearchdomain/pom.xml | 2 +- services/cloudtrail/pom.xml | 2 +- services/cloudtraildata/pom.xml | 2 +- services/cloudwatch/pom.xml | 2 +- services/cloudwatchevents/pom.xml | 2 +- services/cloudwatchlogs/pom.xml | 2 +- services/codeartifact/pom.xml | 2 +- services/codebuild/pom.xml | 2 +- services/codecatalyst/pom.xml | 2 +- services/codecommit/pom.xml | 2 +- services/codeconnections/pom.xml | 2 +- services/codedeploy/pom.xml | 2 +- services/codeguruprofiler/pom.xml | 2 +- services/codegurureviewer/pom.xml | 2 +- services/codegurusecurity/pom.xml | 2 +- services/codepipeline/pom.xml | 2 +- services/codestarconnections/pom.xml | 2 +- services/codestarnotifications/pom.xml | 2 +- services/cognitoidentity/pom.xml | 2 +- services/cognitoidentityprovider/pom.xml | 2 +- services/cognitosync/pom.xml | 2 +- services/comprehend/pom.xml | 2 +- services/comprehendmedical/pom.xml | 2 +- services/computeoptimizer/pom.xml | 2 +- services/config/pom.xml | 2 +- services/connect/pom.xml | 2 +- services/connectcampaigns/pom.xml | 2 +- services/connectcampaignsv2/pom.xml | 2 +- services/connectcases/pom.xml | 2 +- services/connectcontactlens/pom.xml | 2 +- services/connectparticipant/pom.xml | 2 +- services/controlcatalog/pom.xml | 2 +- services/controltower/pom.xml | 2 +- services/costandusagereport/pom.xml | 2 +- services/costexplorer/pom.xml | 2 +- services/costoptimizationhub/pom.xml | 2 +- services/customerprofiles/pom.xml | 2 +- services/databasemigration/pom.xml | 2 +- services/databrew/pom.xml | 2 +- services/dataexchange/pom.xml | 2 +- services/datapipeline/pom.xml | 2 +- services/datasync/pom.xml | 2 +- services/datazone/pom.xml | 2 +- services/dax/pom.xml | 2 +- services/deadline/pom.xml | 2 +- services/detective/pom.xml | 2 +- services/devicefarm/pom.xml | 2 +- services/devopsguru/pom.xml | 2 +- services/directconnect/pom.xml | 2 +- services/directory/pom.xml | 2 +- services/directoryservicedata/pom.xml | 2 +- services/dlm/pom.xml | 2 +- services/docdb/pom.xml | 2 +- services/docdbelastic/pom.xml | 2 +- services/drs/pom.xml | 2 +- services/dsql/pom.xml | 2 +- services/dynamodb/pom.xml | 2 +- services/ebs/pom.xml | 2 +- services/ec2/pom.xml | 2 +- services/ec2instanceconnect/pom.xml | 2 +- services/ecr/pom.xml | 2 +- services/ecrpublic/pom.xml | 2 +- services/ecs/pom.xml | 2 +- services/efs/pom.xml | 2 +- services/eks/pom.xml | 2 +- services/eksauth/pom.xml | 2 +- services/elasticache/pom.xml | 2 +- services/elasticbeanstalk/pom.xml | 2 +- services/elasticloadbalancing/pom.xml | 2 +- services/elasticloadbalancingv2/pom.xml | 2 +- services/elasticsearch/pom.xml | 2 +- services/elastictranscoder/pom.xml | 2 +- services/emr/pom.xml | 2 +- services/emrcontainers/pom.xml | 2 +- services/emrserverless/pom.xml | 2 +- services/entityresolution/pom.xml | 2 +- services/eventbridge/pom.xml | 2 +- services/evidently/pom.xml | 2 +- services/finspace/pom.xml | 2 +- services/finspacedata/pom.xml | 2 +- services/firehose/pom.xml | 2 +- services/fis/pom.xml | 2 +- services/fms/pom.xml | 2 +- services/forecast/pom.xml | 2 +- services/forecastquery/pom.xml | 2 +- services/frauddetector/pom.xml | 2 +- services/freetier/pom.xml | 2 +- services/fsx/pom.xml | 2 +- services/gamelift/pom.xml | 2 +- services/gameliftstreams/pom.xml | 2 +- services/geomaps/pom.xml | 2 +- services/geoplaces/pom.xml | 2 +- services/georoutes/pom.xml | 2 +- services/glacier/pom.xml | 2 +- services/globalaccelerator/pom.xml | 2 +- services/glue/pom.xml | 2 +- services/grafana/pom.xml | 2 +- services/greengrass/pom.xml | 2 +- services/greengrassv2/pom.xml | 2 +- services/groundstation/pom.xml | 2 +- services/guardduty/pom.xml | 2 +- services/health/pom.xml | 2 +- services/healthlake/pom.xml | 2 +- services/iam/pom.xml | 2 +- services/identitystore/pom.xml | 2 +- services/imagebuilder/pom.xml | 2 +- services/inspector/pom.xml | 2 +- services/inspector2/pom.xml | 2 +- services/inspectorscan/pom.xml | 2 +- services/internetmonitor/pom.xml | 2 +- services/invoicing/pom.xml | 2 +- services/iot/pom.xml | 2 +- services/iotanalytics/pom.xml | 2 +- services/iotdataplane/pom.xml | 2 +- services/iotdeviceadvisor/pom.xml | 2 +- services/iotevents/pom.xml | 2 +- services/ioteventsdata/pom.xml | 2 +- services/iotfleethub/pom.xml | 2 +- services/iotfleetwise/pom.xml | 2 +- services/iotjobsdataplane/pom.xml | 2 +- services/iotmanagedintegrations/pom.xml | 2 +- services/iotsecuretunneling/pom.xml | 2 +- services/iotsitewise/pom.xml | 2 +- services/iotthingsgraph/pom.xml | 2 +- services/iottwinmaker/pom.xml | 2 +- services/iotwireless/pom.xml | 2 +- services/ivs/pom.xml | 2 +- services/ivschat/pom.xml | 2 +- services/ivsrealtime/pom.xml | 2 +- services/kafka/pom.xml | 2 +- services/kafkaconnect/pom.xml | 2 +- services/kendra/pom.xml | 2 +- services/kendraranking/pom.xml | 2 +- services/keyspaces/pom.xml | 2 +- services/kinesis/pom.xml | 2 +- services/kinesisanalytics/pom.xml | 2 +- services/kinesisanalyticsv2/pom.xml | 2 +- services/kinesisvideo/pom.xml | 2 +- services/kinesisvideoarchivedmedia/pom.xml | 2 +- services/kinesisvideomedia/pom.xml | 2 +- services/kinesisvideosignaling/pom.xml | 2 +- services/kinesisvideowebrtcstorage/pom.xml | 2 +- services/kms/pom.xml | 2 +- services/lakeformation/pom.xml | 2 +- services/lambda/pom.xml | 2 +- services/launchwizard/pom.xml | 2 +- services/lexmodelbuilding/pom.xml | 2 +- services/lexmodelsv2/pom.xml | 2 +- services/lexruntime/pom.xml | 2 +- services/lexruntimev2/pom.xml | 2 +- services/licensemanager/pom.xml | 2 +- services/licensemanagerlinuxsubscriptions/pom.xml | 2 +- services/licensemanagerusersubscriptions/pom.xml | 2 +- services/lightsail/pom.xml | 2 +- services/location/pom.xml | 2 +- services/lookoutequipment/pom.xml | 2 +- services/lookoutmetrics/pom.xml | 2 +- services/lookoutvision/pom.xml | 2 +- services/m2/pom.xml | 2 +- services/machinelearning/pom.xml | 2 +- services/macie2/pom.xml | 2 +- services/mailmanager/pom.xml | 2 +- services/managedblockchain/pom.xml | 2 +- services/managedblockchainquery/pom.xml | 2 +- services/marketplaceagreement/pom.xml | 2 +- services/marketplacecatalog/pom.xml | 2 +- services/marketplacecommerceanalytics/pom.xml | 2 +- services/marketplacedeployment/pom.xml | 2 +- services/marketplaceentitlement/pom.xml | 2 +- services/marketplacemetering/pom.xml | 2 +- services/marketplacereporting/pom.xml | 2 +- services/mediaconnect/pom.xml | 2 +- services/mediaconvert/pom.xml | 2 +- services/medialive/pom.xml | 2 +- services/mediapackage/pom.xml | 2 +- services/mediapackagev2/pom.xml | 2 +- services/mediapackagevod/pom.xml | 2 +- services/mediastore/pom.xml | 2 +- services/mediastoredata/pom.xml | 2 +- services/mediatailor/pom.xml | 2 +- services/medicalimaging/pom.xml | 2 +- services/memorydb/pom.xml | 2 +- services/mgn/pom.xml | 2 +- services/migrationhub/pom.xml | 2 +- services/migrationhubconfig/pom.xml | 2 +- services/migrationhuborchestrator/pom.xml | 2 +- services/migrationhubrefactorspaces/pom.xml | 2 +- services/migrationhubstrategy/pom.xml | 2 +- services/mq/pom.xml | 2 +- services/mturk/pom.xml | 2 +- services/mwaa/pom.xml | 2 +- services/neptune/pom.xml | 2 +- services/neptunedata/pom.xml | 2 +- services/neptunegraph/pom.xml | 2 +- services/networkfirewall/pom.xml | 2 +- services/networkflowmonitor/pom.xml | 2 +- services/networkmanager/pom.xml | 2 +- services/networkmonitor/pom.xml | 2 +- services/notifications/pom.xml | 2 +- services/notificationscontacts/pom.xml | 2 +- services/oam/pom.xml | 2 +- services/observabilityadmin/pom.xml | 2 +- services/omics/pom.xml | 2 +- services/opensearch/pom.xml | 2 +- services/opensearchserverless/pom.xml | 2 +- services/opsworks/pom.xml | 2 +- services/opsworkscm/pom.xml | 2 +- services/organizations/pom.xml | 2 +- services/osis/pom.xml | 2 +- services/outposts/pom.xml | 2 +- services/panorama/pom.xml | 2 +- services/partnercentralselling/pom.xml | 2 +- services/paymentcryptography/pom.xml | 2 +- services/paymentcryptographydata/pom.xml | 2 +- services/pcaconnectorad/pom.xml | 2 +- services/pcaconnectorscep/pom.xml | 2 +- services/pcs/pom.xml | 2 +- services/personalize/pom.xml | 2 +- services/personalizeevents/pom.xml | 2 +- services/personalizeruntime/pom.xml | 2 +- services/pi/pom.xml | 2 +- services/pinpoint/pom.xml | 2 +- services/pinpointemail/pom.xml | 2 +- services/pinpointsmsvoice/pom.xml | 2 +- services/pinpointsmsvoicev2/pom.xml | 2 +- services/pipes/pom.xml | 2 +- services/polly/pom.xml | 2 +- services/pom.xml | 2 +- services/pricing/pom.xml | 2 +- services/privatenetworks/pom.xml | 2 +- services/proton/pom.xml | 2 +- services/qapps/pom.xml | 2 +- services/qbusiness/pom.xml | 2 +- services/qconnect/pom.xml | 2 +- services/qldb/pom.xml | 2 +- services/qldbsession/pom.xml | 2 +- services/quicksight/pom.xml | 2 +- services/ram/pom.xml | 2 +- services/rbin/pom.xml | 2 +- services/rds/pom.xml | 2 +- services/rdsdata/pom.xml | 2 +- services/redshift/pom.xml | 2 +- services/redshiftdata/pom.xml | 2 +- services/redshiftserverless/pom.xml | 2 +- services/rekognition/pom.xml | 2 +- services/repostspace/pom.xml | 2 +- services/resiliencehub/pom.xml | 2 +- services/resourceexplorer2/pom.xml | 2 +- services/resourcegroups/pom.xml | 2 +- services/resourcegroupstaggingapi/pom.xml | 2 +- services/robomaker/pom.xml | 2 +- services/rolesanywhere/pom.xml | 2 +- services/route53/pom.xml | 2 +- services/route53domains/pom.xml | 2 +- services/route53profiles/pom.xml | 2 +- services/route53recoverycluster/pom.xml | 2 +- services/route53recoverycontrolconfig/pom.xml | 2 +- services/route53recoveryreadiness/pom.xml | 2 +- services/route53resolver/pom.xml | 2 +- services/rum/pom.xml | 2 +- services/s3/pom.xml | 2 +- services/s3control/pom.xml | 2 +- services/s3outposts/pom.xml | 2 +- services/s3tables/pom.xml | 2 +- services/sagemaker/pom.xml | 2 +- services/sagemakera2iruntime/pom.xml | 2 +- services/sagemakeredge/pom.xml | 2 +- services/sagemakerfeaturestoreruntime/pom.xml | 2 +- services/sagemakergeospatial/pom.xml | 2 +- services/sagemakermetrics/pom.xml | 2 +- services/sagemakerruntime/pom.xml | 2 +- services/savingsplans/pom.xml | 2 +- services/scheduler/pom.xml | 2 +- services/schemas/pom.xml | 2 +- services/secretsmanager/pom.xml | 2 +- services/securityhub/pom.xml | 2 +- services/securityir/pom.xml | 2 +- services/securitylake/pom.xml | 2 +- services/serverlessapplicationrepository/pom.xml | 2 +- services/servicecatalog/pom.xml | 2 +- services/servicecatalogappregistry/pom.xml | 2 +- services/servicediscovery/pom.xml | 2 +- services/servicequotas/pom.xml | 2 +- services/ses/pom.xml | 2 +- services/sesv2/pom.xml | 2 +- services/sfn/pom.xml | 2 +- services/shield/pom.xml | 2 +- services/signer/pom.xml | 2 +- services/simspaceweaver/pom.xml | 2 +- services/sms/pom.xml | 2 +- services/snowball/pom.xml | 2 +- services/snowdevicemanagement/pom.xml | 2 +- services/sns/pom.xml | 2 +- services/socialmessaging/pom.xml | 2 +- services/sqs/pom.xml | 2 +- services/ssm/pom.xml | 2 +- services/ssmcontacts/pom.xml | 2 +- services/ssmincidents/pom.xml | 2 +- services/ssmquicksetup/pom.xml | 2 +- services/ssmsap/pom.xml | 2 +- services/sso/pom.xml | 2 +- services/ssoadmin/pom.xml | 2 +- services/ssooidc/pom.xml | 2 +- services/storagegateway/pom.xml | 2 +- services/sts/pom.xml | 2 +- services/supplychain/pom.xml | 2 +- services/support/pom.xml | 2 +- services/supportapp/pom.xml | 2 +- services/swf/pom.xml | 2 +- services/synthetics/pom.xml | 2 +- services/taxsettings/pom.xml | 2 +- services/textract/pom.xml | 2 +- services/timestreaminfluxdb/pom.xml | 2 +- services/timestreamquery/pom.xml | 2 +- services/timestreamwrite/pom.xml | 2 +- services/tnb/pom.xml | 2 +- services/transcribe/pom.xml | 2 +- services/transcribestreaming/pom.xml | 2 +- services/transfer/pom.xml | 2 +- services/translate/pom.xml | 2 +- services/trustedadvisor/pom.xml | 2 +- services/verifiedpermissions/pom.xml | 2 +- services/voiceid/pom.xml | 2 +- services/vpclattice/pom.xml | 2 +- services/waf/pom.xml | 2 +- services/wafv2/pom.xml | 2 +- services/wellarchitected/pom.xml | 2 +- services/wisdom/pom.xml | 2 +- services/workdocs/pom.xml | 2 +- services/workmail/pom.xml | 2 +- services/workmailmessageflow/pom.xml | 2 +- services/workspaces/pom.xml | 2 +- services/workspacesthinclient/pom.xml | 2 +- services/workspacesweb/pom.xml | 2 +- services/xray/pom.xml | 2 +- test/architecture-tests/pom.xml | 2 +- test/auth-tests/pom.xml | 2 +- test/bundle-logging-bridge-binding-test/pom.xml | 2 +- test/bundle-shading-tests/pom.xml | 2 +- test/codegen-generated-classes-test/pom.xml | 2 +- test/crt-unavailable-tests/pom.xml | 2 +- test/http-client-tests/pom.xml | 2 +- test/module-path-tests/pom.xml | 2 +- test/old-client-version-compatibility-test/pom.xml | 2 +- test/protocol-tests-core/pom.xml | 2 +- test/protocol-tests/pom.xml | 2 +- test/region-testing/pom.xml | 2 +- test/ruleset-testing-core/pom.xml | 2 +- test/s3-benchmarks/pom.xml | 2 +- test/s3-tests/pom.xml | 2 +- test/sdk-benchmarks/pom.xml | 2 +- test/sdk-native-image-test/pom.xml | 2 +- test/service-test-utils/pom.xml | 2 +- test/stability-tests/pom.xml | 2 +- test/test-utils/pom.xml | 2 +- test/tests-coverage-reporting/pom.xml | 2 +- test/v2-migration-tests/pom.xml | 2 +- third-party/pom.xml | 2 +- third-party/third-party-jackson-core/pom.xml | 2 +- third-party/third-party-jackson-dataformat-cbor/pom.xml | 2 +- third-party/third-party-slf4j-api/pom.xml | 2 +- utils/pom.xml | 2 +- v2-migration/pom.xml | 2 +- 491 files changed, 492 insertions(+), 492 deletions(-) diff --git a/archetypes/archetype-app-quickstart/pom.xml b/archetypes/archetype-app-quickstart/pom.xml index f1f6722c09be..ad6c13f98f6c 100644 --- a/archetypes/archetype-app-quickstart/pom.xml +++ b/archetypes/archetype-app-quickstart/pom.xml @@ -20,7 +20,7 @@ archetypes software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 diff --git a/archetypes/archetype-lambda/pom.xml b/archetypes/archetype-lambda/pom.xml index 41848c1de2cf..3672a4b9aea2 100644 --- a/archetypes/archetype-lambda/pom.xml +++ b/archetypes/archetype-lambda/pom.xml @@ -20,7 +20,7 @@ archetypes software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 archetype-lambda diff --git a/archetypes/archetype-tools/pom.xml b/archetypes/archetype-tools/pom.xml index 4a9833cd6d88..97305574f184 100644 --- a/archetypes/archetype-tools/pom.xml +++ b/archetypes/archetype-tools/pom.xml @@ -20,7 +20,7 @@ archetypes software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 diff --git a/archetypes/pom.xml b/archetypes/pom.xml index 3d5c886059e5..4344ba823e09 100644 --- a/archetypes/pom.xml +++ b/archetypes/pom.xml @@ -20,7 +20,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 archetypes diff --git a/aws-sdk-java/pom.xml b/aws-sdk-java/pom.xml index d66545bff05e..c550d431c802 100644 --- a/aws-sdk-java/pom.xml +++ b/aws-sdk-java/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk aws-sdk-java-pom - 2.31.19 + 2.31.20-SNAPSHOT ../pom.xml aws-sdk-java diff --git a/bom-internal/pom.xml b/bom-internal/pom.xml index affc13842fa1..b01d28a45617 100644 --- a/bom-internal/pom.xml +++ b/bom-internal/pom.xml @@ -20,7 +20,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 diff --git a/bom/pom.xml b/bom/pom.xml index 9eee4a29aa4c..55255d8f1c4d 100644 --- a/bom/pom.xml +++ b/bom/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk aws-sdk-java-pom - 2.31.19 + 2.31.20-SNAPSHOT ../pom.xml bom diff --git a/bundle-logging-bridge/pom.xml b/bundle-logging-bridge/pom.xml index 1175acb567eb..6df83199f5e7 100644 --- a/bundle-logging-bridge/pom.xml +++ b/bundle-logging-bridge/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk aws-sdk-java-pom - 2.31.19 + 2.31.20-SNAPSHOT bundle-logging-bridge jar diff --git a/bundle-sdk/pom.xml b/bundle-sdk/pom.xml index 162b39108bfd..b18a0ebbd93f 100644 --- a/bundle-sdk/pom.xml +++ b/bundle-sdk/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk aws-sdk-java-pom - 2.31.19 + 2.31.20-SNAPSHOT bundle-sdk jar diff --git a/bundle/pom.xml b/bundle/pom.xml index 927721a356bc..0232001045f8 100644 --- a/bundle/pom.xml +++ b/bundle/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk aws-sdk-java-pom - 2.31.19 + 2.31.20-SNAPSHOT bundle jar diff --git a/codegen-lite-maven-plugin/pom.xml b/codegen-lite-maven-plugin/pom.xml index cf7e28328764..ff18061e377f 100644 --- a/codegen-lite-maven-plugin/pom.xml +++ b/codegen-lite-maven-plugin/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk aws-sdk-java-pom - 2.31.19 + 2.31.20-SNAPSHOT ../pom.xml codegen-lite-maven-plugin diff --git a/codegen-lite/pom.xml b/codegen-lite/pom.xml index a5e276d67ef8..d816cc29892a 100644 --- a/codegen-lite/pom.xml +++ b/codegen-lite/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk aws-sdk-java-pom - 2.31.19 + 2.31.20-SNAPSHOT codegen-lite AWS Java SDK :: Code Generator Lite diff --git a/codegen-maven-plugin/pom.xml b/codegen-maven-plugin/pom.xml index 1d343b5b9b04..3df15b8f39f0 100644 --- a/codegen-maven-plugin/pom.xml +++ b/codegen-maven-plugin/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk aws-sdk-java-pom - 2.31.19 + 2.31.20-SNAPSHOT ../pom.xml codegen-maven-plugin diff --git a/codegen/pom.xml b/codegen/pom.xml index f8bf6945a6b6..e36be37bcb47 100644 --- a/codegen/pom.xml +++ b/codegen/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk aws-sdk-java-pom - 2.31.19 + 2.31.20-SNAPSHOT codegen AWS Java SDK :: Code Generator diff --git a/core/annotations/pom.xml b/core/annotations/pom.xml index 1d74f7482d41..d98841f9a71b 100644 --- a/core/annotations/pom.xml +++ b/core/annotations/pom.xml @@ -20,7 +20,7 @@ core software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 diff --git a/core/arns/pom.xml b/core/arns/pom.xml index 622ba5937de4..b10e45762e3f 100644 --- a/core/arns/pom.xml +++ b/core/arns/pom.xml @@ -20,7 +20,7 @@ core software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 diff --git a/core/auth-crt/pom.xml b/core/auth-crt/pom.xml index 18f0fb76b1ff..f745cdb872ab 100644 --- a/core/auth-crt/pom.xml +++ b/core/auth-crt/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk core - 2.31.19 + 2.31.20-SNAPSHOT auth-crt diff --git a/core/auth/pom.xml b/core/auth/pom.xml index a5acb15ec5b6..d712922a39b3 100644 --- a/core/auth/pom.xml +++ b/core/auth/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk core - 2.31.19 + 2.31.20-SNAPSHOT auth diff --git a/core/aws-core/pom.xml b/core/aws-core/pom.xml index 0d8916b62e38..c994612d3b84 100644 --- a/core/aws-core/pom.xml +++ b/core/aws-core/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk core - 2.31.19 + 2.31.20-SNAPSHOT aws-core diff --git a/core/checksums-spi/pom.xml b/core/checksums-spi/pom.xml index 46125cec3c0c..2e7b265a960f 100644 --- a/core/checksums-spi/pom.xml +++ b/core/checksums-spi/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk core - 2.31.19 + 2.31.20-SNAPSHOT checksums-spi diff --git a/core/checksums/pom.xml b/core/checksums/pom.xml index b188a5c7a1ab..686204442fd9 100644 --- a/core/checksums/pom.xml +++ b/core/checksums/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk core - 2.31.19 + 2.31.20-SNAPSHOT checksums diff --git a/core/crt-core/pom.xml b/core/crt-core/pom.xml index fc957d247c49..ee24d1cf7521 100644 --- a/core/crt-core/pom.xml +++ b/core/crt-core/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk core - 2.31.19 + 2.31.20-SNAPSHOT crt-core diff --git a/core/endpoints-spi/pom.xml b/core/endpoints-spi/pom.xml index ec2937509189..594aeab1a69e 100644 --- a/core/endpoints-spi/pom.xml +++ b/core/endpoints-spi/pom.xml @@ -20,7 +20,7 @@ core software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 diff --git a/core/http-auth-aws-crt/pom.xml b/core/http-auth-aws-crt/pom.xml index 57382d4a335c..0a5d7d274dac 100644 --- a/core/http-auth-aws-crt/pom.xml +++ b/core/http-auth-aws-crt/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk core - 2.31.19 + 2.31.20-SNAPSHOT http-auth-aws-crt diff --git a/core/http-auth-aws-eventstream/pom.xml b/core/http-auth-aws-eventstream/pom.xml index 16a58a70e537..d6865f999e50 100644 --- a/core/http-auth-aws-eventstream/pom.xml +++ b/core/http-auth-aws-eventstream/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk core - 2.31.19 + 2.31.20-SNAPSHOT http-auth-aws-eventstream diff --git a/core/http-auth-aws/pom.xml b/core/http-auth-aws/pom.xml index 932b81b46a4e..7b7062c658fd 100644 --- a/core/http-auth-aws/pom.xml +++ b/core/http-auth-aws/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk core - 2.31.19 + 2.31.20-SNAPSHOT http-auth-aws diff --git a/core/http-auth-spi/pom.xml b/core/http-auth-spi/pom.xml index 6b39638863d6..7ac7539fbff4 100644 --- a/core/http-auth-spi/pom.xml +++ b/core/http-auth-spi/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk core - 2.31.19 + 2.31.20-SNAPSHOT http-auth-spi diff --git a/core/http-auth/pom.xml b/core/http-auth/pom.xml index a13383fe4113..286848ac711d 100644 --- a/core/http-auth/pom.xml +++ b/core/http-auth/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk core - 2.31.19 + 2.31.20-SNAPSHOT http-auth diff --git a/core/identity-spi/pom.xml b/core/identity-spi/pom.xml index cdf979dd325f..45603e0e9475 100644 --- a/core/identity-spi/pom.xml +++ b/core/identity-spi/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk core - 2.31.19 + 2.31.20-SNAPSHOT identity-spi diff --git a/core/imds/pom.xml b/core/imds/pom.xml index cb32535fd0c0..4906160735da 100644 --- a/core/imds/pom.xml +++ b/core/imds/pom.xml @@ -20,7 +20,7 @@ core software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 imds diff --git a/core/json-utils/pom.xml b/core/json-utils/pom.xml index 505cfeacacd3..92103ff1b79c 100644 --- a/core/json-utils/pom.xml +++ b/core/json-utils/pom.xml @@ -20,7 +20,7 @@ core software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 diff --git a/core/metrics-spi/pom.xml b/core/metrics-spi/pom.xml index d5cd0b4efb49..1c524a63d09e 100644 --- a/core/metrics-spi/pom.xml +++ b/core/metrics-spi/pom.xml @@ -5,7 +5,7 @@ core software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 diff --git a/core/pom.xml b/core/pom.xml index 253a356e5227..7f01c4f1371d 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -21,7 +21,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT core diff --git a/core/profiles/pom.xml b/core/profiles/pom.xml index ca1477e47ba7..91daf1d5c908 100644 --- a/core/profiles/pom.xml +++ b/core/profiles/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk core - 2.31.19 + 2.31.20-SNAPSHOT profiles diff --git a/core/protocols/aws-cbor-protocol/pom.xml b/core/protocols/aws-cbor-protocol/pom.xml index de4d61bf2ab8..71b2f56a615f 100644 --- a/core/protocols/aws-cbor-protocol/pom.xml +++ b/core/protocols/aws-cbor-protocol/pom.xml @@ -20,7 +20,7 @@ protocols software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 diff --git a/core/protocols/aws-json-protocol/pom.xml b/core/protocols/aws-json-protocol/pom.xml index 30b572c47a1e..ff805511d805 100644 --- a/core/protocols/aws-json-protocol/pom.xml +++ b/core/protocols/aws-json-protocol/pom.xml @@ -20,7 +20,7 @@ protocols software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 diff --git a/core/protocols/aws-query-protocol/pom.xml b/core/protocols/aws-query-protocol/pom.xml index c7df440a8e7f..859a6a68b3c3 100644 --- a/core/protocols/aws-query-protocol/pom.xml +++ b/core/protocols/aws-query-protocol/pom.xml @@ -20,7 +20,7 @@ protocols software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 diff --git a/core/protocols/aws-xml-protocol/pom.xml b/core/protocols/aws-xml-protocol/pom.xml index 177b836a3dae..fa02938982e8 100644 --- a/core/protocols/aws-xml-protocol/pom.xml +++ b/core/protocols/aws-xml-protocol/pom.xml @@ -20,7 +20,7 @@ protocols software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 diff --git a/core/protocols/pom.xml b/core/protocols/pom.xml index 71d672f203e8..006bcaa14d2c 100644 --- a/core/protocols/pom.xml +++ b/core/protocols/pom.xml @@ -20,7 +20,7 @@ core software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 diff --git a/core/protocols/protocol-core/pom.xml b/core/protocols/protocol-core/pom.xml index cb4bdbaa400a..d827d1fcb601 100644 --- a/core/protocols/protocol-core/pom.xml +++ b/core/protocols/protocol-core/pom.xml @@ -20,7 +20,7 @@ protocols software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 diff --git a/core/protocols/smithy-rpcv2-protocol/pom.xml b/core/protocols/smithy-rpcv2-protocol/pom.xml index e20e3df0f48d..756535eb9bec 100644 --- a/core/protocols/smithy-rpcv2-protocol/pom.xml +++ b/core/protocols/smithy-rpcv2-protocol/pom.xml @@ -20,7 +20,7 @@ protocols software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 diff --git a/core/regions/pom.xml b/core/regions/pom.xml index b9ae1f9cbce4..06a7bf70c640 100644 --- a/core/regions/pom.xml +++ b/core/regions/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk core - 2.31.19 + 2.31.20-SNAPSHOT regions diff --git a/core/retries-spi/pom.xml b/core/retries-spi/pom.xml index 9a26371065f8..45831b1c4efd 100644 --- a/core/retries-spi/pom.xml +++ b/core/retries-spi/pom.xml @@ -20,7 +20,7 @@ core software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 diff --git a/core/retries/pom.xml b/core/retries/pom.xml index 504b6754f9c6..c5d933667c78 100644 --- a/core/retries/pom.xml +++ b/core/retries/pom.xml @@ -21,7 +21,7 @@ core software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 diff --git a/core/sdk-core/pom.xml b/core/sdk-core/pom.xml index 2f5a8cf1b06e..de1509e9bf6e 100644 --- a/core/sdk-core/pom.xml +++ b/core/sdk-core/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk core - 2.31.19 + 2.31.20-SNAPSHOT sdk-core AWS Java SDK :: SDK Core diff --git a/http-client-spi/pom.xml b/http-client-spi/pom.xml index 03ebf902fe32..5d9ff81d1300 100644 --- a/http-client-spi/pom.xml +++ b/http-client-spi/pom.xml @@ -22,7 +22,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT http-client-spi AWS Java SDK :: HTTP Client Interface diff --git a/http-clients/apache-client/pom.xml b/http-clients/apache-client/pom.xml index 5d9f6923d7d1..40bf09e8b8da 100644 --- a/http-clients/apache-client/pom.xml +++ b/http-clients/apache-client/pom.xml @@ -21,7 +21,7 @@ http-clients software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT apache-client diff --git a/http-clients/aws-crt-client/pom.xml b/http-clients/aws-crt-client/pom.xml index dd8942f42efa..15f95c5a593c 100644 --- a/http-clients/aws-crt-client/pom.xml +++ b/http-clients/aws-crt-client/pom.xml @@ -21,7 +21,7 @@ http-clients software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 diff --git a/http-clients/netty-nio-client/pom.xml b/http-clients/netty-nio-client/pom.xml index 51c698b866f2..cabe5b1a0052 100644 --- a/http-clients/netty-nio-client/pom.xml +++ b/http-clients/netty-nio-client/pom.xml @@ -20,7 +20,7 @@ http-clients software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 diff --git a/http-clients/pom.xml b/http-clients/pom.xml index b5b3ac187817..fc4daa426155 100644 --- a/http-clients/pom.xml +++ b/http-clients/pom.xml @@ -21,7 +21,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 diff --git a/http-clients/url-connection-client/pom.xml b/http-clients/url-connection-client/pom.xml index 7964b608ae15..f82749fed546 100644 --- a/http-clients/url-connection-client/pom.xml +++ b/http-clients/url-connection-client/pom.xml @@ -20,7 +20,7 @@ http-clients software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 diff --git a/metric-publishers/cloudwatch-metric-publisher/pom.xml b/metric-publishers/cloudwatch-metric-publisher/pom.xml index 786d4d42f02f..5a70a9d8ccd5 100644 --- a/metric-publishers/cloudwatch-metric-publisher/pom.xml +++ b/metric-publishers/cloudwatch-metric-publisher/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk metric-publishers - 2.31.19 + 2.31.20-SNAPSHOT cloudwatch-metric-publisher diff --git a/metric-publishers/emf-metric-logging-publisher/pom.xml b/metric-publishers/emf-metric-logging-publisher/pom.xml index 453dc8caa49f..2ce319b488a2 100644 --- a/metric-publishers/emf-metric-logging-publisher/pom.xml +++ b/metric-publishers/emf-metric-logging-publisher/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk metric-publishers - 2.31.19 + 2.31.20-SNAPSHOT emf-metric-logging-publisher diff --git a/metric-publishers/pom.xml b/metric-publishers/pom.xml index c8133a599e49..20acaf03b52f 100644 --- a/metric-publishers/pom.xml +++ b/metric-publishers/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk aws-sdk-java-pom - 2.31.19 + 2.31.20-SNAPSHOT metric-publishers diff --git a/pom.xml b/pom.xml index 115897e6c1eb..812b165a3e79 100644 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ 4.0.0 software.amazon.awssdk aws-sdk-java-pom - 2.31.19 + 2.31.20-SNAPSHOT pom AWS Java SDK :: Parent The Amazon Web Services SDK for Java provides Java APIs @@ -101,7 +101,7 @@ ${project.version} - 2.31.18 + 2.31.19 2.15.2 2.15.2 2.17.3 diff --git a/release-scripts/pom.xml b/release-scripts/pom.xml index c4f6379d8ef6..75064b870c2c 100644 --- a/release-scripts/pom.xml +++ b/release-scripts/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk aws-sdk-java-pom - 2.31.19 + 2.31.20-SNAPSHOT ../pom.xml release-scripts diff --git a/services-custom/dynamodb-enhanced/pom.xml b/services-custom/dynamodb-enhanced/pom.xml index 47b6c2c5a10b..5cc8b80f1718 100644 --- a/services-custom/dynamodb-enhanced/pom.xml +++ b/services-custom/dynamodb-enhanced/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services-custom - 2.31.19 + 2.31.20-SNAPSHOT dynamodb-enhanced AWS Java SDK :: DynamoDB :: Enhanced Client diff --git a/services-custom/iam-policy-builder/pom.xml b/services-custom/iam-policy-builder/pom.xml index 449f940ca96a..3ea0f76a9323 100644 --- a/services-custom/iam-policy-builder/pom.xml +++ b/services-custom/iam-policy-builder/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk aws-sdk-java-pom - 2.31.19 + 2.31.20-SNAPSHOT ../../pom.xml iam-policy-builder diff --git a/services-custom/pom.xml b/services-custom/pom.xml index 12ceb07dfe6f..ead2c8991331 100644 --- a/services-custom/pom.xml +++ b/services-custom/pom.xml @@ -19,7 +19,7 @@ software.amazon.awssdk aws-sdk-java-pom - 2.31.19 + 2.31.20-SNAPSHOT services-custom AWS Java SDK :: Custom Services diff --git a/services-custom/s3-event-notifications/pom.xml b/services-custom/s3-event-notifications/pom.xml index 3d098e996844..ae3ee24071ee 100644 --- a/services-custom/s3-event-notifications/pom.xml +++ b/services-custom/s3-event-notifications/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk aws-sdk-java-pom - 2.31.19 + 2.31.20-SNAPSHOT ../../pom.xml s3-event-notifications diff --git a/services-custom/s3-transfer-manager/pom.xml b/services-custom/s3-transfer-manager/pom.xml index 8984d400b5ad..f6884c01d457 100644 --- a/services-custom/s3-transfer-manager/pom.xml +++ b/services-custom/s3-transfer-manager/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk aws-sdk-java-pom - 2.31.19 + 2.31.20-SNAPSHOT ../../pom.xml s3-transfer-manager diff --git a/services/accessanalyzer/pom.xml b/services/accessanalyzer/pom.xml index 2bcce08e78b5..a0f724311977 100644 --- a/services/accessanalyzer/pom.xml +++ b/services/accessanalyzer/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT accessanalyzer AWS Java SDK :: Services :: AccessAnalyzer diff --git a/services/account/pom.xml b/services/account/pom.xml index 2b99092f7639..adf8df8d75bc 100644 --- a/services/account/pom.xml +++ b/services/account/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT account AWS Java SDK :: Services :: Account diff --git a/services/acm/pom.xml b/services/acm/pom.xml index 163a88911625..d641bc4dc490 100644 --- a/services/acm/pom.xml +++ b/services/acm/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT acm AWS Java SDK :: Services :: AWS Certificate Manager diff --git a/services/acmpca/pom.xml b/services/acmpca/pom.xml index 5cb5dc1531b3..b31f98fccf65 100644 --- a/services/acmpca/pom.xml +++ b/services/acmpca/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT acmpca AWS Java SDK :: Services :: ACM PCA diff --git a/services/amp/pom.xml b/services/amp/pom.xml index 9f4ecb5befb9..d8e41abe24fb 100644 --- a/services/amp/pom.xml +++ b/services/amp/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT amp AWS Java SDK :: Services :: Amp diff --git a/services/amplify/pom.xml b/services/amplify/pom.xml index 0767a7fd91f4..bd968d5cc4fa 100644 --- a/services/amplify/pom.xml +++ b/services/amplify/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT amplify AWS Java SDK :: Services :: Amplify diff --git a/services/amplifybackend/pom.xml b/services/amplifybackend/pom.xml index 622654871311..b370cc7f2615 100644 --- a/services/amplifybackend/pom.xml +++ b/services/amplifybackend/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT amplifybackend AWS Java SDK :: Services :: Amplify Backend diff --git a/services/amplifyuibuilder/pom.xml b/services/amplifyuibuilder/pom.xml index a7f23e2be541..4f6c3f080a0a 100644 --- a/services/amplifyuibuilder/pom.xml +++ b/services/amplifyuibuilder/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT amplifyuibuilder AWS Java SDK :: Services :: Amplify UI Builder diff --git a/services/apigateway/pom.xml b/services/apigateway/pom.xml index 1ee2b5213dc1..0f6d6bf3eb32 100644 --- a/services/apigateway/pom.xml +++ b/services/apigateway/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT apigateway AWS Java SDK :: Services :: Amazon API Gateway diff --git a/services/apigatewaymanagementapi/pom.xml b/services/apigatewaymanagementapi/pom.xml index 8f9e7de19664..1866a1e6e137 100644 --- a/services/apigatewaymanagementapi/pom.xml +++ b/services/apigatewaymanagementapi/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT apigatewaymanagementapi AWS Java SDK :: Services :: ApiGatewayManagementApi diff --git a/services/apigatewayv2/pom.xml b/services/apigatewayv2/pom.xml index 7eca5dd4eb3c..5c71b41b05c5 100644 --- a/services/apigatewayv2/pom.xml +++ b/services/apigatewayv2/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT apigatewayv2 AWS Java SDK :: Services :: ApiGatewayV2 diff --git a/services/appconfig/pom.xml b/services/appconfig/pom.xml index 71c315c6ad65..b39e196b7a20 100644 --- a/services/appconfig/pom.xml +++ b/services/appconfig/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT appconfig AWS Java SDK :: Services :: AppConfig diff --git a/services/appconfigdata/pom.xml b/services/appconfigdata/pom.xml index 7c63a250ca53..2269b13f3e52 100644 --- a/services/appconfigdata/pom.xml +++ b/services/appconfigdata/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT appconfigdata AWS Java SDK :: Services :: App Config Data diff --git a/services/appfabric/pom.xml b/services/appfabric/pom.xml index 693460583867..c09faf77393f 100644 --- a/services/appfabric/pom.xml +++ b/services/appfabric/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT appfabric AWS Java SDK :: Services :: App Fabric diff --git a/services/appflow/pom.xml b/services/appflow/pom.xml index 5e481ba8f410..7c087247a8d8 100644 --- a/services/appflow/pom.xml +++ b/services/appflow/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT appflow AWS Java SDK :: Services :: Appflow diff --git a/services/appintegrations/pom.xml b/services/appintegrations/pom.xml index 4b177d48145f..6ea2989699ac 100644 --- a/services/appintegrations/pom.xml +++ b/services/appintegrations/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT appintegrations AWS Java SDK :: Services :: App Integrations diff --git a/services/applicationautoscaling/pom.xml b/services/applicationautoscaling/pom.xml index ba7971b836e0..972bc8fb76fc 100644 --- a/services/applicationautoscaling/pom.xml +++ b/services/applicationautoscaling/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT applicationautoscaling AWS Java SDK :: Services :: AWS Application Auto Scaling diff --git a/services/applicationcostprofiler/pom.xml b/services/applicationcostprofiler/pom.xml index 9ae5369a0599..56e97115dea3 100644 --- a/services/applicationcostprofiler/pom.xml +++ b/services/applicationcostprofiler/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT applicationcostprofiler AWS Java SDK :: Services :: Application Cost Profiler diff --git a/services/applicationdiscovery/pom.xml b/services/applicationdiscovery/pom.xml index a0c6170ff912..a47bd55f2283 100644 --- a/services/applicationdiscovery/pom.xml +++ b/services/applicationdiscovery/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT applicationdiscovery AWS Java SDK :: Services :: AWS Application Discovery Service diff --git a/services/applicationinsights/pom.xml b/services/applicationinsights/pom.xml index 2c0e33bed240..0fc8c9a54318 100644 --- a/services/applicationinsights/pom.xml +++ b/services/applicationinsights/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT applicationinsights AWS Java SDK :: Services :: Application Insights diff --git a/services/applicationsignals/pom.xml b/services/applicationsignals/pom.xml index 46a98a8c92ff..5fc4f8960545 100644 --- a/services/applicationsignals/pom.xml +++ b/services/applicationsignals/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT applicationsignals AWS Java SDK :: Services :: Application Signals diff --git a/services/appmesh/pom.xml b/services/appmesh/pom.xml index 70b01748474b..05444696ebdb 100644 --- a/services/appmesh/pom.xml +++ b/services/appmesh/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT appmesh AWS Java SDK :: Services :: App Mesh diff --git a/services/apprunner/pom.xml b/services/apprunner/pom.xml index f569041aa8d2..66fb348bdbc0 100644 --- a/services/apprunner/pom.xml +++ b/services/apprunner/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT apprunner AWS Java SDK :: Services :: App Runner diff --git a/services/appstream/pom.xml b/services/appstream/pom.xml index 014765ba99e8..98bd328a5cbb 100644 --- a/services/appstream/pom.xml +++ b/services/appstream/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT appstream AWS Java SDK :: Services :: Amazon AppStream diff --git a/services/appsync/pom.xml b/services/appsync/pom.xml index 1c4c358a85e1..b1fce9b15de7 100644 --- a/services/appsync/pom.xml +++ b/services/appsync/pom.xml @@ -21,7 +21,7 @@ services software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT appsync diff --git a/services/apptest/pom.xml b/services/apptest/pom.xml index 71df19ce4312..5dfdc4035163 100644 --- a/services/apptest/pom.xml +++ b/services/apptest/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT apptest AWS Java SDK :: Services :: App Test diff --git a/services/arczonalshift/pom.xml b/services/arczonalshift/pom.xml index a1fdb01a09c4..9f95055e0bdd 100644 --- a/services/arczonalshift/pom.xml +++ b/services/arczonalshift/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT arczonalshift AWS Java SDK :: Services :: ARC Zonal Shift diff --git a/services/artifact/pom.xml b/services/artifact/pom.xml index c0b9403aedc2..a407b4b27f82 100644 --- a/services/artifact/pom.xml +++ b/services/artifact/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT artifact AWS Java SDK :: Services :: Artifact diff --git a/services/athena/pom.xml b/services/athena/pom.xml index dfa991618506..a796715db1a7 100644 --- a/services/athena/pom.xml +++ b/services/athena/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT athena AWS Java SDK :: Services :: Amazon Athena diff --git a/services/auditmanager/pom.xml b/services/auditmanager/pom.xml index 49212c32a563..73957e3d0e42 100644 --- a/services/auditmanager/pom.xml +++ b/services/auditmanager/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT auditmanager AWS Java SDK :: Services :: Audit Manager diff --git a/services/autoscaling/pom.xml b/services/autoscaling/pom.xml index 9bb82cab5fd3..966738645b25 100644 --- a/services/autoscaling/pom.xml +++ b/services/autoscaling/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT autoscaling AWS Java SDK :: Services :: Auto Scaling diff --git a/services/autoscalingplans/pom.xml b/services/autoscalingplans/pom.xml index 1ecafd55b5fe..35e8bba9bb2c 100644 --- a/services/autoscalingplans/pom.xml +++ b/services/autoscalingplans/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT autoscalingplans AWS Java SDK :: Services :: Auto Scaling Plans diff --git a/services/b2bi/pom.xml b/services/b2bi/pom.xml index 25d11d28d8eb..e4410e30ff0e 100644 --- a/services/b2bi/pom.xml +++ b/services/b2bi/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT b2bi AWS Java SDK :: Services :: B2 Bi diff --git a/services/backup/pom.xml b/services/backup/pom.xml index 87436c8768ea..17b48e49750a 100644 --- a/services/backup/pom.xml +++ b/services/backup/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT backup AWS Java SDK :: Services :: Backup diff --git a/services/backupgateway/pom.xml b/services/backupgateway/pom.xml index 9d29bb6a31f6..14d7c2244b17 100644 --- a/services/backupgateway/pom.xml +++ b/services/backupgateway/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT backupgateway AWS Java SDK :: Services :: Backup Gateway diff --git a/services/backupsearch/pom.xml b/services/backupsearch/pom.xml index a922f21de829..3941148e4895 100644 --- a/services/backupsearch/pom.xml +++ b/services/backupsearch/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT backupsearch AWS Java SDK :: Services :: Backup Search diff --git a/services/batch/pom.xml b/services/batch/pom.xml index bc79eb430e2b..1fd5caf09160 100644 --- a/services/batch/pom.xml +++ b/services/batch/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT batch AWS Java SDK :: Services :: AWS Batch diff --git a/services/bcmdataexports/pom.xml b/services/bcmdataexports/pom.xml index 274de8ad9ae8..1243c3cbf97b 100644 --- a/services/bcmdataexports/pom.xml +++ b/services/bcmdataexports/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT bcmdataexports AWS Java SDK :: Services :: BCM Data Exports diff --git a/services/bcmpricingcalculator/pom.xml b/services/bcmpricingcalculator/pom.xml index 4a3930e9fce8..b791402a5b70 100644 --- a/services/bcmpricingcalculator/pom.xml +++ b/services/bcmpricingcalculator/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT bcmpricingcalculator AWS Java SDK :: Services :: BCM Pricing Calculator diff --git a/services/bedrock/pom.xml b/services/bedrock/pom.xml index 670ddc8999af..e63763f2bbab 100644 --- a/services/bedrock/pom.xml +++ b/services/bedrock/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT bedrock AWS Java SDK :: Services :: Bedrock diff --git a/services/bedrockagent/pom.xml b/services/bedrockagent/pom.xml index 3ffe90fe418f..a75388bf669a 100644 --- a/services/bedrockagent/pom.xml +++ b/services/bedrockagent/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT bedrockagent AWS Java SDK :: Services :: Bedrock Agent diff --git a/services/bedrockagentruntime/pom.xml b/services/bedrockagentruntime/pom.xml index eb1b9127542f..db46e6d4f7bb 100644 --- a/services/bedrockagentruntime/pom.xml +++ b/services/bedrockagentruntime/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT bedrockagentruntime AWS Java SDK :: Services :: Bedrock Agent Runtime diff --git a/services/bedrockdataautomation/pom.xml b/services/bedrockdataautomation/pom.xml index a3414ce7e67a..1bc10bd845bf 100644 --- a/services/bedrockdataautomation/pom.xml +++ b/services/bedrockdataautomation/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT bedrockdataautomation AWS Java SDK :: Services :: Bedrock Data Automation diff --git a/services/bedrockdataautomationruntime/pom.xml b/services/bedrockdataautomationruntime/pom.xml index df1e34117b04..d6cd1c0e4f5b 100644 --- a/services/bedrockdataautomationruntime/pom.xml +++ b/services/bedrockdataautomationruntime/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT bedrockdataautomationruntime AWS Java SDK :: Services :: Bedrock Data Automation Runtime diff --git a/services/bedrockruntime/pom.xml b/services/bedrockruntime/pom.xml index f64a4db1e0d8..e268510f50f6 100644 --- a/services/bedrockruntime/pom.xml +++ b/services/bedrockruntime/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT bedrockruntime AWS Java SDK :: Services :: Bedrock Runtime diff --git a/services/billing/pom.xml b/services/billing/pom.xml index 900b041c5f26..c07eabf2817e 100644 --- a/services/billing/pom.xml +++ b/services/billing/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT billing AWS Java SDK :: Services :: Billing diff --git a/services/billingconductor/pom.xml b/services/billingconductor/pom.xml index 5f33fe20e5ef..2e1e05487e25 100644 --- a/services/billingconductor/pom.xml +++ b/services/billingconductor/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT billingconductor AWS Java SDK :: Services :: Billingconductor diff --git a/services/braket/pom.xml b/services/braket/pom.xml index a8711159725a..93bf6cedd5f3 100644 --- a/services/braket/pom.xml +++ b/services/braket/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT braket AWS Java SDK :: Services :: Braket diff --git a/services/budgets/pom.xml b/services/budgets/pom.xml index a4f63cebdb99..b7c79e676b57 100644 --- a/services/budgets/pom.xml +++ b/services/budgets/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT budgets AWS Java SDK :: Services :: AWS Budgets diff --git a/services/chatbot/pom.xml b/services/chatbot/pom.xml index 63c0ddc78e13..4c87ccd367af 100644 --- a/services/chatbot/pom.xml +++ b/services/chatbot/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT chatbot AWS Java SDK :: Services :: Chatbot diff --git a/services/chime/pom.xml b/services/chime/pom.xml index 6e4a60a4f2b0..3a32cdee7a21 100644 --- a/services/chime/pom.xml +++ b/services/chime/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT chime AWS Java SDK :: Services :: Chime diff --git a/services/chimesdkidentity/pom.xml b/services/chimesdkidentity/pom.xml index 5b2494033f9a..93e8cbb29eba 100644 --- a/services/chimesdkidentity/pom.xml +++ b/services/chimesdkidentity/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT chimesdkidentity AWS Java SDK :: Services :: Chime SDK Identity diff --git a/services/chimesdkmediapipelines/pom.xml b/services/chimesdkmediapipelines/pom.xml index 77efc9f544f0..13da31064dfd 100644 --- a/services/chimesdkmediapipelines/pom.xml +++ b/services/chimesdkmediapipelines/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT chimesdkmediapipelines AWS Java SDK :: Services :: Chime SDK Media Pipelines diff --git a/services/chimesdkmeetings/pom.xml b/services/chimesdkmeetings/pom.xml index dd648cddf3be..6c2bae5b76f3 100644 --- a/services/chimesdkmeetings/pom.xml +++ b/services/chimesdkmeetings/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT chimesdkmeetings AWS Java SDK :: Services :: Chime SDK Meetings diff --git a/services/chimesdkmessaging/pom.xml b/services/chimesdkmessaging/pom.xml index bad7bda09124..9aa0a9695497 100644 --- a/services/chimesdkmessaging/pom.xml +++ b/services/chimesdkmessaging/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT chimesdkmessaging AWS Java SDK :: Services :: Chime SDK Messaging diff --git a/services/chimesdkvoice/pom.xml b/services/chimesdkvoice/pom.xml index 617c10a557b8..b4d90ec82c9b 100644 --- a/services/chimesdkvoice/pom.xml +++ b/services/chimesdkvoice/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT chimesdkvoice AWS Java SDK :: Services :: Chime SDK Voice diff --git a/services/cleanrooms/pom.xml b/services/cleanrooms/pom.xml index 1875ced74aa6..c83a16f075a2 100644 --- a/services/cleanrooms/pom.xml +++ b/services/cleanrooms/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT cleanrooms AWS Java SDK :: Services :: Clean Rooms diff --git a/services/cleanroomsml/pom.xml b/services/cleanroomsml/pom.xml index 02312b22bc2f..b92e7a1bda4d 100644 --- a/services/cleanroomsml/pom.xml +++ b/services/cleanroomsml/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT cleanroomsml AWS Java SDK :: Services :: Clean Rooms ML diff --git a/services/cloud9/pom.xml b/services/cloud9/pom.xml index 31d07bddb3d9..ea2b84142496 100644 --- a/services/cloud9/pom.xml +++ b/services/cloud9/pom.xml @@ -20,7 +20,7 @@ services software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 cloud9 diff --git a/services/cloudcontrol/pom.xml b/services/cloudcontrol/pom.xml index 00ff4ac1e62d..368425c2e5f7 100644 --- a/services/cloudcontrol/pom.xml +++ b/services/cloudcontrol/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT cloudcontrol AWS Java SDK :: Services :: Cloud Control diff --git a/services/clouddirectory/pom.xml b/services/clouddirectory/pom.xml index 6356e4b939af..ef2446de1a1f 100644 --- a/services/clouddirectory/pom.xml +++ b/services/clouddirectory/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT clouddirectory AWS Java SDK :: Services :: Amazon CloudDirectory diff --git a/services/cloudformation/pom.xml b/services/cloudformation/pom.xml index fcf95863bef6..be453b80d51a 100644 --- a/services/cloudformation/pom.xml +++ b/services/cloudformation/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT cloudformation AWS Java SDK :: Services :: AWS CloudFormation diff --git a/services/cloudfront/pom.xml b/services/cloudfront/pom.xml index f58a1cbde94c..9be2506e542d 100644 --- a/services/cloudfront/pom.xml +++ b/services/cloudfront/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT cloudfront AWS Java SDK :: Services :: Amazon CloudFront diff --git a/services/cloudfrontkeyvaluestore/pom.xml b/services/cloudfrontkeyvaluestore/pom.xml index 498973192558..0c5ecccc429b 100644 --- a/services/cloudfrontkeyvaluestore/pom.xml +++ b/services/cloudfrontkeyvaluestore/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT cloudfrontkeyvaluestore AWS Java SDK :: Services :: Cloud Front Key Value Store diff --git a/services/cloudhsm/pom.xml b/services/cloudhsm/pom.xml index b1d4c0127e6f..558bb32a65f7 100644 --- a/services/cloudhsm/pom.xml +++ b/services/cloudhsm/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT cloudhsm AWS Java SDK :: Services :: AWS CloudHSM diff --git a/services/cloudhsmv2/pom.xml b/services/cloudhsmv2/pom.xml index 3c0547072716..bf8dce0626a3 100644 --- a/services/cloudhsmv2/pom.xml +++ b/services/cloudhsmv2/pom.xml @@ -20,7 +20,7 @@ services software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 cloudhsmv2 diff --git a/services/cloudsearch/pom.xml b/services/cloudsearch/pom.xml index a3cd3062b8e9..fb714a2eeeaf 100644 --- a/services/cloudsearch/pom.xml +++ b/services/cloudsearch/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT cloudsearch AWS Java SDK :: Services :: Amazon CloudSearch diff --git a/services/cloudsearchdomain/pom.xml b/services/cloudsearchdomain/pom.xml index a51e4ceee599..b671a6476669 100644 --- a/services/cloudsearchdomain/pom.xml +++ b/services/cloudsearchdomain/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT cloudsearchdomain AWS Java SDK :: Services :: Amazon CloudSearch Domain diff --git a/services/cloudtrail/pom.xml b/services/cloudtrail/pom.xml index 5a1af9294704..0489c500b4a6 100644 --- a/services/cloudtrail/pom.xml +++ b/services/cloudtrail/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT cloudtrail AWS Java SDK :: Services :: AWS CloudTrail diff --git a/services/cloudtraildata/pom.xml b/services/cloudtraildata/pom.xml index 5bafc04225ff..6b57eef07390 100644 --- a/services/cloudtraildata/pom.xml +++ b/services/cloudtraildata/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT cloudtraildata AWS Java SDK :: Services :: Cloud Trail Data diff --git a/services/cloudwatch/pom.xml b/services/cloudwatch/pom.xml index 2d4e9fd86f8e..39f0f16dead3 100644 --- a/services/cloudwatch/pom.xml +++ b/services/cloudwatch/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT cloudwatch AWS Java SDK :: Services :: Amazon CloudWatch diff --git a/services/cloudwatchevents/pom.xml b/services/cloudwatchevents/pom.xml index dd1e39af5ff2..bb53cebf8180 100644 --- a/services/cloudwatchevents/pom.xml +++ b/services/cloudwatchevents/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT cloudwatchevents AWS Java SDK :: Services :: Amazon CloudWatch Events diff --git a/services/cloudwatchlogs/pom.xml b/services/cloudwatchlogs/pom.xml index 187c829bcbd4..ceddbe30a8a5 100644 --- a/services/cloudwatchlogs/pom.xml +++ b/services/cloudwatchlogs/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT cloudwatchlogs AWS Java SDK :: Services :: Amazon CloudWatch Logs diff --git a/services/codeartifact/pom.xml b/services/codeartifact/pom.xml index 523e5e313a84..2ebe1cb516ed 100644 --- a/services/codeartifact/pom.xml +++ b/services/codeartifact/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT codeartifact AWS Java SDK :: Services :: Codeartifact diff --git a/services/codebuild/pom.xml b/services/codebuild/pom.xml index 4890e2711cbd..55e859c9d180 100644 --- a/services/codebuild/pom.xml +++ b/services/codebuild/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT codebuild AWS Java SDK :: Services :: AWS Code Build diff --git a/services/codecatalyst/pom.xml b/services/codecatalyst/pom.xml index be4ed9516fc0..f186aac998e0 100644 --- a/services/codecatalyst/pom.xml +++ b/services/codecatalyst/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT codecatalyst AWS Java SDK :: Services :: Code Catalyst diff --git a/services/codecommit/pom.xml b/services/codecommit/pom.xml index 7e7b854222f4..e9c27fae709a 100644 --- a/services/codecommit/pom.xml +++ b/services/codecommit/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT codecommit AWS Java SDK :: Services :: AWS CodeCommit diff --git a/services/codeconnections/pom.xml b/services/codeconnections/pom.xml index 1dddeb867b28..f3e82680981b 100644 --- a/services/codeconnections/pom.xml +++ b/services/codeconnections/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT codeconnections AWS Java SDK :: Services :: Code Connections diff --git a/services/codedeploy/pom.xml b/services/codedeploy/pom.xml index 78c3648f5fb2..d64cfc741b23 100644 --- a/services/codedeploy/pom.xml +++ b/services/codedeploy/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT codedeploy AWS Java SDK :: Services :: AWS CodeDeploy diff --git a/services/codeguruprofiler/pom.xml b/services/codeguruprofiler/pom.xml index fb1531b0b8df..0798c265207e 100644 --- a/services/codeguruprofiler/pom.xml +++ b/services/codeguruprofiler/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT codeguruprofiler AWS Java SDK :: Services :: CodeGuruProfiler diff --git a/services/codegurureviewer/pom.xml b/services/codegurureviewer/pom.xml index 24da3d0c1935..ad5bb58366bf 100644 --- a/services/codegurureviewer/pom.xml +++ b/services/codegurureviewer/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT codegurureviewer AWS Java SDK :: Services :: CodeGuru Reviewer diff --git a/services/codegurusecurity/pom.xml b/services/codegurusecurity/pom.xml index 1dc7a1631615..0172ffb74694 100644 --- a/services/codegurusecurity/pom.xml +++ b/services/codegurusecurity/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT codegurusecurity AWS Java SDK :: Services :: Code Guru Security diff --git a/services/codepipeline/pom.xml b/services/codepipeline/pom.xml index 54084d72de77..d8308aa948b5 100644 --- a/services/codepipeline/pom.xml +++ b/services/codepipeline/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT codepipeline AWS Java SDK :: Services :: AWS CodePipeline diff --git a/services/codestarconnections/pom.xml b/services/codestarconnections/pom.xml index ae39437b3a97..a6fbdc8e23f1 100644 --- a/services/codestarconnections/pom.xml +++ b/services/codestarconnections/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT codestarconnections AWS Java SDK :: Services :: CodeStar connections diff --git a/services/codestarnotifications/pom.xml b/services/codestarnotifications/pom.xml index 4f138860cdc2..21f869820112 100644 --- a/services/codestarnotifications/pom.xml +++ b/services/codestarnotifications/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT codestarnotifications AWS Java SDK :: Services :: Codestar Notifications diff --git a/services/cognitoidentity/pom.xml b/services/cognitoidentity/pom.xml index 5ab3ba96d2de..011902a06fe6 100644 --- a/services/cognitoidentity/pom.xml +++ b/services/cognitoidentity/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT cognitoidentity AWS Java SDK :: Services :: Amazon Cognito Identity diff --git a/services/cognitoidentityprovider/pom.xml b/services/cognitoidentityprovider/pom.xml index b0a1ef7d7051..24354672dda4 100644 --- a/services/cognitoidentityprovider/pom.xml +++ b/services/cognitoidentityprovider/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT cognitoidentityprovider AWS Java SDK :: Services :: Amazon Cognito Identity Provider Service diff --git a/services/cognitosync/pom.xml b/services/cognitosync/pom.xml index a21d6eba05f3..a1d24c87f960 100644 --- a/services/cognitosync/pom.xml +++ b/services/cognitosync/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT cognitosync AWS Java SDK :: Services :: Amazon Cognito Sync diff --git a/services/comprehend/pom.xml b/services/comprehend/pom.xml index f67a7a9ef476..b0ee7d43e87a 100644 --- a/services/comprehend/pom.xml +++ b/services/comprehend/pom.xml @@ -20,7 +20,7 @@ services software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 comprehend diff --git a/services/comprehendmedical/pom.xml b/services/comprehendmedical/pom.xml index dc6fb75c664c..3da448bcbf8a 100644 --- a/services/comprehendmedical/pom.xml +++ b/services/comprehendmedical/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT comprehendmedical AWS Java SDK :: Services :: ComprehendMedical diff --git a/services/computeoptimizer/pom.xml b/services/computeoptimizer/pom.xml index c5ab910a35db..e06a1af93196 100644 --- a/services/computeoptimizer/pom.xml +++ b/services/computeoptimizer/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT computeoptimizer AWS Java SDK :: Services :: Compute Optimizer diff --git a/services/config/pom.xml b/services/config/pom.xml index 06a4a055badd..940443050c74 100644 --- a/services/config/pom.xml +++ b/services/config/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT config AWS Java SDK :: Services :: AWS Config diff --git a/services/connect/pom.xml b/services/connect/pom.xml index 8aca2d51bbe1..8a680955a008 100644 --- a/services/connect/pom.xml +++ b/services/connect/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT connect AWS Java SDK :: Services :: Connect diff --git a/services/connectcampaigns/pom.xml b/services/connectcampaigns/pom.xml index 8e1ccbe8b397..6a1f11fc3f73 100644 --- a/services/connectcampaigns/pom.xml +++ b/services/connectcampaigns/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT connectcampaigns AWS Java SDK :: Services :: Connect Campaigns diff --git a/services/connectcampaignsv2/pom.xml b/services/connectcampaignsv2/pom.xml index 6603c4cb977a..8ffb7ee529da 100644 --- a/services/connectcampaignsv2/pom.xml +++ b/services/connectcampaignsv2/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT connectcampaignsv2 AWS Java SDK :: Services :: Connect Campaigns V2 diff --git a/services/connectcases/pom.xml b/services/connectcases/pom.xml index dbf5365e3649..512d841f44fb 100644 --- a/services/connectcases/pom.xml +++ b/services/connectcases/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT connectcases AWS Java SDK :: Services :: Connect Cases diff --git a/services/connectcontactlens/pom.xml b/services/connectcontactlens/pom.xml index e4a804b9e839..7bea5410f05b 100644 --- a/services/connectcontactlens/pom.xml +++ b/services/connectcontactlens/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT connectcontactlens AWS Java SDK :: Services :: Connect Contact Lens diff --git a/services/connectparticipant/pom.xml b/services/connectparticipant/pom.xml index 530295dcf2e0..0079fb71c85c 100644 --- a/services/connectparticipant/pom.xml +++ b/services/connectparticipant/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT connectparticipant AWS Java SDK :: Services :: ConnectParticipant diff --git a/services/controlcatalog/pom.xml b/services/controlcatalog/pom.xml index c8c7e5476fbc..921f54dbb9f3 100644 --- a/services/controlcatalog/pom.xml +++ b/services/controlcatalog/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT controlcatalog AWS Java SDK :: Services :: Control Catalog diff --git a/services/controltower/pom.xml b/services/controltower/pom.xml index 3fc5d39474be..2d282ea2bf17 100644 --- a/services/controltower/pom.xml +++ b/services/controltower/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT controltower AWS Java SDK :: Services :: Control Tower diff --git a/services/costandusagereport/pom.xml b/services/costandusagereport/pom.xml index 7d677ea9210d..aa9b1b4d7750 100644 --- a/services/costandusagereport/pom.xml +++ b/services/costandusagereport/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT costandusagereport AWS Java SDK :: Services :: AWS Cost and Usage Report diff --git a/services/costexplorer/pom.xml b/services/costexplorer/pom.xml index 6cafece6d447..4b665da08495 100644 --- a/services/costexplorer/pom.xml +++ b/services/costexplorer/pom.xml @@ -20,7 +20,7 @@ services software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 costexplorer diff --git a/services/costoptimizationhub/pom.xml b/services/costoptimizationhub/pom.xml index 7b772bb9bb6c..16a2b39249b2 100644 --- a/services/costoptimizationhub/pom.xml +++ b/services/costoptimizationhub/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT costoptimizationhub AWS Java SDK :: Services :: Cost Optimization Hub diff --git a/services/customerprofiles/pom.xml b/services/customerprofiles/pom.xml index ac24212178f2..7726176bcae2 100644 --- a/services/customerprofiles/pom.xml +++ b/services/customerprofiles/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT customerprofiles AWS Java SDK :: Services :: Customer Profiles diff --git a/services/databasemigration/pom.xml b/services/databasemigration/pom.xml index 5fb66865e014..dc9ad9d1a536 100644 --- a/services/databasemigration/pom.xml +++ b/services/databasemigration/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT databasemigration AWS Java SDK :: Services :: AWS Database Migration Service diff --git a/services/databrew/pom.xml b/services/databrew/pom.xml index f426c26f4fc2..c1704743475a 100644 --- a/services/databrew/pom.xml +++ b/services/databrew/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT databrew AWS Java SDK :: Services :: Data Brew diff --git a/services/dataexchange/pom.xml b/services/dataexchange/pom.xml index 1c354c12a597..93fb501e1765 100644 --- a/services/dataexchange/pom.xml +++ b/services/dataexchange/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT dataexchange AWS Java SDK :: Services :: DataExchange diff --git a/services/datapipeline/pom.xml b/services/datapipeline/pom.xml index be873dfb4e27..479ac9fbe45e 100644 --- a/services/datapipeline/pom.xml +++ b/services/datapipeline/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT datapipeline AWS Java SDK :: Services :: AWS Data Pipeline diff --git a/services/datasync/pom.xml b/services/datasync/pom.xml index 41e50beb2b03..96651bd5b4f2 100644 --- a/services/datasync/pom.xml +++ b/services/datasync/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT datasync AWS Java SDK :: Services :: DataSync diff --git a/services/datazone/pom.xml b/services/datazone/pom.xml index cd7939eb314c..3541d9e637c4 100644 --- a/services/datazone/pom.xml +++ b/services/datazone/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT datazone AWS Java SDK :: Services :: Data Zone diff --git a/services/dax/pom.xml b/services/dax/pom.xml index 020978534b86..b2701cb63100 100644 --- a/services/dax/pom.xml +++ b/services/dax/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT dax AWS Java SDK :: Services :: Amazon DynamoDB Accelerator (DAX) diff --git a/services/deadline/pom.xml b/services/deadline/pom.xml index e40a181ee76c..b9b43d7e2328 100644 --- a/services/deadline/pom.xml +++ b/services/deadline/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT deadline AWS Java SDK :: Services :: Deadline diff --git a/services/detective/pom.xml b/services/detective/pom.xml index 63f30db7988b..a61820834914 100644 --- a/services/detective/pom.xml +++ b/services/detective/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT detective AWS Java SDK :: Services :: Detective diff --git a/services/devicefarm/pom.xml b/services/devicefarm/pom.xml index 41fe218f59a2..4ffdfb5edfa6 100644 --- a/services/devicefarm/pom.xml +++ b/services/devicefarm/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT devicefarm AWS Java SDK :: Services :: AWS Device Farm diff --git a/services/devopsguru/pom.xml b/services/devopsguru/pom.xml index 784cbbac861f..b0cacaaef321 100644 --- a/services/devopsguru/pom.xml +++ b/services/devopsguru/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT devopsguru AWS Java SDK :: Services :: Dev Ops Guru diff --git a/services/directconnect/pom.xml b/services/directconnect/pom.xml index 898bae6b3655..1de233024fdc 100644 --- a/services/directconnect/pom.xml +++ b/services/directconnect/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT directconnect AWS Java SDK :: Services :: AWS Direct Connect diff --git a/services/directory/pom.xml b/services/directory/pom.xml index 62121edeecf6..65adb1d55882 100644 --- a/services/directory/pom.xml +++ b/services/directory/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT directory AWS Java SDK :: Services :: AWS Directory Service diff --git a/services/directoryservicedata/pom.xml b/services/directoryservicedata/pom.xml index 416b4cfad6e4..eb7cbf902bce 100644 --- a/services/directoryservicedata/pom.xml +++ b/services/directoryservicedata/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT directoryservicedata AWS Java SDK :: Services :: Directory Service Data diff --git a/services/dlm/pom.xml b/services/dlm/pom.xml index ad3fcdc19c06..4d8ea068d8c4 100644 --- a/services/dlm/pom.xml +++ b/services/dlm/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT dlm AWS Java SDK :: Services :: DLM diff --git a/services/docdb/pom.xml b/services/docdb/pom.xml index 496ac0828fda..57e5f69d153b 100644 --- a/services/docdb/pom.xml +++ b/services/docdb/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT docdb AWS Java SDK :: Services :: DocDB diff --git a/services/docdbelastic/pom.xml b/services/docdbelastic/pom.xml index 83861a587825..d6b8f91965cc 100644 --- a/services/docdbelastic/pom.xml +++ b/services/docdbelastic/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT docdbelastic AWS Java SDK :: Services :: Doc DB Elastic diff --git a/services/drs/pom.xml b/services/drs/pom.xml index 56f3dc00f3ee..6d17c88ca7fa 100644 --- a/services/drs/pom.xml +++ b/services/drs/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT drs AWS Java SDK :: Services :: Drs diff --git a/services/dsql/pom.xml b/services/dsql/pom.xml index 93a86e12ca8f..a21aeda510d6 100644 --- a/services/dsql/pom.xml +++ b/services/dsql/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT dsql AWS Java SDK :: Services :: DSQL diff --git a/services/dynamodb/pom.xml b/services/dynamodb/pom.xml index 2db49683d587..0bf1297b9518 100644 --- a/services/dynamodb/pom.xml +++ b/services/dynamodb/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT dynamodb AWS Java SDK :: Services :: Amazon DynamoDB diff --git a/services/ebs/pom.xml b/services/ebs/pom.xml index c4f06cb93386..aaa7ab1fd152 100644 --- a/services/ebs/pom.xml +++ b/services/ebs/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT ebs AWS Java SDK :: Services :: EBS diff --git a/services/ec2/pom.xml b/services/ec2/pom.xml index d47a507bef88..cffbdef3e4a0 100644 --- a/services/ec2/pom.xml +++ b/services/ec2/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT ec2 AWS Java SDK :: Services :: Amazon EC2 diff --git a/services/ec2instanceconnect/pom.xml b/services/ec2instanceconnect/pom.xml index 893ca1746af5..551ea1c1c5a6 100644 --- a/services/ec2instanceconnect/pom.xml +++ b/services/ec2instanceconnect/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT ec2instanceconnect AWS Java SDK :: Services :: EC2 Instance Connect diff --git a/services/ecr/pom.xml b/services/ecr/pom.xml index 67e10069de4b..8f53615a6ce7 100644 --- a/services/ecr/pom.xml +++ b/services/ecr/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT ecr AWS Java SDK :: Services :: Amazon EC2 Container Registry diff --git a/services/ecrpublic/pom.xml b/services/ecrpublic/pom.xml index 689a1d61e358..b374d87060e3 100644 --- a/services/ecrpublic/pom.xml +++ b/services/ecrpublic/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT ecrpublic AWS Java SDK :: Services :: ECR PUBLIC diff --git a/services/ecs/pom.xml b/services/ecs/pom.xml index 9bbacb42d37a..dd0ad4f39244 100644 --- a/services/ecs/pom.xml +++ b/services/ecs/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT ecs AWS Java SDK :: Services :: Amazon EC2 Container Service diff --git a/services/efs/pom.xml b/services/efs/pom.xml index 372f245ab4a3..404ca878743b 100644 --- a/services/efs/pom.xml +++ b/services/efs/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT efs AWS Java SDK :: Services :: Amazon Elastic File System diff --git a/services/eks/pom.xml b/services/eks/pom.xml index 386ef83e38cf..aafbb062813c 100644 --- a/services/eks/pom.xml +++ b/services/eks/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT eks AWS Java SDK :: Services :: EKS diff --git a/services/eksauth/pom.xml b/services/eksauth/pom.xml index d731de4a0402..5014ec8d0115 100644 --- a/services/eksauth/pom.xml +++ b/services/eksauth/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT eksauth AWS Java SDK :: Services :: EKS Auth diff --git a/services/elasticache/pom.xml b/services/elasticache/pom.xml index a62ad7eeaee4..52588036bec3 100644 --- a/services/elasticache/pom.xml +++ b/services/elasticache/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT elasticache AWS Java SDK :: Services :: Amazon ElastiCache diff --git a/services/elasticbeanstalk/pom.xml b/services/elasticbeanstalk/pom.xml index 9f1f6fdb49c8..56fdef4283c7 100644 --- a/services/elasticbeanstalk/pom.xml +++ b/services/elasticbeanstalk/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT elasticbeanstalk AWS Java SDK :: Services :: AWS Elastic Beanstalk diff --git a/services/elasticloadbalancing/pom.xml b/services/elasticloadbalancing/pom.xml index abe9b3a93c6b..91ac54c810bd 100644 --- a/services/elasticloadbalancing/pom.xml +++ b/services/elasticloadbalancing/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT elasticloadbalancing AWS Java SDK :: Services :: Elastic Load Balancing diff --git a/services/elasticloadbalancingv2/pom.xml b/services/elasticloadbalancingv2/pom.xml index 10d31cc23812..efcb6edc3377 100644 --- a/services/elasticloadbalancingv2/pom.xml +++ b/services/elasticloadbalancingv2/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT elasticloadbalancingv2 AWS Java SDK :: Services :: Elastic Load Balancing V2 diff --git a/services/elasticsearch/pom.xml b/services/elasticsearch/pom.xml index 058995cc84bb..2ed6fb3af9c2 100644 --- a/services/elasticsearch/pom.xml +++ b/services/elasticsearch/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT elasticsearch AWS Java SDK :: Services :: Amazon Elasticsearch Service diff --git a/services/elastictranscoder/pom.xml b/services/elastictranscoder/pom.xml index 2d37c4b44fc8..fd3b9840bed0 100644 --- a/services/elastictranscoder/pom.xml +++ b/services/elastictranscoder/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT elastictranscoder AWS Java SDK :: Services :: Amazon Elastic Transcoder diff --git a/services/emr/pom.xml b/services/emr/pom.xml index 992eb3aa7f6a..fa7e45638455 100644 --- a/services/emr/pom.xml +++ b/services/emr/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT emr AWS Java SDK :: Services :: Amazon EMR diff --git a/services/emrcontainers/pom.xml b/services/emrcontainers/pom.xml index c1288cb02824..c6374b4f8471 100644 --- a/services/emrcontainers/pom.xml +++ b/services/emrcontainers/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT emrcontainers AWS Java SDK :: Services :: EMR Containers diff --git a/services/emrserverless/pom.xml b/services/emrserverless/pom.xml index ee484cdffa82..689547b5c828 100644 --- a/services/emrserverless/pom.xml +++ b/services/emrserverless/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT emrserverless AWS Java SDK :: Services :: EMR Serverless diff --git a/services/entityresolution/pom.xml b/services/entityresolution/pom.xml index d6a8b9c81a27..8e8195d840f4 100644 --- a/services/entityresolution/pom.xml +++ b/services/entityresolution/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT entityresolution AWS Java SDK :: Services :: Entity Resolution diff --git a/services/eventbridge/pom.xml b/services/eventbridge/pom.xml index 208901f4ba16..115cd802e0a0 100644 --- a/services/eventbridge/pom.xml +++ b/services/eventbridge/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT eventbridge AWS Java SDK :: Services :: EventBridge diff --git a/services/evidently/pom.xml b/services/evidently/pom.xml index 2aa38ffc4c8c..d7048f975a62 100644 --- a/services/evidently/pom.xml +++ b/services/evidently/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT evidently AWS Java SDK :: Services :: Evidently diff --git a/services/finspace/pom.xml b/services/finspace/pom.xml index 3b95ca0936cd..6f36e95738e0 100644 --- a/services/finspace/pom.xml +++ b/services/finspace/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT finspace AWS Java SDK :: Services :: Finspace diff --git a/services/finspacedata/pom.xml b/services/finspacedata/pom.xml index 90ca09208a2d..c5436ae49c00 100644 --- a/services/finspacedata/pom.xml +++ b/services/finspacedata/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT finspacedata AWS Java SDK :: Services :: Finspace Data diff --git a/services/firehose/pom.xml b/services/firehose/pom.xml index e273c89bd51a..92713763f4aa 100644 --- a/services/firehose/pom.xml +++ b/services/firehose/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT firehose AWS Java SDK :: Services :: Amazon Kinesis Firehose diff --git a/services/fis/pom.xml b/services/fis/pom.xml index 686545e2e97c..b1e1326d6303 100644 --- a/services/fis/pom.xml +++ b/services/fis/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT fis AWS Java SDK :: Services :: Fis diff --git a/services/fms/pom.xml b/services/fms/pom.xml index aac0246e414c..396bc269c8c7 100644 --- a/services/fms/pom.xml +++ b/services/fms/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT fms AWS Java SDK :: Services :: FMS diff --git a/services/forecast/pom.xml b/services/forecast/pom.xml index e49c532a01c2..a215253269e0 100644 --- a/services/forecast/pom.xml +++ b/services/forecast/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT forecast AWS Java SDK :: Services :: Forecast diff --git a/services/forecastquery/pom.xml b/services/forecastquery/pom.xml index 96a09fb975a9..cfc76d96cbb4 100644 --- a/services/forecastquery/pom.xml +++ b/services/forecastquery/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT forecastquery AWS Java SDK :: Services :: Forecastquery diff --git a/services/frauddetector/pom.xml b/services/frauddetector/pom.xml index 37c555dd5720..cf33c6ae515a 100644 --- a/services/frauddetector/pom.xml +++ b/services/frauddetector/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT frauddetector AWS Java SDK :: Services :: FraudDetector diff --git a/services/freetier/pom.xml b/services/freetier/pom.xml index 81f75d62eb46..c4f926666dd2 100644 --- a/services/freetier/pom.xml +++ b/services/freetier/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT freetier AWS Java SDK :: Services :: Free Tier diff --git a/services/fsx/pom.xml b/services/fsx/pom.xml index e34933deeb1c..2a3e9af0c6e7 100644 --- a/services/fsx/pom.xml +++ b/services/fsx/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT fsx AWS Java SDK :: Services :: FSx diff --git a/services/gamelift/pom.xml b/services/gamelift/pom.xml index e5dfd60971dc..d26fe71e6402 100644 --- a/services/gamelift/pom.xml +++ b/services/gamelift/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT gamelift AWS Java SDK :: Services :: AWS GameLift diff --git a/services/gameliftstreams/pom.xml b/services/gameliftstreams/pom.xml index d738200bc220..cc485846290d 100644 --- a/services/gameliftstreams/pom.xml +++ b/services/gameliftstreams/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT gameliftstreams AWS Java SDK :: Services :: Game Lift Streams diff --git a/services/geomaps/pom.xml b/services/geomaps/pom.xml index 7c42f526186a..95f4574dfe23 100644 --- a/services/geomaps/pom.xml +++ b/services/geomaps/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT geomaps AWS Java SDK :: Services :: Geo Maps diff --git a/services/geoplaces/pom.xml b/services/geoplaces/pom.xml index 2f4f68110ebd..76598615e13a 100644 --- a/services/geoplaces/pom.xml +++ b/services/geoplaces/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT geoplaces AWS Java SDK :: Services :: Geo Places diff --git a/services/georoutes/pom.xml b/services/georoutes/pom.xml index 20a995df55b5..73c7cf933730 100644 --- a/services/georoutes/pom.xml +++ b/services/georoutes/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT georoutes AWS Java SDK :: Services :: Geo Routes diff --git a/services/glacier/pom.xml b/services/glacier/pom.xml index 433a8812fcd6..937f675887a5 100644 --- a/services/glacier/pom.xml +++ b/services/glacier/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT glacier AWS Java SDK :: Services :: Amazon Glacier diff --git a/services/globalaccelerator/pom.xml b/services/globalaccelerator/pom.xml index 327a4f817b3f..cd3a361cfef0 100644 --- a/services/globalaccelerator/pom.xml +++ b/services/globalaccelerator/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT globalaccelerator AWS Java SDK :: Services :: Global Accelerator diff --git a/services/glue/pom.xml b/services/glue/pom.xml index 166498f191a3..07123fab767c 100644 --- a/services/glue/pom.xml +++ b/services/glue/pom.xml @@ -20,7 +20,7 @@ services software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 glue diff --git a/services/grafana/pom.xml b/services/grafana/pom.xml index 89835714d2cc..5f4a9009264a 100644 --- a/services/grafana/pom.xml +++ b/services/grafana/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT grafana AWS Java SDK :: Services :: Grafana diff --git a/services/greengrass/pom.xml b/services/greengrass/pom.xml index d25805e636f9..80a81368e676 100644 --- a/services/greengrass/pom.xml +++ b/services/greengrass/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT greengrass AWS Java SDK :: Services :: AWS Greengrass diff --git a/services/greengrassv2/pom.xml b/services/greengrassv2/pom.xml index 9f1a321ee4a1..fd5495611508 100644 --- a/services/greengrassv2/pom.xml +++ b/services/greengrassv2/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT greengrassv2 AWS Java SDK :: Services :: Greengrass V2 diff --git a/services/groundstation/pom.xml b/services/groundstation/pom.xml index 803255bb3e1b..5bf441046bcf 100644 --- a/services/groundstation/pom.xml +++ b/services/groundstation/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT groundstation AWS Java SDK :: Services :: GroundStation diff --git a/services/guardduty/pom.xml b/services/guardduty/pom.xml index 0f55792a7773..fc500943e6cc 100644 --- a/services/guardduty/pom.xml +++ b/services/guardduty/pom.xml @@ -20,7 +20,7 @@ services software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 guardduty diff --git a/services/health/pom.xml b/services/health/pom.xml index 9d8b9f3499ef..0db7fe683047 100644 --- a/services/health/pom.xml +++ b/services/health/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT health AWS Java SDK :: Services :: AWS Health APIs and Notifications diff --git a/services/healthlake/pom.xml b/services/healthlake/pom.xml index 7328515f2d19..cecce32b7df9 100644 --- a/services/healthlake/pom.xml +++ b/services/healthlake/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT healthlake AWS Java SDK :: Services :: Health Lake diff --git a/services/iam/pom.xml b/services/iam/pom.xml index 154772ddb366..1e2a5556396f 100644 --- a/services/iam/pom.xml +++ b/services/iam/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT iam AWS Java SDK :: Services :: AWS IAM diff --git a/services/identitystore/pom.xml b/services/identitystore/pom.xml index d3d1c9382507..50e03db6f810 100644 --- a/services/identitystore/pom.xml +++ b/services/identitystore/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT identitystore AWS Java SDK :: Services :: Identitystore diff --git a/services/imagebuilder/pom.xml b/services/imagebuilder/pom.xml index 19be768764f0..6c4c5300fa9c 100644 --- a/services/imagebuilder/pom.xml +++ b/services/imagebuilder/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT imagebuilder AWS Java SDK :: Services :: Imagebuilder diff --git a/services/inspector/pom.xml b/services/inspector/pom.xml index 5676793320f4..ea9fade01989 100644 --- a/services/inspector/pom.xml +++ b/services/inspector/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT inspector AWS Java SDK :: Services :: Amazon Inspector Service diff --git a/services/inspector2/pom.xml b/services/inspector2/pom.xml index 2e52390f4f33..136f4c57f932 100644 --- a/services/inspector2/pom.xml +++ b/services/inspector2/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT inspector2 AWS Java SDK :: Services :: Inspector2 diff --git a/services/inspectorscan/pom.xml b/services/inspectorscan/pom.xml index ba63d2b5fbb4..78f266cbd19a 100644 --- a/services/inspectorscan/pom.xml +++ b/services/inspectorscan/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT inspectorscan AWS Java SDK :: Services :: Inspector Scan diff --git a/services/internetmonitor/pom.xml b/services/internetmonitor/pom.xml index 5d04f4eab0ad..8da5a3b6d46b 100644 --- a/services/internetmonitor/pom.xml +++ b/services/internetmonitor/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT internetmonitor AWS Java SDK :: Services :: Internet Monitor diff --git a/services/invoicing/pom.xml b/services/invoicing/pom.xml index d3d9c2b0f2ff..5ada36169c0b 100644 --- a/services/invoicing/pom.xml +++ b/services/invoicing/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT invoicing AWS Java SDK :: Services :: Invoicing diff --git a/services/iot/pom.xml b/services/iot/pom.xml index 883140e1ff6c..7494cb8663f8 100644 --- a/services/iot/pom.xml +++ b/services/iot/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT iot AWS Java SDK :: Services :: AWS IoT diff --git a/services/iotanalytics/pom.xml b/services/iotanalytics/pom.xml index 9800a3d6c8f4..07656d321208 100644 --- a/services/iotanalytics/pom.xml +++ b/services/iotanalytics/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT iotanalytics AWS Java SDK :: Services :: IoTAnalytics diff --git a/services/iotdataplane/pom.xml b/services/iotdataplane/pom.xml index 756f4198b861..2b4a9f42882d 100644 --- a/services/iotdataplane/pom.xml +++ b/services/iotdataplane/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT iotdataplane AWS Java SDK :: Services :: AWS IoT Data Plane diff --git a/services/iotdeviceadvisor/pom.xml b/services/iotdeviceadvisor/pom.xml index 42f61575f843..452f59bc2a07 100644 --- a/services/iotdeviceadvisor/pom.xml +++ b/services/iotdeviceadvisor/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT iotdeviceadvisor AWS Java SDK :: Services :: Iot Device Advisor diff --git a/services/iotevents/pom.xml b/services/iotevents/pom.xml index be3a5a093f26..1b4816fce5ba 100644 --- a/services/iotevents/pom.xml +++ b/services/iotevents/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT iotevents AWS Java SDK :: Services :: IoT Events diff --git a/services/ioteventsdata/pom.xml b/services/ioteventsdata/pom.xml index a87a739351fb..48e0c3c0b005 100644 --- a/services/ioteventsdata/pom.xml +++ b/services/ioteventsdata/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT ioteventsdata AWS Java SDK :: Services :: IoT Events Data diff --git a/services/iotfleethub/pom.xml b/services/iotfleethub/pom.xml index e481e05d939a..970d3fe4023c 100644 --- a/services/iotfleethub/pom.xml +++ b/services/iotfleethub/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT iotfleethub AWS Java SDK :: Services :: Io T Fleet Hub diff --git a/services/iotfleetwise/pom.xml b/services/iotfleetwise/pom.xml index cdec1c3d3ef8..33e3556765e4 100644 --- a/services/iotfleetwise/pom.xml +++ b/services/iotfleetwise/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT iotfleetwise AWS Java SDK :: Services :: Io T Fleet Wise diff --git a/services/iotjobsdataplane/pom.xml b/services/iotjobsdataplane/pom.xml index 3e74c306b6a5..0bbd9aa9ff14 100644 --- a/services/iotjobsdataplane/pom.xml +++ b/services/iotjobsdataplane/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT iotjobsdataplane AWS Java SDK :: Services :: IoT Jobs Data Plane diff --git a/services/iotmanagedintegrations/pom.xml b/services/iotmanagedintegrations/pom.xml index b9d7618fd64a..ed63646b794a 100644 --- a/services/iotmanagedintegrations/pom.xml +++ b/services/iotmanagedintegrations/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT iotmanagedintegrations AWS Java SDK :: Services :: IoT Managed Integrations diff --git a/services/iotsecuretunneling/pom.xml b/services/iotsecuretunneling/pom.xml index 1d75be06fd25..31f0e6c77c31 100644 --- a/services/iotsecuretunneling/pom.xml +++ b/services/iotsecuretunneling/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT iotsecuretunneling AWS Java SDK :: Services :: IoTSecureTunneling diff --git a/services/iotsitewise/pom.xml b/services/iotsitewise/pom.xml index bb51f26bdf97..b2b6330332f5 100644 --- a/services/iotsitewise/pom.xml +++ b/services/iotsitewise/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT iotsitewise AWS Java SDK :: Services :: Io T Site Wise diff --git a/services/iotthingsgraph/pom.xml b/services/iotthingsgraph/pom.xml index 2d17f7f26658..79123bd804a8 100644 --- a/services/iotthingsgraph/pom.xml +++ b/services/iotthingsgraph/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT iotthingsgraph AWS Java SDK :: Services :: IoTThingsGraph diff --git a/services/iottwinmaker/pom.xml b/services/iottwinmaker/pom.xml index 44dc60aa6be1..0188fca745e2 100644 --- a/services/iottwinmaker/pom.xml +++ b/services/iottwinmaker/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT iottwinmaker AWS Java SDK :: Services :: Io T Twin Maker diff --git a/services/iotwireless/pom.xml b/services/iotwireless/pom.xml index ad37e079f34b..835a5d40ab4a 100644 --- a/services/iotwireless/pom.xml +++ b/services/iotwireless/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT iotwireless AWS Java SDK :: Services :: IoT Wireless diff --git a/services/ivs/pom.xml b/services/ivs/pom.xml index de599aaecb30..61d7ce6f909c 100644 --- a/services/ivs/pom.xml +++ b/services/ivs/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT ivs AWS Java SDK :: Services :: Ivs diff --git a/services/ivschat/pom.xml b/services/ivschat/pom.xml index c0c1011c6a68..2bee49c0ad90 100644 --- a/services/ivschat/pom.xml +++ b/services/ivschat/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT ivschat AWS Java SDK :: Services :: Ivschat diff --git a/services/ivsrealtime/pom.xml b/services/ivsrealtime/pom.xml index a099d207577d..391dbed194b8 100644 --- a/services/ivsrealtime/pom.xml +++ b/services/ivsrealtime/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT ivsrealtime AWS Java SDK :: Services :: IVS Real Time diff --git a/services/kafka/pom.xml b/services/kafka/pom.xml index 904341e1f9a6..745e4ce376bd 100644 --- a/services/kafka/pom.xml +++ b/services/kafka/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT kafka AWS Java SDK :: Services :: Kafka diff --git a/services/kafkaconnect/pom.xml b/services/kafkaconnect/pom.xml index 6cb7b77fd231..1c1fc9a20363 100644 --- a/services/kafkaconnect/pom.xml +++ b/services/kafkaconnect/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT kafkaconnect AWS Java SDK :: Services :: Kafka Connect diff --git a/services/kendra/pom.xml b/services/kendra/pom.xml index 25f16f473831..4031540e064d 100644 --- a/services/kendra/pom.xml +++ b/services/kendra/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT kendra AWS Java SDK :: Services :: Kendra diff --git a/services/kendraranking/pom.xml b/services/kendraranking/pom.xml index eeec0c3386d0..dcaf74b5cf3e 100644 --- a/services/kendraranking/pom.xml +++ b/services/kendraranking/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT kendraranking AWS Java SDK :: Services :: Kendra Ranking diff --git a/services/keyspaces/pom.xml b/services/keyspaces/pom.xml index ee37a98dc9f4..3ffbe9ed1618 100644 --- a/services/keyspaces/pom.xml +++ b/services/keyspaces/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT keyspaces AWS Java SDK :: Services :: Keyspaces diff --git a/services/kinesis/pom.xml b/services/kinesis/pom.xml index 5012199604ad..3a1c62464038 100644 --- a/services/kinesis/pom.xml +++ b/services/kinesis/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT kinesis AWS Java SDK :: Services :: Amazon Kinesis diff --git a/services/kinesisanalytics/pom.xml b/services/kinesisanalytics/pom.xml index a71fbbebdec1..464b5527fda4 100644 --- a/services/kinesisanalytics/pom.xml +++ b/services/kinesisanalytics/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT kinesisanalytics AWS Java SDK :: Services :: Amazon Kinesis Analytics diff --git a/services/kinesisanalyticsv2/pom.xml b/services/kinesisanalyticsv2/pom.xml index 4b07edc09c0a..2fcf08347df6 100644 --- a/services/kinesisanalyticsv2/pom.xml +++ b/services/kinesisanalyticsv2/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT kinesisanalyticsv2 AWS Java SDK :: Services :: Kinesis Analytics V2 diff --git a/services/kinesisvideo/pom.xml b/services/kinesisvideo/pom.xml index eb6ff24b0b96..c8a0afb2427e 100644 --- a/services/kinesisvideo/pom.xml +++ b/services/kinesisvideo/pom.xml @@ -20,7 +20,7 @@ services software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 kinesisvideo diff --git a/services/kinesisvideoarchivedmedia/pom.xml b/services/kinesisvideoarchivedmedia/pom.xml index 9c58f3bc156d..d5d980d6fd8d 100644 --- a/services/kinesisvideoarchivedmedia/pom.xml +++ b/services/kinesisvideoarchivedmedia/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT kinesisvideoarchivedmedia AWS Java SDK :: Services :: Kinesis Video Archived Media diff --git a/services/kinesisvideomedia/pom.xml b/services/kinesisvideomedia/pom.xml index 06af46e8a659..01b0ac0333d4 100644 --- a/services/kinesisvideomedia/pom.xml +++ b/services/kinesisvideomedia/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT kinesisvideomedia AWS Java SDK :: Services :: Kinesis Video Media diff --git a/services/kinesisvideosignaling/pom.xml b/services/kinesisvideosignaling/pom.xml index c72a78f9d817..80d22686f529 100644 --- a/services/kinesisvideosignaling/pom.xml +++ b/services/kinesisvideosignaling/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT kinesisvideosignaling AWS Java SDK :: Services :: Kinesis Video Signaling diff --git a/services/kinesisvideowebrtcstorage/pom.xml b/services/kinesisvideowebrtcstorage/pom.xml index dae4950aa34c..c84b8582684a 100644 --- a/services/kinesisvideowebrtcstorage/pom.xml +++ b/services/kinesisvideowebrtcstorage/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT kinesisvideowebrtcstorage AWS Java SDK :: Services :: Kinesis Video Web RTC Storage diff --git a/services/kms/pom.xml b/services/kms/pom.xml index f821c174dc24..773bc2c683c6 100644 --- a/services/kms/pom.xml +++ b/services/kms/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT kms AWS Java SDK :: Services :: AWS KMS diff --git a/services/lakeformation/pom.xml b/services/lakeformation/pom.xml index a3164498d8bc..b6750d2fed3e 100644 --- a/services/lakeformation/pom.xml +++ b/services/lakeformation/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT lakeformation AWS Java SDK :: Services :: LakeFormation diff --git a/services/lambda/pom.xml b/services/lambda/pom.xml index f4e471a922cd..2afe4793b1a1 100644 --- a/services/lambda/pom.xml +++ b/services/lambda/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT lambda AWS Java SDK :: Services :: AWS Lambda diff --git a/services/launchwizard/pom.xml b/services/launchwizard/pom.xml index 87eee2ab23bd..14a73b1a9206 100644 --- a/services/launchwizard/pom.xml +++ b/services/launchwizard/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT launchwizard AWS Java SDK :: Services :: Launch Wizard diff --git a/services/lexmodelbuilding/pom.xml b/services/lexmodelbuilding/pom.xml index fb182e4757ac..7b9596b416a9 100644 --- a/services/lexmodelbuilding/pom.xml +++ b/services/lexmodelbuilding/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT lexmodelbuilding AWS Java SDK :: Services :: Amazon Lex Model Building diff --git a/services/lexmodelsv2/pom.xml b/services/lexmodelsv2/pom.xml index 1a3ff1e861ca..972b61e9b383 100644 --- a/services/lexmodelsv2/pom.xml +++ b/services/lexmodelsv2/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT lexmodelsv2 AWS Java SDK :: Services :: Lex Models V2 diff --git a/services/lexruntime/pom.xml b/services/lexruntime/pom.xml index 4168f88389ef..c6b8276e93e8 100644 --- a/services/lexruntime/pom.xml +++ b/services/lexruntime/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT lexruntime AWS Java SDK :: Services :: Amazon Lex Runtime diff --git a/services/lexruntimev2/pom.xml b/services/lexruntimev2/pom.xml index 937db99af56d..b254d9d991b0 100644 --- a/services/lexruntimev2/pom.xml +++ b/services/lexruntimev2/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT lexruntimev2 AWS Java SDK :: Services :: Lex Runtime V2 diff --git a/services/licensemanager/pom.xml b/services/licensemanager/pom.xml index 3784e6cee68d..2c1644f21c12 100644 --- a/services/licensemanager/pom.xml +++ b/services/licensemanager/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT licensemanager AWS Java SDK :: Services :: License Manager diff --git a/services/licensemanagerlinuxsubscriptions/pom.xml b/services/licensemanagerlinuxsubscriptions/pom.xml index 1d032064927b..12d4f7dbf1e3 100644 --- a/services/licensemanagerlinuxsubscriptions/pom.xml +++ b/services/licensemanagerlinuxsubscriptions/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT licensemanagerlinuxsubscriptions AWS Java SDK :: Services :: License Manager Linux Subscriptions diff --git a/services/licensemanagerusersubscriptions/pom.xml b/services/licensemanagerusersubscriptions/pom.xml index ef8993c5e088..01a957326ee5 100644 --- a/services/licensemanagerusersubscriptions/pom.xml +++ b/services/licensemanagerusersubscriptions/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT licensemanagerusersubscriptions AWS Java SDK :: Services :: License Manager User Subscriptions diff --git a/services/lightsail/pom.xml b/services/lightsail/pom.xml index 17e4dde3df6b..9d0336e02f96 100644 --- a/services/lightsail/pom.xml +++ b/services/lightsail/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT lightsail AWS Java SDK :: Services :: Amazon Lightsail diff --git a/services/location/pom.xml b/services/location/pom.xml index 7d10d6a0377d..b50f420db5de 100644 --- a/services/location/pom.xml +++ b/services/location/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT location AWS Java SDK :: Services :: Location diff --git a/services/lookoutequipment/pom.xml b/services/lookoutequipment/pom.xml index 291e0be75799..da8b1d17629b 100644 --- a/services/lookoutequipment/pom.xml +++ b/services/lookoutequipment/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT lookoutequipment AWS Java SDK :: Services :: Lookout Equipment diff --git a/services/lookoutmetrics/pom.xml b/services/lookoutmetrics/pom.xml index aee2e6a62bc9..95dc10567df9 100644 --- a/services/lookoutmetrics/pom.xml +++ b/services/lookoutmetrics/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT lookoutmetrics AWS Java SDK :: Services :: Lookout Metrics diff --git a/services/lookoutvision/pom.xml b/services/lookoutvision/pom.xml index b6998b486471..7bc52400c3d2 100644 --- a/services/lookoutvision/pom.xml +++ b/services/lookoutvision/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT lookoutvision AWS Java SDK :: Services :: Lookout Vision diff --git a/services/m2/pom.xml b/services/m2/pom.xml index 5b678c1f0855..5c1b407fd75d 100644 --- a/services/m2/pom.xml +++ b/services/m2/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT m2 AWS Java SDK :: Services :: M2 diff --git a/services/machinelearning/pom.xml b/services/machinelearning/pom.xml index 8e12b0b4ddd6..33f38461b7eb 100644 --- a/services/machinelearning/pom.xml +++ b/services/machinelearning/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT machinelearning AWS Java SDK :: Services :: Amazon Machine Learning diff --git a/services/macie2/pom.xml b/services/macie2/pom.xml index bc11fe9cdef9..4e7068830ce7 100644 --- a/services/macie2/pom.xml +++ b/services/macie2/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT macie2 AWS Java SDK :: Services :: Macie2 diff --git a/services/mailmanager/pom.xml b/services/mailmanager/pom.xml index bbce22e48335..3b24c61f9826 100644 --- a/services/mailmanager/pom.xml +++ b/services/mailmanager/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT mailmanager AWS Java SDK :: Services :: Mail Manager diff --git a/services/managedblockchain/pom.xml b/services/managedblockchain/pom.xml index 6d4e12188fdb..e7b265db7b10 100644 --- a/services/managedblockchain/pom.xml +++ b/services/managedblockchain/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT managedblockchain AWS Java SDK :: Services :: ManagedBlockchain diff --git a/services/managedblockchainquery/pom.xml b/services/managedblockchainquery/pom.xml index b15d638ec6b3..83240607c7c7 100644 --- a/services/managedblockchainquery/pom.xml +++ b/services/managedblockchainquery/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT managedblockchainquery AWS Java SDK :: Services :: Managed Blockchain Query diff --git a/services/marketplaceagreement/pom.xml b/services/marketplaceagreement/pom.xml index 92a761b31434..db3171d38077 100644 --- a/services/marketplaceagreement/pom.xml +++ b/services/marketplaceagreement/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT marketplaceagreement AWS Java SDK :: Services :: Marketplace Agreement diff --git a/services/marketplacecatalog/pom.xml b/services/marketplacecatalog/pom.xml index 5dc36a0a4d97..85f4e3234bce 100644 --- a/services/marketplacecatalog/pom.xml +++ b/services/marketplacecatalog/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT marketplacecatalog AWS Java SDK :: Services :: Marketplace Catalog diff --git a/services/marketplacecommerceanalytics/pom.xml b/services/marketplacecommerceanalytics/pom.xml index 3dbd88a618d6..93a5e7e2b856 100644 --- a/services/marketplacecommerceanalytics/pom.xml +++ b/services/marketplacecommerceanalytics/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT marketplacecommerceanalytics AWS Java SDK :: Services :: AWS Marketplace Commerce Analytics diff --git a/services/marketplacedeployment/pom.xml b/services/marketplacedeployment/pom.xml index d28cdf2225d0..943fb886dafb 100644 --- a/services/marketplacedeployment/pom.xml +++ b/services/marketplacedeployment/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT marketplacedeployment AWS Java SDK :: Services :: Marketplace Deployment diff --git a/services/marketplaceentitlement/pom.xml b/services/marketplaceentitlement/pom.xml index ea54a1d68462..b84a1c1f6d4e 100644 --- a/services/marketplaceentitlement/pom.xml +++ b/services/marketplaceentitlement/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT marketplaceentitlement AWS Java SDK :: Services :: AWS Marketplace Entitlement diff --git a/services/marketplacemetering/pom.xml b/services/marketplacemetering/pom.xml index 2444793f4655..c9c9626e1fb7 100644 --- a/services/marketplacemetering/pom.xml +++ b/services/marketplacemetering/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT marketplacemetering AWS Java SDK :: Services :: AWS Marketplace Metering Service diff --git a/services/marketplacereporting/pom.xml b/services/marketplacereporting/pom.xml index 7480bb625f98..b0422846cea4 100644 --- a/services/marketplacereporting/pom.xml +++ b/services/marketplacereporting/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT marketplacereporting AWS Java SDK :: Services :: Marketplace Reporting diff --git a/services/mediaconnect/pom.xml b/services/mediaconnect/pom.xml index 16b6925086af..df462d7a708e 100644 --- a/services/mediaconnect/pom.xml +++ b/services/mediaconnect/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT mediaconnect AWS Java SDK :: Services :: MediaConnect diff --git a/services/mediaconvert/pom.xml b/services/mediaconvert/pom.xml index 834e6b3a2990..353a8d434e90 100644 --- a/services/mediaconvert/pom.xml +++ b/services/mediaconvert/pom.xml @@ -20,7 +20,7 @@ services software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 mediaconvert diff --git a/services/medialive/pom.xml b/services/medialive/pom.xml index dffe6a08b6df..52864e59cf47 100644 --- a/services/medialive/pom.xml +++ b/services/medialive/pom.xml @@ -20,7 +20,7 @@ services software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 medialive diff --git a/services/mediapackage/pom.xml b/services/mediapackage/pom.xml index 218dcb0f4c61..e1a08dc18d1d 100644 --- a/services/mediapackage/pom.xml +++ b/services/mediapackage/pom.xml @@ -20,7 +20,7 @@ services software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 mediapackage diff --git a/services/mediapackagev2/pom.xml b/services/mediapackagev2/pom.xml index b8103fc41c9e..b64346116b10 100644 --- a/services/mediapackagev2/pom.xml +++ b/services/mediapackagev2/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT mediapackagev2 AWS Java SDK :: Services :: Media Package V2 diff --git a/services/mediapackagevod/pom.xml b/services/mediapackagevod/pom.xml index 89e4ad0b55c0..8de69f594a5b 100644 --- a/services/mediapackagevod/pom.xml +++ b/services/mediapackagevod/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT mediapackagevod AWS Java SDK :: Services :: MediaPackage Vod diff --git a/services/mediastore/pom.xml b/services/mediastore/pom.xml index 7c6bc50f47f9..fdb519fad0fc 100644 --- a/services/mediastore/pom.xml +++ b/services/mediastore/pom.xml @@ -20,7 +20,7 @@ services software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 mediastore diff --git a/services/mediastoredata/pom.xml b/services/mediastoredata/pom.xml index e67ad4600e10..89520ec82b13 100644 --- a/services/mediastoredata/pom.xml +++ b/services/mediastoredata/pom.xml @@ -20,7 +20,7 @@ services software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 mediastoredata diff --git a/services/mediatailor/pom.xml b/services/mediatailor/pom.xml index c926453445f2..4e3b97bc040b 100644 --- a/services/mediatailor/pom.xml +++ b/services/mediatailor/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT mediatailor AWS Java SDK :: Services :: MediaTailor diff --git a/services/medicalimaging/pom.xml b/services/medicalimaging/pom.xml index 59c14522ec63..37f1acead8fb 100644 --- a/services/medicalimaging/pom.xml +++ b/services/medicalimaging/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT medicalimaging AWS Java SDK :: Services :: Medical Imaging diff --git a/services/memorydb/pom.xml b/services/memorydb/pom.xml index 303d847c5f8d..e065918bed13 100644 --- a/services/memorydb/pom.xml +++ b/services/memorydb/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT memorydb AWS Java SDK :: Services :: Memory DB diff --git a/services/mgn/pom.xml b/services/mgn/pom.xml index 71c614ba5717..ac1ca88f610a 100644 --- a/services/mgn/pom.xml +++ b/services/mgn/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT mgn AWS Java SDK :: Services :: Mgn diff --git a/services/migrationhub/pom.xml b/services/migrationhub/pom.xml index 6714ccdb1d39..258da3595e36 100644 --- a/services/migrationhub/pom.xml +++ b/services/migrationhub/pom.xml @@ -20,7 +20,7 @@ services software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 migrationhub diff --git a/services/migrationhubconfig/pom.xml b/services/migrationhubconfig/pom.xml index 3f7b21b337d3..f0cd1411dae0 100644 --- a/services/migrationhubconfig/pom.xml +++ b/services/migrationhubconfig/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT migrationhubconfig AWS Java SDK :: Services :: MigrationHub Config diff --git a/services/migrationhuborchestrator/pom.xml b/services/migrationhuborchestrator/pom.xml index 65eed46d7ad5..0492844e3c92 100644 --- a/services/migrationhuborchestrator/pom.xml +++ b/services/migrationhuborchestrator/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT migrationhuborchestrator AWS Java SDK :: Services :: Migration Hub Orchestrator diff --git a/services/migrationhubrefactorspaces/pom.xml b/services/migrationhubrefactorspaces/pom.xml index f88511626ae2..ddec474a8150 100644 --- a/services/migrationhubrefactorspaces/pom.xml +++ b/services/migrationhubrefactorspaces/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT migrationhubrefactorspaces AWS Java SDK :: Services :: Migration Hub Refactor Spaces diff --git a/services/migrationhubstrategy/pom.xml b/services/migrationhubstrategy/pom.xml index 349c37956890..ec488c1fef68 100644 --- a/services/migrationhubstrategy/pom.xml +++ b/services/migrationhubstrategy/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT migrationhubstrategy AWS Java SDK :: Services :: Migration Hub Strategy diff --git a/services/mq/pom.xml b/services/mq/pom.xml index 4328499c57f9..c7fffc435a56 100644 --- a/services/mq/pom.xml +++ b/services/mq/pom.xml @@ -20,7 +20,7 @@ services software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 mq diff --git a/services/mturk/pom.xml b/services/mturk/pom.xml index 8f8cfef18c4e..66808d3f8628 100644 --- a/services/mturk/pom.xml +++ b/services/mturk/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT mturk AWS Java SDK :: Services :: Amazon Mechanical Turk Requester diff --git a/services/mwaa/pom.xml b/services/mwaa/pom.xml index d1f84bdcfbb2..2afdaae25301 100644 --- a/services/mwaa/pom.xml +++ b/services/mwaa/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT mwaa AWS Java SDK :: Services :: MWAA diff --git a/services/neptune/pom.xml b/services/neptune/pom.xml index d74107706d61..70a8938eceef 100644 --- a/services/neptune/pom.xml +++ b/services/neptune/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT neptune AWS Java SDK :: Services :: Neptune diff --git a/services/neptunedata/pom.xml b/services/neptunedata/pom.xml index 9f9c257cacd1..b471dcc0d3db 100644 --- a/services/neptunedata/pom.xml +++ b/services/neptunedata/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT neptunedata AWS Java SDK :: Services :: Neptunedata diff --git a/services/neptunegraph/pom.xml b/services/neptunegraph/pom.xml index 38c8ea1bef0b..9315a48da3ab 100644 --- a/services/neptunegraph/pom.xml +++ b/services/neptunegraph/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT neptunegraph AWS Java SDK :: Services :: Neptune Graph diff --git a/services/networkfirewall/pom.xml b/services/networkfirewall/pom.xml index 849f10d0179b..6d5dc6ef1fc5 100644 --- a/services/networkfirewall/pom.xml +++ b/services/networkfirewall/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT networkfirewall AWS Java SDK :: Services :: Network Firewall diff --git a/services/networkflowmonitor/pom.xml b/services/networkflowmonitor/pom.xml index 75d2877f8bb0..9c21120014d6 100644 --- a/services/networkflowmonitor/pom.xml +++ b/services/networkflowmonitor/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT networkflowmonitor AWS Java SDK :: Services :: Network Flow Monitor diff --git a/services/networkmanager/pom.xml b/services/networkmanager/pom.xml index 8490d732ce9b..8f5ce7c3fc2a 100644 --- a/services/networkmanager/pom.xml +++ b/services/networkmanager/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT networkmanager AWS Java SDK :: Services :: NetworkManager diff --git a/services/networkmonitor/pom.xml b/services/networkmonitor/pom.xml index d081ea6632ca..77acda4c25bb 100644 --- a/services/networkmonitor/pom.xml +++ b/services/networkmonitor/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT networkmonitor AWS Java SDK :: Services :: Network Monitor diff --git a/services/notifications/pom.xml b/services/notifications/pom.xml index 68a69d44beb1..e7f668e894dd 100644 --- a/services/notifications/pom.xml +++ b/services/notifications/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT notifications AWS Java SDK :: Services :: Notifications diff --git a/services/notificationscontacts/pom.xml b/services/notificationscontacts/pom.xml index b0368d39e313..74593fe2f4e5 100644 --- a/services/notificationscontacts/pom.xml +++ b/services/notificationscontacts/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT notificationscontacts AWS Java SDK :: Services :: Notifications Contacts diff --git a/services/oam/pom.xml b/services/oam/pom.xml index 706042d8e8f1..143bf95c84c0 100644 --- a/services/oam/pom.xml +++ b/services/oam/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT oam AWS Java SDK :: Services :: OAM diff --git a/services/observabilityadmin/pom.xml b/services/observabilityadmin/pom.xml index 5ab4be82fe24..5c5b7e80baf9 100644 --- a/services/observabilityadmin/pom.xml +++ b/services/observabilityadmin/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT observabilityadmin AWS Java SDK :: Services :: Observability Admin diff --git a/services/omics/pom.xml b/services/omics/pom.xml index 73b5b98abc7a..aaf02e3ec850 100644 --- a/services/omics/pom.xml +++ b/services/omics/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT omics AWS Java SDK :: Services :: Omics diff --git a/services/opensearch/pom.xml b/services/opensearch/pom.xml index 37c69ce054b4..513a0bd97e57 100644 --- a/services/opensearch/pom.xml +++ b/services/opensearch/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT opensearch AWS Java SDK :: Services :: Open Search diff --git a/services/opensearchserverless/pom.xml b/services/opensearchserverless/pom.xml index 21685c2f17ae..b396ddfe36fc 100644 --- a/services/opensearchserverless/pom.xml +++ b/services/opensearchserverless/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT opensearchserverless AWS Java SDK :: Services :: Open Search Serverless diff --git a/services/opsworks/pom.xml b/services/opsworks/pom.xml index cee6fc336ad3..2cd42f34ecfe 100644 --- a/services/opsworks/pom.xml +++ b/services/opsworks/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT opsworks AWS Java SDK :: Services :: AWS OpsWorks diff --git a/services/opsworkscm/pom.xml b/services/opsworkscm/pom.xml index 3f917639b51d..a2934dea9a94 100644 --- a/services/opsworkscm/pom.xml +++ b/services/opsworkscm/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT opsworkscm AWS Java SDK :: Services :: AWS OpsWorks for Chef Automate diff --git a/services/organizations/pom.xml b/services/organizations/pom.xml index 8033ceca7e65..27aac7074c12 100644 --- a/services/organizations/pom.xml +++ b/services/organizations/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT organizations AWS Java SDK :: Services :: AWS Organizations diff --git a/services/osis/pom.xml b/services/osis/pom.xml index 0bec41aeab55..d41180015220 100644 --- a/services/osis/pom.xml +++ b/services/osis/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT osis AWS Java SDK :: Services :: OSIS diff --git a/services/outposts/pom.xml b/services/outposts/pom.xml index 665db76346ea..881e5532a8cb 100644 --- a/services/outposts/pom.xml +++ b/services/outposts/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT outposts AWS Java SDK :: Services :: Outposts diff --git a/services/panorama/pom.xml b/services/panorama/pom.xml index cea94a711d15..c8f8b20f30f4 100644 --- a/services/panorama/pom.xml +++ b/services/panorama/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT panorama AWS Java SDK :: Services :: Panorama diff --git a/services/partnercentralselling/pom.xml b/services/partnercentralselling/pom.xml index 0aa0c5581cd7..b1958449ce99 100644 --- a/services/partnercentralselling/pom.xml +++ b/services/partnercentralselling/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT partnercentralselling AWS Java SDK :: Services :: Partner Central Selling diff --git a/services/paymentcryptography/pom.xml b/services/paymentcryptography/pom.xml index 9d1776de5767..4a1bdcd786e8 100644 --- a/services/paymentcryptography/pom.xml +++ b/services/paymentcryptography/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT paymentcryptography AWS Java SDK :: Services :: Payment Cryptography diff --git a/services/paymentcryptographydata/pom.xml b/services/paymentcryptographydata/pom.xml index 38d960bfb951..81664e82ab4c 100644 --- a/services/paymentcryptographydata/pom.xml +++ b/services/paymentcryptographydata/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT paymentcryptographydata AWS Java SDK :: Services :: Payment Cryptography Data diff --git a/services/pcaconnectorad/pom.xml b/services/pcaconnectorad/pom.xml index 5319258f6d83..007a769b9f41 100644 --- a/services/pcaconnectorad/pom.xml +++ b/services/pcaconnectorad/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT pcaconnectorad AWS Java SDK :: Services :: Pca Connector Ad diff --git a/services/pcaconnectorscep/pom.xml b/services/pcaconnectorscep/pom.xml index 52921ceaf3e9..ac5c612b478d 100644 --- a/services/pcaconnectorscep/pom.xml +++ b/services/pcaconnectorscep/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT pcaconnectorscep AWS Java SDK :: Services :: Pca Connector Scep diff --git a/services/pcs/pom.xml b/services/pcs/pom.xml index d05f0d8acf57..582d53e65a77 100644 --- a/services/pcs/pom.xml +++ b/services/pcs/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT pcs AWS Java SDK :: Services :: PCS diff --git a/services/personalize/pom.xml b/services/personalize/pom.xml index 084ab2ce7bf6..7f054d211dfb 100644 --- a/services/personalize/pom.xml +++ b/services/personalize/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT personalize AWS Java SDK :: Services :: Personalize diff --git a/services/personalizeevents/pom.xml b/services/personalizeevents/pom.xml index a4d3c7f78beb..7981809c66c7 100644 --- a/services/personalizeevents/pom.xml +++ b/services/personalizeevents/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT personalizeevents AWS Java SDK :: Services :: Personalize Events diff --git a/services/personalizeruntime/pom.xml b/services/personalizeruntime/pom.xml index ab72d14fcd21..914d6e9748cb 100644 --- a/services/personalizeruntime/pom.xml +++ b/services/personalizeruntime/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT personalizeruntime AWS Java SDK :: Services :: Personalize Runtime diff --git a/services/pi/pom.xml b/services/pi/pom.xml index f9a1f9d6b584..581290b34fb8 100644 --- a/services/pi/pom.xml +++ b/services/pi/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT pi AWS Java SDK :: Services :: PI diff --git a/services/pinpoint/pom.xml b/services/pinpoint/pom.xml index 08861eec4fc9..6aa92f79662b 100644 --- a/services/pinpoint/pom.xml +++ b/services/pinpoint/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT pinpoint AWS Java SDK :: Services :: Amazon Pinpoint diff --git a/services/pinpointemail/pom.xml b/services/pinpointemail/pom.xml index 7cbbb3c7fc31..28103fd78c4e 100644 --- a/services/pinpointemail/pom.xml +++ b/services/pinpointemail/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT pinpointemail AWS Java SDK :: Services :: Pinpoint Email diff --git a/services/pinpointsmsvoice/pom.xml b/services/pinpointsmsvoice/pom.xml index 0b16dc7b1a98..4d080455e3e0 100644 --- a/services/pinpointsmsvoice/pom.xml +++ b/services/pinpointsmsvoice/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT pinpointsmsvoice AWS Java SDK :: Services :: Pinpoint SMS Voice diff --git a/services/pinpointsmsvoicev2/pom.xml b/services/pinpointsmsvoicev2/pom.xml index 3d342609c842..f84740b0dd6f 100644 --- a/services/pinpointsmsvoicev2/pom.xml +++ b/services/pinpointsmsvoicev2/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT pinpointsmsvoicev2 AWS Java SDK :: Services :: Pinpoint SMS Voice V2 diff --git a/services/pipes/pom.xml b/services/pipes/pom.xml index b22ff2c0e557..1603b7733146 100644 --- a/services/pipes/pom.xml +++ b/services/pipes/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT pipes AWS Java SDK :: Services :: Pipes diff --git a/services/polly/pom.xml b/services/polly/pom.xml index 5315d10c3aec..c9472a30a6fa 100644 --- a/services/polly/pom.xml +++ b/services/polly/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT polly AWS Java SDK :: Services :: Amazon Polly diff --git a/services/pom.xml b/services/pom.xml index b494b04d645f..347d303f965d 100644 --- a/services/pom.xml +++ b/services/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk aws-sdk-java-pom - 2.31.19 + 2.31.20-SNAPSHOT services AWS Java SDK :: Services diff --git a/services/pricing/pom.xml b/services/pricing/pom.xml index 4baaa3072780..a127f0213835 100644 --- a/services/pricing/pom.xml +++ b/services/pricing/pom.xml @@ -20,7 +20,7 @@ services software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 pricing diff --git a/services/privatenetworks/pom.xml b/services/privatenetworks/pom.xml index 3d8870d3c6ca..7d3c861a5abf 100644 --- a/services/privatenetworks/pom.xml +++ b/services/privatenetworks/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT privatenetworks AWS Java SDK :: Services :: Private Networks diff --git a/services/proton/pom.xml b/services/proton/pom.xml index 804f626dcca5..0685f2b9e6a8 100644 --- a/services/proton/pom.xml +++ b/services/proton/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT proton AWS Java SDK :: Services :: Proton diff --git a/services/qapps/pom.xml b/services/qapps/pom.xml index 074512c0c2e9..915338708a6d 100644 --- a/services/qapps/pom.xml +++ b/services/qapps/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT qapps AWS Java SDK :: Services :: Q Apps diff --git a/services/qbusiness/pom.xml b/services/qbusiness/pom.xml index da171c18ddea..9d1d03f2c94a 100644 --- a/services/qbusiness/pom.xml +++ b/services/qbusiness/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT qbusiness AWS Java SDK :: Services :: Q Business diff --git a/services/qconnect/pom.xml b/services/qconnect/pom.xml index 7e41d52288c5..3c3511f42bb1 100644 --- a/services/qconnect/pom.xml +++ b/services/qconnect/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT qconnect AWS Java SDK :: Services :: Q Connect diff --git a/services/qldb/pom.xml b/services/qldb/pom.xml index 3f4c4f78c9e1..d5abfd919267 100644 --- a/services/qldb/pom.xml +++ b/services/qldb/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT qldb AWS Java SDK :: Services :: QLDB diff --git a/services/qldbsession/pom.xml b/services/qldbsession/pom.xml index be92d5c8c34b..b233ba40ac38 100644 --- a/services/qldbsession/pom.xml +++ b/services/qldbsession/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT qldbsession AWS Java SDK :: Services :: QLDB Session diff --git a/services/quicksight/pom.xml b/services/quicksight/pom.xml index b5a784565e23..7fddba57d21e 100644 --- a/services/quicksight/pom.xml +++ b/services/quicksight/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT quicksight AWS Java SDK :: Services :: QuickSight diff --git a/services/ram/pom.xml b/services/ram/pom.xml index 7e55be6ef8b5..2b6311ddc6df 100644 --- a/services/ram/pom.xml +++ b/services/ram/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT ram AWS Java SDK :: Services :: RAM diff --git a/services/rbin/pom.xml b/services/rbin/pom.xml index dad62eb2d60d..cc4185da9e65 100644 --- a/services/rbin/pom.xml +++ b/services/rbin/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT rbin AWS Java SDK :: Services :: Rbin diff --git a/services/rds/pom.xml b/services/rds/pom.xml index d944513985ac..66f2008c6b08 100644 --- a/services/rds/pom.xml +++ b/services/rds/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT rds AWS Java SDK :: Services :: Amazon RDS diff --git a/services/rdsdata/pom.xml b/services/rdsdata/pom.xml index 49018fda5fa2..bd77846420e2 100644 --- a/services/rdsdata/pom.xml +++ b/services/rdsdata/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT rdsdata AWS Java SDK :: Services :: RDS Data diff --git a/services/redshift/pom.xml b/services/redshift/pom.xml index 98006d313286..58ad85e78dae 100644 --- a/services/redshift/pom.xml +++ b/services/redshift/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT redshift AWS Java SDK :: Services :: Amazon Redshift diff --git a/services/redshiftdata/pom.xml b/services/redshiftdata/pom.xml index 68df927befce..b186179bd49c 100644 --- a/services/redshiftdata/pom.xml +++ b/services/redshiftdata/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT redshiftdata AWS Java SDK :: Services :: Redshift Data diff --git a/services/redshiftserverless/pom.xml b/services/redshiftserverless/pom.xml index cb48f4ea619e..b2276b3760ef 100644 --- a/services/redshiftserverless/pom.xml +++ b/services/redshiftserverless/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT redshiftserverless AWS Java SDK :: Services :: Redshift Serverless diff --git a/services/rekognition/pom.xml b/services/rekognition/pom.xml index 73393fda561b..c1183fdfe972 100644 --- a/services/rekognition/pom.xml +++ b/services/rekognition/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT rekognition AWS Java SDK :: Services :: Amazon Rekognition diff --git a/services/repostspace/pom.xml b/services/repostspace/pom.xml index 54ca510d2811..e81f6dc7cd40 100644 --- a/services/repostspace/pom.xml +++ b/services/repostspace/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT repostspace AWS Java SDK :: Services :: Repostspace diff --git a/services/resiliencehub/pom.xml b/services/resiliencehub/pom.xml index 9bf41faf2df7..8e7db25a85ce 100644 --- a/services/resiliencehub/pom.xml +++ b/services/resiliencehub/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT resiliencehub AWS Java SDK :: Services :: Resiliencehub diff --git a/services/resourceexplorer2/pom.xml b/services/resourceexplorer2/pom.xml index db00b6192cd5..30b666a03ea7 100644 --- a/services/resourceexplorer2/pom.xml +++ b/services/resourceexplorer2/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT resourceexplorer2 AWS Java SDK :: Services :: Resource Explorer 2 diff --git a/services/resourcegroups/pom.xml b/services/resourcegroups/pom.xml index a09c96558b7b..f6a2f097cd9c 100644 --- a/services/resourcegroups/pom.xml +++ b/services/resourcegroups/pom.xml @@ -20,7 +20,7 @@ services software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 resourcegroups diff --git a/services/resourcegroupstaggingapi/pom.xml b/services/resourcegroupstaggingapi/pom.xml index 5df9da7ece84..3529b173552e 100644 --- a/services/resourcegroupstaggingapi/pom.xml +++ b/services/resourcegroupstaggingapi/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT resourcegroupstaggingapi AWS Java SDK :: Services :: AWS Resource Groups Tagging API diff --git a/services/robomaker/pom.xml b/services/robomaker/pom.xml index 4e5335090766..f5bb7aa99f17 100644 --- a/services/robomaker/pom.xml +++ b/services/robomaker/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT robomaker AWS Java SDK :: Services :: RoboMaker diff --git a/services/rolesanywhere/pom.xml b/services/rolesanywhere/pom.xml index 0dd775cf8870..c51cf50443f4 100644 --- a/services/rolesanywhere/pom.xml +++ b/services/rolesanywhere/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT rolesanywhere AWS Java SDK :: Services :: Roles Anywhere diff --git a/services/route53/pom.xml b/services/route53/pom.xml index 9df81ce38039..35b0bcea86c2 100644 --- a/services/route53/pom.xml +++ b/services/route53/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT route53 AWS Java SDK :: Services :: Amazon Route53 diff --git a/services/route53domains/pom.xml b/services/route53domains/pom.xml index 7b8bde987665..420a06b992bc 100644 --- a/services/route53domains/pom.xml +++ b/services/route53domains/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT route53domains AWS Java SDK :: Services :: Amazon Route53 Domains diff --git a/services/route53profiles/pom.xml b/services/route53profiles/pom.xml index 7e4ffaa904de..b0d6f40e4220 100644 --- a/services/route53profiles/pom.xml +++ b/services/route53profiles/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT route53profiles AWS Java SDK :: Services :: Route53 Profiles diff --git a/services/route53recoverycluster/pom.xml b/services/route53recoverycluster/pom.xml index 92bdc37e6030..119e86bebe63 100644 --- a/services/route53recoverycluster/pom.xml +++ b/services/route53recoverycluster/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT route53recoverycluster AWS Java SDK :: Services :: Route53 Recovery Cluster diff --git a/services/route53recoverycontrolconfig/pom.xml b/services/route53recoverycontrolconfig/pom.xml index 0dec645fd6c4..d858fa8d8a37 100644 --- a/services/route53recoverycontrolconfig/pom.xml +++ b/services/route53recoverycontrolconfig/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT route53recoverycontrolconfig AWS Java SDK :: Services :: Route53 Recovery Control Config diff --git a/services/route53recoveryreadiness/pom.xml b/services/route53recoveryreadiness/pom.xml index 25ea8bcf7c00..cbe383581790 100644 --- a/services/route53recoveryreadiness/pom.xml +++ b/services/route53recoveryreadiness/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT route53recoveryreadiness AWS Java SDK :: Services :: Route53 Recovery Readiness diff --git a/services/route53resolver/pom.xml b/services/route53resolver/pom.xml index 3e2c5d57b796..d57db89d34aa 100644 --- a/services/route53resolver/pom.xml +++ b/services/route53resolver/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT route53resolver AWS Java SDK :: Services :: Route53Resolver diff --git a/services/rum/pom.xml b/services/rum/pom.xml index eb67f4b756b9..705b79f83263 100644 --- a/services/rum/pom.xml +++ b/services/rum/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT rum AWS Java SDK :: Services :: RUM diff --git a/services/s3/pom.xml b/services/s3/pom.xml index 4bc0089f97fb..d91b2f9ef599 100644 --- a/services/s3/pom.xml +++ b/services/s3/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT s3 AWS Java SDK :: Services :: Amazon S3 diff --git a/services/s3control/pom.xml b/services/s3control/pom.xml index 30c15cdedd9c..4861f76b4496 100644 --- a/services/s3control/pom.xml +++ b/services/s3control/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT s3control AWS Java SDK :: Services :: Amazon S3 Control diff --git a/services/s3outposts/pom.xml b/services/s3outposts/pom.xml index 7cdf5b47b08c..7a067f1cb160 100644 --- a/services/s3outposts/pom.xml +++ b/services/s3outposts/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT s3outposts AWS Java SDK :: Services :: S3 Outposts diff --git a/services/s3tables/pom.xml b/services/s3tables/pom.xml index 31ddf61f5a7a..1276b6c9fb20 100644 --- a/services/s3tables/pom.xml +++ b/services/s3tables/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT s3tables AWS Java SDK :: Services :: S3 Tables diff --git a/services/sagemaker/pom.xml b/services/sagemaker/pom.xml index 0930cdb7a87e..1f4b9eea7adc 100644 --- a/services/sagemaker/pom.xml +++ b/services/sagemaker/pom.xml @@ -20,7 +20,7 @@ services software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 sagemaker diff --git a/services/sagemakera2iruntime/pom.xml b/services/sagemakera2iruntime/pom.xml index 5c149ee718f8..c1f6d4c8e66e 100644 --- a/services/sagemakera2iruntime/pom.xml +++ b/services/sagemakera2iruntime/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT sagemakera2iruntime AWS Java SDK :: Services :: SageMaker A2I Runtime diff --git a/services/sagemakeredge/pom.xml b/services/sagemakeredge/pom.xml index 8cee9b916d4f..6243c6dc40d1 100644 --- a/services/sagemakeredge/pom.xml +++ b/services/sagemakeredge/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT sagemakeredge AWS Java SDK :: Services :: Sagemaker Edge diff --git a/services/sagemakerfeaturestoreruntime/pom.xml b/services/sagemakerfeaturestoreruntime/pom.xml index c8f1b8908804..8a4e80fa6c38 100644 --- a/services/sagemakerfeaturestoreruntime/pom.xml +++ b/services/sagemakerfeaturestoreruntime/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT sagemakerfeaturestoreruntime AWS Java SDK :: Services :: Sage Maker Feature Store Runtime diff --git a/services/sagemakergeospatial/pom.xml b/services/sagemakergeospatial/pom.xml index 839a23833241..eedd9e9e9bbc 100644 --- a/services/sagemakergeospatial/pom.xml +++ b/services/sagemakergeospatial/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT sagemakergeospatial AWS Java SDK :: Services :: Sage Maker Geospatial diff --git a/services/sagemakermetrics/pom.xml b/services/sagemakermetrics/pom.xml index 39f5da09b976..70a6e4cab234 100644 --- a/services/sagemakermetrics/pom.xml +++ b/services/sagemakermetrics/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT sagemakermetrics AWS Java SDK :: Services :: Sage Maker Metrics diff --git a/services/sagemakerruntime/pom.xml b/services/sagemakerruntime/pom.xml index 47988eaa7372..741913854ecc 100644 --- a/services/sagemakerruntime/pom.xml +++ b/services/sagemakerruntime/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT sagemakerruntime AWS Java SDK :: Services :: SageMaker Runtime diff --git a/services/savingsplans/pom.xml b/services/savingsplans/pom.xml index 5a4b0041800f..8ae23e45d4e4 100644 --- a/services/savingsplans/pom.xml +++ b/services/savingsplans/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT savingsplans AWS Java SDK :: Services :: Savingsplans diff --git a/services/scheduler/pom.xml b/services/scheduler/pom.xml index 75f119dfbc06..b8a732c65963 100644 --- a/services/scheduler/pom.xml +++ b/services/scheduler/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT scheduler AWS Java SDK :: Services :: Scheduler diff --git a/services/schemas/pom.xml b/services/schemas/pom.xml index 973055e59033..53531e8f60d2 100644 --- a/services/schemas/pom.xml +++ b/services/schemas/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT schemas AWS Java SDK :: Services :: Schemas diff --git a/services/secretsmanager/pom.xml b/services/secretsmanager/pom.xml index 8c6b5a3b26f5..e246341bedb1 100644 --- a/services/secretsmanager/pom.xml +++ b/services/secretsmanager/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT secretsmanager AWS Java SDK :: Services :: AWS Secrets Manager diff --git a/services/securityhub/pom.xml b/services/securityhub/pom.xml index e8e692b6838c..b7cff98e3ee8 100644 --- a/services/securityhub/pom.xml +++ b/services/securityhub/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT securityhub AWS Java SDK :: Services :: SecurityHub diff --git a/services/securityir/pom.xml b/services/securityir/pom.xml index 8a233eed7cca..691728d08a46 100644 --- a/services/securityir/pom.xml +++ b/services/securityir/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT securityir AWS Java SDK :: Services :: Security IR diff --git a/services/securitylake/pom.xml b/services/securitylake/pom.xml index aee7a6ce0f26..9451d96ad16a 100644 --- a/services/securitylake/pom.xml +++ b/services/securitylake/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT securitylake AWS Java SDK :: Services :: Security Lake diff --git a/services/serverlessapplicationrepository/pom.xml b/services/serverlessapplicationrepository/pom.xml index d12a701fb84e..29086f244a8f 100644 --- a/services/serverlessapplicationrepository/pom.xml +++ b/services/serverlessapplicationrepository/pom.xml @@ -20,7 +20,7 @@ services software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 serverlessapplicationrepository diff --git a/services/servicecatalog/pom.xml b/services/servicecatalog/pom.xml index 24f4bf0d22f0..6ae13005143d 100644 --- a/services/servicecatalog/pom.xml +++ b/services/servicecatalog/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT servicecatalog AWS Java SDK :: Services :: AWS Service Catalog diff --git a/services/servicecatalogappregistry/pom.xml b/services/servicecatalogappregistry/pom.xml index 924bf207f808..fbefdce1a147 100644 --- a/services/servicecatalogappregistry/pom.xml +++ b/services/servicecatalogappregistry/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT servicecatalogappregistry AWS Java SDK :: Services :: Service Catalog App Registry diff --git a/services/servicediscovery/pom.xml b/services/servicediscovery/pom.xml index de1ae157122a..db27611d3ffb 100644 --- a/services/servicediscovery/pom.xml +++ b/services/servicediscovery/pom.xml @@ -20,7 +20,7 @@ services software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 servicediscovery diff --git a/services/servicequotas/pom.xml b/services/servicequotas/pom.xml index c37ce9848dda..ae2cf96eb68f 100644 --- a/services/servicequotas/pom.xml +++ b/services/servicequotas/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT servicequotas AWS Java SDK :: Services :: Service Quotas diff --git a/services/ses/pom.xml b/services/ses/pom.xml index a9f630cf92c6..0ae723bc15f0 100644 --- a/services/ses/pom.xml +++ b/services/ses/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT ses AWS Java SDK :: Services :: Amazon SES diff --git a/services/sesv2/pom.xml b/services/sesv2/pom.xml index 41489722cbe4..472554656092 100644 --- a/services/sesv2/pom.xml +++ b/services/sesv2/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT sesv2 AWS Java SDK :: Services :: SESv2 diff --git a/services/sfn/pom.xml b/services/sfn/pom.xml index 4dcc34842ee8..10bc18c85e8c 100644 --- a/services/sfn/pom.xml +++ b/services/sfn/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT sfn AWS Java SDK :: Services :: AWS Step Functions diff --git a/services/shield/pom.xml b/services/shield/pom.xml index 9ed0818316d5..83fa1d34a105 100644 --- a/services/shield/pom.xml +++ b/services/shield/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT shield AWS Java SDK :: Services :: AWS Shield diff --git a/services/signer/pom.xml b/services/signer/pom.xml index 8b721bdb8f73..8789d2dfbf01 100644 --- a/services/signer/pom.xml +++ b/services/signer/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT signer AWS Java SDK :: Services :: Signer diff --git a/services/simspaceweaver/pom.xml b/services/simspaceweaver/pom.xml index 99100e35c78b..f8802b64a79f 100644 --- a/services/simspaceweaver/pom.xml +++ b/services/simspaceweaver/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT simspaceweaver AWS Java SDK :: Services :: Sim Space Weaver diff --git a/services/sms/pom.xml b/services/sms/pom.xml index 255739b42807..fe2997150e50 100644 --- a/services/sms/pom.xml +++ b/services/sms/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT sms AWS Java SDK :: Services :: AWS Server Migration diff --git a/services/snowball/pom.xml b/services/snowball/pom.xml index 1fe8c00adbf9..1f3bd51ebeb0 100644 --- a/services/snowball/pom.xml +++ b/services/snowball/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT snowball AWS Java SDK :: Services :: Amazon Snowball diff --git a/services/snowdevicemanagement/pom.xml b/services/snowdevicemanagement/pom.xml index 58e9f9902c5a..076d714a59c2 100644 --- a/services/snowdevicemanagement/pom.xml +++ b/services/snowdevicemanagement/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT snowdevicemanagement AWS Java SDK :: Services :: Snow Device Management diff --git a/services/sns/pom.xml b/services/sns/pom.xml index c820b268c784..f1c93b37068d 100644 --- a/services/sns/pom.xml +++ b/services/sns/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT sns AWS Java SDK :: Services :: Amazon SNS diff --git a/services/socialmessaging/pom.xml b/services/socialmessaging/pom.xml index 1ffbec9fe60e..96c003225bc5 100644 --- a/services/socialmessaging/pom.xml +++ b/services/socialmessaging/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT socialmessaging AWS Java SDK :: Services :: Social Messaging diff --git a/services/sqs/pom.xml b/services/sqs/pom.xml index 0f5858165643..6ad523be0bcc 100644 --- a/services/sqs/pom.xml +++ b/services/sqs/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT sqs AWS Java SDK :: Services :: Amazon SQS diff --git a/services/ssm/pom.xml b/services/ssm/pom.xml index 1ae67f60b199..2e3ecc49c3d2 100644 --- a/services/ssm/pom.xml +++ b/services/ssm/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT ssm AWS Java SDK :: Services :: AWS Simple Systems Management (SSM) diff --git a/services/ssmcontacts/pom.xml b/services/ssmcontacts/pom.xml index 7758e74065ab..eb3985858d71 100644 --- a/services/ssmcontacts/pom.xml +++ b/services/ssmcontacts/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT ssmcontacts AWS Java SDK :: Services :: SSM Contacts diff --git a/services/ssmincidents/pom.xml b/services/ssmincidents/pom.xml index 764fea515ca3..c3ad0dcbe610 100644 --- a/services/ssmincidents/pom.xml +++ b/services/ssmincidents/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT ssmincidents AWS Java SDK :: Services :: SSM Incidents diff --git a/services/ssmquicksetup/pom.xml b/services/ssmquicksetup/pom.xml index 83fb05ba231e..909f28d92f55 100644 --- a/services/ssmquicksetup/pom.xml +++ b/services/ssmquicksetup/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT ssmquicksetup AWS Java SDK :: Services :: SSM Quick Setup diff --git a/services/ssmsap/pom.xml b/services/ssmsap/pom.xml index 61a1a2590678..3874b4d272d8 100644 --- a/services/ssmsap/pom.xml +++ b/services/ssmsap/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT ssmsap AWS Java SDK :: Services :: Ssm Sap diff --git a/services/sso/pom.xml b/services/sso/pom.xml index 4e7492873b45..228476995fb1 100644 --- a/services/sso/pom.xml +++ b/services/sso/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT sso AWS Java SDK :: Services :: SSO diff --git a/services/ssoadmin/pom.xml b/services/ssoadmin/pom.xml index c883678e1d9d..8d615b98c48b 100644 --- a/services/ssoadmin/pom.xml +++ b/services/ssoadmin/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT ssoadmin AWS Java SDK :: Services :: SSO Admin diff --git a/services/ssooidc/pom.xml b/services/ssooidc/pom.xml index a11ce6638bce..33048d781a3f 100644 --- a/services/ssooidc/pom.xml +++ b/services/ssooidc/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT ssooidc AWS Java SDK :: Services :: SSO OIDC diff --git a/services/storagegateway/pom.xml b/services/storagegateway/pom.xml index 1e60b5052b34..416230bffa66 100644 --- a/services/storagegateway/pom.xml +++ b/services/storagegateway/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT storagegateway AWS Java SDK :: Services :: AWS Storage Gateway diff --git a/services/sts/pom.xml b/services/sts/pom.xml index 48f9ba92dd99..be5eaf99595f 100644 --- a/services/sts/pom.xml +++ b/services/sts/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT sts AWS Java SDK :: Services :: AWS STS diff --git a/services/supplychain/pom.xml b/services/supplychain/pom.xml index 23d6ef8a9752..01ae0f3fe776 100644 --- a/services/supplychain/pom.xml +++ b/services/supplychain/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT supplychain AWS Java SDK :: Services :: Supply Chain diff --git a/services/support/pom.xml b/services/support/pom.xml index 00d4d387e2ed..ef14f0b213a5 100644 --- a/services/support/pom.xml +++ b/services/support/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT support AWS Java SDK :: Services :: AWS Support diff --git a/services/supportapp/pom.xml b/services/supportapp/pom.xml index 0523f1b5a27b..fbd47e87fc39 100644 --- a/services/supportapp/pom.xml +++ b/services/supportapp/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT supportapp AWS Java SDK :: Services :: Support App diff --git a/services/swf/pom.xml b/services/swf/pom.xml index 0e67f871d6be..23a87312c527 100644 --- a/services/swf/pom.xml +++ b/services/swf/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT swf AWS Java SDK :: Services :: Amazon SWF diff --git a/services/synthetics/pom.xml b/services/synthetics/pom.xml index 0155a839fc95..20075e713e88 100644 --- a/services/synthetics/pom.xml +++ b/services/synthetics/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT synthetics AWS Java SDK :: Services :: Synthetics diff --git a/services/taxsettings/pom.xml b/services/taxsettings/pom.xml index 9673e2d29f9f..5dd7d9fc9e28 100644 --- a/services/taxsettings/pom.xml +++ b/services/taxsettings/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT taxsettings AWS Java SDK :: Services :: Tax Settings diff --git a/services/textract/pom.xml b/services/textract/pom.xml index b8be7f6dabdb..61a5022a6d3a 100644 --- a/services/textract/pom.xml +++ b/services/textract/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT textract AWS Java SDK :: Services :: Textract diff --git a/services/timestreaminfluxdb/pom.xml b/services/timestreaminfluxdb/pom.xml index c54200527827..637dfa41b4ac 100644 --- a/services/timestreaminfluxdb/pom.xml +++ b/services/timestreaminfluxdb/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT timestreaminfluxdb AWS Java SDK :: Services :: Timestream Influx DB diff --git a/services/timestreamquery/pom.xml b/services/timestreamquery/pom.xml index 0295088ad6c8..44aef6172de7 100644 --- a/services/timestreamquery/pom.xml +++ b/services/timestreamquery/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT timestreamquery AWS Java SDK :: Services :: Timestream Query diff --git a/services/timestreamwrite/pom.xml b/services/timestreamwrite/pom.xml index 9928c643575e..4dc4afff0c83 100644 --- a/services/timestreamwrite/pom.xml +++ b/services/timestreamwrite/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT timestreamwrite AWS Java SDK :: Services :: Timestream Write diff --git a/services/tnb/pom.xml b/services/tnb/pom.xml index f27e923e4419..2fa5519feb9b 100644 --- a/services/tnb/pom.xml +++ b/services/tnb/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT tnb AWS Java SDK :: Services :: Tnb diff --git a/services/transcribe/pom.xml b/services/transcribe/pom.xml index 73669d23a17f..8e70aab71323 100644 --- a/services/transcribe/pom.xml +++ b/services/transcribe/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT transcribe AWS Java SDK :: Services :: Transcribe diff --git a/services/transcribestreaming/pom.xml b/services/transcribestreaming/pom.xml index 1520b325886c..8138c3a06954 100644 --- a/services/transcribestreaming/pom.xml +++ b/services/transcribestreaming/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT transcribestreaming AWS Java SDK :: Services :: AWS Transcribe Streaming diff --git a/services/transfer/pom.xml b/services/transfer/pom.xml index ae19e41ec1d8..858ab3eb3992 100644 --- a/services/transfer/pom.xml +++ b/services/transfer/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT transfer AWS Java SDK :: Services :: Transfer diff --git a/services/translate/pom.xml b/services/translate/pom.xml index cb01ede1e887..174a17085a02 100644 --- a/services/translate/pom.xml +++ b/services/translate/pom.xml @@ -20,7 +20,7 @@ services software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 translate diff --git a/services/trustedadvisor/pom.xml b/services/trustedadvisor/pom.xml index 68cf88acf7e6..d8788c2ddc95 100644 --- a/services/trustedadvisor/pom.xml +++ b/services/trustedadvisor/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT trustedadvisor AWS Java SDK :: Services :: Trusted Advisor diff --git a/services/verifiedpermissions/pom.xml b/services/verifiedpermissions/pom.xml index ce1109ad15c2..b802ca954862 100644 --- a/services/verifiedpermissions/pom.xml +++ b/services/verifiedpermissions/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT verifiedpermissions AWS Java SDK :: Services :: Verified Permissions diff --git a/services/voiceid/pom.xml b/services/voiceid/pom.xml index 8814aa91bd3b..4d90f12149fe 100644 --- a/services/voiceid/pom.xml +++ b/services/voiceid/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT voiceid AWS Java SDK :: Services :: Voice ID diff --git a/services/vpclattice/pom.xml b/services/vpclattice/pom.xml index 29d7910e078a..267d0e73a14a 100644 --- a/services/vpclattice/pom.xml +++ b/services/vpclattice/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT vpclattice AWS Java SDK :: Services :: VPC Lattice diff --git a/services/waf/pom.xml b/services/waf/pom.xml index c132e90623b4..77d5d64b006f 100644 --- a/services/waf/pom.xml +++ b/services/waf/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT waf AWS Java SDK :: Services :: AWS WAF diff --git a/services/wafv2/pom.xml b/services/wafv2/pom.xml index 1e4437c2ae19..7935470bb9bc 100644 --- a/services/wafv2/pom.xml +++ b/services/wafv2/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT wafv2 AWS Java SDK :: Services :: WAFV2 diff --git a/services/wellarchitected/pom.xml b/services/wellarchitected/pom.xml index 381d5a9ab7d7..4c25e35fe761 100644 --- a/services/wellarchitected/pom.xml +++ b/services/wellarchitected/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT wellarchitected AWS Java SDK :: Services :: Well Architected diff --git a/services/wisdom/pom.xml b/services/wisdom/pom.xml index 1c3db55d2850..d829b02b2888 100644 --- a/services/wisdom/pom.xml +++ b/services/wisdom/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT wisdom AWS Java SDK :: Services :: Wisdom diff --git a/services/workdocs/pom.xml b/services/workdocs/pom.xml index 205b1d708a13..cc6cb3a56c46 100644 --- a/services/workdocs/pom.xml +++ b/services/workdocs/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT workdocs AWS Java SDK :: Services :: Amazon WorkDocs diff --git a/services/workmail/pom.xml b/services/workmail/pom.xml index 46522b8c969a..2de94d968953 100644 --- a/services/workmail/pom.xml +++ b/services/workmail/pom.xml @@ -20,7 +20,7 @@ services software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 workmail diff --git a/services/workmailmessageflow/pom.xml b/services/workmailmessageflow/pom.xml index 8efe306c7617..b2f103b95a8b 100644 --- a/services/workmailmessageflow/pom.xml +++ b/services/workmailmessageflow/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT workmailmessageflow AWS Java SDK :: Services :: WorkMailMessageFlow diff --git a/services/workspaces/pom.xml b/services/workspaces/pom.xml index f22d12128cf4..cf818a7e0d54 100644 --- a/services/workspaces/pom.xml +++ b/services/workspaces/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT workspaces AWS Java SDK :: Services :: Amazon WorkSpaces diff --git a/services/workspacesthinclient/pom.xml b/services/workspacesthinclient/pom.xml index dd53805ee8e4..8344526f3040 100644 --- a/services/workspacesthinclient/pom.xml +++ b/services/workspacesthinclient/pom.xml @@ -17,7 +17,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT workspacesthinclient AWS Java SDK :: Services :: Work Spaces Thin Client diff --git a/services/workspacesweb/pom.xml b/services/workspacesweb/pom.xml index 284aba97f6ea..06828d13f725 100644 --- a/services/workspacesweb/pom.xml +++ b/services/workspacesweb/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT workspacesweb AWS Java SDK :: Services :: Work Spaces Web diff --git a/services/xray/pom.xml b/services/xray/pom.xml index 52e2772f1547..ed61653b1fd3 100644 --- a/services/xray/pom.xml +++ b/services/xray/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk services - 2.31.19 + 2.31.20-SNAPSHOT xray AWS Java SDK :: Services :: AWS X-Ray diff --git a/test/architecture-tests/pom.xml b/test/architecture-tests/pom.xml index 6608902e237e..0112af2b9150 100644 --- a/test/architecture-tests/pom.xml +++ b/test/architecture-tests/pom.xml @@ -21,7 +21,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT ../../pom.xml diff --git a/test/auth-tests/pom.xml b/test/auth-tests/pom.xml index 607fb559373f..5f77e622839b 100644 --- a/test/auth-tests/pom.xml +++ b/test/auth-tests/pom.xml @@ -20,7 +20,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/test/bundle-logging-bridge-binding-test/pom.xml b/test/bundle-logging-bridge-binding-test/pom.xml index ed3e751bf076..b2c5b3a8ff81 100644 --- a/test/bundle-logging-bridge-binding-test/pom.xml +++ b/test/bundle-logging-bridge-binding-test/pom.xml @@ -20,7 +20,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/test/bundle-shading-tests/pom.xml b/test/bundle-shading-tests/pom.xml index b10c7bc9874b..02549d3bb231 100644 --- a/test/bundle-shading-tests/pom.xml +++ b/test/bundle-shading-tests/pom.xml @@ -20,7 +20,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/test/codegen-generated-classes-test/pom.xml b/test/codegen-generated-classes-test/pom.xml index 1df337534c3b..677750722895 100644 --- a/test/codegen-generated-classes-test/pom.xml +++ b/test/codegen-generated-classes-test/pom.xml @@ -21,7 +21,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT ../../pom.xml diff --git a/test/crt-unavailable-tests/pom.xml b/test/crt-unavailable-tests/pom.xml index 432a44834075..388e00d96361 100644 --- a/test/crt-unavailable-tests/pom.xml +++ b/test/crt-unavailable-tests/pom.xml @@ -20,7 +20,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/test/http-client-tests/pom.xml b/test/http-client-tests/pom.xml index 070b066818de..a445a4303981 100644 --- a/test/http-client-tests/pom.xml +++ b/test/http-client-tests/pom.xml @@ -21,7 +21,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT ../../pom.xml http-client-tests diff --git a/test/module-path-tests/pom.xml b/test/module-path-tests/pom.xml index 4291e7cc8d15..a2bdbad8c62f 100644 --- a/test/module-path-tests/pom.xml +++ b/test/module-path-tests/pom.xml @@ -20,7 +20,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/test/old-client-version-compatibility-test/pom.xml b/test/old-client-version-compatibility-test/pom.xml index 2e9427c473a1..783132274961 100644 --- a/test/old-client-version-compatibility-test/pom.xml +++ b/test/old-client-version-compatibility-test/pom.xml @@ -21,7 +21,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT ../../pom.xml diff --git a/test/protocol-tests-core/pom.xml b/test/protocol-tests-core/pom.xml index e189619424ea..add5bf8ab8ed 100644 --- a/test/protocol-tests-core/pom.xml +++ b/test/protocol-tests-core/pom.xml @@ -20,7 +20,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/test/protocol-tests/pom.xml b/test/protocol-tests/pom.xml index 684533be34c1..d6c74c5de096 100644 --- a/test/protocol-tests/pom.xml +++ b/test/protocol-tests/pom.xml @@ -20,7 +20,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/test/region-testing/pom.xml b/test/region-testing/pom.xml index 8b087424aaba..1938f51ca2ed 100644 --- a/test/region-testing/pom.xml +++ b/test/region-testing/pom.xml @@ -20,7 +20,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/test/ruleset-testing-core/pom.xml b/test/ruleset-testing-core/pom.xml index 1fa20a0fde9b..88812484eff8 100644 --- a/test/ruleset-testing-core/pom.xml +++ b/test/ruleset-testing-core/pom.xml @@ -20,7 +20,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/test/s3-benchmarks/pom.xml b/test/s3-benchmarks/pom.xml index 04cbf75c2480..089437d90f29 100644 --- a/test/s3-benchmarks/pom.xml +++ b/test/s3-benchmarks/pom.xml @@ -20,7 +20,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/test/s3-tests/pom.xml b/test/s3-tests/pom.xml index 2afb2ced5e15..926391e51c7a 100644 --- a/test/s3-tests/pom.xml +++ b/test/s3-tests/pom.xml @@ -20,7 +20,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/test/sdk-benchmarks/pom.xml b/test/sdk-benchmarks/pom.xml index 49af2069ffcb..2823ce9a7473 100644 --- a/test/sdk-benchmarks/pom.xml +++ b/test/sdk-benchmarks/pom.xml @@ -19,7 +19,7 @@ software.amazon.awssdk aws-sdk-java-pom - 2.31.19 + 2.31.20-SNAPSHOT ../../pom.xml diff --git a/test/sdk-native-image-test/pom.xml b/test/sdk-native-image-test/pom.xml index 3a7e8eee44ef..a89b283e75c5 100644 --- a/test/sdk-native-image-test/pom.xml +++ b/test/sdk-native-image-test/pom.xml @@ -20,7 +20,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/test/service-test-utils/pom.xml b/test/service-test-utils/pom.xml index 76241a3408db..870ae1d88a09 100644 --- a/test/service-test-utils/pom.xml +++ b/test/service-test-utils/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk aws-sdk-java-pom - 2.31.19 + 2.31.20-SNAPSHOT ../../pom.xml service-test-utils diff --git a/test/stability-tests/pom.xml b/test/stability-tests/pom.xml index 2aadc1395c5a..5bc357013708 100644 --- a/test/stability-tests/pom.xml +++ b/test/stability-tests/pom.xml @@ -20,7 +20,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/test/test-utils/pom.xml b/test/test-utils/pom.xml index 202d560358e2..3edbfc6b6183 100644 --- a/test/test-utils/pom.xml +++ b/test/test-utils/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk aws-sdk-java-pom - 2.31.19 + 2.31.20-SNAPSHOT ../../pom.xml test-utils diff --git a/test/tests-coverage-reporting/pom.xml b/test/tests-coverage-reporting/pom.xml index 05a5b98a5363..3a1aae239d5c 100644 --- a/test/tests-coverage-reporting/pom.xml +++ b/test/tests-coverage-reporting/pom.xml @@ -20,7 +20,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/test/v2-migration-tests/pom.xml b/test/v2-migration-tests/pom.xml index 39c848074afa..77d7229433d4 100644 --- a/test/v2-migration-tests/pom.xml +++ b/test/v2-migration-tests/pom.xml @@ -22,7 +22,7 @@ software.amazon.awssdk aws-sdk-java-pom - 2.31.19 + 2.31.20-SNAPSHOT ../.. diff --git a/third-party/pom.xml b/third-party/pom.xml index ffb5bcebfa6d..169124d5104e 100644 --- a/third-party/pom.xml +++ b/third-party/pom.xml @@ -21,7 +21,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT third-party diff --git a/third-party/third-party-jackson-core/pom.xml b/third-party/third-party-jackson-core/pom.xml index 9a7743c5c15e..e2365a9bd58e 100644 --- a/third-party/third-party-jackson-core/pom.xml +++ b/third-party/third-party-jackson-core/pom.xml @@ -20,7 +20,7 @@ third-party software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 diff --git a/third-party/third-party-jackson-dataformat-cbor/pom.xml b/third-party/third-party-jackson-dataformat-cbor/pom.xml index 285c4b102396..a7ceae45f0a3 100644 --- a/third-party/third-party-jackson-dataformat-cbor/pom.xml +++ b/third-party/third-party-jackson-dataformat-cbor/pom.xml @@ -20,7 +20,7 @@ third-party software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 diff --git a/third-party/third-party-slf4j-api/pom.xml b/third-party/third-party-slf4j-api/pom.xml index dc4025ab03b8..3706056abe8d 100644 --- a/third-party/third-party-slf4j-api/pom.xml +++ b/third-party/third-party-slf4j-api/pom.xml @@ -20,7 +20,7 @@ third-party software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 diff --git a/utils/pom.xml b/utils/pom.xml index 0c7de0b45b00..aba6cc4d34cd 100644 --- a/utils/pom.xml +++ b/utils/pom.xml @@ -20,7 +20,7 @@ aws-sdk-java-pom software.amazon.awssdk - 2.31.19 + 2.31.20-SNAPSHOT 4.0.0 diff --git a/v2-migration/pom.xml b/v2-migration/pom.xml index f64c1414d354..fe90be48e2ae 100644 --- a/v2-migration/pom.xml +++ b/v2-migration/pom.xml @@ -21,7 +21,7 @@ software.amazon.awssdk aws-sdk-java-pom - 2.31.19 + 2.31.20-SNAPSHOT ../pom.xml From b5e4483fe08d3753cf627fe8b4daa0b1af0a5359 Mon Sep 17 00:00:00 2001 From: Saranya Somepalli Date: Wed, 9 Apr 2025 16:49:59 -0700 Subject: [PATCH 22/22] Additional changes for updating non-streaming error unmarshaller --- .../amazon/awssdk/services/kinesis/KinesisExceptionTest.java | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename services/kinesis/src/{it => test}/java/software/amazon/awssdk/services/kinesis/KinesisExceptionTest.java (100%) diff --git a/services/kinesis/src/it/java/software/amazon/awssdk/services/kinesis/KinesisExceptionTest.java b/services/kinesis/src/test/java/software/amazon/awssdk/services/kinesis/KinesisExceptionTest.java similarity index 100% rename from services/kinesis/src/it/java/software/amazon/awssdk/services/kinesis/KinesisExceptionTest.java rename to services/kinesis/src/test/java/software/amazon/awssdk/services/kinesis/KinesisExceptionTest.java