use of software.amazon.awssdk.services.xml.transform.APostOperationWithOutputRequestMarshaller in project aws-sdk-java-v2 by aws.
the class DefaultXmlClient method aPostOperationWithOutput.
/**
* <p>
* Performs a post operation to the xml service and has modelled output
* </p>
*
* @param aPostOperationWithOutputRequest
* @return Result of the APostOperationWithOutput operation returned by the service.
* @throws InvalidInputException
* The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
* @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.APostOperationWithOutput
* @see <a href="https://docs.aws.amazon.com/goto/WebAPI/xml-service-2010-05-08/APostOperationWithOutput"
* target="_top">AWS API Documentation</a>
*/
@Override
public APostOperationWithOutputResponse aPostOperationWithOutput(APostOperationWithOutputRequest aPostOperationWithOutputRequest) throws InvalidInputException, AwsServiceException, SdkClientException, XmlException {
HttpResponseHandler<Response<APostOperationWithOutputResponse>> responseHandler = protocolFactory.createCombinedResponseHandler(APostOperationWithOutputResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false));
List<MetricPublisher> metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationWithOutputRequest.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, "APostOperationWithOutput");
return clientHandler.execute(new ClientExecutionParams<APostOperationWithOutputRequest, APostOperationWithOutputResponse>().withOperationName("APostOperationWithOutput").withCombinedResponseHandler(responseHandler).withMetricCollector(apiCallMetricCollector).withInput(aPostOperationWithOutputRequest).withMarshaller(new APostOperationWithOutputRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
use of software.amazon.awssdk.services.xml.transform.APostOperationWithOutputRequestMarshaller in project aws-sdk-java-v2 by aws.
the class DefaultXmlAsyncClient method aPostOperationWithOutput.
/**
* <p>
* Performs a post operation to the xml service and has modelled output
* </p>
*
* @param aPostOperationWithOutputRequest
* @return A Java Future containing the result of the APostOperationWithOutput operation returned by the service.<br/>
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
* <ul>
* <li>InvalidInputException The request was rejected because an invalid or out-of-range value was supplied
* for an input parameter.</li>
* <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.APostOperationWithOutput
* @see <a href="https://docs.aws.amazon.com/goto/WebAPI/xml-service-2010-05-08/APostOperationWithOutput"
* target="_top">AWS API Documentation</a>
*/
@Override
public CompletableFuture<APostOperationWithOutputResponse> aPostOperationWithOutput(APostOperationWithOutputRequest aPostOperationWithOutputRequest) {
List<MetricPublisher> metricPublishers = resolveMetricPublishers(clientConfiguration, aPostOperationWithOutputRequest.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, "APostOperationWithOutput");
HttpResponseHandler<Response<APostOperationWithOutputResponse>> responseHandler = protocolFactory.createCombinedResponseHandler(APostOperationWithOutputResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(false));
CompletableFuture<APostOperationWithOutputResponse> executeFuture = clientHandler.execute(new ClientExecutionParams<APostOperationWithOutputRequest, APostOperationWithOutputResponse>().withOperationName("APostOperationWithOutput").withMarshaller(new APostOperationWithOutputRequestMarshaller(protocolFactory)).withCombinedResponseHandler(responseHandler).withMetricCollector(apiCallMetricCollector).withInput(aPostOperationWithOutputRequest));
CompletableFuture<APostOperationWithOutputResponse> 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);
}
}
Aggregations