use of software.amazon.awssdk.services.xml.model.GetOperationWithChecksumResponse in project aws-sdk-java-v2 by aws.
the class DefaultXmlAsyncClient method getOperationWithChecksum.
/**
* Invokes the GetOperationWithChecksum operation asynchronously.
*
* @param getOperationWithChecksumRequest
* @return A Java Future containing the result of the GetOperationWithChecksum 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>XmlException Base class for all service exceptions. Unknown exceptions will be thrown as an instance
* of this type.</li>
* </ul>
* @sample XmlAsyncClient.GetOperationWithChecksum
* @see <a href="https://docs.aws.amazon.com/goto/WebAPI/xml-service-2010-05-08/GetOperationWithChecksum"
* target="_top">AWS API Documentation</a>
*/
@Override
public CompletableFuture<GetOperationWithChecksumResponse> getOperationWithChecksum(GetOperationWithChecksumRequest getOperationWithChecksumRequest) {
List<MetricPublisher> metricPublishers = resolveMetricPublishers(clientConfiguration, getOperationWithChecksumRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetOperationWithChecksum");
HttpResponseHandler<Response<GetOperationWithChecksumResponse>> responseHandler = protocolFactory.createCombinedResponseHandler(GetOperationWithChecksumResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false));
CompletableFuture<GetOperationWithChecksumResponse> executeFuture = clientHandler.execute(new ClientExecutionParams<GetOperationWithChecksumRequest, GetOperationWithChecksumResponse>().withOperationName("GetOperationWithChecksum").withMarshaller(new GetOperationWithChecksumRequestMarshaller(protocolFactory)).withCombinedResponseHandler(responseHandler).withMetricCollector(apiCallMetricCollector).putExecutionAttribute(SdkInternalExecutionAttribute.HTTP_CHECKSUM, HttpChecksum.builder().requestChecksumRequired(true).requestAlgorithm(getOperationWithChecksumRequest.checksumAlgorithmAsString()).isRequestStreaming(false).build()).withInput(getOperationWithChecksumRequest));
CompletableFuture<GetOperationWithChecksumResponse> whenCompleteFuture = null;
whenCompleteFuture = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture);
return whenCompleteFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
use of software.amazon.awssdk.services.xml.model.GetOperationWithChecksumResponse in project aws-sdk-java-v2 by aws.
the class DefaultXmlClient method getOperationWithChecksum.
/**
* Invokes the GetOperationWithChecksum operation.
*
* @param getOperationWithChecksumRequest
* @return Result of the GetOperationWithChecksum 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 XmlException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample XmlClient.GetOperationWithChecksum
* @see <a href="https://docs.aws.amazon.com/goto/WebAPI/xml-service-2010-05-08/GetOperationWithChecksum"
* target="_top">AWS API Documentation</a>
*/
@Override
public GetOperationWithChecksumResponse getOperationWithChecksum(GetOperationWithChecksumRequest getOperationWithChecksumRequest) throws AwsServiceException, SdkClientException, XmlException {
HttpResponseHandler<Response<GetOperationWithChecksumResponse>> responseHandler = protocolFactory.createCombinedResponseHandler(GetOperationWithChecksumResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false));
List<MetricPublisher> metricPublishers = resolveMetricPublishers(clientConfiguration, getOperationWithChecksumRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetOperationWithChecksum");
return clientHandler.execute(new ClientExecutionParams<GetOperationWithChecksumRequest, GetOperationWithChecksumResponse>().withOperationName("GetOperationWithChecksum").withCombinedResponseHandler(responseHandler).withMetricCollector(apiCallMetricCollector).withInput(getOperationWithChecksumRequest).putExecutionAttribute(SdkInternalExecutionAttribute.HTTP_CHECKSUM, HttpChecksum.builder().requestChecksumRequired(true).requestAlgorithm(getOperationWithChecksumRequest.checksumAlgorithmAsString()).isRequestStreaming(false).build()).withMarshaller(new GetOperationWithChecksumRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
Aggregations