|
65 | 65 | import software.amazon.awssdk.services.xml.model.EventStreamOperationResponseHandler;
|
66 | 66 | import software.amazon.awssdk.services.xml.model.GetOperationWithChecksumRequest;
|
67 | 67 | import software.amazon.awssdk.services.xml.model.GetOperationWithChecksumResponse;
|
| 68 | +import software.amazon.awssdk.services.xml.model.InvalidInputException; |
68 | 69 | import software.amazon.awssdk.services.xml.model.OperationWithChecksumRequiredRequest;
|
69 | 70 | import software.amazon.awssdk.services.xml.model.OperationWithChecksumRequiredResponse;
|
70 | 71 | import software.amazon.awssdk.services.xml.model.OperationWithNoneAuthTypeRequest;
|
@@ -158,6 +159,19 @@ public CompletableFuture<APostOperationResponse> aPostOperation(APostOperationRe
|
158 | 159 | HttpResponseHandler<Response<APostOperationResponse>> responseHandler = protocolFactory
|
159 | 160 | .createCombinedResponseHandler(APostOperationResponse::builder,
|
160 | 161 | new XmlOperationMetadata().withHasStreamingSuccessResponse(false));
|
| 162 | + |
| 163 | + Function<String, Optional<ExceptionMetadata>> exceptionMetadataMapper = errorCode -> { |
| 164 | + switch (errorCode) { |
| 165 | + case "InvalidInput": |
| 166 | + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) |
| 167 | + .exceptionBuilderSupplier(InvalidInputException::builder).build()); |
| 168 | + default: |
| 169 | + return Optional.empty(); |
| 170 | + } |
| 171 | + }; |
| 172 | + |
| 173 | + HttpResponseHandler<AwsServiceException> errorResponseHandler = protocolFactory |
| 174 | + .createErrorResponseHandler(exceptionMetadataMapper); |
161 | 175 | String hostPrefix = "foo-";
|
162 | 176 | String resolvedHostExpression = "foo-";
|
163 | 177 |
|
@@ -221,6 +235,19 @@ public CompletableFuture<APostOperationWithOutputResponse> aPostOperationWithOut
|
221 | 235 | .createCombinedResponseHandler(APostOperationWithOutputResponse::builder,
|
222 | 236 | new XmlOperationMetadata().withHasStreamingSuccessResponse(false));
|
223 | 237 |
|
| 238 | + Function<String, Optional<ExceptionMetadata>> exceptionMetadataMapper = errorCode -> { |
| 239 | + switch (errorCode) { |
| 240 | + case "InvalidInput": |
| 241 | + return Optional.of(ExceptionMetadata.builder().errorCode("InvalidInput").httpStatusCode(400) |
| 242 | + .exceptionBuilderSupplier(InvalidInputException::builder).build()); |
| 243 | + default: |
| 244 | + return Optional.empty(); |
| 245 | + } |
| 246 | + }; |
| 247 | + |
| 248 | + HttpResponseHandler<AwsServiceException> errorResponseHandler = protocolFactory |
| 249 | + .createErrorResponseHandler(exceptionMetadataMapper); |
| 250 | + |
224 | 251 | CompletableFuture<APostOperationWithOutputResponse> executeFuture = clientHandler
|
225 | 252 | .execute(new ClientExecutionParams<APostOperationWithOutputRequest, APostOperationWithOutputResponse>()
|
226 | 253 | .withOperationName("APostOperationWithOutput").withRequestConfiguration(clientConfiguration)
|
@@ -277,6 +304,16 @@ public CompletableFuture<BearerAuthOperationResponse> bearerAuthOperation(
|
277 | 304 | .createCombinedResponseHandler(BearerAuthOperationResponse::builder,
|
278 | 305 | new XmlOperationMetadata().withHasStreamingSuccessResponse(false));
|
279 | 306 |
|
| 307 | + Function<String, Optional<ExceptionMetadata>> exceptionMetadataMapper = errorCode -> { |
| 308 | + switch (errorCode) { |
| 309 | + default: |
| 310 | + return Optional.empty(); |
| 311 | + } |
| 312 | + }; |
| 313 | + |
| 314 | + HttpResponseHandler<AwsServiceException> errorResponseHandler = protocolFactory |
| 315 | + .createErrorResponseHandler(exceptionMetadataMapper); |
| 316 | + |
280 | 317 | CompletableFuture<BearerAuthOperationResponse> executeFuture = clientHandler
|
281 | 318 | .execute(new ClientExecutionParams<BearerAuthOperationRequest, BearerAuthOperationResponse>()
|
282 | 319 | .withOperationName("BearerAuthOperation").withRequestConfiguration(clientConfiguration)
|
@@ -331,14 +368,23 @@ public CompletableFuture<Void> eventStreamOperation(EventStreamOperationRequest
|
331 | 368 | HttpResponseHandler<EventStreamOperationResponse> responseHandler = protocolFactory.createResponseHandler(
|
332 | 369 | EventStreamOperationResponse::builder, XmlOperationMetadata.builder().hasStreamingSuccessResponse(true)
|
333 | 370 | .build());
|
334 |
| - HttpResponseHandler<AwsServiceException> errorResponseHandler = protocolFactory.createErrorResponseHandler(); |
335 | 371 | HttpResponseHandler<? extends EventStream> eventResponseHandler = protocolFactory.createResponseHandler(
|
336 | 372 | EventStreamTaggedUnionPojoSupplier.builder()
|
337 | 373 | .putSdkPojoSupplier("EventPayloadEvent", EventStream::eventPayloadEventBuilder)
|
338 | 374 | .putSdkPojoSupplier("NonEventPayloadEvent", EventStream::nonEventPayloadEventBuilder)
|
339 | 375 | .putSdkPojoSupplier("SecondEventPayloadEvent", EventStream::secondEventPayloadEventBuilder)
|
340 | 376 | .defaultSdkPojoSupplier(() -> new SdkPojoBuilder(EventStream.UNKNOWN)).build(), XmlOperationMetadata
|
341 | 377 | .builder().hasStreamingSuccessResponse(false).build());
|
| 378 | + |
| 379 | + Function<String, Optional<ExceptionMetadata>> exceptionMetadataMapper = errorCode -> { |
| 380 | + switch (errorCode) { |
| 381 | + default: |
| 382 | + return Optional.empty(); |
| 383 | + } |
| 384 | + }; |
| 385 | + |
| 386 | + HttpResponseHandler<AwsServiceException> errorResponseHandler = protocolFactory |
| 387 | + .createErrorResponseHandler(exceptionMetadataMapper); |
342 | 388 | CompletableFuture<Void> eventStreamTransformFuture = new CompletableFuture<>();
|
343 | 389 | EventStreamAsyncResponseTransformer<EventStreamOperationResponse, EventStream> asyncResponseTransformer = EventStreamAsyncResponseTransformer
|
344 | 390 | .<EventStreamOperationResponse, EventStream> builder().eventStreamResponseHandler(asyncResponseHandler)
|
@@ -414,6 +460,16 @@ public CompletableFuture<GetOperationWithChecksumResponse> getOperationWithCheck
|
414 | 460 | .createCombinedResponseHandler(GetOperationWithChecksumResponse::builder,
|
415 | 461 | new XmlOperationMetadata().withHasStreamingSuccessResponse(false));
|
416 | 462 |
|
| 463 | + Function<String, Optional<ExceptionMetadata>> exceptionMetadataMapper = errorCode -> { |
| 464 | + switch (errorCode) { |
| 465 | + default: |
| 466 | + return Optional.empty(); |
| 467 | + } |
| 468 | + }; |
| 469 | + |
| 470 | + HttpResponseHandler<AwsServiceException> errorResponseHandler = protocolFactory |
| 471 | + .createErrorResponseHandler(exceptionMetadataMapper); |
| 472 | + |
417 | 473 | CompletableFuture<GetOperationWithChecksumResponse> executeFuture = clientHandler
|
418 | 474 | .execute(new ClientExecutionParams<GetOperationWithChecksumRequest, GetOperationWithChecksumResponse>()
|
419 | 475 | .withOperationName("GetOperationWithChecksum")
|
@@ -478,6 +534,16 @@ public CompletableFuture<OperationWithChecksumRequiredResponse> operationWithChe
|
478 | 534 | .createCombinedResponseHandler(OperationWithChecksumRequiredResponse::builder,
|
479 | 535 | new XmlOperationMetadata().withHasStreamingSuccessResponse(false));
|
480 | 536 |
|
| 537 | + Function<String, Optional<ExceptionMetadata>> exceptionMetadataMapper = errorCode -> { |
| 538 | + switch (errorCode) { |
| 539 | + default: |
| 540 | + return Optional.empty(); |
| 541 | + } |
| 542 | + }; |
| 543 | + |
| 544 | + HttpResponseHandler<AwsServiceException> errorResponseHandler = protocolFactory |
| 545 | + .createErrorResponseHandler(exceptionMetadataMapper); |
| 546 | + |
481 | 547 | CompletableFuture<OperationWithChecksumRequiredResponse> executeFuture = clientHandler
|
482 | 548 | .execute(new ClientExecutionParams<OperationWithChecksumRequiredRequest, OperationWithChecksumRequiredResponse>()
|
483 | 549 | .withOperationName("OperationWithChecksumRequired")
|
@@ -537,6 +603,16 @@ public CompletableFuture<OperationWithNoneAuthTypeResponse> operationWithNoneAut
|
537 | 603 | .createCombinedResponseHandler(OperationWithNoneAuthTypeResponse::builder,
|
538 | 604 | new XmlOperationMetadata().withHasStreamingSuccessResponse(false));
|
539 | 605 |
|
| 606 | + Function<String, Optional<ExceptionMetadata>> exceptionMetadataMapper = errorCode -> { |
| 607 | + switch (errorCode) { |
| 608 | + default: |
| 609 | + return Optional.empty(); |
| 610 | + } |
| 611 | + }; |
| 612 | + |
| 613 | + HttpResponseHandler<AwsServiceException> errorResponseHandler = protocolFactory |
| 614 | + .createErrorResponseHandler(exceptionMetadataMapper); |
| 615 | + |
540 | 616 | CompletableFuture<OperationWithNoneAuthTypeResponse> executeFuture = clientHandler
|
541 | 617 | .execute(new ClientExecutionParams<OperationWithNoneAuthTypeRequest, OperationWithNoneAuthTypeResponse>()
|
542 | 618 | .withOperationName("OperationWithNoneAuthType").withRequestConfiguration(clientConfiguration)
|
@@ -594,6 +670,16 @@ public CompletableFuture<OperationWithRequestCompressionResponse> operationWithR
|
594 | 670 | .createCombinedResponseHandler(OperationWithRequestCompressionResponse::builder,
|
595 | 671 | new XmlOperationMetadata().withHasStreamingSuccessResponse(false));
|
596 | 672 |
|
| 673 | + Function<String, Optional<ExceptionMetadata>> exceptionMetadataMapper = errorCode -> { |
| 674 | + switch (errorCode) { |
| 675 | + default: |
| 676 | + return Optional.empty(); |
| 677 | + } |
| 678 | + }; |
| 679 | + |
| 680 | + HttpResponseHandler<AwsServiceException> errorResponseHandler = protocolFactory |
| 681 | + .createErrorResponseHandler(exceptionMetadataMapper); |
| 682 | + |
597 | 683 | CompletableFuture<OperationWithRequestCompressionResponse> executeFuture = clientHandler
|
598 | 684 | .execute(new ClientExecutionParams<OperationWithRequestCompressionRequest, OperationWithRequestCompressionResponse>()
|
599 | 685 | .withOperationName("OperationWithRequestCompression")
|
@@ -772,6 +858,16 @@ public CompletableFuture<StreamingInputOperationResponse> streamingInputOperatio
|
772 | 858 | .createCombinedResponseHandler(StreamingInputOperationResponse::builder,
|
773 | 859 | new XmlOperationMetadata().withHasStreamingSuccessResponse(false));
|
774 | 860 |
|
| 861 | + Function<String, Optional<ExceptionMetadata>> exceptionMetadataMapper = errorCode -> { |
| 862 | + switch (errorCode) { |
| 863 | + default: |
| 864 | + return Optional.empty(); |
| 865 | + } |
| 866 | + }; |
| 867 | + |
| 868 | + HttpResponseHandler<AwsServiceException> errorResponseHandler = protocolFactory |
| 869 | + .createErrorResponseHandler(exceptionMetadataMapper); |
| 870 | + |
775 | 871 | CompletableFuture<StreamingInputOperationResponse> executeFuture = clientHandler
|
776 | 872 | .execute(new ClientExecutionParams<StreamingInputOperationRequest, StreamingInputOperationResponse>()
|
777 | 873 | .withOperationName("StreamingInputOperation")
|
|
0 commit comments