Search in sources :

Example 1 with JsonException

use of software.amazon.awssdk.services.json.model.JsonException in project aws-sdk-java-v2 by aws.

the class DefaultJsonAsyncClient method streamingInputOutputOperation.

/**
 * Some operation with streaming input and streaming output
 *
 * @param streamingInputOutputOperationRequest
 * @param requestBody
 *        Functional interface that can be implemented to produce the request content in a non-blocking manner. The
 *        size of the content is expected to be known up front. See {@link AsyncRequestBody} for specific details on
 *        implementing this interface as well as links to precanned implementations for common scenarios like
 *        uploading from a file. The service documentation for the request content is as follows 'This be a stream'
 * @param asyncResponseTransformer
 *        The response transformer for processing the streaming response in a non-blocking manner. See
 *        {@link AsyncResponseTransformer} for details on how this callback should be implemented and for links to
 *        precanned implementations for common scenarios like downloading to a file. The service documentation for
 *        the response content is as follows 'This be a stream'.
 * @return A future to the transformed result of the AsyncResponseTransformer.<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.StreamingInputOutputOperation
 * @see <a href="https://docs.aws.amazon.com/goto/WebAPI/json-service-2010-05-08/StreamingInputOutputOperation"
 *      target="_top">AWS API Documentation</a>
 */
@Override
public <ReturnT> CompletableFuture<ReturnT> streamingInputOutputOperation(StreamingInputOutputOperationRequest streamingInputOutputOperationRequest, AsyncRequestBody requestBody, AsyncResponseTransformer<StreamingInputOutputOperationResponse, ReturnT> asyncResponseTransformer) {
    List<MetricPublisher> metricPublishers = resolveMetricPublishers(clientConfiguration, streamingInputOutputOperationRequest.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, "StreamingInputOutputOperation");
        Pair<AsyncResponseTransformer<StreamingInputOutputOperationResponse, ReturnT>, CompletableFuture<Void>> pair = AsyncResponseTransformerUtils.wrapWithEndOfStreamFuture(asyncResponseTransformer);
        asyncResponseTransformer = pair.left();
        CompletableFuture<Void> endOfStreamFuture = pair.right();
        streamingInputOutputOperationRequest = applySignerOverride(streamingInputOutputOperationRequest, Aws4UnsignedPayloadSigner.create());
        JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(true).isPayloadJson(false).build();
        HttpResponseHandler<StreamingInputOutputOperationResponse> responseHandler = protocolFactory.createResponseHandler(operationMetadata, StreamingInputOutputOperationResponse::builder);
        HttpResponseHandler<AwsServiceException> errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata);
        CompletableFuture<ReturnT> executeFuture = clientHandler.execute(new ClientExecutionParams<StreamingInputOutputOperationRequest, StreamingInputOutputOperationResponse>().withOperationName("StreamingInputOutputOperation").withMarshaller(AsyncStreamingRequestMarshaller.builder().delegateMarshaller(new StreamingInputOutputOperationRequestMarshaller(protocolFactory)).asyncRequestBody(requestBody).transferEncoding(true).build()).withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler).withMetricCollector(apiCallMetricCollector).withAsyncRequestBody(requestBody).withInput(streamingInputOutputOperationRequest), asyncResponseTransformer);
        AsyncResponseTransformer<StreamingInputOutputOperationResponse, ReturnT> finalAsyncResponseTransformer = asyncResponseTransformer;
        CompletableFuture<ReturnT> whenCompleted = executeFuture.whenComplete((r, e) -> {
            if (e != null) {
                runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", () -> finalAsyncResponseTransformer.exceptionOccurred(e));
            }
            endOfStreamFuture.whenComplete((r2, e2) -> {
                metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
            });
        });
        executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
        return executeFuture;
    } catch (Throwable t) {
        AsyncResponseTransformer<StreamingInputOutputOperationResponse, ReturnT> finalAsyncResponseTransformer = asyncResponseTransformer;
        runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", () -> finalAsyncResponseTransformer.exceptionOccurred(t));
        metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
        return CompletableFutureUtils.failedFuture(t);
    }
}
Also used : ExceptionMetadata(software.amazon.awssdk.protocols.core.ExceptionMetadata) AwsAsyncClientHandler(software.amazon.awssdk.awscore.client.handler.AwsAsyncClientHandler) StreamingInputOutputOperationRequestMarshaller(software.amazon.awssdk.services.json.transform.StreamingInputOutputOperationRequestMarshaller) EventStreamOperationResponseHandler(software.amazon.awssdk.services.json.model.EventStreamOperationResponseHandler) AsyncStreamingRequestMarshaller(software.amazon.awssdk.core.runtime.transform.AsyncStreamingRequestMarshaller) AsyncResponseTransformer(software.amazon.awssdk.core.async.AsyncResponseTransformer) InputEventStreamTwo(software.amazon.awssdk.services.json.model.InputEventStreamTwo) StreamingInputOperationRequest(software.amazon.awssdk.services.json.model.StreamingInputOperationRequest) AsyncClientHandler(software.amazon.awssdk.core.client.handler.AsyncClientHandler) PaginatedOperationWithResultKeyResponse(software.amazon.awssdk.services.json.model.PaginatedOperationWithResultKeyResponse) AwsServiceException(software.amazon.awssdk.awscore.exception.AwsServiceException) PaginatedOperationWithResultKeyPublisher(software.amazon.awssdk.services.json.paginators.PaginatedOperationWithResultKeyPublisher) EventStreamOperationWithOnlyInputRequestMarshaller(software.amazon.awssdk.services.json.transform.EventStreamOperationWithOnlyInputRequestMarshaller) APostOperationWithOutputResponse(software.amazon.awssdk.services.json.model.APostOperationWithOutputResponse) EventStream(software.amazon.awssdk.services.json.model.EventStream) APostOperationRequest(software.amazon.awssdk.services.json.model.APostOperationRequest) PaginatedOperationWithoutResultKeyPublisher(software.amazon.awssdk.services.json.paginators.PaginatedOperationWithoutResultKeyPublisher) PaginatedOperationWithoutResultKeyResponse(software.amazon.awssdk.services.json.model.PaginatedOperationWithoutResultKeyResponse) AsyncRequestBody(software.amazon.awssdk.core.async.AsyncRequestBody) AsyncAws4Signer(software.amazon.awssdk.auth.signer.AsyncAws4Signer) SdkAdvancedAsyncClientOption(software.amazon.awssdk.core.client.config.SdkAdvancedAsyncClientOption) APostOperationWithOutputRequestMarshaller(software.amazon.awssdk.services.json.transform.APostOperationWithOutputRequestMarshaller) EventStreamOperationRequest(software.amazon.awssdk.services.json.model.EventStreamOperationRequest) HttpResponseHandler(software.amazon.awssdk.core.http.HttpResponseHandler) Generated(software.amazon.awssdk.annotations.Generated) AsyncResponseTransformerUtils(software.amazon.awssdk.core.async.AsyncResponseTransformerUtils) PaginatedOperationWithResultKeyRequestMarshaller(software.amazon.awssdk.services.json.transform.PaginatedOperationWithResultKeyRequestMarshaller) PaginatedOperationWithoutResultKeyRequestMarshaller(software.amazon.awssdk.services.json.transform.PaginatedOperationWithoutResultKeyRequestMarshaller) OperationWithChecksumRequiredResponse(software.amazon.awssdk.services.json.model.OperationWithChecksumRequiredResponse) EventStreamTaggedUnionJsonMarshaller(software.amazon.awssdk.awscore.eventstream.EventStreamTaggedUnionJsonMarshaller) VoidSdkResponse(software.amazon.awssdk.core.protocol.VoidSdkResponse) CompletableFutureUtils(software.amazon.awssdk.utils.CompletableFutureUtils) SdkClientConfiguration(software.amazon.awssdk.core.client.config.SdkClientConfiguration) VersionInfo(software.amazon.awssdk.core.util.VersionInfo) PaginatedOperationWithResultKeyRequest(software.amazon.awssdk.services.json.model.PaginatedOperationWithResultKeyRequest) CoreMetric(software.amazon.awssdk.core.metrics.CoreMetric) BaseAwsJsonProtocolFactory(software.amazon.awssdk.protocols.json.BaseAwsJsonProtocolFactory) RequestOverrideConfiguration(software.amazon.awssdk.core.RequestOverrideConfiguration) EventStreamOperationWithOnlyOutputResponse(software.amazon.awssdk.services.json.model.EventStreamOperationWithOnlyOutputResponse) StreamingOutputOperationRequest(software.amazon.awssdk.services.json.model.StreamingOutputOperationRequest) InputEventTwoMarshaller(software.amazon.awssdk.services.json.transform.InputEventTwoMarshaller) SdkInternalExecutionAttribute(software.amazon.awssdk.core.interceptor.SdkInternalExecutionAttribute) MetricCollector(software.amazon.awssdk.metrics.MetricCollector) Executor(java.util.concurrent.Executor) Publisher(org.reactivestreams.Publisher) APostOperationWithOutputRequest(software.amazon.awssdk.services.json.model.APostOperationWithOutputRequest) EventStreamOperationWithOnlyInputResponse(software.amazon.awssdk.services.json.model.EventStreamOperationWithOnlyInputResponse) SdkInternalApi(software.amazon.awssdk.annotations.SdkInternalApi) GetWithoutRequiredMembersResponse(software.amazon.awssdk.services.json.model.GetWithoutRequiredMembersResponse) DefaultInputEventTwo(software.amazon.awssdk.services.json.model.inputeventstreamtwo.DefaultInputEventTwo) GetWithoutRequiredMembersRequestMarshaller(software.amazon.awssdk.services.json.transform.GetWithoutRequiredMembersRequestMarshaller) LoggerFactory(org.slf4j.LoggerFactory) StreamingInputOperationRequestMarshaller(software.amazon.awssdk.services.json.transform.StreamingInputOperationRequestMarshaller) ByteBuffer(java.nio.ByteBuffer) JsonException(software.amazon.awssdk.services.json.model.JsonException) MetricPublisher(software.amazon.awssdk.metrics.MetricPublisher) DefaultInputEvent(software.amazon.awssdk.services.json.model.inputeventstream.DefaultInputEvent) JsonOperationMetadata(software.amazon.awssdk.protocols.json.JsonOperationMetadata) EventStreamOperationWithOnlyInputRequest(software.amazon.awssdk.services.json.model.EventStreamOperationWithOnlyInputRequest) ApiName(software.amazon.awssdk.core.ApiName) GetWithoutRequiredMembersRequest(software.amazon.awssdk.services.json.model.GetWithoutRequiredMembersRequest) SdkClientOption(software.amazon.awssdk.core.client.config.SdkClientOption) HostnameValidator(software.amazon.awssdk.utils.HostnameValidator) StreamingOutputOperationResponse(software.amazon.awssdk.services.json.model.StreamingOutputOperationResponse) APostOperationRequestMarshaller(software.amazon.awssdk.services.json.transform.APostOperationRequestMarshaller) StreamingInputOperationResponse(software.amazon.awssdk.services.json.model.StreamingInputOperationResponse) EventStreamOperationRequestMarshaller(software.amazon.awssdk.services.json.transform.EventStreamOperationRequestMarshaller) DefaultInputEventOne(software.amazon.awssdk.services.json.model.inputeventstreamtwo.DefaultInputEventOne) SdkPojoBuilder(software.amazon.awssdk.core.SdkPojoBuilder) InputEventMarshaller(software.amazon.awssdk.services.json.transform.InputEventMarshaller) OperationWithChecksumRequiredRequest(software.amazon.awssdk.services.json.model.OperationWithChecksumRequiredRequest) InputEventStream(software.amazon.awssdk.services.json.model.InputEventStream) List(java.util.List) APostOperationResponse(software.amazon.awssdk.services.json.model.APostOperationResponse) StreamingInputOutputOperationRequest(software.amazon.awssdk.services.json.model.StreamingInputOutputOperationRequest) AttachHttpMetadataResponseHandler(software.amazon.awssdk.core.client.handler.AttachHttpMetadataResponseHandler) Aws4UnsignedPayloadSigner(software.amazon.awssdk.auth.signer.Aws4UnsignedPayloadSigner) JsonRequest(software.amazon.awssdk.services.json.model.JsonRequest) EventStreamOperationWithOnlyOutputRequestMarshaller(software.amazon.awssdk.services.json.transform.EventStreamOperationWithOnlyOutputRequestMarshaller) OperationWithChecksumRequiredRequestMarshaller(software.amazon.awssdk.services.json.transform.OperationWithChecksumRequiredRequestMarshaller) AwsRequestOverrideConfiguration(software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration) Signer(software.amazon.awssdk.core.signer.Signer) AwsJsonProtocol(software.amazon.awssdk.protocols.json.AwsJsonProtocol) EventStreamAsyncResponseTransformer(software.amazon.awssdk.awscore.eventstream.EventStreamAsyncResponseTransformer) EventStreamTaggedUnionPojoSupplier(software.amazon.awssdk.awscore.eventstream.EventStreamTaggedUnionPojoSupplier) CompletableFuture(java.util.concurrent.CompletableFuture) HttpChecksumRequired(software.amazon.awssdk.core.interceptor.trait.HttpChecksumRequired) InvalidInputException(software.amazon.awssdk.services.json.model.InvalidInputException) NoOpMetricCollector(software.amazon.awssdk.metrics.NoOpMetricCollector) PaginatedOperationWithoutResultKeyRequest(software.amazon.awssdk.services.json.model.PaginatedOperationWithoutResultKeyRequest) Logger(org.slf4j.Logger) EventStreamOperationWithOnlyOutputRequest(software.amazon.awssdk.services.json.model.EventStreamOperationWithOnlyOutputRequest) Pair(software.amazon.awssdk.utils.Pair) SdkPublisher(software.amazon.awssdk.core.async.SdkPublisher) EventStreamAws4Signer(software.amazon.awssdk.auth.signer.EventStreamAws4Signer) Consumer(java.util.function.Consumer) StreamingOutputOperationRequestMarshaller(software.amazon.awssdk.services.json.transform.StreamingOutputOperationRequestMarshaller) ClientExecutionParams(software.amazon.awssdk.core.client.handler.ClientExecutionParams) EventStreamOperationWithOnlyOutputResponseHandler(software.amazon.awssdk.services.json.model.EventStreamOperationWithOnlyOutputResponseHandler) StreamingInputOutputOperationResponse(software.amazon.awssdk.services.json.model.StreamingInputOutputOperationResponse) AwsClientHandlerUtils(software.amazon.awssdk.awscore.client.handler.AwsClientHandlerUtils) EventStreamOperationResponse(software.amazon.awssdk.services.json.model.EventStreamOperationResponse) SdkResponse(software.amazon.awssdk.core.SdkResponse) AwsJsonProtocolFactory(software.amazon.awssdk.protocols.json.AwsJsonProtocolFactory) FunctionalUtils.runAndLogError(software.amazon.awssdk.utils.FunctionalUtils.runAndLogError) Collections(java.util.Collections) ClientExecutionParams(software.amazon.awssdk.core.client.handler.ClientExecutionParams) StreamingInputOutputOperationResponse(software.amazon.awssdk.services.json.model.StreamingInputOutputOperationResponse) MetricPublisher(software.amazon.awssdk.metrics.MetricPublisher) JsonOperationMetadata(software.amazon.awssdk.protocols.json.JsonOperationMetadata) StreamingInputOutputOperationRequestMarshaller(software.amazon.awssdk.services.json.transform.StreamingInputOutputOperationRequestMarshaller) CompletableFuture(java.util.concurrent.CompletableFuture) AsyncResponseTransformer(software.amazon.awssdk.core.async.AsyncResponseTransformer) EventStreamAsyncResponseTransformer(software.amazon.awssdk.awscore.eventstream.EventStreamAsyncResponseTransformer) AwsServiceException(software.amazon.awssdk.awscore.exception.AwsServiceException) MetricCollector(software.amazon.awssdk.metrics.MetricCollector) NoOpMetricCollector(software.amazon.awssdk.metrics.NoOpMetricCollector)

