use of software.amazon.awssdk.services.json.model.PaginatedOperationWithoutResultKeyRequest in project aws-sdk-java-v2 by aws.
the class DefaultJsonAsyncClient method paginatedOperationWithoutResultKey.
/**
* Some paginated operation without result_key in paginators.json file
*
* @param paginatedOperationWithoutResultKeyRequest
* @return A Java Future containing the result of the PaginatedOperationWithoutResultKey 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>JsonException Base class for all service exceptions. Unknown exceptions will be thrown as an instance
* of this type.</li>
* </ul>
* @sample JsonAsyncClient.PaginatedOperationWithoutResultKey
* @see <a href="https://docs.aws.amazon.com/goto/WebAPI/json-service-2010-05-08/PaginatedOperationWithoutResultKey"
* target="_top">AWS API Documentation</a>
*/
@Override
public CompletableFuture<PaginatedOperationWithoutResultKeyResponse> paginatedOperationWithoutResultKey(PaginatedOperationWithoutResultKeyRequest paginatedOperationWithoutResultKeyRequest) {
List<MetricPublisher> metricPublishers = resolveMetricPublishers(clientConfiguration, paginatedOperationWithoutResultKeyRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PaginatedOperationWithoutResultKey");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false).isPayloadJson(true).build();
HttpResponseHandler<PaginatedOperationWithoutResultKeyResponse> responseHandler = protocolFactory.createResponseHandler(operationMetadata, PaginatedOperationWithoutResultKeyResponse::builder);
HttpResponseHandler<AwsServiceException> errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata);
CompletableFuture<PaginatedOperationWithoutResultKeyResponse> executeFuture = clientHandler.execute(new ClientExecutionParams<PaginatedOperationWithoutResultKeyRequest, PaginatedOperationWithoutResultKeyResponse>().withOperationName("PaginatedOperationWithoutResultKey").withMarshaller(new PaginatedOperationWithoutResultKeyRequestMarshaller(protocolFactory)).withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler).withMetricCollector(apiCallMetricCollector).withInput(paginatedOperationWithoutResultKeyRequest));
CompletableFuture<PaginatedOperationWithoutResultKeyResponse> whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
use of software.amazon.awssdk.services.json.model.PaginatedOperationWithoutResultKeyRequest in project aws-sdk-java-v2 by aws.
the class DefaultJsonClient method paginatedOperationWithoutResultKey.
/**
* Some paginated operation without result_key in paginators.json file
*
* @param paginatedOperationWithoutResultKeyRequest
* @return Result of the PaginatedOperationWithoutResultKey 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 JsonException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample JsonClient.PaginatedOperationWithoutResultKey
* @see <a href="https://docs.aws.amazon.com/goto/WebAPI/json-service-2010-05-08/PaginatedOperationWithoutResultKey"
* target="_top">AWS API Documentation</a>
*/
@Override
public PaginatedOperationWithoutResultKeyResponse paginatedOperationWithoutResultKey(PaginatedOperationWithoutResultKeyRequest paginatedOperationWithoutResultKeyRequest) throws AwsServiceException, SdkClientException, JsonException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false).isPayloadJson(true).build();
HttpResponseHandler<PaginatedOperationWithoutResultKeyResponse> responseHandler = protocolFactory.createResponseHandler(operationMetadata, PaginatedOperationWithoutResultKeyResponse::builder);
HttpResponseHandler<AwsServiceException> errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata);
List<MetricPublisher> metricPublishers = resolveMetricPublishers(clientConfiguration, paginatedOperationWithoutResultKeyRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PaginatedOperationWithoutResultKey");
return clientHandler.execute(new ClientExecutionParams<PaginatedOperationWithoutResultKeyRequest, PaginatedOperationWithoutResultKeyResponse>().withOperationName("PaginatedOperationWithoutResultKey").withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler).withInput(paginatedOperationWithoutResultKeyRequest).withMetricCollector(apiCallMetricCollector).withMarshaller(new PaginatedOperationWithoutResultKeyRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
Aggregations