Interface FreeTierAsyncClient

  • All Superinterfaces:
    AutoCloseable, AwsClient, SdkAutoCloseable, SdkClient

    @Generated("software.amazon.awssdk:codegen")
    @ThreadSafe
    public interface FreeTierAsyncClient
    extends AwsClient
    Service client for accessing AWS Free Tier asynchronously. This can be created using the static builder() method.The asynchronous client performs non-blocking I/O when configured with any SdkAsyncHttpClient supported in the SDK. However, full non-blocking is not guaranteed as the async client may perform blocking calls in some cases such as credentials retrieval and endpoint discovery as part of the async API call.

    You can use the Amazon Web Services Free Tier API to query programmatically your Free Tier usage data.

    Free Tier tracks your monthly usage data for all free tier offers that are associated with your Amazon Web Services account. You can use the Free Tier API to filter and show only the data that you want.

    Service endpoint

    The Free Tier API provides the following endpoint:

    • https://freetier.us-east-1.api.aws

    For more information, see Using the Amazon Web Services Free Tier in the Billing User Guide.

    • Method Detail

      • getFreeTierUsage

        default CompletableFuture<GetFreeTierUsageResponse> getFreeTierUsage​(GetFreeTierUsageRequest getFreeTierUsageRequest)

        Returns a list of all Free Tier usage objects that match your filters.

        Parameters:
        getFreeTierUsageRequest -
        Returns:
        A Java Future containing the result of the GetFreeTierUsage operation returned by the service.
        The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
        • InternalServerException An unexpected error occurred during the processing of your request.
        • ValidationException The input fails to satisfy the constraints specified by an Amazon Web Service.
        • ThrottlingException The request was denied due to request throttling.
        • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
        • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
        • FreeTierException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
        See Also:
        AWS API Documentation
      • getFreeTierUsage

        default CompletableFuture<GetFreeTierUsageResponse> getFreeTierUsage​(Consumer<GetFreeTierUsageRequest.Builder> getFreeTierUsageRequest)

        Returns a list of all Free Tier usage objects that match your filters.


        This is a convenience which creates an instance of the GetFreeTierUsageRequest.Builder avoiding the need to create one manually via GetFreeTierUsageRequest.builder()

        Parameters:
        getFreeTierUsageRequest - A Consumer that will call methods on GetFreeTierUsageRequest.Builder to create a request.
        Returns:
        A Java Future containing the result of the GetFreeTierUsage operation returned by the service.
        The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
        • InternalServerException An unexpected error occurred during the processing of your request.
        • ValidationException The input fails to satisfy the constraints specified by an Amazon Web Service.
        • ThrottlingException The request was denied due to request throttling.
        • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
        • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
        • FreeTierException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
        See Also:
        AWS API Documentation
      • getFreeTierUsagePaginator

        default GetFreeTierUsagePublisher getFreeTierUsagePaginator​(GetFreeTierUsageRequest getFreeTierUsageRequest)

        This is a variant of getFreeTierUsage(software.amazon.awssdk.services.freetier.model.GetFreeTierUsageRequest) operation. The return type is a custom publisher that can be subscribed to request a stream of response pages. SDK will internally handle making service calls for you.

        When the operation is called, an instance of this class is returned. At this point, no service calls are made yet and so there is no guarantee that the request is valid. If there are errors in your request, you will see the failures only after you start streaming the data. The subscribe method should be called as a request to start streaming data. For more info, see Publisher.subscribe(org.reactivestreams.Subscriber). Each call to the subscribe method will result in a new Subscription i.e., a new contract to stream data from the starting request.

        The following are few ways to use the response class:

        1) Using the subscribe helper method
         
         software.amazon.awssdk.services.freetier.paginators.GetFreeTierUsagePublisher publisher = client.getFreeTierUsagePaginator(request);
         CompletableFuture<Void> future = publisher.subscribe(res -> { // Do something with the response });
         future.get();
         
         
        2) Using a custom subscriber
         
         software.amazon.awssdk.services.freetier.paginators.GetFreeTierUsagePublisher publisher = client.getFreeTierUsagePaginator(request);
         publisher.subscribe(new Subscriber<software.amazon.awssdk.services.freetier.model.GetFreeTierUsageResponse>() {
         
         public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
         
         
         public void onNext(software.amazon.awssdk.services.freetier.model.GetFreeTierUsageResponse response) { //... };
         });
         
        As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.

        Please notice that the configuration of maxResults won't limit the number of results you get with the paginator. It only limits the number of results in each page.

        Note: If you prefer to have control on service calls, use the getFreeTierUsage(software.amazon.awssdk.services.freetier.model.GetFreeTierUsageRequest) operation.

        Parameters:
        getFreeTierUsageRequest -
        Returns:
        A custom publisher that can be subscribed to request a stream of response pages.
        The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
        • InternalServerException An unexpected error occurred during the processing of your request.
        • ValidationException The input fails to satisfy the constraints specified by an Amazon Web Service.
        • ThrottlingException The request was denied due to request throttling.
        • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
        • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
        • FreeTierException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
        See Also:
        AWS API Documentation
      • getFreeTierUsagePaginator

        default GetFreeTierUsagePublisher getFreeTierUsagePaginator​(Consumer<GetFreeTierUsageRequest.Builder> getFreeTierUsageRequest)

        This is a variant of getFreeTierUsage(software.amazon.awssdk.services.freetier.model.GetFreeTierUsageRequest) operation. The return type is a custom publisher that can be subscribed to request a stream of response pages. SDK will internally handle making service calls for you.

        When the operation is called, an instance of this class is returned. At this point, no service calls are made yet and so there is no guarantee that the request is valid. If there are errors in your request, you will see the failures only after you start streaming the data. The subscribe method should be called as a request to start streaming data. For more info, see Publisher.subscribe(org.reactivestreams.Subscriber). Each call to the subscribe method will result in a new Subscription i.e., a new contract to stream data from the starting request.

        The following are few ways to use the response class:

        1) Using the subscribe helper method
         
         software.amazon.awssdk.services.freetier.paginators.GetFreeTierUsagePublisher publisher = client.getFreeTierUsagePaginator(request);
         CompletableFuture<Void> future = publisher.subscribe(res -> { // Do something with the response });
         future.get();
         
         
        2) Using a custom subscriber
         
         software.amazon.awssdk.services.freetier.paginators.GetFreeTierUsagePublisher publisher = client.getFreeTierUsagePaginator(request);
         publisher.subscribe(new Subscriber<software.amazon.awssdk.services.freetier.model.GetFreeTierUsageResponse>() {
         
         public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
         
         
         public void onNext(software.amazon.awssdk.services.freetier.model.GetFreeTierUsageResponse response) { //... };
         });
         
        As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.

        Please notice that the configuration of maxResults won't limit the number of results you get with the paginator. It only limits the number of results in each page.

        Note: If you prefer to have control on service calls, use the getFreeTierUsage(software.amazon.awssdk.services.freetier.model.GetFreeTierUsageRequest) operation.


        This is a convenience which creates an instance of the GetFreeTierUsageRequest.Builder avoiding the need to create one manually via GetFreeTierUsageRequest.builder()

        Parameters:
        getFreeTierUsageRequest - A Consumer that will call methods on GetFreeTierUsageRequest.Builder to create a request.
        Returns:
        A custom publisher that can be subscribed to request a stream of response pages.
        The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
        • InternalServerException An unexpected error occurred during the processing of your request.
        • ValidationException The input fails to satisfy the constraints specified by an Amazon Web Service.
        • ThrottlingException The request was denied due to request throttling.
        • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
        • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
        • FreeTierException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
        See Also:
        AWS API Documentation