com.amazonaws.services.acmpca.AWSACMPCAAsyncClient Maven / Gradle / Ivy
Show all versions of aws-java-sdk-acmpca 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.acmpca;
import javax.annotation.Generated;
import com.amazonaws.services.acmpca.model.*;
import com.amazonaws.client.AwsAsyncClientParams;
import com.amazonaws.annotation.ThreadSafe;
import java.util.concurrent.ExecutorService;
/**
* Client for accessing ACM-PCA 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.
*
*
* This is the Amazon Web Services Private Certificate Authority API Reference. It provides descriptions, syntax,
* and usage examples for each of the actions and data types involved in creating and managing a private certificate
* authority (CA) for your organization.
*
*
* The documentation for each action shows the API request parameters and the JSON response. Alternatively, you can use
* one of the Amazon Web Services SDKs to access an API that is tailored to the programming language or platform that
* you prefer. For more information, see Amazon Web Services SDKs.
*
*
* Each Amazon Web Services Private CA API operation has a quota that determines the number of times the operation can
* be called per second. Amazon Web Services Private CA throttles API requests at different rates depending on the
* operation. Throttling means that Amazon Web Services Private CA rejects an otherwise valid request because the
* request exceeds the operation's quota for the number of requests per second. When a request is throttled, Amazon Web
* Services Private CA returns a ThrottlingException error.
* Amazon Web Services Private CA does not guarantee a minimum request rate for APIs.
*
*
* To see an up-to-date list of your Amazon Web Services Private CA quotas, or to request a quota increase, log into
* your Amazon Web Services account and visit the Service
* Quotas console.
*
*/
@ThreadSafe
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AWSACMPCAAsyncClient extends AWSACMPCAClient implements AWSACMPCAAsync {
private static final int DEFAULT_THREAD_POOL_SIZE = 50;
private final java.util.concurrent.ExecutorService executorService;
public static AWSACMPCAAsyncClientBuilder asyncBuilder() {
return AWSACMPCAAsyncClientBuilder.standard();
}
/**
* Constructs a new asynchronous client to invoke service methods on ACM-PCA using the specified parameters.
*
* @param asyncClientParams
* Object providing client parameters.
*/
AWSACMPCAAsyncClient(AwsAsyncClientParams asyncClientParams) {
this(asyncClientParams, false);
}
/**
* Constructs a new asynchronous client to invoke service methods on ACM-PCA using the specified parameters.
*
* @param asyncClientParams
* Object providing client parameters.
* @param endpointDiscoveryEnabled
* true will enable endpoint discovery if the service supports it.
*/
AWSACMPCAAsyncClient(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 createCertificateAuthorityAsync(CreateCertificateAuthorityRequest request) {
return createCertificateAuthorityAsync(request, null);
}
@Override
public java.util.concurrent.Future createCertificateAuthorityAsync(final CreateCertificateAuthorityRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreateCertificateAuthorityRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateCertificateAuthorityResult call() throws Exception {
CreateCertificateAuthorityResult result = null;
try {
result = executeCreateCertificateAuthority(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 createCertificateAuthorityAuditReportAsync(
CreateCertificateAuthorityAuditReportRequest request) {
return createCertificateAuthorityAuditReportAsync(request, null);
}
@Override
public java.util.concurrent.Future createCertificateAuthorityAuditReportAsync(
final CreateCertificateAuthorityAuditReportRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreateCertificateAuthorityAuditReportRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateCertificateAuthorityAuditReportResult call() throws Exception {
CreateCertificateAuthorityAuditReportResult result = null;
try {
result = executeCreateCertificateAuthorityAuditReport(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 createPermissionAsync(CreatePermissionRequest request) {
return createPermissionAsync(request, null);
}
@Override
public java.util.concurrent.Future createPermissionAsync(final CreatePermissionRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreatePermissionRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreatePermissionResult call() throws Exception {
CreatePermissionResult result = null;
try {
result = executeCreatePermission(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 deleteCertificateAuthorityAsync(DeleteCertificateAuthorityRequest request) {
return deleteCertificateAuthorityAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteCertificateAuthorityAsync(final DeleteCertificateAuthorityRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteCertificateAuthorityRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteCertificateAuthorityResult call() throws Exception {
DeleteCertificateAuthorityResult result = null;
try {
result = executeDeleteCertificateAuthority(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 deletePermissionAsync(DeletePermissionRequest request) {
return deletePermissionAsync(request, null);
}
@Override
public java.util.concurrent.Future deletePermissionAsync(final DeletePermissionRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeletePermissionRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeletePermissionResult call() throws Exception {
DeletePermissionResult result = null;
try {
result = executeDeletePermission(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 deletePolicyAsync(DeletePolicyRequest request) {
return deletePolicyAsync(request, null);
}
@Override
public java.util.concurrent.Future deletePolicyAsync(final DeletePolicyRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeletePolicyRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeletePolicyResult call() throws Exception {
DeletePolicyResult result = null;
try {
result = executeDeletePolicy(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 describeCertificateAuthorityAsync(DescribeCertificateAuthorityRequest request) {
return describeCertificateAuthorityAsync(request, null);
}
@Override
public java.util.concurrent.Future describeCertificateAuthorityAsync(final DescribeCertificateAuthorityRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DescribeCertificateAuthorityRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeCertificateAuthorityResult call() throws Exception {
DescribeCertificateAuthorityResult result = null;
try {
result = executeDescribeCertificateAuthority(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 describeCertificateAuthorityAuditReportAsync(
DescribeCertificateAuthorityAuditReportRequest request) {
return describeCertificateAuthorityAuditReportAsync(request, null);
}
@Override
public java.util.concurrent.Future describeCertificateAuthorityAuditReportAsync(
final DescribeCertificateAuthorityAuditReportRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DescribeCertificateAuthorityAuditReportRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeCertificateAuthorityAuditReportResult call() throws Exception {
DescribeCertificateAuthorityAuditReportResult result = null;
try {
result = executeDescribeCertificateAuthorityAuditReport(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 getCertificateAsync(GetCertificateRequest request) {
return getCertificateAsync(request, null);
}
@Override
public java.util.concurrent.Future getCertificateAsync(final GetCertificateRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetCertificateRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetCertificateResult call() throws Exception {
GetCertificateResult result = null;
try {
result = executeGetCertificate(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 getCertificateAuthorityCertificateAsync(
GetCertificateAuthorityCertificateRequest request) {
return getCertificateAuthorityCertificateAsync(request, null);
}
@Override
public java.util.concurrent.Future getCertificateAuthorityCertificateAsync(
final GetCertificateAuthorityCertificateRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetCertificateAuthorityCertificateRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetCertificateAuthorityCertificateResult call() throws Exception {
GetCertificateAuthorityCertificateResult result = null;
try {
result = executeGetCertificateAuthorityCertificate(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 getCertificateAuthorityCsrAsync(GetCertificateAuthorityCsrRequest request) {
return getCertificateAuthorityCsrAsync(request, null);
}
@Override
public java.util.concurrent.Future getCertificateAuthorityCsrAsync(final GetCertificateAuthorityCsrRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetCertificateAuthorityCsrRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetCertificateAuthorityCsrResult call() throws Exception {
GetCertificateAuthorityCsrResult result = null;
try {
result = executeGetCertificateAuthorityCsr(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 getPolicyAsync(GetPolicyRequest request) {
return getPolicyAsync(request, null);
}
@Override
public java.util.concurrent.Future getPolicyAsync(final GetPolicyRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetPolicyRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetPolicyResult call() throws Exception {
GetPolicyResult result = null;
try {
result = executeGetPolicy(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 importCertificateAuthorityCertificateAsync(
ImportCertificateAuthorityCertificateRequest request) {
return importCertificateAuthorityCertificateAsync(request, null);
}
@Override
public java.util.concurrent.Future importCertificateAuthorityCertificateAsync(
final ImportCertificateAuthorityCertificateRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ImportCertificateAuthorityCertificateRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ImportCertificateAuthorityCertificateResult call() throws Exception {
ImportCertificateAuthorityCertificateResult result = null;
try {
result = executeImportCertificateAuthorityCertificate(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 issueCertificateAsync(IssueCertificateRequest request) {
return issueCertificateAsync(request, null);
}
@Override
public java.util.concurrent.Future issueCertificateAsync(final IssueCertificateRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final IssueCertificateRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public IssueCertificateResult call() throws Exception {
IssueCertificateResult result = null;
try {
result = executeIssueCertificate(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 listCertificateAuthoritiesAsync(ListCertificateAuthoritiesRequest request) {
return listCertificateAuthoritiesAsync(request, null);
}
@Override
public java.util.concurrent.Future listCertificateAuthoritiesAsync(final ListCertificateAuthoritiesRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListCertificateAuthoritiesRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListCertificateAuthoritiesResult call() throws Exception {
ListCertificateAuthoritiesResult result = null;
try {
result = executeListCertificateAuthorities(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 listPermissionsAsync(ListPermissionsRequest request) {
return listPermissionsAsync(request, null);
}
@Override
public java.util.concurrent.Future listPermissionsAsync(final ListPermissionsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListPermissionsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListPermissionsResult call() throws Exception {
ListPermissionsResult result = null;
try {
result = executeListPermissions(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 listTagsAsync(ListTagsRequest request) {
return listTagsAsync(request, null);
}
@Override
public java.util.concurrent.Future listTagsAsync(final ListTagsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListTagsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListTagsResult call() throws Exception {
ListTagsResult result = null;
try {
result = executeListTags(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 putPolicyAsync(PutPolicyRequest request) {
return putPolicyAsync(request, null);
}
@Override
public java.util.concurrent.Future putPolicyAsync(final PutPolicyRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final PutPolicyRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public PutPolicyResult call() throws Exception {
PutPolicyResult result = null;
try {
result = executePutPolicy(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 restoreCertificateAuthorityAsync(RestoreCertificateAuthorityRequest request) {
return restoreCertificateAuthorityAsync(request, null);
}
@Override
public java.util.concurrent.Future restoreCertificateAuthorityAsync(final RestoreCertificateAuthorityRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final RestoreCertificateAuthorityRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public RestoreCertificateAuthorityResult call() throws Exception {
RestoreCertificateAuthorityResult result = null;
try {
result = executeRestoreCertificateAuthority(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 revokeCertificateAsync(RevokeCertificateRequest request) {
return revokeCertificateAsync(request, null);
}
@Override
public java.util.concurrent.Future revokeCertificateAsync(final RevokeCertificateRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final RevokeCertificateRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public RevokeCertificateResult call() throws Exception {
RevokeCertificateResult result = null;
try {
result = executeRevokeCertificate(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 tagCertificateAuthorityAsync(TagCertificateAuthorityRequest request) {
return tagCertificateAuthorityAsync(request, null);
}
@Override
public java.util.concurrent.Future tagCertificateAuthorityAsync(final TagCertificateAuthorityRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final TagCertificateAuthorityRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public TagCertificateAuthorityResult call() throws Exception {
TagCertificateAuthorityResult result = null;
try {
result = executeTagCertificateAuthority(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 untagCertificateAuthorityAsync(UntagCertificateAuthorityRequest request) {
return untagCertificateAuthorityAsync(request, null);
}
@Override
public java.util.concurrent.Future untagCertificateAuthorityAsync(final UntagCertificateAuthorityRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UntagCertificateAuthorityRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UntagCertificateAuthorityResult call() throws Exception {
UntagCertificateAuthorityResult result = null;
try {
result = executeUntagCertificateAuthority(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 updateCertificateAuthorityAsync(UpdateCertificateAuthorityRequest request) {
return updateCertificateAuthorityAsync(request, null);
}
@Override
public java.util.concurrent.Future updateCertificateAuthorityAsync(final UpdateCertificateAuthorityRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UpdateCertificateAuthorityRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UpdateCertificateAuthorityResult call() throws Exception {
UpdateCertificateAuthorityResult result = null;
try {
result = executeUpdateCertificateAuthority(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();
}
}