/*
* Copyright 2018-2023 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.budgets;
import static java.util.concurrent.Executors.newFixedThreadPool;
import javax.annotation.Generated;
import com.amazonaws.services.budgets.model.*;
import com.amazonaws.client.AwsAsyncClientParams;
import com.amazonaws.annotation.ThreadSafe;
import com.amazonaws.ClientConfiguration;
import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.AWSCredentialsProvider;
import java.util.concurrent.ExecutorService;
import com.amazonaws.auth.DefaultAWSCredentialsProviderChain;
/**
* Client for accessing AWSBudgets 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.
*
*
* Use the Amazon Web Services Budgets API to plan your service usage, service costs, and instance reservations. This
* API reference provides descriptions, syntax, and usage examples for each of the actions and data types for the Amazon
* Web Services Budgets feature.
*
*
* Budgets provide you with a way to see the following information:
*
*
* -
*
* How close your plan is to your budgeted amount or to the free tier limits
*
*
* -
*
* Your usage-to-date, including how much you've used of your Reserved Instances (RIs)
*
*
* -
*
* Your current estimated charges from Amazon Web Services, and how much your predicted usage will accrue in charges by
* the end of the month
*
*
* -
*
* How much of your budget has been used
*
*
*
*
* Amazon Web Services updates your budget status several times a day. Budgets track your unblended costs,
* subscriptions, refunds, and RIs. You can create the following types of budgets:
*
*
* -
*
* Cost budgets - Plan how much you want to spend on a service.
*
*
* -
*
* Usage budgets - Plan how much you want to use one or more services.
*
*
* -
*
* RI utilization budgets - Define a utilization threshold, and receive alerts when your RI usage falls below
* that threshold. This lets you see if your RIs are unused or under-utilized.
*
*
* -
*
* RI coverage budgets - Define a coverage threshold, and receive alerts when the number of your instance hours
* that are covered by RIs fall below that threshold. This lets you see how much of your instance usage is covered by a
* reservation.
*
*
*
*
* Service Endpoint
*
*
* The Amazon Web Services Budgets API provides the following endpoint:
*
*
*
* For information about costs that are associated with the Amazon Web Services Budgets API, see Amazon Web Services Cost Management Pricing.
*
*/
@ThreadSafe
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AWSBudgetsAsyncClient extends AWSBudgetsClient implements AWSBudgetsAsync {
private static final int DEFAULT_THREAD_POOL_SIZE = 50;
private final java.util.concurrent.ExecutorService executorService;
/**
* Constructs a new asynchronous client to invoke service methods on AWSBudgets. A credentials provider chain will
* be used that searches for credentials in this order:
*
* - Environment Variables - AWS_ACCESS_KEY_ID and AWS_SECRET_KEY
* - Java System Properties - aws.accessKeyId and aws.secretKey
* - Credential profiles file at the default location (~/.aws/credentials) shared by all AWS SDKs and the AWS CLI
* - Instance profile credentials delivered through the Amazon EC2 metadata service
*
*
* Asynchronous methods are delegated to a fixed-size thread pool containing 50 threads (to match the default
* maximum number of concurrent connections to the service).
*
* @see com.amazonaws.auth.DefaultAWSCredentialsProviderChain
* @see java.util.concurrent.Executors#newFixedThreadPool(int)
* @deprecated use {@link AWSBudgetsAsyncClientBuilder#defaultClient()}
*/
@Deprecated
public AWSBudgetsAsyncClient() {
this(DefaultAWSCredentialsProviderChain.getInstance());
}
/**
* Constructs a new asynchronous client to invoke service methods on AWSBudgets. A credentials provider chain will
* be used that searches for credentials in this order:
*
* - Environment Variables - AWS_ACCESS_KEY_ID and AWS_SECRET_KEY
* - Java System Properties - aws.accessKeyId and aws.secretKey
* - Credential profiles file at the default location (~/.aws/credentials) shared by all AWS SDKs and the AWS CLI
* - Instance profile credentials delivered through the Amazon EC2 metadata service
*
*
* Asynchronous methods are delegated to a fixed-size thread pool containing a number of threads equal to the
* maximum number of concurrent connections configured via {@code ClientConfiguration.getMaxConnections()}.
*
* @param clientConfiguration
* The client configuration options controlling how this client connects to AWSBudgets (ex: proxy settings,
* retry counts, etc).
*
* @see com.amazonaws.auth.DefaultAWSCredentialsProviderChain
* @see java.util.concurrent.Executors#newFixedThreadPool(int)
* @deprecated use {@link AWSBudgetsAsyncClientBuilder#withClientConfiguration(ClientConfiguration)}
*/
@Deprecated
public AWSBudgetsAsyncClient(ClientConfiguration clientConfiguration) {
this(DefaultAWSCredentialsProviderChain.getInstance(), clientConfiguration, newFixedThreadPool(clientConfiguration.getMaxConnections()));
}
/**
* Constructs a new asynchronous client to invoke service methods on AWSBudgets using the specified AWS account
* credentials.
*
* Asynchronous methods are delegated to a fixed-size thread pool containing 50 threads (to match the default
* maximum number of concurrent connections to the service).
*
* @param awsCredentials
* The AWS credentials (access key ID and secret key) to use when authenticating with AWS services.
* @see java.util.concurrent.Executors#newFixedThreadPool(int)
* @deprecated use {@link AWSBudgetsAsyncClientBuilder#withCredentials(AWSCredentialsProvider)}
*/
@Deprecated
public AWSBudgetsAsyncClient(AWSCredentials awsCredentials) {
this(awsCredentials, newFixedThreadPool(DEFAULT_THREAD_POOL_SIZE));
}
/**
* Constructs a new asynchronous client to invoke service methods on AWSBudgets using the specified AWS account
* credentials and executor service. Default client settings will be used.
*
* @param awsCredentials
* The AWS credentials (access key ID and secret key) to use when authenticating with AWS services.
* @param executorService
* The executor service by which all asynchronous requests will be executed.
* @deprecated use {@link AWSBudgetsAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} and
* {@link AWSBudgetsAsyncClientBuilder#withExecutorFactory(com.amazonaws.client.builder.ExecutorFactory)}
*/
@Deprecated
public AWSBudgetsAsyncClient(AWSCredentials awsCredentials, ExecutorService executorService) {
this(awsCredentials, configFactory.getConfig(), executorService);
}
/**
* Constructs a new asynchronous client to invoke service methods on AWSBudgets using the specified AWS account
* credentials, executor service, and client configuration options.
*
* @param awsCredentials
* The AWS credentials (access key ID and secret key) to use when authenticating with AWS services.
* @param clientConfiguration
* Client configuration options (ex: max retry limit, proxy settings, etc).
* @param executorService
* The executor service by which all asynchronous requests will be executed.
* @deprecated use {@link AWSBudgetsAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} and
* {@link AWSBudgetsAsyncClientBuilder#withClientConfiguration(ClientConfiguration)} and
* {@link AWSBudgetsAsyncClientBuilder#withExecutorFactory(com.amazonaws.client.builder.ExecutorFactory)}
*/
@Deprecated
public AWSBudgetsAsyncClient(AWSCredentials awsCredentials, ClientConfiguration clientConfiguration, ExecutorService executorService) {
super(awsCredentials, clientConfiguration);
this.executorService = executorService;
}
/**
* Constructs a new asynchronous client to invoke service methods on AWSBudgets using the specified AWS account
* credentials provider. Default client settings will be used.
*
* Asynchronous methods are delegated to a fixed-size thread pool containing 50 threads (to match the default
* maximum number of concurrent connections to the service).
*
* @param awsCredentialsProvider
* The AWS credentials provider which will provide credentials to authenticate requests with AWS services.
* @see java.util.concurrent.Executors#newFixedThreadPool(int)
* @deprecated use {@link AWSBudgetsAsyncClientBuilder#withCredentials(AWSCredentialsProvider)}
*/
@Deprecated
public AWSBudgetsAsyncClient(AWSCredentialsProvider awsCredentialsProvider) {
this(awsCredentialsProvider, newFixedThreadPool(DEFAULT_THREAD_POOL_SIZE));
}
/**
* Constructs a new asynchronous client to invoke service methods on AWSBudgets using the provided AWS account
* credentials provider and client configuration options.
*
* Asynchronous methods are delegated to a fixed-size thread pool containing a number of threads equal to the
* maximum number of concurrent connections configured via {@code ClientConfiguration.getMaxConnections()}.
*
* @param awsCredentialsProvider
* The AWS credentials provider which will provide credentials to authenticate requests with AWS services.
* @param clientConfiguration
* Client configuration options (ex: max retry limit, proxy settings, etc).
*
* @see com.amazonaws.auth.DefaultAWSCredentialsProviderChain
* @see java.util.concurrent.Executors#newFixedThreadPool(int)
* @deprecated use {@link AWSBudgetsAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} and
* {@link AWSBudgetsAsyncClientBuilder#withClientConfiguration(ClientConfiguration)}
*/
@Deprecated
public AWSBudgetsAsyncClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration) {
this(awsCredentialsProvider, clientConfiguration, newFixedThreadPool(clientConfiguration.getMaxConnections()));
}
/**
* Constructs a new asynchronous client to invoke service methods on AWSBudgets using the specified AWS account
* credentials provider and executor service. Default client settings will be used.
*
* @param awsCredentialsProvider
* The AWS credentials provider which will provide credentials to authenticate requests with AWS services.
* @param executorService
* The executor service by which all asynchronous requests will be executed.
* @deprecated use {@link AWSBudgetsAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} and
* {@link AWSBudgetsAsyncClientBuilder#withExecutorFactory(com.amazonaws.client.builder.ExecutorFactory)}
*/
@Deprecated
public AWSBudgetsAsyncClient(AWSCredentialsProvider awsCredentialsProvider, ExecutorService executorService) {
this(awsCredentialsProvider, configFactory.getConfig(), executorService);
}
/**
* Constructs a new asynchronous client to invoke service methods on AWSBudgets using the specified AWS account
* credentials provider, executor service, and client configuration options.
*
* @param awsCredentialsProvider
* The AWS credentials provider which will provide credentials to authenticate requests with AWS services.
* @param clientConfiguration
* Client configuration options (ex: max retry limit, proxy settings, etc).
* @param executorService
* The executor service by which all asynchronous requests will be executed.
* @deprecated use {@link AWSBudgetsAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} and
* {@link AWSBudgetsAsyncClientBuilder#withClientConfiguration(ClientConfiguration)} and
* {@link AWSBudgetsAsyncClientBuilder#withExecutorFactory(com.amazonaws.client.builder.ExecutorFactory)}
*/
@Deprecated
public AWSBudgetsAsyncClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration, ExecutorService executorService) {
super(awsCredentialsProvider, clientConfiguration);
this.executorService = executorService;
}
public static AWSBudgetsAsyncClientBuilder asyncBuilder() {
return AWSBudgetsAsyncClientBuilder.standard();
}
/**
* Constructs a new asynchronous client to invoke service methods on AWSBudgets using the specified parameters.
*
* @param asyncClientParams
* Object providing client parameters.
*/
AWSBudgetsAsyncClient(AwsAsyncClientParams asyncClientParams) {
this(asyncClientParams, false);
}
/**
* Constructs a new asynchronous client to invoke service methods on AWSBudgets using the specified parameters.
*
* @param asyncClientParams
* Object providing client parameters.
* @param endpointDiscoveryEnabled
* true will enable endpoint discovery if the service supports it.
*/
AWSBudgetsAsyncClient(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 createBudgetAsync(CreateBudgetRequest request) {
return createBudgetAsync(request, null);
}
@Override
public java.util.concurrent.Future createBudgetAsync(final CreateBudgetRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreateBudgetRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateBudgetResult call() throws Exception {
CreateBudgetResult result = null;
try {
result = executeCreateBudget(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 createBudgetActionAsync(CreateBudgetActionRequest request) {
return createBudgetActionAsync(request, null);
}
@Override
public java.util.concurrent.Future createBudgetActionAsync(final CreateBudgetActionRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreateBudgetActionRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateBudgetActionResult call() throws Exception {
CreateBudgetActionResult result = null;
try {
result = executeCreateBudgetAction(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 createNotificationAsync(CreateNotificationRequest request) {
return createNotificationAsync(request, null);
}
@Override
public java.util.concurrent.Future createNotificationAsync(final CreateNotificationRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreateNotificationRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateNotificationResult call() throws Exception {
CreateNotificationResult result = null;
try {
result = executeCreateNotification(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 createSubscriberAsync(CreateSubscriberRequest request) {
return createSubscriberAsync(request, null);
}
@Override
public java.util.concurrent.Future createSubscriberAsync(final CreateSubscriberRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreateSubscriberRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateSubscriberResult call() throws Exception {
CreateSubscriberResult result = null;
try {
result = executeCreateSubscriber(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 deleteBudgetAsync(DeleteBudgetRequest request) {
return deleteBudgetAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteBudgetAsync(final DeleteBudgetRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteBudgetRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteBudgetResult call() throws Exception {
DeleteBudgetResult result = null;
try {
result = executeDeleteBudget(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 deleteBudgetActionAsync(DeleteBudgetActionRequest request) {
return deleteBudgetActionAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteBudgetActionAsync(final DeleteBudgetActionRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteBudgetActionRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteBudgetActionResult call() throws Exception {
DeleteBudgetActionResult result = null;
try {
result = executeDeleteBudgetAction(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 deleteNotificationAsync(DeleteNotificationRequest request) {
return deleteNotificationAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteNotificationAsync(final DeleteNotificationRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteNotificationRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteNotificationResult call() throws Exception {
DeleteNotificationResult result = null;
try {
result = executeDeleteNotification(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 deleteSubscriberAsync(DeleteSubscriberRequest request) {
return deleteSubscriberAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteSubscriberAsync(final DeleteSubscriberRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteSubscriberRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteSubscriberResult call() throws Exception {
DeleteSubscriberResult result = null;
try {
result = executeDeleteSubscriber(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 describeBudgetAsync(DescribeBudgetRequest request) {
return describeBudgetAsync(request, null);
}
@Override
public java.util.concurrent.Future describeBudgetAsync(final DescribeBudgetRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DescribeBudgetRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeBudgetResult call() throws Exception {
DescribeBudgetResult result = null;
try {
result = executeDescribeBudget(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 describeBudgetActionAsync(DescribeBudgetActionRequest request) {
return describeBudgetActionAsync(request, null);
}
@Override
public java.util.concurrent.Future describeBudgetActionAsync(final DescribeBudgetActionRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DescribeBudgetActionRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeBudgetActionResult call() throws Exception {
DescribeBudgetActionResult result = null;
try {
result = executeDescribeBudgetAction(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 describeBudgetActionHistoriesAsync(DescribeBudgetActionHistoriesRequest request) {
return describeBudgetActionHistoriesAsync(request, null);
}
@Override
public java.util.concurrent.Future describeBudgetActionHistoriesAsync(
final DescribeBudgetActionHistoriesRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DescribeBudgetActionHistoriesRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeBudgetActionHistoriesResult call() throws Exception {
DescribeBudgetActionHistoriesResult result = null;
try {
result = executeDescribeBudgetActionHistories(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 describeBudgetActionsForAccountAsync(
DescribeBudgetActionsForAccountRequest request) {
return describeBudgetActionsForAccountAsync(request, null);
}
@Override
public java.util.concurrent.Future describeBudgetActionsForAccountAsync(
final DescribeBudgetActionsForAccountRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DescribeBudgetActionsForAccountRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeBudgetActionsForAccountResult call() throws Exception {
DescribeBudgetActionsForAccountResult result = null;
try {
result = executeDescribeBudgetActionsForAccount(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 describeBudgetActionsForBudgetAsync(DescribeBudgetActionsForBudgetRequest request) {
return describeBudgetActionsForBudgetAsync(request, null);
}
@Override
public java.util.concurrent.Future describeBudgetActionsForBudgetAsync(
final DescribeBudgetActionsForBudgetRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DescribeBudgetActionsForBudgetRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeBudgetActionsForBudgetResult call() throws Exception {
DescribeBudgetActionsForBudgetResult result = null;
try {
result = executeDescribeBudgetActionsForBudget(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 describeBudgetNotificationsForAccountAsync(
DescribeBudgetNotificationsForAccountRequest request) {
return describeBudgetNotificationsForAccountAsync(request, null);
}
@Override
public java.util.concurrent.Future describeBudgetNotificationsForAccountAsync(
final DescribeBudgetNotificationsForAccountRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DescribeBudgetNotificationsForAccountRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeBudgetNotificationsForAccountResult call() throws Exception {
DescribeBudgetNotificationsForAccountResult result = null;
try {
result = executeDescribeBudgetNotificationsForAccount(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 describeBudgetPerformanceHistoryAsync(
DescribeBudgetPerformanceHistoryRequest request) {
return describeBudgetPerformanceHistoryAsync(request, null);
}
@Override
public java.util.concurrent.Future describeBudgetPerformanceHistoryAsync(
final DescribeBudgetPerformanceHistoryRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DescribeBudgetPerformanceHistoryRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeBudgetPerformanceHistoryResult call() throws Exception {
DescribeBudgetPerformanceHistoryResult result = null;
try {
result = executeDescribeBudgetPerformanceHistory(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 describeBudgetsAsync(DescribeBudgetsRequest request) {
return describeBudgetsAsync(request, null);
}
@Override
public java.util.concurrent.Future describeBudgetsAsync(final DescribeBudgetsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DescribeBudgetsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeBudgetsResult call() throws Exception {
DescribeBudgetsResult result = null;
try {
result = executeDescribeBudgets(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 describeNotificationsForBudgetAsync(DescribeNotificationsForBudgetRequest request) {
return describeNotificationsForBudgetAsync(request, null);
}
@Override
public java.util.concurrent.Future describeNotificationsForBudgetAsync(
final DescribeNotificationsForBudgetRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DescribeNotificationsForBudgetRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeNotificationsForBudgetResult call() throws Exception {
DescribeNotificationsForBudgetResult result = null;
try {
result = executeDescribeNotificationsForBudget(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 describeSubscribersForNotificationAsync(
DescribeSubscribersForNotificationRequest request) {
return describeSubscribersForNotificationAsync(request, null);
}
@Override
public java.util.concurrent.Future describeSubscribersForNotificationAsync(
final DescribeSubscribersForNotificationRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DescribeSubscribersForNotificationRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeSubscribersForNotificationResult call() throws Exception {
DescribeSubscribersForNotificationResult result = null;
try {
result = executeDescribeSubscribersForNotification(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 executeBudgetActionAsync(ExecuteBudgetActionRequest request) {
return executeBudgetActionAsync(request, null);
}
@Override
public java.util.concurrent.Future executeBudgetActionAsync(final ExecuteBudgetActionRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ExecuteBudgetActionRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ExecuteBudgetActionResult call() throws Exception {
ExecuteBudgetActionResult result = null;
try {
result = executeExecuteBudgetAction(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 updateBudgetAsync(UpdateBudgetRequest request) {
return updateBudgetAsync(request, null);
}
@Override
public java.util.concurrent.Future updateBudgetAsync(final UpdateBudgetRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UpdateBudgetRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UpdateBudgetResult call() throws Exception {
UpdateBudgetResult result = null;
try {
result = executeUpdateBudget(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 updateBudgetActionAsync(UpdateBudgetActionRequest request) {
return updateBudgetActionAsync(request, null);
}
@Override
public java.util.concurrent.Future updateBudgetActionAsync(final UpdateBudgetActionRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UpdateBudgetActionRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UpdateBudgetActionResult call() throws Exception {
UpdateBudgetActionResult result = null;
try {
result = executeUpdateBudgetAction(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 updateNotificationAsync(UpdateNotificationRequest request) {
return updateNotificationAsync(request, null);
}
@Override
public java.util.concurrent.Future updateNotificationAsync(final UpdateNotificationRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UpdateNotificationRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UpdateNotificationResult call() throws Exception {
UpdateNotificationResult result = null;
try {
result = executeUpdateNotification(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 updateSubscriberAsync(UpdateSubscriberRequest request) {
return updateSubscriberAsync(request, null);
}
@Override
public java.util.concurrent.Future updateSubscriberAsync(final UpdateSubscriberRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UpdateSubscriberRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UpdateSubscriberResult call() throws Exception {
UpdateSubscriberResult result = null;
try {
result = executeUpdateSubscriber(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();
}
}