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 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 the invoked.
        Returns:
        the response if successful. Else it will propagate all AwsServiceException that is thrown or SdkClientException if there is client side problem
      • injectCredentialsAndInvokeV2Aync

        <RequestT extends software.amazon.awssdk.awscore.AwsRequest,​ResponseT extends software.amazon.awssdk.awscore.AwsResponse> CompletableFuture<ResponseT> injectCredentialsAndInvokeV2Aync​(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 the 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.