Example 2 with JsonException

use of software.amazon.awssdk.services.json.model.JsonException 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);
    }
}
Also used : ExceptionMetadata(software.amazon.awssdk.protocols.core.ExceptionMetadata) AwsAsyncClientHandler(software.amazon.awssdk.awscore.client.handler.AwsAsyncClientHandler) StreamingInputOutputOperationRequestMarshaller(software.amazon.awssdk.services.json.transform.StreamingInputOutputOperationRequestMarshaller) EventStreamOperationResponseHandler(software.amazon.awssdk.services.json.model.EventStreamOperationResponseHandler) AsyncStreamingRequestMarshaller(software.amazon.awssdk.core.runtime.transform.AsyncStreamingRequestMarshaller) AsyncResponseTransformer(software.amazon.awssdk.core.async.AsyncResponseTransformer) InputEventStreamTwo(software.amazon.awssdk.services.json.model.InputEventStreamTwo) StreamingInputOperationRequest(software.amazon.awssdk.services.json.model.StreamingInputOperationRequest) AsyncClientHandler(software.amazon.awssdk.core.client.handler.AsyncClientHandler) PaginatedOperationWithResultKeyResponse(software.amazon.awssdk.services.json.model.PaginatedOperationWithResultKeyResponse) AwsServiceException(software.amazon.awssdk.awscore.exception.AwsServiceException) PaginatedOperationWithResultKeyPublisher(software.amazon.awssdk.services.json.paginators.PaginatedOperationWithResultKeyPublisher) EventStreamOperationWithOnlyInputRequestMarshaller(software.amazon.awssdk.services.json.transform.EventStreamOperationWithOnlyInputRequestMarshaller) APostOperationWithOutputResponse(software.amazon.awssdk.services.json.model.APostOperationWithOutputResponse) EventStream(software.amazon.awssdk.services.json.model.EventStream) APostOperationRequest(software.amazon.awssdk.services.json.model.APostOperationRequest) PaginatedOperationWithoutResultKeyPublisher(software.amazon.awssdk.services.json.paginators.PaginatedOperationWithoutResultKeyPublisher) PaginatedOperationWithoutResultKeyResponse(software.amazon.awssdk.services.json.model.PaginatedOperationWithoutResultKeyResponse) AsyncRequestBody(software.amazon.awssdk.core.async.AsyncRequestBody) AsyncAws4Signer(software.amazon.awssdk.auth.signer.AsyncAws4Signer) SdkAdvancedAsyncClientOption(software.amazon.awssdk.core.client.config.SdkAdvancedAsyncClientOption) APostOperationWithOutputRequestMarshaller(software.amazon.awssdk.services.json.transform.APostOperationWithOutputRequestMarshaller) EventStreamOperationRequest(software.amazon.awssdk.services.json.model.EventStreamOperationRequest) HttpResponseHandler(software.amazon.awssdk.core.http.HttpResponseHandler) Generated(software.amazon.awssdk.annotations.Generated) AsyncResponseTransformerUtils(software.amazon.awssdk.core.async.AsyncResponseTransformerUtils) PaginatedOperationWithResultKeyRequestMarshaller(software.amazon.awssdk.services.json.transform.PaginatedOperationWithResultKeyRequestMarshaller) PaginatedOperationWithoutResultKeyRequestMarshaller(software.amazon.awssdk.services.json.transform.PaginatedOperationWithoutResultKeyRequestMarshaller) OperationWithChecksumRequiredResponse(software.amazon.awssdk.services.json.model.OperationWithChecksumRequiredResponse) EventStreamTaggedUnionJsonMarshaller(software.amazon.awssdk.awscore.eventstream.EventStreamTaggedUnionJsonMarshaller) VoidSdkResponse(software.amazon.awssdk.core.protocol.VoidSdkResponse) CompletableFutureUtils(software.amazon.awssdk.utils.CompletableFutureUtils) SdkClientConfiguration(software.amazon.awssdk.core.client.config.SdkClientConfiguration) VersionInfo(software.amazon.awssdk.core.util.VersionInfo) PaginatedOperationWithResultKeyRequest(software.amazon.awssdk.services.json.model.PaginatedOperationWithResultKeyRequest) CoreMetric(software.amazon.awssdk.core.metrics.CoreMetric) BaseAwsJsonProtocolFactory(software.amazon.awssdk.protocols.json.BaseAwsJsonProtocolFactory) RequestOverrideConfiguration(software.amazon.awssdk.core.RequestOverrideConfiguration) EventStreamOperationWithOnlyOutputResponse(software.amazon.awssdk.services.json.model.EventStreamOperationWithOnlyOutputResponse) StreamingOutputOperationRequest(software.amazon.awssdk.services.json.model.StreamingOutputOperationRequest) InputEventTwoMarshaller(software.amazon.awssdk.services.json.transform.InputEventTwoMarshaller) SdkInternalExecutionAttribute(software.amazon.awssdk.core.interceptor.SdkInternalExecutionAttribute) MetricCollector(software.amazon.awssdk.metrics.MetricCollector) Executor(java.util.concurrent.Executor) Publisher(org.reactivestreams.Publisher) APostOperationWithOutputRequest(software.amazon.awssdk.services.json.model.APostOperationWithOutputRequest) EventStreamOperationWithOnlyInputResponse(software.amazon.awssdk.services.json.model.EventStreamOperationWithOnlyInputResponse) SdkInternalApi(software.amazon.awssdk.annotations.SdkInternalApi) GetWithoutRequiredMembersResponse(software.amazon.awssdk.services.json.model.GetWithoutRequiredMembersResponse) DefaultInputEventTwo(software.amazon.awssdk.services.json.model.inputeventstreamtwo.DefaultInputEventTwo) GetWithoutRequiredMembersRequestMarshaller(software.amazon.awssdk.services.json.transform.GetWithoutRequiredMembersRequestMarshaller) LoggerFactory(org.slf4j.LoggerFactory) StreamingInputOperationRequestMarshaller(software.amazon.awssdk.services.json.transform.StreamingInputOperationRequestMarshaller) ByteBuffer(java.nio.ByteBuffer) JsonException(software.amazon.awssdk.services.json.model.JsonException) MetricPublisher(software.amazon.awssdk.metrics.MetricPublisher) DefaultInputEvent(software.amazon.awssdk.services.json.model.inputeventstream.DefaultInputEvent) JsonOperationMetadata(software.amazon.awssdk.protocols.json.JsonOperationMetadata) EventStreamOperationWithOnlyInputRequest(software.amazon.awssdk.services.json.model.EventStreamOperationWithOnlyInputRequest) ApiName(software.amazon.awssdk.core.ApiName) GetWithoutRequiredMembersRequest(software.amazon.awssdk.services.json.model.GetWithoutRequiredMembersRequest) SdkClientOption(software.amazon.awssdk.core.client.config.SdkClientOption) HostnameValidator(software.amazon.awssdk.utils.HostnameValidator) StreamingOutputOperationResponse(software.amazon.awssdk.services.json.model.StreamingOutputOperationResponse) APostOperationRequestMarshaller(software.amazon.awssdk.services.json.transform.APostOperationRequestMarshaller) StreamingInputOperationResponse(software.amazon.awssdk.services.json.model.StreamingInputOperationResponse) EventStreamOperationRequestMarshaller(software.amazon.awssdk.services.json.transform.EventStreamOperationRequestMarshaller) DefaultInputEventOne(software.amazon.awssdk.services.json.model.inputeventstreamtwo.DefaultInputEventOne) SdkPojoBuilder(software.amazon.awssdk.core.SdkPojoBuilder) InputEventMarshaller(software.amazon.awssdk.services.json.transform.InputEventMarshaller) OperationWithChecksumRequiredRequest(software.amazon.awssdk.services.json.model.OperationWithChecksumRequiredRequest) InputEventStream(software.amazon.awssdk.services.json.model.InputEventStream) List(java.util.List) APostOperationResponse(software.amazon.awssdk.services.json.model.APostOperationResponse) StreamingInputOutputOperationRequest(software.amazon.awssdk.services.json.model.StreamingInputOutputOperationRequest) AttachHttpMetadataResponseHandler(software.amazon.awssdk.core.client.handler.AttachHttpMetadataResponseHandler) Aws4UnsignedPayloadSigner(software.amazon.awssdk.auth.signer.Aws4UnsignedPayloadSigner) JsonRequest(software.amazon.awssdk.services.json.model.JsonRequest) EventStreamOperationWithOnlyOutputRequestMarshaller(software.amazon.awssdk.services.json.transform.EventStreamOperationWithOnlyOutputRequestMarshaller) OperationWithChecksumRequiredRequestMarshaller(software.amazon.awssdk.services.json.transform.OperationWithChecksumRequiredRequestMarshaller) AwsRequestOverrideConfiguration(software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration) Signer(software.amazon.awssdk.core.signer.Signer) AwsJsonProtocol(software.amazon.awssdk.protocols.json.AwsJsonProtocol) EventStreamAsyncResponseTransformer(software.amazon.awssdk.awscore.eventstream.EventStreamAsyncResponseTransformer) EventStreamTaggedUnionPojoSupplier(software.amazon.awssdk.awscore.eventstream.EventStreamTaggedUnionPojoSupplier) CompletableFuture(java.util.concurrent.CompletableFuture) HttpChecksumRequired(software.amazon.awssdk.core.interceptor.trait.HttpChecksumRequired) InvalidInputException(software.amazon.awssdk.services.json.model.InvalidInputException) NoOpMetricCollector(software.amazon.awssdk.metrics.NoOpMetricCollector) PaginatedOperationWithoutResultKeyRequest(software.amazon.awssdk.services.json.model.PaginatedOperationWithoutResultKeyRequest) Logger(org.slf4j.Logger) EventStreamOperationWithOnlyOutputRequest(software.amazon.awssdk.services.json.model.EventStreamOperationWithOnlyOutputRequest) Pair(software.amazon.awssdk.utils.Pair) SdkPublisher(software.amazon.awssdk.core.async.SdkPublisher) EventStreamAws4Signer(software.amazon.awssdk.auth.signer.EventStreamAws4Signer) Consumer(java.util.function.Consumer) StreamingOutputOperationRequestMarshaller(software.amazon.awssdk.services.json.transform.StreamingOutputOperationRequestMarshaller) ClientExecutionParams(software.amazon.awssdk.core.client.handler.ClientExecutionParams) EventStreamOperationWithOnlyOutputResponseHandler(software.amazon.awssdk.services.json.model.EventStreamOperationWithOnlyOutputResponseHandler) StreamingInputOutputOperationResponse(software.amazon.awssdk.services.json.model.StreamingInputOutputOperationResponse) AwsClientHandlerUtils(software.amazon.awssdk.awscore.client.handler.AwsClientHandlerUtils) EventStreamOperationResponse(software.amazon.awssdk.services.json.model.EventStreamOperationResponse) SdkResponse(software.amazon.awssdk.core.SdkResponse) AwsJsonProtocolFactory(software.amazon.awssdk.protocols.json.AwsJsonProtocolFactory) FunctionalUtils.runAndLogError(software.amazon.awssdk.utils.FunctionalUtils.runAndLogError) Collections(java.util.Collections) MetricPublisher(software.amazon.awssdk.metrics.MetricPublisher) JsonOperationMetadata(software.amazon.awssdk.protocols.json.JsonOperationMetadata) PaginatedOperationWithoutResultKeyResponse(software.amazon.awssdk.services.json.model.PaginatedOperationWithoutResultKeyResponse) AwsServiceException(software.amazon.awssdk.awscore.exception.AwsServiceException) MetricCollector(software.amazon.awssdk.metrics.MetricCollector) NoOpMetricCollector(software.amazon.awssdk.metrics.NoOpMetricCollector) PaginatedOperationWithoutResultKeyRequest(software.amazon.awssdk.services.json.model.PaginatedOperationWithoutResultKeyRequest) PaginatedOperationWithoutResultKeyRequestMarshaller(software.amazon.awssdk.services.json.transform.PaginatedOperationWithoutResultKeyRequestMarshaller)

