|
14 | 14 | import software.amazon.awssdk.awscore.exception.AwsServiceException;
|
15 | 15 | import software.amazon.awssdk.awscore.internal.AwsProtocolMetadata;
|
16 | 16 | import software.amazon.awssdk.awscore.internal.AwsServiceProtocol;
|
| 17 | +import software.amazon.awssdk.codegen.internal.UtilsTest; |
17 | 18 | import software.amazon.awssdk.core.CredentialType;
|
18 | 19 | import software.amazon.awssdk.core.RequestOverrideConfiguration;
|
19 | 20 | import software.amazon.awssdk.core.SdkPlugin;
|
|
51 | 52 | import software.amazon.awssdk.services.query.model.OperationWithChecksumRequiredResponse;
|
52 | 53 | import software.amazon.awssdk.services.query.model.OperationWithContextParamRequest;
|
53 | 54 | import software.amazon.awssdk.services.query.model.OperationWithContextParamResponse;
|
| 55 | +import software.amazon.awssdk.services.query.model.OperationWithCustomMemberRequest; |
| 56 | +import software.amazon.awssdk.services.query.model.OperationWithCustomMemberResponse; |
54 | 57 | import software.amazon.awssdk.services.query.model.OperationWithCustomizedOperationContextParamRequest;
|
55 | 58 | import software.amazon.awssdk.services.query.model.OperationWithCustomizedOperationContextParamResponse;
|
56 | 59 | import software.amazon.awssdk.services.query.model.OperationWithNoneAuthTypeRequest;
|
|
74 | 77 | import software.amazon.awssdk.services.query.transform.GetOperationWithChecksumRequestMarshaller;
|
75 | 78 | import software.amazon.awssdk.services.query.transform.OperationWithChecksumRequiredRequestMarshaller;
|
76 | 79 | import software.amazon.awssdk.services.query.transform.OperationWithContextParamRequestMarshaller;
|
| 80 | +import software.amazon.awssdk.services.query.transform.OperationWithCustomMemberRequestMarshaller; |
77 | 81 | import software.amazon.awssdk.services.query.transform.OperationWithCustomizedOperationContextParamRequestMarshaller;
|
78 | 82 | import software.amazon.awssdk.services.query.transform.OperationWithNoneAuthTypeRequestMarshaller;
|
79 | 83 | import software.amazon.awssdk.services.query.transform.OperationWithOperationContextParamRequestMarshaller;
|
@@ -470,6 +474,63 @@ public CompletableFuture<OperationWithContextParamResponse> operationWithContext
|
470 | 474 | }
|
471 | 475 | }
|
472 | 476 |
|
| 477 | + /** |
| 478 | + * Invokes the OperationWithCustomMember operation asynchronously. |
| 479 | + * |
| 480 | + * @param operationWithCustomMemberRequest |
| 481 | + * @return A Java Future containing the result of the OperationWithCustomMember operation returned by the service.<br/> |
| 482 | + * The CompletableFuture returned by this method can be completed exceptionally with the following |
| 483 | + * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke |
| 484 | + * {@link Throwable#getCause} to retrieve the underlying exception. |
| 485 | + * <ul> |
| 486 | + * <li>SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). |
| 487 | + * Can be used for catch all scenarios.</li> |
| 488 | + * <li>SdkClientException If any client side error occurs such as an IO related failure, failure to get |
| 489 | + * credentials, etc.</li> |
| 490 | + * <li>QueryException Base class for all service exceptions. Unknown exceptions will be thrown as an |
| 491 | + * instance of this type.</li> |
| 492 | + * </ul> |
| 493 | + * @sample QueryAsyncClient.OperationWithCustomMember |
| 494 | + * @see <a href="https://docs.aws.amazon.com/goto/WebAPI/query-service-2010-05-08/OperationWithCustomMember" |
| 495 | + * target="_top">AWS API Documentation</a> |
| 496 | + */ |
| 497 | + @Override |
| 498 | + public CompletableFuture<OperationWithCustomMemberResponse> operationWithCustomMember( |
| 499 | + OperationWithCustomMemberRequest operationWithCustomMemberRequest) { |
| 500 | + operationWithCustomMemberRequest = UtilsTest.dummyRequestModifier(operationWithCustomMemberRequest); |
| 501 | + SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(operationWithCustomMemberRequest, |
| 502 | + this.clientConfiguration); |
| 503 | + List<MetricPublisher> metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithCustomMemberRequest |
| 504 | + .overrideConfiguration().orElse(null)); |
| 505 | + MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector |
| 506 | + .create("ApiCall"); |
| 507 | + try { |
| 508 | + apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service"); |
| 509 | + apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithCustomMember"); |
| 510 | + |
| 511 | + HttpResponseHandler<OperationWithCustomMemberResponse> responseHandler = protocolFactory |
| 512 | + .createResponseHandler(OperationWithCustomMemberResponse::builder); |
| 513 | + |
| 514 | + HttpResponseHandler<AwsServiceException> errorResponseHandler = protocolFactory.createErrorResponseHandler(); |
| 515 | + |
| 516 | + CompletableFuture<OperationWithCustomMemberResponse> executeFuture = clientHandler |
| 517 | + .execute(new ClientExecutionParams<OperationWithCustomMemberRequest, OperationWithCustomMemberResponse>() |
| 518 | + .withOperationName("OperationWithCustomMember").withProtocolMetadata(protocolMetadata) |
| 519 | + .withMarshaller(new OperationWithCustomMemberRequestMarshaller(protocolFactory)) |
| 520 | + .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) |
| 521 | + .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) |
| 522 | + .withInput(operationWithCustomMemberRequest)); |
| 523 | + CompletableFuture<OperationWithCustomMemberResponse> whenCompleteFuture = null; |
| 524 | + whenCompleteFuture = executeFuture.whenComplete((r, e) -> { |
| 525 | + metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); |
| 526 | + }); |
| 527 | + return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); |
| 528 | + } catch (Throwable t) { |
| 529 | + metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); |
| 530 | + return CompletableFutureUtils.failedFuture(t); |
| 531 | + } |
| 532 | + } |
| 533 | + |
473 | 534 | /**
|
474 | 535 | * Invokes the OperationWithCustomizedOperationContextParam operation asynchronously.
|
475 | 536 | *
|
|
0 commit comments