com.amazonaws.services.kms.AWSKMSAsyncClient Maven / Gradle / Ivy
Show all versions of aws-java-sdk-kms Show documentation
/*
* 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.kms;
import static java.util.concurrent.Executors.newFixedThreadPool;
import javax.annotation.Generated;
import com.amazonaws.services.kms.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 KMS 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.
*
* Key Management Service
*
* Key Management Service (KMS) is an encryption and key management web service. This guide describes the KMS operations
* that you can call programmatically. For general information about KMS, see the Key Management Service Developer Guide .
*
*
*
* KMS has replaced the term customer master key (CMK) with KMS key and KMS key. The concept has
* not changed. To prevent breaking changes, KMS is keeping some variations of this term.
*
*
* Amazon Web Services provides SDKs that consist of libraries and sample code for various programming languages and
* platforms (Java, Ruby, .Net, macOS, Android, etc.). The SDKs provide a convenient way to create programmatic access
* to KMS and other Amazon Web Services services. For example, the SDKs take care of tasks such as signing requests (see
* below), managing errors, and retrying requests automatically. For more information about the Amazon Web Services
* SDKs, including how to download and install them, see Tools for Amazon Web
* Services.
*
*
*
* We recommend that you use the Amazon Web Services SDKs to make programmatic API calls to KMS.
*
*
* If you need to use FIPS 140-2 validated cryptographic modules when communicating with Amazon Web Services, use the
* FIPS endpoint in your preferred Amazon Web Services Region. For more information about the available FIPS endpoints,
* see Service endpoints in the Key
* Management Service topic of the Amazon Web Services General Reference.
*
*
* All KMS API calls must be signed and be transmitted using Transport Layer Security (TLS). KMS recommends you always
* use the latest supported TLS version. Clients must also support cipher suites with Perfect Forward Secrecy (PFS) such
* as Ephemeral Diffie-Hellman (DHE) or Elliptic Curve Ephemeral Diffie-Hellman (ECDHE). Most modern systems such as
* Java 7 and later support these modes.
*
*
* Signing Requests
*
*
* Requests must be signed using an access key ID and a secret access key. We strongly recommend that you do not use
* your Amazon Web Services account root access key ID and secret access key for everyday work. You can use the access
* key ID and secret access key for an IAM user or you can use the Security Token Service (STS) to generate temporary
* security credentials and use those to sign requests.
*
*
* All KMS requests must be signed with Signature Version 4.
*
*
* Logging API Requests
*
*
* KMS supports CloudTrail, a service that logs Amazon Web Services API calls and related events for your Amazon Web
* Services account and delivers them to an Amazon S3 bucket that you specify. By using the information collected by
* CloudTrail, you can determine what requests were made to KMS, who made the request, when it was made, and so on. To
* learn more about CloudTrail, including how to turn it on and find your log files, see the CloudTrail User Guide.
*
*
* Additional Resources
*
*
* For more information about credentials and request signing, see the following:
*
*
* -
*
* Amazon Web Services Security
* Credentials - This topic provides general information about the types of credentials used to access Amazon Web
* Services.
*
*
* -
*
* Temporary Security
* Credentials - This section of the IAM User Guide describes how to create and use temporary security
* credentials.
*
*
* -
*
* Signature Version 4 Signing
* Process - This set of topics walks you through the process of signing a request using an access key ID and a
* secret access key.
*
*
*
*
* Commonly Used API Operations
*
*
* Of the API operations discussed in this guide, the following will prove the most useful for most applications. You
* will likely perform operations other than these, such as creating keys and assigning policies, by using the console.
*
*
* -
*
* Encrypt
*
*
* -
*
* Decrypt
*
*
* -
*
* GenerateDataKey
*
*
* -
*
*
*
*/
@ThreadSafe
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AWSKMSAsyncClient extends AWSKMSClient implements AWSKMSAsync {
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 KMS. 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 AWSKMSAsyncClientBuilder#defaultClient()}
*/
@Deprecated
public AWSKMSAsyncClient() {
this(DefaultAWSCredentialsProviderChain.getInstance());
}
/**
* Constructs a new asynchronous client to invoke service methods on KMS. 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 KMS (ex: proxy settings, retry
* counts, etc).
*
* @see com.amazonaws.auth.DefaultAWSCredentialsProviderChain
* @see java.util.concurrent.Executors#newFixedThreadPool(int)
* @deprecated use {@link AWSKMSAsyncClientBuilder#withClientConfiguration(ClientConfiguration)}
*/
@Deprecated
public AWSKMSAsyncClient(ClientConfiguration clientConfiguration) {
this(DefaultAWSCredentialsProviderChain.getInstance(), clientConfiguration, newFixedThreadPool(clientConfiguration.getMaxConnections()));
}
/**
* Constructs a new asynchronous client to invoke service methods on KMS 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 AWSKMSAsyncClientBuilder#withCredentials(AWSCredentialsProvider)}
*/
@Deprecated
public AWSKMSAsyncClient(AWSCredentials awsCredentials) {
this(awsCredentials, newFixedThreadPool(DEFAULT_THREAD_POOL_SIZE));
}
/**
* Constructs a new asynchronous client to invoke service methods on KMS 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 AWSKMSAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} and
* {@link AWSKMSAsyncClientBuilder#withExecutorFactory(com.amazonaws.client.builder.ExecutorFactory)}
*/
@Deprecated
public AWSKMSAsyncClient(AWSCredentials awsCredentials, ExecutorService executorService) {
this(awsCredentials, configFactory.getConfig(), executorService);
}
/**
* Constructs a new asynchronous client to invoke service methods on KMS 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 AWSKMSAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} and
* {@link AWSKMSAsyncClientBuilder#withClientConfiguration(ClientConfiguration)} and
* {@link AWSKMSAsyncClientBuilder#withExecutorFactory(com.amazonaws.client.builder.ExecutorFactory)}
*/
@Deprecated
public AWSKMSAsyncClient(AWSCredentials awsCredentials, ClientConfiguration clientConfiguration, ExecutorService executorService) {
super(awsCredentials, clientConfiguration);
this.executorService = executorService;
}
/**
* Constructs a new asynchronous client to invoke service methods on KMS 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 AWSKMSAsyncClientBuilder#withCredentials(AWSCredentialsProvider)}
*/
@Deprecated
public AWSKMSAsyncClient(AWSCredentialsProvider awsCredentialsProvider) {
this(awsCredentialsProvider, newFixedThreadPool(DEFAULT_THREAD_POOL_SIZE));
}
/**
* Constructs a new asynchronous client to invoke service methods on KMS 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 AWSKMSAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} and
* {@link AWSKMSAsyncClientBuilder#withClientConfiguration(ClientConfiguration)}
*/
@Deprecated
public AWSKMSAsyncClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration) {
this(awsCredentialsProvider, clientConfiguration, newFixedThreadPool(clientConfiguration.getMaxConnections()));
}
/**
* Constructs a new asynchronous client to invoke service methods on KMS 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 AWSKMSAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} and
* {@link AWSKMSAsyncClientBuilder#withExecutorFactory(com.amazonaws.client.builder.ExecutorFactory)}
*/
@Deprecated
public AWSKMSAsyncClient(AWSCredentialsProvider awsCredentialsProvider, ExecutorService executorService) {
this(awsCredentialsProvider, configFactory.getConfig(), executorService);
}
/**
* Constructs a new asynchronous client to invoke service methods on KMS 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 AWSKMSAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} and
* {@link AWSKMSAsyncClientBuilder#withClientConfiguration(ClientConfiguration)} and
* {@link AWSKMSAsyncClientBuilder#withExecutorFactory(com.amazonaws.client.builder.ExecutorFactory)}
*/
@Deprecated
public AWSKMSAsyncClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration, ExecutorService executorService) {
super(awsCredentialsProvider, clientConfiguration);
this.executorService = executorService;
}
public static AWSKMSAsyncClientBuilder asyncBuilder() {
return AWSKMSAsyncClientBuilder.standard();
}
/**
* Constructs a new asynchronous client to invoke service methods on KMS using the specified parameters.
*
* @param asyncClientParams
* Object providing client parameters.
*/
AWSKMSAsyncClient(AwsAsyncClientParams asyncClientParams) {
this(asyncClientParams, false);
}
/**
* Constructs a new asynchronous client to invoke service methods on KMS using the specified parameters.
*
* @param asyncClientParams
* Object providing client parameters.
* @param endpointDiscoveryEnabled
* true will enable endpoint discovery if the service supports it.
*/
AWSKMSAsyncClient(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 cancelKeyDeletionAsync(CancelKeyDeletionRequest request) {
return cancelKeyDeletionAsync(request, null);
}
@Override
public java.util.concurrent.Future cancelKeyDeletionAsync(final CancelKeyDeletionRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CancelKeyDeletionRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CancelKeyDeletionResult call() throws Exception {
CancelKeyDeletionResult result = null;
try {
result = executeCancelKeyDeletion(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 connectCustomKeyStoreAsync(ConnectCustomKeyStoreRequest request) {
return connectCustomKeyStoreAsync(request, null);
}
@Override
public java.util.concurrent.Future connectCustomKeyStoreAsync(final ConnectCustomKeyStoreRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ConnectCustomKeyStoreRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ConnectCustomKeyStoreResult call() throws Exception {
ConnectCustomKeyStoreResult result = null;
try {
result = executeConnectCustomKeyStore(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 createAliasAsync(CreateAliasRequest request) {
return createAliasAsync(request, null);
}
@Override
public java.util.concurrent.Future createAliasAsync(final CreateAliasRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreateAliasRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateAliasResult call() throws Exception {
CreateAliasResult result = null;
try {
result = executeCreateAlias(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 createCustomKeyStoreAsync(CreateCustomKeyStoreRequest request) {
return createCustomKeyStoreAsync(request, null);
}
@Override
public java.util.concurrent.Future createCustomKeyStoreAsync(final CreateCustomKeyStoreRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreateCustomKeyStoreRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateCustomKeyStoreResult call() throws Exception {
CreateCustomKeyStoreResult result = null;
try {
result = executeCreateCustomKeyStore(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 createGrantAsync(CreateGrantRequest request) {
return createGrantAsync(request, null);
}
@Override
public java.util.concurrent.Future createGrantAsync(final CreateGrantRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreateGrantRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateGrantResult call() throws Exception {
CreateGrantResult result = null;
try {
result = executeCreateGrant(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 createKeyAsync(CreateKeyRequest request) {
return createKeyAsync(request, null);
}
@Override
public java.util.concurrent.Future createKeyAsync(final CreateKeyRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreateKeyRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateKeyResult call() throws Exception {
CreateKeyResult result = null;
try {
result = executeCreateKey(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
/**
* Simplified method form for invoking the CreateKey operation.
*
* @see #createKeyAsync(CreateKeyRequest)
*/
@Override
public java.util.concurrent.Future createKeyAsync() {
return createKeyAsync(new CreateKeyRequest());
}
/**
* Simplified method form for invoking the CreateKey operation with an AsyncHandler.
*
* @see #createKeyAsync(CreateKeyRequest, com.amazonaws.handlers.AsyncHandler)
*/
@Override
public java.util.concurrent.Future createKeyAsync(com.amazonaws.handlers.AsyncHandler asyncHandler) {
return createKeyAsync(new CreateKeyRequest(), asyncHandler);
}
@Override
public java.util.concurrent.Future decryptAsync(DecryptRequest request) {
return decryptAsync(request, null);
}
@Override
public java.util.concurrent.Future decryptAsync(final DecryptRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DecryptRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DecryptResult call() throws Exception {
DecryptResult result = null;
try {
result = executeDecrypt(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 deleteAliasAsync(DeleteAliasRequest request) {
return deleteAliasAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteAliasAsync(final DeleteAliasRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteAliasRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteAliasResult call() throws Exception {
DeleteAliasResult result = null;
try {
result = executeDeleteAlias(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 deleteCustomKeyStoreAsync(DeleteCustomKeyStoreRequest request) {
return deleteCustomKeyStoreAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteCustomKeyStoreAsync(final DeleteCustomKeyStoreRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteCustomKeyStoreRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteCustomKeyStoreResult call() throws Exception {
DeleteCustomKeyStoreResult result = null;
try {
result = executeDeleteCustomKeyStore(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 deleteImportedKeyMaterialAsync(DeleteImportedKeyMaterialRequest request) {
return deleteImportedKeyMaterialAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteImportedKeyMaterialAsync(final DeleteImportedKeyMaterialRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteImportedKeyMaterialRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteImportedKeyMaterialResult call() throws Exception {
DeleteImportedKeyMaterialResult result = null;
try {
result = executeDeleteImportedKeyMaterial(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 deriveSharedSecretAsync(DeriveSharedSecretRequest request) {
return deriveSharedSecretAsync(request, null);
}
@Override
public java.util.concurrent.Future deriveSharedSecretAsync(final DeriveSharedSecretRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeriveSharedSecretRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeriveSharedSecretResult call() throws Exception {
DeriveSharedSecretResult result = null;
try {
result = executeDeriveSharedSecret(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 describeCustomKeyStoresAsync(DescribeCustomKeyStoresRequest request) {
return describeCustomKeyStoresAsync(request, null);
}
@Override
public java.util.concurrent.Future describeCustomKeyStoresAsync(final DescribeCustomKeyStoresRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DescribeCustomKeyStoresRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeCustomKeyStoresResult call() throws Exception {
DescribeCustomKeyStoresResult result = null;
try {
result = executeDescribeCustomKeyStores(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 describeKeyAsync(DescribeKeyRequest request) {
return describeKeyAsync(request, null);
}
@Override
public java.util.concurrent.Future describeKeyAsync(final DescribeKeyRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DescribeKeyRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeKeyResult call() throws Exception {
DescribeKeyResult result = null;
try {
result = executeDescribeKey(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 disableKeyAsync(DisableKeyRequest request) {
return disableKeyAsync(request, null);
}
@Override
public java.util.concurrent.Future disableKeyAsync(final DisableKeyRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DisableKeyRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DisableKeyResult call() throws Exception {
DisableKeyResult result = null;
try {
result = executeDisableKey(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 disableKeyRotationAsync(DisableKeyRotationRequest request) {
return disableKeyRotationAsync(request, null);
}
@Override
public java.util.concurrent.Future disableKeyRotationAsync(final DisableKeyRotationRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DisableKeyRotationRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DisableKeyRotationResult call() throws Exception {
DisableKeyRotationResult result = null;
try {
result = executeDisableKeyRotation(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 disconnectCustomKeyStoreAsync(DisconnectCustomKeyStoreRequest request) {
return disconnectCustomKeyStoreAsync(request, null);
}
@Override
public java.util.concurrent.Future disconnectCustomKeyStoreAsync(final DisconnectCustomKeyStoreRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DisconnectCustomKeyStoreRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DisconnectCustomKeyStoreResult call() throws Exception {
DisconnectCustomKeyStoreResult result = null;
try {
result = executeDisconnectCustomKeyStore(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 enableKeyAsync(EnableKeyRequest request) {
return enableKeyAsync(request, null);
}
@Override
public java.util.concurrent.Future enableKeyAsync(final EnableKeyRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final EnableKeyRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public EnableKeyResult call() throws Exception {
EnableKeyResult result = null;
try {
result = executeEnableKey(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 enableKeyRotationAsync(EnableKeyRotationRequest request) {
return enableKeyRotationAsync(request, null);
}
@Override
public java.util.concurrent.Future enableKeyRotationAsync(final EnableKeyRotationRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final EnableKeyRotationRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public EnableKeyRotationResult call() throws Exception {
EnableKeyRotationResult result = null;
try {
result = executeEnableKeyRotation(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 encryptAsync(EncryptRequest request) {
return encryptAsync(request, null);
}
@Override
public java.util.concurrent.Future encryptAsync(final EncryptRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final EncryptRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public EncryptResult call() throws Exception {
EncryptResult result = null;
try {
result = executeEncrypt(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 generateDataKeyAsync(GenerateDataKeyRequest request) {
return generateDataKeyAsync(request, null);
}
@Override
public java.util.concurrent.Future generateDataKeyAsync(final GenerateDataKeyRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GenerateDataKeyRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GenerateDataKeyResult call() throws Exception {
GenerateDataKeyResult result = null;
try {
result = executeGenerateDataKey(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 generateDataKeyPairAsync(GenerateDataKeyPairRequest request) {
return generateDataKeyPairAsync(request, null);
}
@Override
public java.util.concurrent.Future generateDataKeyPairAsync(final GenerateDataKeyPairRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GenerateDataKeyPairRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GenerateDataKeyPairResult call() throws Exception {
GenerateDataKeyPairResult result = null;
try {
result = executeGenerateDataKeyPair(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 generateDataKeyPairWithoutPlaintextAsync(
GenerateDataKeyPairWithoutPlaintextRequest request) {
return generateDataKeyPairWithoutPlaintextAsync(request, null);
}
@Override
public java.util.concurrent.Future generateDataKeyPairWithoutPlaintextAsync(
final GenerateDataKeyPairWithoutPlaintextRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GenerateDataKeyPairWithoutPlaintextRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GenerateDataKeyPairWithoutPlaintextResult call() throws Exception {
GenerateDataKeyPairWithoutPlaintextResult result = null;
try {
result = executeGenerateDataKeyPairWithoutPlaintext(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 generateDataKeyWithoutPlaintextAsync(
GenerateDataKeyWithoutPlaintextRequest request) {
return generateDataKeyWithoutPlaintextAsync(request, null);
}
@Override
public java.util.concurrent.Future generateDataKeyWithoutPlaintextAsync(
final GenerateDataKeyWithoutPlaintextRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GenerateDataKeyWithoutPlaintextRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GenerateDataKeyWithoutPlaintextResult call() throws Exception {
GenerateDataKeyWithoutPlaintextResult result = null;
try {
result = executeGenerateDataKeyWithoutPlaintext(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 generateMacAsync(GenerateMacRequest request) {
return generateMacAsync(request, null);
}
@Override
public java.util.concurrent.Future generateMacAsync(final GenerateMacRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GenerateMacRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GenerateMacResult call() throws Exception {
GenerateMacResult result = null;
try {
result = executeGenerateMac(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 generateRandomAsync(GenerateRandomRequest request) {
return generateRandomAsync(request, null);
}
@Override
public java.util.concurrent.Future generateRandomAsync(final GenerateRandomRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GenerateRandomRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GenerateRandomResult call() throws Exception {
GenerateRandomResult result = null;
try {
result = executeGenerateRandom(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
/**
* Simplified method form for invoking the GenerateRandom operation.
*
* @see #generateRandomAsync(GenerateRandomRequest)
*/
@Override
public java.util.concurrent.Future generateRandomAsync() {
return generateRandomAsync(new GenerateRandomRequest());
}
/**
* Simplified method form for invoking the GenerateRandom operation with an AsyncHandler.
*
* @see #generateRandomAsync(GenerateRandomRequest, com.amazonaws.handlers.AsyncHandler)
*/
@Override
public java.util.concurrent.Future generateRandomAsync(
com.amazonaws.handlers.AsyncHandler asyncHandler) {
return generateRandomAsync(new GenerateRandomRequest(), asyncHandler);
}
@Override
public java.util.concurrent.Future getKeyPolicyAsync(GetKeyPolicyRequest request) {
return getKeyPolicyAsync(request, null);
}
@Override
public java.util.concurrent.Future getKeyPolicyAsync(final GetKeyPolicyRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetKeyPolicyRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetKeyPolicyResult call() throws Exception {
GetKeyPolicyResult result = null;
try {
result = executeGetKeyPolicy(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 getKeyRotationStatusAsync(GetKeyRotationStatusRequest request) {
return getKeyRotationStatusAsync(request, null);
}
@Override
public java.util.concurrent.Future getKeyRotationStatusAsync(final GetKeyRotationStatusRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetKeyRotationStatusRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetKeyRotationStatusResult call() throws Exception {
GetKeyRotationStatusResult result = null;
try {
result = executeGetKeyRotationStatus(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 getParametersForImportAsync(GetParametersForImportRequest request) {
return getParametersForImportAsync(request, null);
}
@Override
public java.util.concurrent.Future getParametersForImportAsync(final GetParametersForImportRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetParametersForImportRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetParametersForImportResult call() throws Exception {
GetParametersForImportResult result = null;
try {
result = executeGetParametersForImport(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 getPublicKeyAsync(GetPublicKeyRequest request) {
return getPublicKeyAsync(request, null);
}
@Override
public java.util.concurrent.Future getPublicKeyAsync(final GetPublicKeyRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetPublicKeyRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetPublicKeyResult call() throws Exception {
GetPublicKeyResult result = null;
try {
result = executeGetPublicKey(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 importKeyMaterialAsync(ImportKeyMaterialRequest request) {
return importKeyMaterialAsync(request, null);
}
@Override
public java.util.concurrent.Future importKeyMaterialAsync(final ImportKeyMaterialRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ImportKeyMaterialRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ImportKeyMaterialResult call() throws Exception {
ImportKeyMaterialResult result = null;
try {
result = executeImportKeyMaterial(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 listAliasesAsync(ListAliasesRequest request) {
return listAliasesAsync(request, null);
}
@Override
public java.util.concurrent.Future listAliasesAsync(final ListAliasesRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListAliasesRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListAliasesResult call() throws Exception {
ListAliasesResult result = null;
try {
result = executeListAliases(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
/**
* Simplified method form for invoking the ListAliases operation.
*
* @see #listAliasesAsync(ListAliasesRequest)
*/
@Override
public java.util.concurrent.Future listAliasesAsync() {
return listAliasesAsync(new ListAliasesRequest());
}
/**
* Simplified method form for invoking the ListAliases operation with an AsyncHandler.
*
* @see #listAliasesAsync(ListAliasesRequest, com.amazonaws.handlers.AsyncHandler)
*/
@Override
public java.util.concurrent.Future listAliasesAsync(
com.amazonaws.handlers.AsyncHandler asyncHandler) {
return listAliasesAsync(new ListAliasesRequest(), asyncHandler);
}
@Override
public java.util.concurrent.Future listGrantsAsync(ListGrantsRequest request) {
return listGrantsAsync(request, null);
}
@Override
public java.util.concurrent.Future listGrantsAsync(final ListGrantsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListGrantsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListGrantsResult call() throws Exception {
ListGrantsResult result = null;
try {
result = executeListGrants(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 listKeyPoliciesAsync(ListKeyPoliciesRequest request) {
return listKeyPoliciesAsync(request, null);
}
@Override
public java.util.concurrent.Future listKeyPoliciesAsync(final ListKeyPoliciesRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListKeyPoliciesRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListKeyPoliciesResult call() throws Exception {
ListKeyPoliciesResult result = null;
try {
result = executeListKeyPolicies(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 listKeyRotationsAsync(ListKeyRotationsRequest request) {
return listKeyRotationsAsync(request, null);
}
@Override
public java.util.concurrent.Future listKeyRotationsAsync(final ListKeyRotationsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListKeyRotationsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListKeyRotationsResult call() throws Exception {
ListKeyRotationsResult result = null;
try {
result = executeListKeyRotations(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 listKeysAsync(ListKeysRequest request) {
return listKeysAsync(request, null);
}
@Override
public java.util.concurrent.Future listKeysAsync(final ListKeysRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListKeysRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListKeysResult call() throws Exception {
ListKeysResult result = null;
try {
result = executeListKeys(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
/**
* Simplified method form for invoking the ListKeys operation.
*
* @see #listKeysAsync(ListKeysRequest)
*/
@Override
public java.util.concurrent.Future listKeysAsync() {
return listKeysAsync(new ListKeysRequest());
}
/**
* Simplified method form for invoking the ListKeys operation with an AsyncHandler.
*
* @see #listKeysAsync(ListKeysRequest, com.amazonaws.handlers.AsyncHandler)
*/
@Override
public java.util.concurrent.Future listKeysAsync(com.amazonaws.handlers.AsyncHandler asyncHandler) {
return listKeysAsync(new ListKeysRequest(), asyncHandler);
}
@Override
public java.util.concurrent.Future listResourceTagsAsync(ListResourceTagsRequest request) {
return listResourceTagsAsync(request, null);
}
@Override
public java.util.concurrent.Future listResourceTagsAsync(final ListResourceTagsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListResourceTagsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListResourceTagsResult call() throws Exception {
ListResourceTagsResult result = null;
try {
result = executeListResourceTags(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 listRetirableGrantsAsync(ListRetirableGrantsRequest request) {
return listRetirableGrantsAsync(request, null);
}
@Override
public java.util.concurrent.Future listRetirableGrantsAsync(final ListRetirableGrantsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListRetirableGrantsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListRetirableGrantsResult call() throws Exception {
ListRetirableGrantsResult result = null;
try {
result = executeListRetirableGrants(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 putKeyPolicyAsync(PutKeyPolicyRequest request) {
return putKeyPolicyAsync(request, null);
}
@Override
public java.util.concurrent.Future putKeyPolicyAsync(final PutKeyPolicyRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final PutKeyPolicyRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public PutKeyPolicyResult call() throws Exception {
PutKeyPolicyResult result = null;
try {
result = executePutKeyPolicy(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 reEncryptAsync(ReEncryptRequest request) {
return reEncryptAsync(request, null);
}
@Override
public java.util.concurrent.Future reEncryptAsync(final ReEncryptRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ReEncryptRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ReEncryptResult call() throws Exception {
ReEncryptResult result = null;
try {
result = executeReEncrypt(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 replicateKeyAsync(ReplicateKeyRequest request) {
return replicateKeyAsync(request, null);
}
@Override
public java.util.concurrent.Future replicateKeyAsync(final ReplicateKeyRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ReplicateKeyRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ReplicateKeyResult call() throws Exception {
ReplicateKeyResult result = null;
try {
result = executeReplicateKey(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 retireGrantAsync(RetireGrantRequest request) {
return retireGrantAsync(request, null);
}
@Override
public java.util.concurrent.Future retireGrantAsync(final RetireGrantRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final RetireGrantRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public RetireGrantResult call() throws Exception {
RetireGrantResult result = null;
try {
result = executeRetireGrant(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
/**
* Simplified method form for invoking the RetireGrant operation.
*
* @see #retireGrantAsync(RetireGrantRequest)
*/
@Override
public java.util.concurrent.Future retireGrantAsync() {
return retireGrantAsync(new RetireGrantRequest());
}
/**
* Simplified method form for invoking the RetireGrant operation with an AsyncHandler.
*
* @see #retireGrantAsync(RetireGrantRequest, com.amazonaws.handlers.AsyncHandler)
*/
@Override
public java.util.concurrent.Future retireGrantAsync(
com.amazonaws.handlers.AsyncHandler asyncHandler) {
return retireGrantAsync(new RetireGrantRequest(), asyncHandler);
}
@Override
public java.util.concurrent.Future revokeGrantAsync(RevokeGrantRequest request) {
return revokeGrantAsync(request, null);
}
@Override
public java.util.concurrent.Future revokeGrantAsync(final RevokeGrantRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final RevokeGrantRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public RevokeGrantResult call() throws Exception {
RevokeGrantResult result = null;
try {
result = executeRevokeGrant(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 rotateKeyOnDemandAsync(RotateKeyOnDemandRequest request) {
return rotateKeyOnDemandAsync(request, null);
}
@Override
public java.util.concurrent.Future rotateKeyOnDemandAsync(final RotateKeyOnDemandRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final RotateKeyOnDemandRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public RotateKeyOnDemandResult call() throws Exception {
RotateKeyOnDemandResult result = null;
try {
result = executeRotateKeyOnDemand(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 scheduleKeyDeletionAsync(ScheduleKeyDeletionRequest request) {
return scheduleKeyDeletionAsync(request, null);
}
@Override
public java.util.concurrent.Future scheduleKeyDeletionAsync(final ScheduleKeyDeletionRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ScheduleKeyDeletionRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ScheduleKeyDeletionResult call() throws Exception {
ScheduleKeyDeletionResult result = null;
try {
result = executeScheduleKeyDeletion(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 signAsync(SignRequest request) {
return signAsync(request, null);
}
@Override
public java.util.concurrent.Future signAsync(final SignRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final SignRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public SignResult call() throws Exception {
SignResult result = null;
try {
result = executeSign(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 updateAliasAsync(UpdateAliasRequest request) {
return updateAliasAsync(request, null);
}
@Override
public java.util.concurrent.Future updateAliasAsync(final UpdateAliasRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UpdateAliasRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UpdateAliasResult call() throws Exception {
UpdateAliasResult result = null;
try {
result = executeUpdateAlias(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 updateCustomKeyStoreAsync(UpdateCustomKeyStoreRequest request) {
return updateCustomKeyStoreAsync(request, null);
}
@Override
public java.util.concurrent.Future updateCustomKeyStoreAsync(final UpdateCustomKeyStoreRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UpdateCustomKeyStoreRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UpdateCustomKeyStoreResult call() throws Exception {
UpdateCustomKeyStoreResult result = null;
try {
result = executeUpdateCustomKeyStore(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 updateKeyDescriptionAsync(UpdateKeyDescriptionRequest request) {
return updateKeyDescriptionAsync(request, null);
}
@Override
public java.util.concurrent.Future updateKeyDescriptionAsync(final UpdateKeyDescriptionRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UpdateKeyDescriptionRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UpdateKeyDescriptionResult call() throws Exception {
UpdateKeyDescriptionResult result = null;
try {
result = executeUpdateKeyDescription(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 updatePrimaryRegionAsync(UpdatePrimaryRegionRequest request) {
return updatePrimaryRegionAsync(request, null);
}
@Override
public java.util.concurrent.Future updatePrimaryRegionAsync(final UpdatePrimaryRegionRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UpdatePrimaryRegionRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UpdatePrimaryRegionResult call() throws Exception {
UpdatePrimaryRegionResult result = null;
try {
result = executeUpdatePrimaryRegion(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 verifyAsync(VerifyRequest request) {
return verifyAsync(request, null);
}
@Override
public java.util.concurrent.Future verifyAsync(final VerifyRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final VerifyRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public VerifyResult call() throws Exception {
VerifyResult result = null;
try {
result = executeVerify(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 verifyMacAsync(VerifyMacRequest request) {
return verifyMacAsync(request, null);
}
@Override
public java.util.concurrent.Future verifyMacAsync(final VerifyMacRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final VerifyMacRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public VerifyMacResult call() throws Exception {
VerifyMacResult result = null;
try {
result = executeVerifyMac(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();
}
}