Example 3 with JsonException

use of software.amazon.awssdk.services.json.model.JsonException in project aws-sdk-java-v2 by aws.

the class DefaultJsonAsyncClient method eventStreamOperationWithOnlyInput.

/**
 * Invokes the EventStreamOperationWithOnlyInput operation asynchronously.
 *
 * @param eventStreamOperationWithOnlyInputRequest
 * @return A Java Future containing the result of the EventStreamOperationWithOnlyInput 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.EventStreamOperationWithOnlyInput
 * @see <a href="https://docs.aws.amazon.com/goto/WebAPI/json-service-2010-05-08/EventStreamOperationWithOnlyInput"
 *      target="_top">AWS API Documentation</a>
 */
@Override
public CompletableFuture<EventStreamOperationWithOnlyInputResponse> eventStreamOperationWithOnlyInput(EventStreamOperationWithOnlyInputRequest eventStreamOperationWithOnlyInputRequest, Publisher<InputEventStreamTwo> requestStream) {
    List<MetricPublisher> metricPublishers = resolveMetricPublishers(clientConfiguration, eventStreamOperationWithOnlyInputRequest.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, "EventStreamOperationWithOnlyInput");
        eventStreamOperationWithOnlyInputRequest = applySignerOverride(eventStreamOperationWithOnlyInputRequest, EventStreamAws4Signer.create());
        JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false).isPayloadJson(true).build();
        HttpResponseHandler<EventStreamOperationWithOnlyInputResponse> responseHandler = protocolFactory.createResponseHandler(operationMetadata, EventStreamOperationWithOnlyInputResponse::builder);
        HttpResponseHandler<AwsServiceException> errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata);
        EventStreamTaggedUnionJsonMarshaller eventMarshaller = EventStreamTaggedUnionJsonMarshaller.builder().putMarshaller(DefaultInputEventOne.class, new InputEventMarshaller(protocolFactory)).putMarshaller(DefaultInputEventTwo.class, new InputEventTwoMarshaller(protocolFactory)).build();
        SdkPublisher<InputEventStreamTwo> eventPublisher = SdkPublisher.adapt(requestStream);
        Publisher<ByteBuffer> adapted = eventPublisher.map(event -> eventMarshaller.marshall(event)).map(AwsClientHandlerUtils::encodeEventStreamRequestToByteBuffer);
        CompletableFuture<EventStreamOperationWithOnlyInputResponse> executeFuture = clientHandler.execute(new ClientExecutionParams<EventStreamOperationWithOnlyInputRequest, EventStreamOperationWithOnlyInputResponse>().withOperationName("EventStreamOperationWithOnlyInput").withMarshaller(new EventStreamOperationWithOnlyInputRequestMarshaller(protocolFactory)).withAsyncRequestBody(AsyncRequestBody.fromPublisher(adapted)).withInitialRequestEvent(true).withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler).withMetricCollector(apiCallMetricCollector).withInput(eventStreamOperationWithOnlyInputRequest));
        CompletableFuture<EventStreamOperationWithOnlyInputResponse> 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);
    }
}
Also used : ExceptionMetadata(software.amazon.awssdk.protocols.core.ExceptionMetadata) AwsAsyncClientHandler(software.amazon.awssdk.awscore.client.handler.AwsAsyncClientHandler) StreamingInputOutputOperationRequestMarshaller(software.amazon.awssdk.services.json.transform.StreamingInputOutputOperationRequestMarshaller) EventStreamOperationResponseHandler(software.amazon.awssdk.services.json.model.EventStreamOperationResponseHandler) AsyncStreamingRequestMarshaller(software.amazon.awssdk.core.runtime.transform.AsyncStreamingRequestMarshaller) AsyncResponseTransformer(software.amazon.awssdk.core.async.AsyncResponseTransformer) InputEventStreamTwo(software.amazon.awssdk.services.json.model.InputEventStreamTwo) StreamingInputOperationRequest(software.amazon.awssdk.services.json.model.StreamingInputOperationRequest) AsyncClientHandler(software.amazon.awssdk.core.client.handler.AsyncClientHandler) PaginatedOperationWithResultKeyResponse(software.amazon.awssdk.services.json.model.PaginatedOperationWithResultKeyResponse) AwsServiceException(software.amazon.awssdk.awscore.exception.AwsServiceException) PaginatedOperationWithResultKeyPublisher(software.amazon.awssdk.services.json.paginators.PaginatedOperationWithResultKeyPublisher) EventStreamOperationWithOnlyInputRequestMarshaller(software.amazon.awssdk.services.json.transform.EventStreamOperationWithOnlyInputRequestMarshaller) APostOperationWithOutputResponse(software.amazon.awssdk.services.json.model.APostOperationWithOutputResponse) EventStream(software.amazon.awssdk.services.json.model.EventStream) APostOperationRequest(software.amazon.awssdk.services.json.model.APostOperationRequest) PaginatedOperationWithoutResultKeyPublisher(software.amazon.awssdk.services.json.paginators.PaginatedOperationWithoutResultKeyPublisher) PaginatedOperationWithoutResultKeyResponse(software.amazon.awssdk.services.json.model.PaginatedOperationWithoutResultKeyResponse) AsyncRequestBody(software.amazon.awssdk.core.async.AsyncRequestBody) AsyncAws4Signer(software.amazon.awssdk.auth.signer.AsyncAws4Signer) SdkAdvancedAsyncClientOption(software.amazon.awssdk.core.client.config.SdkAdvancedAsyncClientOption) APostOperationWithOutputRequestMarshaller(software.amazon.awssdk.services.json.transform.APostOperationWithOutputRequestMarshaller) EventStreamOperationRequest(software.amazon.awssdk.services.json.model.EventStreamOperationRequest) HttpResponseHandler(software.amazon.awssdk.core.http.HttpResponseHandler) Generated(software.amazon.awssdk.annotations.Generated) AsyncResponseTransformerUtils(software.amazon.awssdk.core.async.AsyncResponseTransformerUtils) PaginatedOperationWithResultKeyRequestMarshaller(software.amazon.awssdk.services.json.transform.PaginatedOperationWithResultKeyRequestMarshaller) PaginatedOperationWithoutResultKeyRequestMarshaller(software.amazon.awssdk.services.json.transform.PaginatedOperationWithoutResultKeyRequestMarshaller) OperationWithChecksumRequiredResponse(software.amazon.awssdk.services.json.model.OperationWithChecksumRequiredResponse) EventStreamTaggedUnionJsonMarshaller(software.amazon.awssdk.awscore.eventstream.EventStreamTaggedUnionJsonMarshaller) VoidSdkResponse(software.amazon.awssdk.core.protocol.VoidSdkResponse) CompletableFutureUtils(software.amazon.awssdk.utils.CompletableFutureUtils) SdkClientConfiguration(software.amazon.awssdk.core.client.config.SdkClientConfiguration) VersionInfo(software.amazon.awssdk.core.util.VersionInfo) PaginatedOperationWithResultKeyRequest(software.amazon.awssdk.services.json.model.PaginatedOperationWithResultKeyRequest) CoreMetric(software.amazon.awssdk.core.metrics.CoreMetric) BaseAwsJsonProtocolFactory(software.amazon.awssdk.protocols.json.BaseAwsJsonProtocolFactory) RequestOverrideConfiguration(software.amazon.awssdk.core.RequestOverrideConfiguration) EventStreamOperationWithOnlyOutputResponse(software.amazon.awssdk.services.json.model.EventStreamOperationWithOnlyOutputResponse) StreamingOutputOperationRequest(software.amazon.awssdk.services.json.model.StreamingOutputOperationRequest) InputEventTwoMarshaller(software.amazon.awssdk.services.json.transform.InputEventTwoMarshaller) SdkInternalExecutionAttribute(software.amazon.awssdk.core.interceptor.SdkInternalExecutionAttribute) MetricCollector(software.amazon.awssdk.metrics.MetricCollector) Executor(java.util.concurrent.Executor) Publisher(org.reactivestreams.Publisher) APostOperationWithOutputRequest(software.amazon.awssdk.services.json.model.APostOperationWithOutputRequest) EventStreamOperationWithOnlyInputResponse(software.amazon.awssdk.services.json.model.EventStreamOperationWithOnlyInputResponse) SdkInternalApi(software.amazon.awssdk.annotations.SdkInternalApi) GetWithoutRequiredMembersResponse(software.amazon.awssdk.services.json.model.GetWithoutRequiredMembersResponse) DefaultInputEventTwo(software.amazon.awssdk.services.json.model.inputeventstreamtwo.DefaultInputEventTwo) GetWithoutRequiredMembersRequestMarshaller(software.amazon.awssdk.services.json.transform.GetWithoutRequiredMembersRequestMarshaller) LoggerFactory(org.slf4j.LoggerFactory) StreamingInputOperationRequestMarshaller(software.amazon.awssdk.services.json.transform.StreamingInputOperationRequestMarshaller) ByteBuffer(java.nio.ByteBuffer) JsonException(software.amazon.awssdk.services.json.model.JsonException) MetricPublisher(software.amazon.awssdk.metrics.MetricPublisher) DefaultInputEvent(software.amazon.awssdk.services.json.model.inputeventstream.DefaultInputEvent) JsonOperationMetadata(software.amazon.awssdk.protocols.json.JsonOperationMetadata) EventStreamOperationWithOnlyInputRequest(software.amazon.awssdk.services.json.model.EventStreamOperationWithOnlyInputRequest) ApiName(software.amazon.awssdk.core.ApiName) GetWithoutRequiredMembersRequest(software.amazon.awssdk.services.json.model.GetWithoutRequiredMembersRequest) SdkClientOption(software.amazon.awssdk.core.client.config.SdkClientOption) HostnameValidator(software.amazon.awssdk.utils.HostnameValidator) StreamingOutputOperationResponse(software.amazon.awssdk.services.json.model.StreamingOutputOperationResponse) APostOperationRequestMarshaller(software.amazon.awssdk.services.json.transform.APostOperationRequestMarshaller) StreamingInputOperationResponse(software.amazon.awssdk.services.json.model.StreamingInputOperationResponse) EventStreamOperationRequestMarshaller(software.amazon.awssdk.services.json.transform.EventStreamOperationRequestMarshaller) DefaultInputEventOne(software.amazon.awssdk.services.json.model.inputeventstreamtwo.DefaultInputEventOne) SdkPojoBuilder(software.amazon.awssdk.core.SdkPojoBuilder) InputEventMarshaller(software.amazon.awssdk.services.json.transform.InputEventMarshaller) OperationWithChecksumRequiredRequest(software.amazon.awssdk.services.json.model.OperationWithChecksumRequiredRequest) InputEventStream(software.amazon.awssdk.services.json.model.InputEventStream) List(java.util.List) APostOperationResponse(software.amazon.awssdk.services.json.model.APostOperationResponse) StreamingInputOutputOperationRequest(software.amazon.awssdk.services.json.model.StreamingInputOutputOperationRequest) AttachHttpMetadataResponseHandler(software.amazon.awssdk.core.client.handler.AttachHttpMetadataResponseHandler) Aws4UnsignedPayloadSigner(software.amazon.awssdk.auth.signer.Aws4UnsignedPayloadSigner) JsonRequest(software.amazon.awssdk.services.json.model.JsonRequest) EventStreamOperationWithOnlyOutputRequestMarshaller(software.amazon.awssdk.services.json.transform.EventStreamOperationWithOnlyOutputRequestMarshaller) OperationWithChecksumRequiredRequestMarshaller(software.amazon.awssdk.services.json.transform.OperationWithChecksumRequiredRequestMarshaller) AwsRequestOverrideConfiguration(software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration) Signer(software.amazon.awssdk.core.signer.Signer) AwsJsonProtocol(software.amazon.awssdk.protocols.json.AwsJsonProtocol) EventStreamAsyncResponseTransformer(software.amazon.awssdk.awscore.eventstream.EventStreamAsyncResponseTransformer) EventStreamTaggedUnionPojoSupplier(software.amazon.awssdk.awscore.eventstream.EventStreamTaggedUnionPojoSupplier) CompletableFuture(java.util.concurrent.CompletableFuture) HttpChecksumRequired(software.amazon.awssdk.core.interceptor.trait.HttpChecksumRequired) InvalidInputException(software.amazon.awssdk.services.json.model.InvalidInputException) NoOpMetricCollector(software.amazon.awssdk.metrics.NoOpMetricCollector) PaginatedOperationWithoutResultKeyRequest(software.amazon.awssdk.services.json.model.PaginatedOperationWithoutResultKeyRequest) Logger(org.slf4j.Logger) EventStreamOperationWithOnlyOutputRequest(software.amazon.awssdk.services.json.model.EventStreamOperationWithOnlyOutputRequest) Pair(software.amazon.awssdk.utils.Pair) SdkPublisher(software.amazon.awssdk.core.async.SdkPublisher) EventStreamAws4Signer(software.amazon.awssdk.auth.signer.EventStreamAws4Signer) Consumer(java.util.function.Consumer) StreamingOutputOperationRequestMarshaller(software.amazon.awssdk.services.json.transform.StreamingOutputOperationRequestMarshaller) ClientExecutionParams(software.amazon.awssdk.core.client.handler.ClientExecutionParams) EventStreamOperationWithOnlyOutputResponseHandler(software.amazon.awssdk.services.json.model.EventStreamOperationWithOnlyOutputResponseHandler) StreamingInputOutputOperationResponse(software.amazon.awssdk.services.json.model.StreamingInputOutputOperationResponse) AwsClientHandlerUtils(software.amazon.awssdk.awscore.client.handler.AwsClientHandlerUtils) EventStreamOperationResponse(software.amazon.awssdk.services.json.model.EventStreamOperationResponse) SdkResponse(software.amazon.awssdk.core.SdkResponse) AwsJsonProtocolFactory(software.amazon.awssdk.protocols.json.AwsJsonProtocolFactory) FunctionalUtils.runAndLogError(software.amazon.awssdk.utils.FunctionalUtils.runAndLogError) Collections(java.util.Collections) InputEventStreamTwo(software.amazon.awssdk.services.json.model.InputEventStreamTwo) InputEventMarshaller(software.amazon.awssdk.services.json.transform.InputEventMarshaller) AwsClientHandlerUtils(software.amazon.awssdk.awscore.client.handler.AwsClientHandlerUtils) MetricPublisher(software.amazon.awssdk.metrics.MetricPublisher) JsonOperationMetadata(software.amazon.awssdk.protocols.json.JsonOperationMetadata) ByteBuffer(java.nio.ByteBuffer) EventStreamTaggedUnionJsonMarshaller(software.amazon.awssdk.awscore.eventstream.EventStreamTaggedUnionJsonMarshaller) InputEventTwoMarshaller(software.amazon.awssdk.services.json.transform.InputEventTwoMarshaller) EventStreamOperationWithOnlyInputRequestMarshaller(software.amazon.awssdk.services.json.transform.EventStreamOperationWithOnlyInputRequestMarshaller) EventStreamOperationWithOnlyInputResponse(software.amazon.awssdk.services.json.model.EventStreamOperationWithOnlyInputResponse) EventStreamOperationWithOnlyInputRequest(software.amazon.awssdk.services.json.model.EventStreamOperationWithOnlyInputRequest) DefaultInputEventTwo(software.amazon.awssdk.services.json.model.inputeventstreamtwo.DefaultInputEventTwo) AwsServiceException(software.amazon.awssdk.awscore.exception.AwsServiceException) MetricCollector(software.amazon.awssdk.metrics.MetricCollector) NoOpMetricCollector(software.amazon.awssdk.metrics.NoOpMetricCollector)

