1 /* 2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"). 5 * You may not use this file except in compliance with the License. 6 * A copy of the License is located at 7 * 8 * http://aws.amazon.com/apache2.0 9 * 10 * or in the "license" file accompanying this file. This file is distributed 11 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 * express or implied. See the License for the specific language governing 13 * permissions and limitations under the License. 14 */ 15 16 package software.amazon.awssdk.core.client.handler; 17 18 import java.util.concurrent.CompletableFuture; 19 import software.amazon.awssdk.annotations.SdkProtectedApi; 20 import software.amazon.awssdk.core.SdkRequest; 21 import software.amazon.awssdk.core.SdkResponse; 22 import software.amazon.awssdk.core.async.AsyncResponseTransformer; 23 import software.amazon.awssdk.utils.SdkAutoCloseable; 24 25 /** 26 * Client interface to invoke an API. 27 */ 28 @SdkProtectedApi 29 public interface AsyncClientHandler extends SdkAutoCloseable { 30 /** 31 * Execute's a web service request. Handles marshalling and unmarshalling of data and making the 32 * underlying HTTP call(s). 33 * 34 * @param executionParams Parameters specific to this invocation of an API. 35 * @param <InputT> Input POJO type 36 * @param <OutputT> Output POJO type 37 * @return Unmarshalled output POJO type. 38 */ execute( ClientExecutionParams<InputT, OutputT> executionParams)39 <InputT extends SdkRequest, OutputT extends SdkResponse> CompletableFuture<OutputT> execute( 40 ClientExecutionParams<InputT, OutputT> executionParams); 41 42 /** 43 * Execute's a streaming web service request. Handles marshalling and unmarshalling of data and making the 44 * underlying HTTP call(s). 45 * 46 * @param executionParams Parameters specific to this invocation of an API. 47 * @param asyncResponseTransformer Response handler to consume streaming data in an asynchronous fashion. 48 * @param <InputT> Input POJO type 49 * @param <OutputT> Output POJO type 50 * @param <ReturnT> Transformed result returned by asyncResponseTransformer. 51 * @return CompletableFuture containing transformed result type as returned by asyncResponseTransformer. 52 */ execute( ClientExecutionParams<InputT, OutputT> executionParams, AsyncResponseTransformer<OutputT, ReturnT> asyncResponseTransformer)53 <InputT extends SdkRequest, OutputT extends SdkResponse, ReturnT> CompletableFuture<ReturnT> execute( 54 ClientExecutionParams<InputT, OutputT> executionParams, 55 AsyncResponseTransformer<OutputT, ReturnT> asyncResponseTransformer); 56 } 57