Interface ProxyClient<ClientT>

  • Type Parameters:
    ClientT - the AWS client like KinesisClient that is used to invoke the web service

    public interface ProxyClient<ClientT>
    This class provides a wrapper for the client and provides methods to inject scoped credentials for each request context when invoking AWS services. This is the primary mechanism for handlers to invoke service requests to ensure the right scoped credentials are being injected. IMPORTANT: DO NOT DIRECTLY INVOKE methods on the client. Use the client to provide method references to be invoked. See example below CreateStreamResponse call(ProxyClient<KinesisClient> client, CreateStreamRequest request) { return client.injectCredentialsAndInvokeV2( request, client.client()::createStream); // method reference }
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      ClientT client()  
      default <RequestT extends software.amazon.awssdk.awscore.AwsRequest,​ResponseT extends software.amazon.awssdk.awscore.AwsResponse,​IterableT extends software.amazon.awssdk.core.pagination.sync.SdkIterable<ResponseT>>
      IterableT
      injectCredentialsAndInvokeIterableV2​(RequestT request, Function<RequestT,​IterableT> requestFunction)
      This is a synchronous version of making API calls which implement Iterable in the SDKv2
      <RequestT extends software.amazon.awssdk.awscore.AwsRequest,​ResponseT extends software.amazon.awssdk.awscore.AwsResponse>
      ResponseT
      injectCredentialsAndInvokeV2​(RequestT request, Function<RequestT,​ResponseT> requestFunction)
      This is the synchronous version of making API calls.
      default <RequestT extends software.amazon.awssdk.awscore.AwsRequest,​ResponseT extends software.amazon.awssdk.awscore.AwsResponse>
      CompletableFuture<ResponseT>
      injectCredentialsAndInvokeV2Async​(RequestT request, Function<RequestT,​CompletableFuture<ResponseT>> requestFunction)
      This is the asynchronous version of making API calls.
      default <RequestT extends software.amazon.awssdk.awscore.AwsRequest,​ResponseT extends software.amazon.awssdk.awscore.AwsResponse>
      software.amazon.awssdk.core.ResponseBytes<ResponseT>
      injectCredentialsAndInvokeV2Bytes​(RequestT request, Function<RequestT,​software.amazon.awssdk.core.ResponseBytes<ResponseT>> requestFunction)
      This is a synchronous version of making API calls which implement ResponseBytes in the SDKv2
      default <RequestT extends software.amazon.awssdk.awscore.AwsRequest,​ResponseT extends software.amazon.awssdk.awscore.AwsResponse>
      software.amazon.awssdk.core.ResponseInputStream<ResponseT>
      injectCredentialsAndInvokeV2InputStream​(RequestT request, Function<RequestT,​software.amazon.awssdk.core.ResponseInputStream<ResponseT>> requestFunction)
      This is a synchronous version of making API calls which implement ResponseInputStream in the SDKv2
    • Method Detail

      • injectCredentialsAndInvokeV2

        <RequestT extends software.amazon.awssdk.awscore.AwsRequest,​ResponseT extends software.amazon.awssdk.awscore.AwsResponse> ResponseT injectCredentialsAndInvokeV2​(RequestT request,
                                                                                                                                                                               Function<RequestT,​ResponseT> requestFunction)
        This is the synchronous version of making API calls.
        Type Parameters:
        RequestT - the request type
        ResponseT - the response from the request
        Parameters:
        request - , the AWS service request that we need to make
        requestFunction - , this is a Lambda closure that provide the actual API that needs to be invoked.
        Returns:
        the response if successful. Else it will propagate all AwsServiceException that is thrown or SdkClientException if there is client side problem
      • injectCredentialsAndInvokeV2Async

        default <RequestT extends software.amazon.awssdk.awscore.AwsRequest,​ResponseT extends software.amazon.awssdk.awscore.AwsResponse> CompletableFuture<ResponseT> injectCredentialsAndInvokeV2Async​(RequestT request,
                                                                                                                                                                                                               Function<RequestT,​CompletableFuture<ResponseT>> requestFunction)
        This is the asynchronous version of making API calls.
        Type Parameters:
        RequestT - the request type
        ResponseT - the response from the request
        Parameters:
        request - , the AWS service request that we need to make
        requestFunction - , this is a Lambda closure that provide the actual API that needs to be invoked.
        Returns:
        the response if successful. Else it will propagate all AwsServiceException that is thrown or SdkClientException if there is client side problem
      • injectCredentialsAndInvokeIterableV2

        default <RequestT extends software.amazon.awssdk.awscore.AwsRequest,​ResponseT extends software.amazon.awssdk.awscore.AwsResponse,​IterableT extends software.amazon.awssdk.core.pagination.sync.SdkIterable<ResponseT>> IterableT injectCredentialsAndInvokeIterableV2​(RequestT request,
                                                                                                                                                                                                                                                                                          Function<RequestT,​IterableT> requestFunction)
        This is a synchronous version of making API calls which implement Iterable in the SDKv2
        Type Parameters:
        RequestT - the request type
        ResponseT - the response from the request
        IterableT - the iterable collection from the response
        Parameters:
        request - , the AWS service request that we need to make
        requestFunction - , this is a Lambda closure that provide the actual API that needs to be invoked.
        Returns:
        the response if successful. Else it will propagate all AwsServiceException that is thrown or SdkClientException if there is client side problem
      • injectCredentialsAndInvokeV2InputStream

        default <RequestT extends software.amazon.awssdk.awscore.AwsRequest,​ResponseT extends software.amazon.awssdk.awscore.AwsResponse> software.amazon.awssdk.core.ResponseInputStream<ResponseT> injectCredentialsAndInvokeV2InputStream​(RequestT request,
                                                                                                                                                                                                                                                   Function<RequestT,​software.amazon.awssdk.core.ResponseInputStream<ResponseT>> requestFunction)
        This is a synchronous version of making API calls which implement ResponseInputStream in the SDKv2
        Type Parameters:
        RequestT - the request type
        ResponseT - the response from the request
        Parameters:
        request - , the AWS service request that we need to make
        requestFunction - , this is a Lambda closure that provide the actual API that needs to be invoked.
        Returns:
        the response if successful. Else it will propagate all AwsServiceException that is thrown or SdkClientException if there is client side problem
      • injectCredentialsAndInvokeV2Bytes

        default <RequestT extends software.amazon.awssdk.awscore.AwsRequest,​ResponseT extends software.amazon.awssdk.awscore.AwsResponse> software.amazon.awssdk.core.ResponseBytes<ResponseT> injectCredentialsAndInvokeV2Bytes​(RequestT request,
                                                                                                                                                                                                                                       Function<RequestT,​software.amazon.awssdk.core.ResponseBytes<ResponseT>> requestFunction)
        This is a synchronous version of making API calls which implement ResponseBytes in the SDKv2
        Type Parameters:
        RequestT - the request type
        ResponseT - the response from the request
        Parameters:
        request - , the AWS service request that we need to make
        requestFunction - , this is a Lambda closure that provide the actual API that needs to be invoked.
        Returns:
        the response if successful. Else it will propagate all AwsServiceException that is thrown or SdkClientException if there is client side problem
      • client

        ClientT client()
        Returns:
        the actual AWS service client that we need to use to provide the actual method we are going to call.