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

com.amazonaws.services.secretsmanager.AWSSecretsManagerAsyncClient Maven / Gradle / Ivy

Go to download

The AWS Java SDK for AWS Secrets Manager module holds the client classes that are used for communicating with AWS Secrets Manager Service

There is a newer version: 1.12.780
Show newest version
/*
 * 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.secretsmanager;

import javax.annotation.Generated;

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

import java.util.concurrent.ExecutorService;

/**
 * Client for accessing AWS Secrets Manager 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.
 * 

* Amazon Web Services Secrets Manager *

* Amazon Web Services Secrets Manager provides a service to enable you to store, manage, and retrieve, secrets. *

*

* This guide provides descriptions of the Secrets Manager API. For more information about using this service, see the * Amazon Web Services Secrets * Manager User Guide. *

*

* API Version *

*

* This version of the Secrets Manager API Reference documents the Secrets Manager API version 2017-10-17. *

* *

* As an alternative to using the API, you can use one of the Amazon Web Services SDKs, which consist of libraries and * sample code for various programming languages and platforms such as Java, Ruby, .NET, iOS, and Android. The SDKs * provide a convenient way to create programmatic access to Amazon Web Services Secrets Manager. For example, the SDKs * provide cryptographically signing requests, managing errors, and retrying requests automatically. For more * information about the Amazon Web Services SDKs, including downloading and installing them, see Tools for Amazon Web Services. *

*
*

* We recommend you use the Amazon Web Services SDKs to make programmatic API calls to Secrets Manager. However, you * also can use the Secrets Manager HTTP Query API to make direct calls to the Secrets Manager web service. To learn * more about the Secrets Manager HTTP Query API, see Making Query Requests in * the Amazon Web Services Secrets Manager User Guide. *

*

* Secrets Manager API supports GET and POST requests for all actions, and doesn't require you to use GET for some * actions and POST for others. However, GET requests are subject to the limitation size of a URL. Therefore, for * operations that require larger sizes, use a POST request. *

*

* Support and Feedback for Amazon Web Services Secrets Manager *

*

* We welcome your feedback. Send your comments to [email protected], or post your feedback * and questions in the Amazon Web Services Secrets * Manager Discussion Forum. For more information about the Amazon Web Services Discussion Forums, see Forums Help. *

*

* How examples are presented *

*

* The JSON that Amazon Web Services Secrets Manager expects as your request parameters and the service returns as a * response to HTTP query requests contain single, long strings without line breaks or white space formatting. The JSON * shown in the examples displays the code formatted with both line breaks and white space to improve readability. When * example input parameters can also cause long strings extending beyond the screen, you can insert line breaks to * enhance readability. You should always submit the input as a single JSON text string. *

*

* Logging API Requests *

*

* Amazon Web Services Secrets Manager supports Amazon Web Services CloudTrail, a service that records Amazon Web * Services API calls for your Amazon Web Services account and delivers log files to an Amazon S3 bucket. By using * information that's collected by Amazon Web Services CloudTrail, you can determine the requests successfully made to * Secrets Manager, who made the request, when it was made, and so on. For more about Amazon Web Services Secrets * Manager and support for Amazon Web Services CloudTrail, see Logging * Amazon Web Services Secrets Manager Events with Amazon Web Services CloudTrail in the Amazon Web Services * Secrets Manager User Guide. To learn more about CloudTrail, including enabling it and find your log files, see * the Amazon * Web Services CloudTrail User Guide. *

*/ @ThreadSafe @Generated("com.amazonaws:aws-java-sdk-code-generator") public class AWSSecretsManagerAsyncClient extends AWSSecretsManagerClient implements AWSSecretsManagerAsync { private static final int DEFAULT_THREAD_POOL_SIZE = 50; private final java.util.concurrent.ExecutorService executorService; public static AWSSecretsManagerAsyncClientBuilder asyncBuilder() { return AWSSecretsManagerAsyncClientBuilder.standard(); } /** * Constructs a new asynchronous client to invoke service methods on AWS Secrets Manager using the specified * parameters. * * @param asyncClientParams * Object providing client parameters. */ AWSSecretsManagerAsyncClient(AwsAsyncClientParams asyncClientParams) { this(asyncClientParams, false); } /** * Constructs a new asynchronous client to invoke service methods on AWS Secrets Manager using the specified * parameters. * * @param asyncClientParams * Object providing client parameters. * @param endpointDiscoveryEnabled * true will enable endpoint discovery if the service supports it. */ AWSSecretsManagerAsyncClient(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 cancelRotateSecretAsync(CancelRotateSecretRequest request) { return cancelRotateSecretAsync(request, null); } @Override public java.util.concurrent.Future cancelRotateSecretAsync(final CancelRotateSecretRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final CancelRotateSecretRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public CancelRotateSecretResult call() throws Exception { CancelRotateSecretResult result = null; try { result = executeCancelRotateSecret(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 createSecretAsync(CreateSecretRequest request) { return createSecretAsync(request, null); } @Override public java.util.concurrent.Future createSecretAsync(final CreateSecretRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final CreateSecretRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public CreateSecretResult call() throws Exception { CreateSecretResult result = null; try { result = executeCreateSecret(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 deleteResourcePolicyAsync(DeleteResourcePolicyRequest request) { return deleteResourcePolicyAsync(request, null); } @Override public java.util.concurrent.Future deleteResourcePolicyAsync(final DeleteResourcePolicyRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DeleteResourcePolicyRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DeleteResourcePolicyResult call() throws Exception { DeleteResourcePolicyResult result = null; try { result = executeDeleteResourcePolicy(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 deleteSecretAsync(DeleteSecretRequest request) { return deleteSecretAsync(request, null); } @Override public java.util.concurrent.Future deleteSecretAsync(final DeleteSecretRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DeleteSecretRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DeleteSecretResult call() throws Exception { DeleteSecretResult result = null; try { result = executeDeleteSecret(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 describeSecretAsync(DescribeSecretRequest request) { return describeSecretAsync(request, null); } @Override public java.util.concurrent.Future describeSecretAsync(final DescribeSecretRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DescribeSecretRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DescribeSecretResult call() throws Exception { DescribeSecretResult result = null; try { result = executeDescribeSecret(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 getRandomPasswordAsync(GetRandomPasswordRequest request) { return getRandomPasswordAsync(request, null); } @Override public java.util.concurrent.Future getRandomPasswordAsync(final GetRandomPasswordRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final GetRandomPasswordRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public GetRandomPasswordResult call() throws Exception { GetRandomPasswordResult result = null; try { result = executeGetRandomPassword(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 getResourcePolicyAsync(GetResourcePolicyRequest request) { return getResourcePolicyAsync(request, null); } @Override public java.util.concurrent.Future getResourcePolicyAsync(final GetResourcePolicyRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final GetResourcePolicyRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public GetResourcePolicyResult call() throws Exception { GetResourcePolicyResult result = null; try { result = executeGetResourcePolicy(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 getSecretValueAsync(GetSecretValueRequest request) { return getSecretValueAsync(request, null); } @Override public java.util.concurrent.Future getSecretValueAsync(final GetSecretValueRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final GetSecretValueRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public GetSecretValueResult call() throws Exception { GetSecretValueResult result = null; try { result = executeGetSecretValue(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 listSecretVersionIdsAsync(ListSecretVersionIdsRequest request) { return listSecretVersionIdsAsync(request, null); } @Override public java.util.concurrent.Future listSecretVersionIdsAsync(final ListSecretVersionIdsRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ListSecretVersionIdsRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ListSecretVersionIdsResult call() throws Exception { ListSecretVersionIdsResult result = null; try { result = executeListSecretVersionIds(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 listSecretsAsync(ListSecretsRequest request) { return listSecretsAsync(request, null); } @Override public java.util.concurrent.Future listSecretsAsync(final ListSecretsRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ListSecretsRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ListSecretsResult call() throws Exception { ListSecretsResult result = null; try { result = executeListSecrets(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 putResourcePolicyAsync(PutResourcePolicyRequest request) { return putResourcePolicyAsync(request, null); } @Override public java.util.concurrent.Future putResourcePolicyAsync(final PutResourcePolicyRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final PutResourcePolicyRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public PutResourcePolicyResult call() throws Exception { PutResourcePolicyResult result = null; try { result = executePutResourcePolicy(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 putSecretValueAsync(PutSecretValueRequest request) { return putSecretValueAsync(request, null); } @Override public java.util.concurrent.Future putSecretValueAsync(final PutSecretValueRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final PutSecretValueRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public PutSecretValueResult call() throws Exception { PutSecretValueResult result = null; try { result = executePutSecretValue(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 removeRegionsFromReplicationAsync(RemoveRegionsFromReplicationRequest request) { return removeRegionsFromReplicationAsync(request, null); } @Override public java.util.concurrent.Future removeRegionsFromReplicationAsync(final RemoveRegionsFromReplicationRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final RemoveRegionsFromReplicationRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public RemoveRegionsFromReplicationResult call() throws Exception { RemoveRegionsFromReplicationResult result = null; try { result = executeRemoveRegionsFromReplication(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 replicateSecretToRegionsAsync(ReplicateSecretToRegionsRequest request) { return replicateSecretToRegionsAsync(request, null); } @Override public java.util.concurrent.Future replicateSecretToRegionsAsync(final ReplicateSecretToRegionsRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ReplicateSecretToRegionsRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ReplicateSecretToRegionsResult call() throws Exception { ReplicateSecretToRegionsResult result = null; try { result = executeReplicateSecretToRegions(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 restoreSecretAsync(RestoreSecretRequest request) { return restoreSecretAsync(request, null); } @Override public java.util.concurrent.Future restoreSecretAsync(final RestoreSecretRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final RestoreSecretRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public RestoreSecretResult call() throws Exception { RestoreSecretResult result = null; try { result = executeRestoreSecret(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 rotateSecretAsync(RotateSecretRequest request) { return rotateSecretAsync(request, null); } @Override public java.util.concurrent.Future rotateSecretAsync(final RotateSecretRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final RotateSecretRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public RotateSecretResult call() throws Exception { RotateSecretResult result = null; try { result = executeRotateSecret(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 stopReplicationToReplicaAsync(StopReplicationToReplicaRequest request) { return stopReplicationToReplicaAsync(request, null); } @Override public java.util.concurrent.Future stopReplicationToReplicaAsync(final StopReplicationToReplicaRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final StopReplicationToReplicaRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public StopReplicationToReplicaResult call() throws Exception { StopReplicationToReplicaResult result = null; try { result = executeStopReplicationToReplica(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 updateSecretAsync(UpdateSecretRequest request) { return updateSecretAsync(request, null); } @Override public java.util.concurrent.Future updateSecretAsync(final UpdateSecretRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final UpdateSecretRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public UpdateSecretResult call() throws Exception { UpdateSecretResult result = null; try { result = executeUpdateSecret(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 updateSecretVersionStageAsync(UpdateSecretVersionStageRequest request) { return updateSecretVersionStageAsync(request, null); } @Override public java.util.concurrent.Future updateSecretVersionStageAsync(final UpdateSecretVersionStageRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final UpdateSecretVersionStageRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public UpdateSecretVersionStageResult call() throws Exception { UpdateSecretVersionStageResult result = null; try { result = executeUpdateSecretVersionStage(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 validateResourcePolicyAsync(ValidateResourcePolicyRequest request) { return validateResourcePolicyAsync(request, null); } @Override public java.util.concurrent.Future validateResourcePolicyAsync(final ValidateResourcePolicyRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ValidateResourcePolicyRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ValidateResourcePolicyResult call() throws Exception { ValidateResourcePolicyResult result = null; try { result = executeValidateResourcePolicy(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } /** * Shuts down the client, releasing all managed resources. This includes forcibly terminating all pending * asynchronous service calls. Clients who wish to give pending asynchronous service calls time to complete should * call {@code getExecutorService().shutdown()} followed by {@code getExecutorService().awaitTermination()} prior to * calling this method. */ @Override public void shutdown() { super.shutdown(); executorService.shutdownNow(); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy