All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.amazonaws.services.pricing.AWSPricingAsyncClient Maven / Gradle / Ivy

/*
 * Copyright 2019-2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
 * the License. A copy of the License is located at
 * 
 * http://aws.amazon.com/apache2.0
 * 
 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
 * and limitations under the License.
 */
package com.amazonaws.services.pricing;

import javax.annotation.Generated;

import com.amazonaws.services.pricing.model.*;
import com.amazonaws.client.AwsAsyncClientParams;
import com.amazonaws.annotation.ThreadSafe;

import java.util.concurrent.ExecutorService;

/**
 * Client for accessing AWS Pricing asynchronously. Each asynchronous method will return a Java Future object
 * representing the asynchronous operation; overloads which accept an {@code AsyncHandler} can be used to receive
 * notification when an asynchronous operation completes.
 * 

*

* The Amazon Web Services Price List API is a centralized and convenient way to programmatically query Amazon Web * Services for services, products, and pricing information. The Amazon Web Services Price List uses standardized * product attributes such as Location, Storage Class, and Operating System, and * provides prices at the SKU level. You can use the Amazon Web Services Price List to do the following: *

*
    *
  • *

    * Build cost control and scenario planning tools *

    *
  • *
  • *

    * Reconcile billing data *

    *
  • *
  • *

    * Forecast future spend for budgeting purposes *

    *
  • *
  • *

    * Provide cost benefit analysis that compare your internal workloads with Amazon Web Services *

    *
  • *
*

* Use GetServices without a service code to retrieve the service codes for all Amazon Web Services, then * GetServices with a service code to retrieve the attribute names for that service. After you have the * service code and attribute names, you can use GetAttributeValues to see what values are available for an * attribute. With the service code and an attribute name and value, you can use GetProducts to find * specific products that you're interested in, such as an AmazonEC2 instance, with a * Provisioned IOPS volumeType. *

*

* For more information, see Using the Amazon Web Services * Price List API in the Billing User Guide. *

*/ @ThreadSafe @Generated("com.amazonaws:aws-java-sdk-code-generator") public class AWSPricingAsyncClient extends AWSPricingClient implements AWSPricingAsync { private static final int DEFAULT_THREAD_POOL_SIZE = 50; private final java.util.concurrent.ExecutorService executorService; public static AWSPricingAsyncClientBuilder asyncBuilder() { return AWSPricingAsyncClientBuilder.standard(); } /** * Constructs a new asynchronous client to invoke service methods on AWS Pricing using the specified parameters. * * @param asyncClientParams * Object providing client parameters. */ AWSPricingAsyncClient(AwsAsyncClientParams asyncClientParams) { this(asyncClientParams, false); } /** * Constructs a new asynchronous client to invoke service methods on AWS Pricing using the specified parameters. * * @param asyncClientParams * Object providing client parameters. * @param endpointDiscoveryEnabled * true will enable endpoint discovery if the service supports it. */ AWSPricingAsyncClient(AwsAsyncClientParams asyncClientParams, boolean endpointDiscoveryEnabled) { super(asyncClientParams, endpointDiscoveryEnabled); this.executorService = asyncClientParams.getExecutor(); } /** * Returns the executor service used by this client to execute async requests. * * @return The executor service used by this client to execute async requests. */ public ExecutorService getExecutorService() { return executorService; } @Override public java.util.concurrent.Future describeServicesAsync(DescribeServicesRequest request) { return describeServicesAsync(request, null); } @Override public java.util.concurrent.Future describeServicesAsync(final DescribeServicesRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DescribeServicesRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DescribeServicesResult call() throws Exception { DescribeServicesResult result = null; try { result = executeDescribeServices(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future getAttributeValuesAsync(GetAttributeValuesRequest request) { return getAttributeValuesAsync(request, null); } @Override public java.util.concurrent.Future getAttributeValuesAsync(final GetAttributeValuesRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final GetAttributeValuesRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public GetAttributeValuesResult call() throws Exception { GetAttributeValuesResult result = null; try { result = executeGetAttributeValues(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future getPriceListFileUrlAsync(GetPriceListFileUrlRequest request) { return getPriceListFileUrlAsync(request, null); } @Override public java.util.concurrent.Future getPriceListFileUrlAsync(final GetPriceListFileUrlRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final GetPriceListFileUrlRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public GetPriceListFileUrlResult call() throws Exception { GetPriceListFileUrlResult result = null; try { result = executeGetPriceListFileUrl(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future getProductsAsync(GetProductsRequest request) { return getProductsAsync(request, null); } @Override public java.util.concurrent.Future getProductsAsync(final GetProductsRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final GetProductsRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public GetProductsResult call() throws Exception { GetProductsResult result = null; try { result = executeGetProducts(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future listPriceListsAsync(ListPriceListsRequest request) { return listPriceListsAsync(request, null); } @Override public java.util.concurrent.Future listPriceListsAsync(final ListPriceListsRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ListPriceListsRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ListPriceListsResult call() throws Exception { ListPriceListsResult result = null; try { result = executeListPriceLists(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } /** * Shuts down the client, releasing all managed resources. This includes forcibly terminating all pending * asynchronous service calls. Clients who wish to give pending asynchronous service calls time to complete should * call {@code getExecutorService().shutdown()} followed by {@code getExecutorService().awaitTermination()} prior to * calling this method. */ @Override public void shutdown() { super.shutdown(); executorService.shutdownNow(); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy