use of software.amazon.awssdk.services.query.transform.OperationWithChecksumRequiredRequestMarshaller in project aws-sdk-java-v2 by aws.
the class DefaultQueryAsyncClient method operationWithChecksumRequired.
/**
* Invokes the OperationWithChecksumRequired operation asynchronously.
*
* @param operationWithChecksumRequiredRequest
* @return A Java Future containing the result of the OperationWithChecksumRequired operation returned by the
* service.<br/>
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
* <ul>
* <li>SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.</li>
* <li>SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.</li>
* <li>QueryException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.</li>
* </ul>
* @sample QueryAsyncClient.OperationWithChecksumRequired
* @see <a href="https://docs.aws.amazon.com/goto/WebAPI/query-service-2010-05-08/OperationWithChecksumRequired"
* target="_top">AWS API Documentation</a>
*/
@Override
public CompletableFuture<OperationWithChecksumRequiredResponse> operationWithChecksumRequired(OperationWithChecksumRequiredRequest operationWithChecksumRequiredRequest) {
List<MetricPublisher> metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithChecksumRequiredRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithChecksumRequired");
HttpResponseHandler<OperationWithChecksumRequiredResponse> responseHandler = protocolFactory.createResponseHandler(OperationWithChecksumRequiredResponse::builder);
HttpResponseHandler<AwsServiceException> errorResponseHandler = protocolFactory.createErrorResponseHandler();
CompletableFuture<OperationWithChecksumRequiredResponse> executeFuture = clientHandler.execute(new ClientExecutionParams<OperationWithChecksumRequiredRequest, OperationWithChecksumRequiredResponse>().withOperationName("OperationWithChecksumRequired").withMarshaller(new OperationWithChecksumRequiredRequestMarshaller(protocolFactory)).withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler).withMetricCollector(apiCallMetricCollector).putExecutionAttribute(SdkInternalExecutionAttribute.HTTP_CHECKSUM_REQUIRED, HttpChecksumRequired.create()).withInput(operationWithChecksumRequiredRequest));
CompletableFuture<OperationWithChecksumRequiredResponse> whenCompleteFuture = null;
whenCompleteFuture = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture);
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
use of software.amazon.awssdk.services.query.transform.OperationWithChecksumRequiredRequestMarshaller in project aws-sdk-java-v2 by aws.
the class DefaultQueryClient method operationWithChecksumRequired.
/**
* Invokes the OperationWithChecksumRequired operation.
*
* @param operationWithChecksumRequiredRequest
* @return Result of the OperationWithChecksumRequired operation returned by the service.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws QueryException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample QueryClient.OperationWithChecksumRequired
* @see <a href="https://docs.aws.amazon.com/goto/WebAPI/query-service-2010-05-08/OperationWithChecksumRequired"
* target="_top">AWS API Documentation</a>
*/
@Override
public OperationWithChecksumRequiredResponse operationWithChecksumRequired(OperationWithChecksumRequiredRequest operationWithChecksumRequiredRequest) throws AwsServiceException, SdkClientException, QueryException {
HttpResponseHandler<OperationWithChecksumRequiredResponse> responseHandler = protocolFactory.createResponseHandler(OperationWithChecksumRequiredResponse::builder);
HttpResponseHandler<AwsServiceException> errorResponseHandler = protocolFactory.createErrorResponseHandler();
List<MetricPublisher> metricPublishers = resolveMetricPublishers(clientConfiguration, operationWithChecksumRequiredRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Query Service");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithChecksumRequired");
return clientHandler.execute(new ClientExecutionParams<OperationWithChecksumRequiredRequest, OperationWithChecksumRequiredResponse>().withOperationName("OperationWithChecksumRequired").withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler).withInput(operationWithChecksumRequiredRequest).withMetricCollector(apiCallMetricCollector).putExecutionAttribute(SdkInternalExecutionAttribute.HTTP_CHECKSUM_REQUIRED, HttpChecksumRequired.create()).withMarshaller(new OperationWithChecksumRequiredRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
Aggregations