Example 4 with JsonException

use of software.amazon.awssdk.services.json.model.JsonException in project aws-sdk-java-v2 by aws.

the class DefaultJsonAsyncClient 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>JsonException Base class for all service exceptions. Unknown exceptions will be thrown as an instance
 *         of this type.</li>
 *         </ul>
 * @sample JsonAsyncClient.OperationWithChecksumRequired
 * @see <a href="https://docs.aws.amazon.com/goto/WebAPI/json-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, "Json Service");
        apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OperationWithChecksumRequired");
        JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false).isPayloadJson(true).build();
        HttpResponseHandler<OperationWithChecksumRequiredResponse> responseHandler = protocolFactory.createResponseHandler(operationMetadata, OperationWithChecksumRequiredResponse::builder);
        HttpResponseHandler<AwsServiceException> errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata);
        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> 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);
    }
}
Also used : ExceptionMetadata(software.amazon.awssdk.protocols.core.ExceptionMetadata) AwsAsyncClientHandler(software.amazon.awssdk.awscore.client.handler.AwsAsyncClientHandler) StreamingInputOutputOperationRequestMarshaller(software.amazon.awssdk.services.json.transform.StreamingInputOutputOperationRequestMarshaller) EventStreamOperationResponseHandler(software.amazon.awssdk.services.json.model.EventStreamOperationResponseHandler) AsyncStreamingRequestMarshaller(software.amazon.awssdk.core.runtime.transform.AsyncStreamingRequestMarshaller) AsyncResponseTransformer(software.amazon.awssdk.core.async.AsyncResponseTransformer) InputEventStreamTwo(software.amazon.awssdk.services.json.model.InputEventStreamTwo) StreamingInputOperationRequest(software.amazon.awssdk.services.json.model.StreamingInputOperationRequest) AsyncClientHandler(software.amazon.awssdk.core.client.handler.AsyncClientHandler) PaginatedOperationWithResultKeyResponse(software.amazon.awssdk.services.json.model.PaginatedOperationWithResultKeyResponse) AwsServiceException(software.amazon.awssdk.awscore.exception.AwsServiceException) PaginatedOperationWithResultKeyPublisher(software.amazon.awssdk.services.json.paginators.PaginatedOperationWithResultKeyPublisher) EventStreamOperationWithOnlyInputRequestMarshaller(software.amazon.awssdk.services.json.transform.EventStreamOperationWithOnlyInputRequestMarshaller) APostOperationWithOutputResponse(software.amazon.awssdk.services.json.model.APostOperationWithOutputResponse) EventStream(software.amazon.awssdk.services.json.model.EventStream) APostOperationRequest(software.amazon.awssdk.services.json.model.APostOperationRequest) PaginatedOperationWithoutResultKeyPublisher(software.amazon.awssdk.services.json.paginators.PaginatedOperationWithoutResultKeyPublisher) PaginatedOperationWithoutResultKeyResponse(software.amazon.awssdk.services.json.model.PaginatedOperationWithoutResultKeyResponse) AsyncRequestBody(software.amazon.awssdk.core.async.AsyncRequestBody) AsyncAws4Signer(software.amazon.awssdk.auth.signer.AsyncAws4Signer) SdkAdvancedAsyncClientOption(software.amazon.awssdk.core.client.config.SdkAdvancedAsyncClientOption) APostOperationWithOutputRequestMarshaller(software.amazon.awssdk.services.json.transform.APostOperationWithOutputRequestMarshaller) EventStreamOperationRequest(software.amazon.awssdk.services.json.model.EventStreamOperationRequest) HttpResponseHandler(software.amazon.awssdk.core.http.HttpResponseHandler) Generated(software.amazon.awssdk.annotations.Generated) AsyncResponseTransformerUtils(software.amazon.awssdk.core.async.AsyncResponseTransformerUtils) PaginatedOperationWithResultKeyRequestMarshaller(software.amazon.awssdk.services.json.transform.PaginatedOperationWithResultKeyRequestMarshaller) PaginatedOperationWithoutResultKeyRequestMarshaller(software.amazon.awssdk.services.json.transform.PaginatedOperationWithoutResultKeyRequestMarshaller) OperationWithChecksumRequiredResponse(software.amazon.awssdk.services.json.model.OperationWithChecksumRequiredResponse) EventStreamTaggedUnionJsonMarshaller(software.amazon.awssdk.awscore.eventstream.EventStreamTaggedUnionJsonMarshaller) VoidSdkResponse(software.amazon.awssdk.core.protocol.VoidSdkResponse) CompletableFutureUtils(software.amazon.awssdk.utils.CompletableFutureUtils) SdkClientConfiguration(software.amazon.awssdk.core.client.config.SdkClientConfiguration) VersionInfo(software.amazon.awssdk.core.util.VersionInfo) PaginatedOperationWithResultKeyRequest(software.amazon.awssdk.services.json.model.PaginatedOperationWithResultKeyRequest) CoreMetric(software.amazon.awssdk.core.metrics.CoreMetric) BaseAwsJsonProtocolFactory(software.amazon.awssdk.protocols.json.BaseAwsJsonProtocolFactory) RequestOverrideConfiguration(software.amazon.awssdk.core.RequestOverrideConfiguration) EventStreamOperationWithOnlyOutputResponse(software.amazon.awssdk.services.json.model.EventStreamOperationWithOnlyOutputResponse) StreamingOutputOperationRequest(software.amazon.awssdk.services.json.model.StreamingOutputOperationRequest) InputEventTwoMarshaller(software.amazon.awssdk.services.json.transform.InputEventTwoMarshaller) SdkInternalExecutionAttribute(software.amazon.awssdk.core.interceptor.SdkInternalExecutionAttribute) MetricCollector(software.amazon.awssdk.metrics.MetricCollector) Executor(java.util.concurrent.Executor) Publisher(org.reactivestreams.Publisher) APostOperationWithOutputRequest(software.amazon.awssdk.services.json.model.APostOperationWithOutputRequest) EventStreamOperationWithOnlyInputResponse(software.amazon.awssdk.services.json.model.EventStreamOperationWithOnlyInputResponse) SdkInternalApi(software.amazon.awssdk.annotations.SdkInternalApi) GetWithoutRequiredMembersResponse(software.amazon.awssdk.services.json.model.GetWithoutRequiredMembersResponse) DefaultInputEventTwo(software.amazon.awssdk.services.json.model.inputeventstreamtwo.DefaultInputEventTwo) GetWithoutRequiredMembersRequestMarshaller(software.amazon.awssdk.services.json.transform.GetWithoutRequiredMembersRequestMarshaller) LoggerFactory(org.slf4j.LoggerFactory) StreamingInputOperationRequestMarshaller(software.amazon.awssdk.services.json.transform.StreamingInputOperationRequestMarshaller) ByteBuffer(java.nio.ByteBuffer) JsonException(software.amazon.awssdk.services.json.model.JsonException) MetricPublisher(software.amazon.awssdk.metrics.MetricPublisher) DefaultInputEvent(software.amazon.awssdk.services.json.model.inputeventstream.DefaultInputEvent) JsonOperationMetadata(software.amazon.awssdk.protocols.json.JsonOperationMetadata) EventStreamOperationWithOnlyInputRequest(software.amazon.awssdk.services.json.model.EventStreamOperationWithOnlyInputRequest) ApiName(software.amazon.awssdk.core.ApiName) GetWithoutRequiredMembersRequest(software.amazon.awssdk.services.json.model.GetWithoutRequiredMembersRequest) SdkClientOption(software.amazon.awssdk.core.client.config.SdkClientOption) HostnameValidator(software.amazon.awssdk.utils.HostnameValidator) StreamingOutputOperationResponse(software.amazon.awssdk.services.json.model.StreamingOutputOperationResponse) APostOperationRequestMarshaller(software.amazon.awssdk.services.json.transform.APostOperationRequestMarshaller) StreamingInputOperationResponse(software.amazon.awssdk.services.json.model.StreamingInputOperationResponse) EventStreamOperationRequestMarshaller(software.amazon.awssdk.services.json.transform.EventStreamOperationRequestMarshaller) DefaultInputEventOne(software.amazon.awssdk.services.json.model.inputeventstreamtwo.DefaultInputEventOne) SdkPojoBuilder(software.amazon.awssdk.core.SdkPojoBuilder) InputEventMarshaller(software.amazon.awssdk.services.json.transform.InputEventMarshaller) OperationWithChecksumRequiredRequest(software.amazon.awssdk.services.json.model.OperationWithChecksumRequiredRequest) InputEventStream(software.amazon.awssdk.services.json.model.InputEventStream) List(java.util.List) APostOperationResponse(software.amazon.awssdk.services.json.model.APostOperationResponse) StreamingInputOutputOperationRequest(software.amazon.awssdk.services.json.model.StreamingInputOutputOperationRequest) AttachHttpMetadataResponseHandler(software.amazon.awssdk.core.client.handler.AttachHttpMetadataResponseHandler) Aws4UnsignedPayloadSigner(software.amazon.awssdk.auth.signer.Aws4UnsignedPayloadSigner) JsonRequest(software.amazon.awssdk.services.json.model.JsonRequest) EventStreamOperationWithOnlyOutputRequestMarshaller(software.amazon.awssdk.services.json.transform.EventStreamOperationWithOnlyOutputRequestMarshaller) OperationWithChecksumRequiredRequestMarshaller(software.amazon.awssdk.services.json.transform.OperationWithChecksumRequiredRequestMarshaller) AwsRequestOverrideConfiguration(software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration) Signer(software.amazon.awssdk.core.signer.Signer) AwsJsonProtocol(software.amazon.awssdk.protocols.json.AwsJsonProtocol) EventStreamAsyncResponseTransformer(software.amazon.awssdk.awscore.eventstream.EventStreamAsyncResponseTransformer) EventStreamTaggedUnionPojoSupplier(software.amazon.awssdk.awscore.eventstream.EventStreamTaggedUnionPojoSupplier) CompletableFuture(java.util.concurrent.CompletableFuture) HttpChecksumRequired(software.amazon.awssdk.core.interceptor.trait.HttpChecksumRequired) InvalidInputException(software.amazon.awssdk.services.json.model.InvalidInputException) NoOpMetricCollector(software.amazon.awssdk.metrics.NoOpMetricCollector) PaginatedOperationWithoutResultKeyRequest(software.amazon.awssdk.services.json.model.PaginatedOperationWithoutResultKeyRequest) Logger(org.slf4j.Logger) EventStreamOperationWithOnlyOutputRequest(software.amazon.awssdk.services.json.model.EventStreamOperationWithOnlyOutputRequest) Pair(software.amazon.awssdk.utils.Pair) SdkPublisher(software.amazon.awssdk.core.async.SdkPublisher) EventStreamAws4Signer(software.amazon.awssdk.auth.signer.EventStreamAws4Signer) Consumer(java.util.function.Consumer) StreamingOutputOperationRequestMarshaller(software.amazon.awssdk.services.json.transform.StreamingOutputOperationRequestMarshaller) ClientExecutionParams(software.amazon.awssdk.core.client.handler.ClientExecutionParams) EventStreamOperationWithOnlyOutputResponseHandler(software.amazon.awssdk.services.json.model.EventStreamOperationWithOnlyOutputResponseHandler) StreamingInputOutputOperationResponse(software.amazon.awssdk.services.json.model.StreamingInputOutputOperationResponse) AwsClientHandlerUtils(software.amazon.awssdk.awscore.client.handler.AwsClientHandlerUtils) EventStreamOperationResponse(software.amazon.awssdk.services.json.model.EventStreamOperationResponse) SdkResponse(software.amazon.awssdk.core.SdkResponse) AwsJsonProtocolFactory(software.amazon.awssdk.protocols.json.AwsJsonProtocolFactory) FunctionalUtils.runAndLogError(software.amazon.awssdk.utils.FunctionalUtils.runAndLogError) Collections(java.util.Collections) ClientExecutionParams(software.amazon.awssdk.core.client.handler.ClientExecutionParams) MetricPublisher(software.amazon.awssdk.metrics.MetricPublisher) OperationWithChecksumRequiredResponse(software.amazon.awssdk.services.json.model.OperationWithChecksumRequiredResponse) JsonOperationMetadata(software.amazon.awssdk.protocols.json.JsonOperationMetadata) AwsServiceException(software.amazon.awssdk.awscore.exception.AwsServiceException) MetricCollector(software.amazon.awssdk.metrics.MetricCollector) NoOpMetricCollector(software.amazon.awssdk.metrics.NoOpMetricCollector) OperationWithChecksumRequiredRequestMarshaller(software.amazon.awssdk.services.json.transform.OperationWithChecksumRequiredRequestMarshaller)

