com.amazonaws.services.opsworkscm.AWSOpsWorksCMAsyncClient Maven / Gradle / Ivy
Show all versions of aws-java-sdk-opsworkscm Show documentation
/*
* Copyright 2017-2022 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.opsworkscm;
import static java.util.concurrent.Executors.newFixedThreadPool;
import javax.annotation.Generated;
import com.amazonaws.services.opsworkscm.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 OpsWorksCM 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.
*
* AWS OpsWorks CM
*
* AWS OpsWorks for configuration management (CM) is a service that runs and manages configuration management servers.
* You can use AWS OpsWorks CM to create and manage AWS OpsWorks for Chef Automate and AWS OpsWorks for Puppet
* Enterprise servers, and add or remove nodes for the servers to manage.
*
*
* Glossary of terms
*
*
* -
*
* Server: A configuration management server that can be highly-available. The configuration management server
* runs on an Amazon Elastic Compute Cloud (EC2) instance, and may use various other AWS services, such as Amazon
* Relational Database Service (RDS) and Elastic Load Balancing. A server is a generic abstraction over the
* configuration manager that you want to use, much like Amazon RDS. In AWS OpsWorks CM, you do not start or stop
* servers. After you create servers, they continue to run until they are deleted.
*
*
* -
*
* Engine: The engine is the specific configuration manager that you want to use. Valid values in this release
* include ChefAutomate
and Puppet
.
*
*
* -
*
* Backup: This is an application-level backup of the data that the configuration manager stores. AWS OpsWorks CM
* creates an S3 bucket for backups when you launch the first server. A backup maintains a snapshot of a server's
* configuration-related attributes at the time the backup starts.
*
*
* -
*
* Events: Events are always related to a server. Events are written during server creation, when health checks
* run, when backups are created, when system maintenance is performed, etc. When you delete a server, the server's
* events are also deleted.
*
*
* -
*
* Account attributes: Every account has attributes that are assigned in the AWS OpsWorks CM database. These
* attributes store information about configuration limits (servers, backups, etc.) and your customer account.
*
*
*
*
* Endpoints
*
*
* AWS OpsWorks CM supports the following endpoints, all HTTPS. You must connect to one of the following endpoints. Your
* servers can only be accessed or managed within the endpoint in which they are created.
*
*
* -
*
* opsworks-cm.us-east-1.amazonaws.com
*
*
* -
*
* opsworks-cm.us-east-2.amazonaws.com
*
*
* -
*
* opsworks-cm.us-west-1.amazonaws.com
*
*
* -
*
* opsworks-cm.us-west-2.amazonaws.com
*
*
* -
*
* opsworks-cm.ap-northeast-1.amazonaws.com
*
*
* -
*
* opsworks-cm.ap-southeast-1.amazonaws.com
*
*
* -
*
* opsworks-cm.ap-southeast-2.amazonaws.com
*
*
* -
*
* opsworks-cm.eu-central-1.amazonaws.com
*
*
* -
*
* opsworks-cm.eu-west-1.amazonaws.com
*
*
*
*
* For more information, see AWS OpsWorks
* endpoints and quotas in the AWS General Reference.
*
*
* Throttling limits
*
*
* All API operations allow for five requests per second with a burst of 10 requests per second.
*
*/
@ThreadSafe
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AWSOpsWorksCMAsyncClient extends AWSOpsWorksCMClient implements AWSOpsWorksCMAsync {
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 OpsWorksCM. 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 AWSOpsWorksCMAsyncClientBuilder#defaultClient()}
*/
@Deprecated
public AWSOpsWorksCMAsyncClient() {
this(DefaultAWSCredentialsProviderChain.getInstance());
}
/**
* Constructs a new asynchronous client to invoke service methods on OpsWorksCM. 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 OpsWorksCM (ex: proxy settings,
* retry counts, etc).
*
* @see com.amazonaws.auth.DefaultAWSCredentialsProviderChain
* @see java.util.concurrent.Executors#newFixedThreadPool(int)
* @deprecated use {@link AWSOpsWorksCMAsyncClientBuilder#withClientConfiguration(ClientConfiguration)}
*/
@Deprecated
public AWSOpsWorksCMAsyncClient(ClientConfiguration clientConfiguration) {
this(DefaultAWSCredentialsProviderChain.getInstance(), clientConfiguration, newFixedThreadPool(clientConfiguration.getMaxConnections()));
}
/**
* Constructs a new asynchronous client to invoke service methods on OpsWorksCM 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 AWSOpsWorksCMAsyncClientBuilder#withCredentials(AWSCredentialsProvider)}
*/
@Deprecated
public AWSOpsWorksCMAsyncClient(AWSCredentials awsCredentials) {
this(awsCredentials, newFixedThreadPool(DEFAULT_THREAD_POOL_SIZE));
}
/**
* Constructs a new asynchronous client to invoke service methods on OpsWorksCM 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 AWSOpsWorksCMAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} and
* {@link AWSOpsWorksCMAsyncClientBuilder#withExecutorFactory(com.amazonaws.client.builder.ExecutorFactory)}
*/
@Deprecated
public AWSOpsWorksCMAsyncClient(AWSCredentials awsCredentials, ExecutorService executorService) {
this(awsCredentials, configFactory.getConfig(), executorService);
}
/**
* Constructs a new asynchronous client to invoke service methods on OpsWorksCM 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 AWSOpsWorksCMAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} and
* {@link AWSOpsWorksCMAsyncClientBuilder#withClientConfiguration(ClientConfiguration)} and
* {@link AWSOpsWorksCMAsyncClientBuilder#withExecutorFactory(com.amazonaws.client.builder.ExecutorFactory)}
*/
@Deprecated
public AWSOpsWorksCMAsyncClient(AWSCredentials awsCredentials, ClientConfiguration clientConfiguration, ExecutorService executorService) {
super(awsCredentials, clientConfiguration);
this.executorService = executorService;
}
/**
* Constructs a new asynchronous client to invoke service methods on OpsWorksCM 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 AWSOpsWorksCMAsyncClientBuilder#withCredentials(AWSCredentialsProvider)}
*/
@Deprecated
public AWSOpsWorksCMAsyncClient(AWSCredentialsProvider awsCredentialsProvider) {
this(awsCredentialsProvider, newFixedThreadPool(DEFAULT_THREAD_POOL_SIZE));
}
/**
* Constructs a new asynchronous client to invoke service methods on OpsWorksCM 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 AWSOpsWorksCMAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} and
* {@link AWSOpsWorksCMAsyncClientBuilder#withClientConfiguration(ClientConfiguration)}
*/
@Deprecated
public AWSOpsWorksCMAsyncClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration) {
this(awsCredentialsProvider, clientConfiguration, newFixedThreadPool(clientConfiguration.getMaxConnections()));
}
/**
* Constructs a new asynchronous client to invoke service methods on OpsWorksCM 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 AWSOpsWorksCMAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} and
* {@link AWSOpsWorksCMAsyncClientBuilder#withExecutorFactory(com.amazonaws.client.builder.ExecutorFactory)}
*/
@Deprecated
public AWSOpsWorksCMAsyncClient(AWSCredentialsProvider awsCredentialsProvider, ExecutorService executorService) {
this(awsCredentialsProvider, configFactory.getConfig(), executorService);
}
/**
* Constructs a new asynchronous client to invoke service methods on OpsWorksCM 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 AWSOpsWorksCMAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} and
* {@link AWSOpsWorksCMAsyncClientBuilder#withClientConfiguration(ClientConfiguration)} and
* {@link AWSOpsWorksCMAsyncClientBuilder#withExecutorFactory(com.amazonaws.client.builder.ExecutorFactory)}
*/
@Deprecated
public AWSOpsWorksCMAsyncClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration, ExecutorService executorService) {
super(awsCredentialsProvider, clientConfiguration);
this.executorService = executorService;
}
public static AWSOpsWorksCMAsyncClientBuilder asyncBuilder() {
return AWSOpsWorksCMAsyncClientBuilder.standard();
}
/**
* Constructs a new asynchronous client to invoke service methods on OpsWorksCM using the specified parameters.
*
* @param asyncClientParams
* Object providing client parameters.
*/
AWSOpsWorksCMAsyncClient(AwsAsyncClientParams asyncClientParams) {
this(asyncClientParams, false);
}
/**
* Constructs a new asynchronous client to invoke service methods on OpsWorksCM using the specified parameters.
*
* @param asyncClientParams
* Object providing client parameters.
* @param endpointDiscoveryEnabled
* true will enable endpoint discovery if the service supports it.
*/
AWSOpsWorksCMAsyncClient(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 associateNodeAsync(AssociateNodeRequest request) {
return associateNodeAsync(request, null);
}
@Override
public java.util.concurrent.Future associateNodeAsync(final AssociateNodeRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final AssociateNodeRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public AssociateNodeResult call() throws Exception {
AssociateNodeResult result = null;
try {
result = executeAssociateNode(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 createBackupAsync(CreateBackupRequest request) {
return createBackupAsync(request, null);
}
@Override
public java.util.concurrent.Future createBackupAsync(final CreateBackupRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreateBackupRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateBackupResult call() throws Exception {
CreateBackupResult result = null;
try {
result = executeCreateBackup(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 createServerAsync(CreateServerRequest request) {
return createServerAsync(request, null);
}
@Override
public java.util.concurrent.Future createServerAsync(final CreateServerRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreateServerRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateServerResult call() throws Exception {
CreateServerResult result = null;
try {
result = executeCreateServer(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 deleteBackupAsync(DeleteBackupRequest request) {
return deleteBackupAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteBackupAsync(final DeleteBackupRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteBackupRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteBackupResult call() throws Exception {
DeleteBackupResult result = null;
try {
result = executeDeleteBackup(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 deleteServerAsync(DeleteServerRequest request) {
return deleteServerAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteServerAsync(final DeleteServerRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteServerRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteServerResult call() throws Exception {
DeleteServerResult result = null;
try {
result = executeDeleteServer(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 describeAccountAttributesAsync(DescribeAccountAttributesRequest request) {
return describeAccountAttributesAsync(request, null);
}
@Override
public java.util.concurrent.Future describeAccountAttributesAsync(final DescribeAccountAttributesRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DescribeAccountAttributesRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeAccountAttributesResult call() throws Exception {
DescribeAccountAttributesResult result = null;
try {
result = executeDescribeAccountAttributes(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 describeBackupsAsync(DescribeBackupsRequest request) {
return describeBackupsAsync(request, null);
}
@Override
public java.util.concurrent.Future describeBackupsAsync(final DescribeBackupsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DescribeBackupsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeBackupsResult call() throws Exception {
DescribeBackupsResult result = null;
try {
result = executeDescribeBackups(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 describeEventsAsync(DescribeEventsRequest request) {
return describeEventsAsync(request, null);
}
@Override
public java.util.concurrent.Future describeEventsAsync(final DescribeEventsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DescribeEventsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeEventsResult call() throws Exception {
DescribeEventsResult result = null;
try {
result = executeDescribeEvents(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 describeNodeAssociationStatusAsync(DescribeNodeAssociationStatusRequest request) {
return describeNodeAssociationStatusAsync(request, null);
}
@Override
public java.util.concurrent.Future describeNodeAssociationStatusAsync(
final DescribeNodeAssociationStatusRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DescribeNodeAssociationStatusRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeNodeAssociationStatusResult call() throws Exception {
DescribeNodeAssociationStatusResult result = null;
try {
result = executeDescribeNodeAssociationStatus(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 describeServersAsync(DescribeServersRequest request) {
return describeServersAsync(request, null);
}
@Override
public java.util.concurrent.Future describeServersAsync(final DescribeServersRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DescribeServersRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeServersResult call() throws Exception {
DescribeServersResult result = null;
try {
result = executeDescribeServers(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 disassociateNodeAsync(DisassociateNodeRequest request) {
return disassociateNodeAsync(request, null);
}
@Override
public java.util.concurrent.Future disassociateNodeAsync(final DisassociateNodeRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DisassociateNodeRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DisassociateNodeResult call() throws Exception {
DisassociateNodeResult result = null;
try {
result = executeDisassociateNode(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 exportServerEngineAttributeAsync(ExportServerEngineAttributeRequest request) {
return exportServerEngineAttributeAsync(request, null);
}
@Override
public java.util.concurrent.Future exportServerEngineAttributeAsync(final ExportServerEngineAttributeRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ExportServerEngineAttributeRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ExportServerEngineAttributeResult call() throws Exception {
ExportServerEngineAttributeResult result = null;
try {
result = executeExportServerEngineAttribute(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 listTagsForResourceAsync(ListTagsForResourceRequest request) {
return listTagsForResourceAsync(request, null);
}
@Override
public java.util.concurrent.Future listTagsForResourceAsync(final ListTagsForResourceRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListTagsForResourceRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListTagsForResourceResult call() throws Exception {
ListTagsForResourceResult result = null;
try {
result = executeListTagsForResource(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 restoreServerAsync(RestoreServerRequest request) {
return restoreServerAsync(request, null);
}
@Override
public java.util.concurrent.Future restoreServerAsync(final RestoreServerRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final RestoreServerRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public RestoreServerResult call() throws Exception {
RestoreServerResult result = null;
try {
result = executeRestoreServer(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 startMaintenanceAsync(StartMaintenanceRequest request) {
return startMaintenanceAsync(request, null);
}
@Override
public java.util.concurrent.Future startMaintenanceAsync(final StartMaintenanceRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final StartMaintenanceRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public StartMaintenanceResult call() throws Exception {
StartMaintenanceResult result = null;
try {
result = executeStartMaintenance(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 tagResourceAsync(TagResourceRequest request) {
return tagResourceAsync(request, null);
}
@Override
public java.util.concurrent.Future tagResourceAsync(final TagResourceRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final TagResourceRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public TagResourceResult call() throws Exception {
TagResourceResult result = null;
try {
result = executeTagResource(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 untagResourceAsync(UntagResourceRequest request) {
return untagResourceAsync(request, null);
}
@Override
public java.util.concurrent.Future untagResourceAsync(final UntagResourceRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UntagResourceRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UntagResourceResult call() throws Exception {
UntagResourceResult result = null;
try {
result = executeUntagResource(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 updateServerAsync(UpdateServerRequest request) {
return updateServerAsync(request, null);
}
@Override
public java.util.concurrent.Future updateServerAsync(final UpdateServerRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UpdateServerRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UpdateServerResult call() throws Exception {
UpdateServerResult result = null;
try {
result = executeUpdateServer(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 updateServerEngineAttributesAsync(UpdateServerEngineAttributesRequest request) {
return updateServerEngineAttributesAsync(request, null);
}
@Override
public java.util.concurrent.Future updateServerEngineAttributesAsync(final UpdateServerEngineAttributesRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UpdateServerEngineAttributesRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UpdateServerEngineAttributesResult call() throws Exception {
UpdateServerEngineAttributesResult result = null;
try {
result = executeUpdateServerEngineAttributes(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();
}
}