Example 5 with JsonException

use of software.amazon.awssdk.services.json.model.JsonException in project aws-sdk-java-v2 by aws.

the class DefaultJsonAsyncClient method putOperationWithChecksum.

/**
 * Invokes the PutOperationWithChecksum operation asynchronously.
 *
 * @param putOperationWithChecksumRequest
 * @param requestBody
 *        Functional interface that can be implemented to produce the request content in a non-blocking manner. The
 *        size of the content is expected to be known up front. See {@link AsyncRequestBody} for specific details on
 *        implementing this interface as well as links to precanned implementations for common scenarios like
 *        uploading from a file. The service documentation for the request content is as follows '
 *        <p>
 *        Object data.
 *        </p>
 *        '
 * @param asyncResponseTransformer
 *        The response transformer for processing the streaming response in a non-blocking manner. See
 *        {@link AsyncResponseTransformer} for details on how this callback should be implemented and for links to
 *        precanned implementations for common scenarios like downloading to a file. The service documentation for
 *        the response content is as follows '
 *        <p>
 *        Object data.
 *        </p>
 *        '.
 * @return A future to the transformed result of the AsyncResponseTransformer.<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.PutOperationWithChecksum
 * @see <a href="https://docs.aws.amazon.com/goto/WebAPI/json-service-2010-05-08/PutOperationWithChecksum"
 *      target="_top">AWS API Documentation</a>
 */
@Override
public <ReturnT> CompletableFuture<ReturnT> putOperationWithChecksum(PutOperationWithChecksumRequest putOperationWithChecksumRequest, AsyncRequestBody requestBody, AsyncResponseTransformer<PutOperationWithChecksumResponse, ReturnT> asyncResponseTransformer) {
    List<MetricPublisher> metricPublishers = resolveMetricPublishers(clientConfiguration, putOperationWithChecksumRequest.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, "PutOperationWithChecksum");
        Pair<AsyncResponseTransformer<PutOperationWithChecksumResponse, ReturnT>, CompletableFuture<Void>> pair = AsyncResponseTransformerUtils.wrapWithEndOfStreamFuture(asyncResponseTransformer);
        asyncResponseTransformer = pair.left();
        CompletableFuture<Void> endOfStreamFuture = pair.right();
        if (!isSignerOverridden(clientConfiguration)) {
            putOperationWithChecksumRequest = applySignerOverride(putOperationWithChecksumRequest, AsyncAws4Signer.create());
        }
        JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(true).isPayloadJson(false).build();
        HttpResponseHandler<PutOperationWithChecksumResponse> responseHandler = protocolFactory.createResponseHandler(operationMetadata, PutOperationWithChecksumResponse::builder);
        HttpResponseHandler<AwsServiceException> errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata);
        CompletableFuture<ReturnT> executeFuture = clientHandler.execute(new ClientExecutionParams<PutOperationWithChecksumRequest, PutOperationWithChecksumResponse>().withOperationName("PutOperationWithChecksum").withMarshaller(AsyncStreamingRequestMarshaller.builder().delegateMarshaller(new PutOperationWithChecksumRequestMarshaller(protocolFactory)).asyncRequestBody(requestBody).build()).withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler).withMetricCollector(apiCallMetricCollector).withAsyncRequestBody(requestBody).putExecutionAttribute(SdkInternalExecutionAttribute.HTTP_CHECKSUM, HttpChecksum.builder().requestChecksumRequired(false).requestValidationMode(putOperationWithChecksumRequest.checksumModeAsString()).responseAlgorithms("CRC32C", "CRC32", "SHA1", "SHA256").isRequestStreaming(true).build()).withInput(putOperationWithChecksumRequest), asyncResponseTransformer);
        AsyncResponseTransformer<PutOperationWithChecksumResponse, ReturnT> finalAsyncResponseTransformer = asyncResponseTransformer;
        CompletableFuture<ReturnT> whenCompleted = executeFuture.whenComplete((r, e) -> {
            if (e != null) {
                runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", () -> finalAsyncResponseTransformer.exceptionOccurred(e));
            }
            endOfStreamFuture.whenComplete((r2, e2) -> {
                metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
            });
        });
        executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
        return executeFuture;
    } catch (Throwable t) {
        AsyncResponseTransformer<PutOperationWithChecksumResponse, ReturnT> finalAsyncResponseTransformer = asyncResponseTransformer;
        runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", () -> finalAsyncResponseTransformer.exceptionOccurred(t));
        metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
        return CompletableFutureUtils.failedFuture(t);
    }
}
Also used : ExceptionMetadata(software.amazon.awssdk.protocols.core.ExceptionMetadata) AwsAsyncClientHandler(software.amazon.awssdk.awscore.client.handler.AwsAsyncClientHandler) StreamingInputOutputOperationRequestMarshaller(software.amazon.awssdk.services.json.transform.StreamingInputOutputOperationRequestMarshaller) EventStreamOperationResponseHandler(software.amazon.awssdk.services.json.model.EventStreamOperationResponseHandler) AsyncStreamingRequestMarshaller(software.amazon.awssdk.core.runtime.transform.AsyncStreamingRequestMarshaller) AsyncResponseTransformer(software.amazon.awssdk.core.async.AsyncResponseTransformer) InputEventStreamTwo(software.amazon.awssdk.services.json.model.InputEventStreamTwo) StreamingInputOperationRequest(software.amazon.awssdk.services.json.model.StreamingInputOperationRequest) AsyncClientHandler(software.amazon.awssdk.core.client.handler.AsyncClientHandler) PaginatedOperationWithResultKeyResponse(software.amazon.awssdk.services.json.model.PaginatedOperationWithResultKeyResponse) AwsServiceException(software.amazon.awssdk.awscore.exception.AwsServiceException) PaginatedOperationWithResultKeyPublisher(software.amazon.awssdk.services.json.paginators.PaginatedOperationWithResultKeyPublisher) EventStreamOperationWithOnlyInputRequestMarshaller(software.amazon.awssdk.services.json.transform.EventStreamOperationWithOnlyInputRequestMarshaller) APostOperationWithOutputResponse(software.amazon.awssdk.services.json.model.APostOperationWithOutputResponse) EventStream(software.amazon.awssdk.services.json.model.EventStream) APostOperationRequest(software.amazon.awssdk.services.json.model.APostOperationRequest) PaginatedOperationWithoutResultKeyPublisher(software.amazon.awssdk.services.json.paginators.PaginatedOperationWithoutResultKeyPublisher) PaginatedOperationWithoutResultKeyResponse(software.amazon.awssdk.services.json.model.PaginatedOperationWithoutResultKeyResponse) AsyncRequestBody(software.amazon.awssdk.core.async.AsyncRequestBody) GetOperationWithChecksumResponse(software.amazon.awssdk.services.json.model.GetOperationWithChecksumResponse) AsyncAws4Signer(software.amazon.awssdk.auth.signer.AsyncAws4Signer) SdkAdvancedAsyncClientOption(software.amazon.awssdk.core.client.config.SdkAdvancedAsyncClientOption) APostOperationWithOutputRequestMarshaller(software.amazon.awssdk.services.json.transform.APostOperationWithOutputRequestMarshaller) PutOperationWithChecksumRequestMarshaller(software.amazon.awssdk.services.json.transform.PutOperationWithChecksumRequestMarshaller) EventStreamOperationRequest(software.amazon.awssdk.services.json.model.EventStreamOperationRequest) HttpResponseHandler(software.amazon.awssdk.core.http.HttpResponseHandler) Generated(software.amazon.awssdk.annotations.Generated) AsyncResponseTransformerUtils(software.amazon.awssdk.core.async.AsyncResponseTransformerUtils) PaginatedOperationWithResultKeyRequestMarshaller(software.amazon.awssdk.services.json.transform.PaginatedOperationWithResultKeyRequestMarshaller) PaginatedOperationWithoutResultKeyRequestMarshaller(software.amazon.awssdk.services.json.transform.PaginatedOperationWithoutResultKeyRequestMarshaller) OperationWithChecksumRequiredResponse(software.amazon.awssdk.services.json.model.OperationWithChecksumRequiredResponse) EventStreamTaggedUnionJsonMarshaller(software.amazon.awssdk.awscore.eventstream.EventStreamTaggedUnionJsonMarshaller) VoidSdkResponse(software.amazon.awssdk.core.protocol.VoidSdkResponse) CompletableFutureUtils(software.amazon.awssdk.utils.CompletableFutureUtils) SdkClientConfiguration(software.amazon.awssdk.core.client.config.SdkClientConfiguration) VersionInfo(software.amazon.awssdk.core.util.VersionInfo) PaginatedOperationWithResultKeyRequest(software.amazon.awssdk.services.json.model.PaginatedOperationWithResultKeyRequest) CoreMetric(software.amazon.awssdk.core.metrics.CoreMetric) BaseAwsJsonProtocolFactory(software.amazon.awssdk.protocols.json.BaseAwsJsonProtocolFactory) RequestOverrideConfiguration(software.amazon.awssdk.core.RequestOverrideConfiguration) EventStreamOperationWithOnlyOutputResponse(software.amazon.awssdk.services.json.model.EventStreamOperationWithOnlyOutputResponse) StreamingOutputOperationRequest(software.amazon.awssdk.services.json.model.StreamingOutputOperationRequest) InputEventTwoMarshaller(software.amazon.awssdk.services.json.transform.InputEventTwoMarshaller) SdkInternalExecutionAttribute(software.amazon.awssdk.core.interceptor.SdkInternalExecutionAttribute) MetricCollector(software.amazon.awssdk.metrics.MetricCollector) Executor(java.util.concurrent.Executor) Publisher(org.reactivestreams.Publisher) APostOperationWithOutputRequest(software.amazon.awssdk.services.json.model.APostOperationWithOutputRequest) HttpChecksum(software.amazon.awssdk.core.interceptor.trait.HttpChecksum) EventStreamOperationWithOnlyInputResponse(software.amazon.awssdk.services.json.model.EventStreamOperationWithOnlyInputResponse) SdkInternalApi(software.amazon.awssdk.annotations.SdkInternalApi) GetWithoutRequiredMembersResponse(software.amazon.awssdk.services.json.model.GetWithoutRequiredMembersResponse) DefaultInputEventTwo(software.amazon.awssdk.services.json.model.inputeventstreamtwo.DefaultInputEventTwo) GetWithoutRequiredMembersRequestMarshaller(software.amazon.awssdk.services.json.transform.GetWithoutRequiredMembersRequestMarshaller) LoggerFactory(org.slf4j.LoggerFactory) StreamingInputOperationRequestMarshaller(software.amazon.awssdk.services.json.transform.StreamingInputOperationRequestMarshaller) RestEventStreamAsyncResponseTransformer(software.amazon.awssdk.awscore.eventstream.RestEventStreamAsyncResponseTransformer) GetOperationWithChecksumRequest(software.amazon.awssdk.services.json.model.GetOperationWithChecksumRequest) ByteBuffer(java.nio.ByteBuffer) JsonException(software.amazon.awssdk.services.json.model.JsonException) MetricPublisher(software.amazon.awssdk.metrics.MetricPublisher) DefaultInputEvent(software.amazon.awssdk.services.json.model.inputeventstream.DefaultInputEvent) JsonOperationMetadata(software.amazon.awssdk.protocols.json.JsonOperationMetadata) EventStreamOperationWithOnlyInputRequest(software.amazon.awssdk.services.json.model.EventStreamOperationWithOnlyInputRequest) ApiName(software.amazon.awssdk.core.ApiName) GetWithoutRequiredMembersRequest(software.amazon.awssdk.services.json.model.GetWithoutRequiredMembersRequest) PutOperationWithChecksumResponse(software.amazon.awssdk.services.json.model.PutOperationWithChecksumResponse) SdkClientOption(software.amazon.awssdk.core.client.config.SdkClientOption) HostnameValidator(software.amazon.awssdk.utils.HostnameValidator) StreamingOutputOperationResponse(software.amazon.awssdk.services.json.model.StreamingOutputOperationResponse) APostOperationRequestMarshaller(software.amazon.awssdk.services.json.transform.APostOperationRequestMarshaller) StreamingInputOperationResponse(software.amazon.awssdk.services.json.model.StreamingInputOperationResponse) EventStreamOperationRequestMarshaller(software.amazon.awssdk.services.json.transform.EventStreamOperationRequestMarshaller) DefaultInputEventOne(software.amazon.awssdk.services.json.model.inputeventstreamtwo.DefaultInputEventOne) SdkPojoBuilder(software.amazon.awssdk.core.SdkPojoBuilder) InputEventMarshaller(software.amazon.awssdk.services.json.transform.InputEventMarshaller) OperationWithChecksumRequiredRequest(software.amazon.awssdk.services.json.model.OperationWithChecksumRequiredRequest) InputEventStream(software.amazon.awssdk.services.json.model.InputEventStream) GetOperationWithChecksumRequestMarshaller(software.amazon.awssdk.services.json.transform.GetOperationWithChecksumRequestMarshaller) List(java.util.List) APostOperationResponse(software.amazon.awssdk.services.json.model.APostOperationResponse) StreamingInputOutputOperationRequest(software.amazon.awssdk.services.json.model.StreamingInputOutputOperationRequest) AttachHttpMetadataResponseHandler(software.amazon.awssdk.core.client.handler.AttachHttpMetadataResponseHandler) Aws4UnsignedPayloadSigner(software.amazon.awssdk.auth.signer.Aws4UnsignedPayloadSigner) JsonRequest(software.amazon.awssdk.services.json.model.JsonRequest) EventStreamOperationWithOnlyOutputRequestMarshaller(software.amazon.awssdk.services.json.transform.EventStreamOperationWithOnlyOutputRequestMarshaller) OperationWithChecksumRequiredRequestMarshaller(software.amazon.awssdk.services.json.transform.OperationWithChecksumRequiredRequestMarshaller) AwsRequestOverrideConfiguration(software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration) Signer(software.amazon.awssdk.core.signer.Signer) AwsJsonProtocol(software.amazon.awssdk.protocols.json.AwsJsonProtocol) PutOperationWithChecksumRequest(software.amazon.awssdk.services.json.model.PutOperationWithChecksumRequest) EventStreamAsyncResponseTransformer(software.amazon.awssdk.awscore.eventstream.EventStreamAsyncResponseTransformer) EventStreamTaggedUnionPojoSupplier(software.amazon.awssdk.awscore.eventstream.EventStreamTaggedUnionPojoSupplier) CompletableFuture(java.util.concurrent.CompletableFuture) HttpChecksumRequired(software.amazon.awssdk.core.interceptor.trait.HttpChecksumRequired) InvalidInputException(software.amazon.awssdk.services.json.model.InvalidInputException) NoOpMetricCollector(software.amazon.awssdk.metrics.NoOpMetricCollector) PaginatedOperationWithoutResultKeyRequest(software.amazon.awssdk.services.json.model.PaginatedOperationWithoutResultKeyRequest) Logger(org.slf4j.Logger) EventStreamOperationWithOnlyOutputRequest(software.amazon.awssdk.services.json.model.EventStreamOperationWithOnlyOutputRequest) Pair(software.amazon.awssdk.utils.Pair) SdkPublisher(software.amazon.awssdk.core.async.SdkPublisher) EventStreamAws4Signer(software.amazon.awssdk.auth.signer.EventStreamAws4Signer) Consumer(java.util.function.Consumer) StreamingOutputOperationRequestMarshaller(software.amazon.awssdk.services.json.transform.StreamingOutputOperationRequestMarshaller) ClientExecutionParams(software.amazon.awssdk.core.client.handler.ClientExecutionParams) EventStreamOperationWithOnlyOutputResponseHandler(software.amazon.awssdk.services.json.model.EventStreamOperationWithOnlyOutputResponseHandler) StreamingInputOutputOperationResponse(software.amazon.awssdk.services.json.model.StreamingInputOutputOperationResponse) AwsClientHandlerUtils(software.amazon.awssdk.awscore.client.handler.AwsClientHandlerUtils) EventStreamOperationResponse(software.amazon.awssdk.services.json.model.EventStreamOperationResponse) SdkResponse(software.amazon.awssdk.core.SdkResponse) AwsJsonProtocolFactory(software.amazon.awssdk.protocols.json.AwsJsonProtocolFactory) FunctionalUtils.runAndLogError(software.amazon.awssdk.utils.FunctionalUtils.runAndLogError) Collections(java.util.Collections) MetricPublisher(software.amazon.awssdk.metrics.MetricPublisher) JsonOperationMetadata(software.amazon.awssdk.protocols.json.JsonOperationMetadata) PutOperationWithChecksumRequest(software.amazon.awssdk.services.json.model.PutOperationWithChecksumRequest) CompletableFuture(java.util.concurrent.CompletableFuture) AsyncResponseTransformer(software.amazon.awssdk.core.async.AsyncResponseTransformer) RestEventStreamAsyncResponseTransformer(software.amazon.awssdk.awscore.eventstream.RestEventStreamAsyncResponseTransformer) EventStreamAsyncResponseTransformer(software.amazon.awssdk.awscore.eventstream.EventStreamAsyncResponseTransformer) PutOperationWithChecksumRequestMarshaller(software.amazon.awssdk.services.json.transform.PutOperationWithChecksumRequestMarshaller) AwsServiceException(software.amazon.awssdk.awscore.exception.AwsServiceException) MetricCollector(software.amazon.awssdk.metrics.MetricCollector) NoOpMetricCollector(software.amazon.awssdk.metrics.NoOpMetricCollector) PutOperationWithChecksumResponse(software.amazon.awssdk.services.json.model.PutOperationWithChecksumResponse)

Aggregations

ByteBuffer (java.nio.ByteBuffer)14 Collections (java.util.Collections)14 List (java.util.List)14 CompletableFuture (java.util.concurrent.CompletableFuture)14 Executor (java.util.concurrent.Executor)14 Consumer (java.util.function.Consumer)14 Publisher (org.reactivestreams.Publisher)14 Logger (org.slf4j.Logger)14 LoggerFactory (org.slf4j.LoggerFactory)14 Generated (software.amazon.awssdk.annotations.Generated)14 SdkInternalApi (software.amazon.awssdk.annotations.SdkInternalApi)14 AsyncAws4Signer (software.amazon.awssdk.auth.signer.AsyncAws4Signer)14 Aws4UnsignedPayloadSigner (software.amazon.awssdk.auth.signer.Aws4UnsignedPayloadSigner)14 EventStreamAws4Signer (software.amazon.awssdk.auth.signer.EventStreamAws4Signer)14 AwsRequestOverrideConfiguration (software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration)14 AwsAsyncClientHandler (software.amazon.awssdk.awscore.client.handler.AwsAsyncClientHandler)14 AwsClientHandlerUtils (software.amazon.awssdk.awscore.client.handler.AwsClientHandlerUtils)14 EventStreamAsyncResponseTransformer (software.amazon.awssdk.awscore.eventstream.EventStreamAsyncResponseTransformer)14 EventStreamTaggedUnionJsonMarshaller (software.amazon.awssdk.awscore.eventstream.EventStreamTaggedUnionJsonMarshaller)14 EventStreamTaggedUnionPojoSupplier (software.amazon.awssdk.awscore.eventstream.EventStreamTaggedUnionPojoSupplier)14