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

software.amazon.awssdk.services.acm.DefaultAcmAsyncClient Maven / Gradle / Ivy

Go to download

The AWS Java SDK for AWS Certificate Manager module holds the client classes that are used for communicating with AWS Certificate Manager service.

There is a newer version: 2.28.3
Show newest version
/*
 * Copyright 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 software.amazon.awssdk.services.acm;

import java.util.Collections;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ScheduledExecutorService;
import java.util.function.Consumer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.awscore.client.handler.AwsAsyncClientHandler;
import software.amazon.awssdk.awscore.exception.AwsServiceException;
import software.amazon.awssdk.core.ApiName;
import software.amazon.awssdk.core.RequestOverrideConfiguration;
import software.amazon.awssdk.core.client.config.SdkClientConfiguration;
import software.amazon.awssdk.core.client.config.SdkClientOption;
import software.amazon.awssdk.core.client.handler.AsyncClientHandler;
import software.amazon.awssdk.core.client.handler.ClientExecutionParams;
import software.amazon.awssdk.core.http.HttpResponseHandler;
import software.amazon.awssdk.core.metrics.CoreMetric;
import software.amazon.awssdk.core.util.VersionInfo;
import software.amazon.awssdk.metrics.MetricCollector;
import software.amazon.awssdk.metrics.MetricPublisher;
import software.amazon.awssdk.metrics.NoOpMetricCollector;
import software.amazon.awssdk.protocols.core.ExceptionMetadata;
import software.amazon.awssdk.protocols.json.AwsJsonProtocol;
import software.amazon.awssdk.protocols.json.AwsJsonProtocolFactory;
import software.amazon.awssdk.protocols.json.BaseAwsJsonProtocolFactory;
import software.amazon.awssdk.protocols.json.JsonOperationMetadata;
import software.amazon.awssdk.services.acm.model.AccessDeniedException;
import software.amazon.awssdk.services.acm.model.AcmException;
import software.amazon.awssdk.services.acm.model.AcmRequest;
import software.amazon.awssdk.services.acm.model.AddTagsToCertificateRequest;
import software.amazon.awssdk.services.acm.model.AddTagsToCertificateResponse;
import software.amazon.awssdk.services.acm.model.ConflictException;
import software.amazon.awssdk.services.acm.model.DeleteCertificateRequest;
import software.amazon.awssdk.services.acm.model.DeleteCertificateResponse;
import software.amazon.awssdk.services.acm.model.DescribeCertificateRequest;
import software.amazon.awssdk.services.acm.model.DescribeCertificateResponse;
import software.amazon.awssdk.services.acm.model.ExportCertificateRequest;
import software.amazon.awssdk.services.acm.model.ExportCertificateResponse;
import software.amazon.awssdk.services.acm.model.GetAccountConfigurationRequest;
import software.amazon.awssdk.services.acm.model.GetAccountConfigurationResponse;
import software.amazon.awssdk.services.acm.model.GetCertificateRequest;
import software.amazon.awssdk.services.acm.model.GetCertificateResponse;
import software.amazon.awssdk.services.acm.model.ImportCertificateRequest;
import software.amazon.awssdk.services.acm.model.ImportCertificateResponse;
import software.amazon.awssdk.services.acm.model.InvalidArgsException;
import software.amazon.awssdk.services.acm.model.InvalidArnException;
import software.amazon.awssdk.services.acm.model.InvalidDomainValidationOptionsException;
import software.amazon.awssdk.services.acm.model.InvalidParameterException;
import software.amazon.awssdk.services.acm.model.InvalidStateException;
import software.amazon.awssdk.services.acm.model.InvalidTagException;
import software.amazon.awssdk.services.acm.model.LimitExceededException;
import software.amazon.awssdk.services.acm.model.ListCertificatesRequest;
import software.amazon.awssdk.services.acm.model.ListCertificatesResponse;
import software.amazon.awssdk.services.acm.model.ListTagsForCertificateRequest;
import software.amazon.awssdk.services.acm.model.ListTagsForCertificateResponse;
import software.amazon.awssdk.services.acm.model.PutAccountConfigurationRequest;
import software.amazon.awssdk.services.acm.model.PutAccountConfigurationResponse;
import software.amazon.awssdk.services.acm.model.RemoveTagsFromCertificateRequest;
import software.amazon.awssdk.services.acm.model.RemoveTagsFromCertificateResponse;
import software.amazon.awssdk.services.acm.model.RenewCertificateRequest;
import software.amazon.awssdk.services.acm.model.RenewCertificateResponse;
import software.amazon.awssdk.services.acm.model.RequestCertificateRequest;
import software.amazon.awssdk.services.acm.model.RequestCertificateResponse;
import software.amazon.awssdk.services.acm.model.RequestInProgressException;
import software.amazon.awssdk.services.acm.model.ResendValidationEmailRequest;
import software.amazon.awssdk.services.acm.model.ResendValidationEmailResponse;
import software.amazon.awssdk.services.acm.model.ResourceInUseException;
import software.amazon.awssdk.services.acm.model.ResourceNotFoundException;
import software.amazon.awssdk.services.acm.model.TagPolicyException;
import software.amazon.awssdk.services.acm.model.ThrottlingException;
import software.amazon.awssdk.services.acm.model.TooManyTagsException;
import software.amazon.awssdk.services.acm.model.UpdateCertificateOptionsRequest;
import software.amazon.awssdk.services.acm.model.UpdateCertificateOptionsResponse;
import software.amazon.awssdk.services.acm.model.ValidationException;
import software.amazon.awssdk.services.acm.paginators.ListCertificatesPublisher;
import software.amazon.awssdk.services.acm.transform.AddTagsToCertificateRequestMarshaller;
import software.amazon.awssdk.services.acm.transform.DeleteCertificateRequestMarshaller;
import software.amazon.awssdk.services.acm.transform.DescribeCertificateRequestMarshaller;
import software.amazon.awssdk.services.acm.transform.ExportCertificateRequestMarshaller;
import software.amazon.awssdk.services.acm.transform.GetAccountConfigurationRequestMarshaller;
import software.amazon.awssdk.services.acm.transform.GetCertificateRequestMarshaller;
import software.amazon.awssdk.services.acm.transform.ImportCertificateRequestMarshaller;
import software.amazon.awssdk.services.acm.transform.ListCertificatesRequestMarshaller;
import software.amazon.awssdk.services.acm.transform.ListTagsForCertificateRequestMarshaller;
import software.amazon.awssdk.services.acm.transform.PutAccountConfigurationRequestMarshaller;
import software.amazon.awssdk.services.acm.transform.RemoveTagsFromCertificateRequestMarshaller;
import software.amazon.awssdk.services.acm.transform.RenewCertificateRequestMarshaller;
import software.amazon.awssdk.services.acm.transform.RequestCertificateRequestMarshaller;
import software.amazon.awssdk.services.acm.transform.ResendValidationEmailRequestMarshaller;
import software.amazon.awssdk.services.acm.transform.UpdateCertificateOptionsRequestMarshaller;
import software.amazon.awssdk.services.acm.waiters.AcmAsyncWaiter;
import software.amazon.awssdk.utils.CompletableFutureUtils;

/**
 * Internal implementation of {@link AcmAsyncClient}.
 *
 * @see AcmAsyncClient#builder()
 */
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
final class DefaultAcmAsyncClient implements AcmAsyncClient {
    private static final Logger log = LoggerFactory.getLogger(DefaultAcmAsyncClient.class);

    private final AsyncClientHandler clientHandler;

    private final AwsJsonProtocolFactory protocolFactory;

    private final SdkClientConfiguration clientConfiguration;

    private final ScheduledExecutorService executorService;

    protected DefaultAcmAsyncClient(SdkClientConfiguration clientConfiguration) {
        this.clientHandler = new AwsAsyncClientHandler(clientConfiguration);
        this.clientConfiguration = clientConfiguration;
        this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
        this.executorService = clientConfiguration.option(SdkClientOption.SCHEDULED_EXECUTOR_SERVICE);
    }

    @Override
    public final String serviceName() {
        return SERVICE_NAME;
    }

    /**
     * 

* Adds one or more tags to an ACM certificate. Tags are labels that you can use to identify and organize your * Amazon Web Services resources. Each tag consists of a key and an optional value. You * specify the certificate on input by its Amazon Resource Name (ARN). You specify the tag by using a key-value * pair. *

*

* You can apply a tag to just one certificate if you want to identify a specific characteristic of that * certificate, or you can apply the same tag to multiple certificates if you want to filter for a common * relationship among those certificates. Similarly, you can apply the same tag to multiple resources if you want to * specify a relationship among those resources. For example, you can add the same tag to an ACM certificate and an * Elastic Load Balancing load balancer to indicate that they are both used by the same website. For more * information, see Tagging ACM * certificates. *

*

* To remove one or more tags, use the RemoveTagsFromCertificate action. To view all of the tags that have * been applied to the certificate, use the ListTagsForCertificate action. *

* * @param addTagsToCertificateRequest * @return A Java Future containing the result of the AddTagsToCertificate operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ResourceNotFoundException The specified certificate cannot be found in the caller's account or the * caller's account cannot be found.
  • *
  • InvalidArnException The requested Amazon Resource Name (ARN) does not refer to an existing resource.
  • *
  • InvalidTagException One or both of the values that make up the key-value pair is not valid. For * example, you cannot specify a tag value that begins with aws:.
  • *
  • TooManyTagsException The request contains too many tags. Try the request again with fewer tags.
  • *
  • TagPolicyException A specified tag did not comply with an existing tag policy and was rejected.
  • *
  • InvalidParameterException An input parameter was invalid.
  • *
  • ThrottlingException The request was denied because it exceeded a quota.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AcmException Base class for all service exceptions. Unknown exceptions will be thrown as an instance * of this type.
  • *
* @sample AcmAsyncClient.AddTagsToCertificate * @see AWS API * Documentation */ @Override public CompletableFuture addTagsToCertificate( AddTagsToCertificateRequest addTagsToCertificateRequest) { List metricPublishers = resolveMetricPublishers(clientConfiguration, addTagsToCertificateRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "ACM"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AddTagsToCertificate"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, AddTagsToCertificateResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("AddTagsToCertificate") .withMarshaller(new AddTagsToCertificateRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withMetricCollector(apiCallMetricCollector).withInput(addTagsToCertificateRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Deletes a certificate and its associated private key. If this action succeeds, the certificate no longer appears * in the list that can be displayed by calling the ListCertificates action or be retrieved by calling the * GetCertificate action. The certificate will not be available for use by Amazon Web Services services * integrated with ACM. *

* *

* You cannot delete an ACM certificate that is being used by another Amazon Web Services service. To delete a * certificate that is in use, the certificate association must first be removed. *

*
* * @param deleteCertificateRequest * @return A Java Future containing the result of the DeleteCertificate operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ResourceNotFoundException The specified certificate cannot be found in the caller's account or the * caller's account cannot be found.
  • *
  • ResourceInUseException The certificate is in use by another Amazon Web Services service in the * caller's account. Remove the association and try again.
  • *
  • InvalidArnException The requested Amazon Resource Name (ARN) does not refer to an existing resource.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AcmException Base class for all service exceptions. Unknown exceptions will be thrown as an instance * of this type.
  • *
* @sample AcmAsyncClient.DeleteCertificate * @see AWS API * Documentation */ @Override public CompletableFuture deleteCertificate(DeleteCertificateRequest deleteCertificateRequest) { List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteCertificateRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "ACM"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteCertificate"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DeleteCertificateResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DeleteCertificate") .withMarshaller(new DeleteCertificateRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withMetricCollector(apiCallMetricCollector).withInput(deleteCertificateRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Returns detailed metadata about the specified ACM certificate. *

* * @param describeCertificateRequest * @return A Java Future containing the result of the DescribeCertificate operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ResourceNotFoundException The specified certificate cannot be found in the caller's account or the * caller's account cannot be found.
  • *
  • InvalidArnException The requested Amazon Resource Name (ARN) does not refer to an existing resource.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AcmException Base class for all service exceptions. Unknown exceptions will be thrown as an instance * of this type.
  • *
* @sample AcmAsyncClient.DescribeCertificate * @see AWS API * Documentation */ @Override public CompletableFuture describeCertificate( DescribeCertificateRequest describeCertificateRequest) { List metricPublishers = resolveMetricPublishers(clientConfiguration, describeCertificateRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "ACM"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeCertificate"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeCertificateResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeCertificate") .withMarshaller(new DescribeCertificateRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withMetricCollector(apiCallMetricCollector).withInput(describeCertificateRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Exports a private certificate issued by a private certificate authority (CA) for use anywhere. The exported file * contains the certificate, the certificate chain, and the encrypted private 2048-bit RSA key associated with the * public key that is embedded in the certificate. For security, you must assign a passphrase for the private key * when exporting it. *

*

* For information about exporting and formatting a certificate using the ACM console or CLI, see Export a Private * Certificate. *

* * @param exportCertificateRequest * @return A Java Future containing the result of the ExportCertificate operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ResourceNotFoundException The specified certificate cannot be found in the caller's account or the * caller's account cannot be found.
  • *
  • RequestInProgressException The certificate request is in process and the certificate in your account * has not yet been issued.
  • *
  • InvalidArnException The requested Amazon Resource Name (ARN) does not refer to an existing resource.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AcmException Base class for all service exceptions. Unknown exceptions will be thrown as an instance * of this type.
  • *
* @sample AcmAsyncClient.ExportCertificate * @see AWS API * Documentation */ @Override public CompletableFuture exportCertificate(ExportCertificateRequest exportCertificateRequest) { List metricPublishers = resolveMetricPublishers(clientConfiguration, exportCertificateRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "ACM"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ExportCertificate"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ExportCertificateResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ExportCertificate") .withMarshaller(new ExportCertificateRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withMetricCollector(apiCallMetricCollector).withInput(exportCertificateRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Returns the account configuration options associated with an Amazon Web Services account. *

* * @param getAccountConfigurationRequest * @return A Java Future containing the result of the GetAccountConfiguration operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • AccessDeniedException You do not have access required to perform this action.
  • *
  • ThrottlingException The request was denied because it exceeded a quota.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AcmException Base class for all service exceptions. Unknown exceptions will be thrown as an instance * of this type.
  • *
* @sample AcmAsyncClient.GetAccountConfiguration * @see AWS * API Documentation */ @Override public CompletableFuture getAccountConfiguration( GetAccountConfigurationRequest getAccountConfigurationRequest) { List metricPublishers = resolveMetricPublishers(clientConfiguration, getAccountConfigurationRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "ACM"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetAccountConfiguration"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetAccountConfigurationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("GetAccountConfiguration") .withMarshaller(new GetAccountConfigurationRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withMetricCollector(apiCallMetricCollector).withInput(getAccountConfigurationRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Retrieves an Amazon-issued certificate and its certificate chain. The chain consists of the certificate of the * issuing CA and the intermediate certificates of any other subordinate CAs. All of the certificates are base64 * encoded. You can use OpenSSL to decode * the certificates and inspect individual fields. *

* * @param getCertificateRequest * @return A Java Future containing the result of the GetCertificate operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ResourceNotFoundException The specified certificate cannot be found in the caller's account or the * caller's account cannot be found.
  • *
  • RequestInProgressException The certificate request is in process and the certificate in your account * has not yet been issued.
  • *
  • InvalidArnException The requested Amazon Resource Name (ARN) does not refer to an existing resource.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AcmException Base class for all service exceptions. Unknown exceptions will be thrown as an instance * of this type.
  • *
* @sample AcmAsyncClient.GetCertificate * @see AWS API * Documentation */ @Override public CompletableFuture getCertificate(GetCertificateRequest getCertificateRequest) { List metricPublishers = resolveMetricPublishers(clientConfiguration, getCertificateRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "ACM"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetCertificate"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetCertificateResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("GetCertificate") .withMarshaller(new GetCertificateRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withMetricCollector(apiCallMetricCollector).withInput(getCertificateRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Imports a certificate into Amazon Web Services Certificate Manager (ACM) to use with services that are integrated * with ACM. Note that integrated * services allow only certificate types and keys they support to be associated with their resources. Further, * their support differs depending on whether the certificate is imported into IAM or into ACM. For more * information, see the documentation for each service. For more information about importing certificates into ACM, * see Importing Certificates * in the Amazon Web Services Certificate Manager User Guide. *

* *

* ACM does not provide managed * renewal for certificates that you import. *

*
*

* Note the following guidelines when importing third party certificates: *

*
    *
  • *

    * You must enter the private key that matches the certificate you are importing. *

    *
  • *
  • *

    * The private key must be unencrypted. You cannot import a private key that is protected by a password or a * passphrase. *

    *
  • *
  • *

    * The private key must be no larger than 5 KB (5,120 bytes). *

    *
  • *
  • *

    * If the certificate you are importing is not self-signed, you must enter its certificate chain. *

    *
  • *
  • *

    * If a certificate chain is included, the issuer must be the subject of one of the certificates in the chain. *

    *
  • *
  • *

    * The certificate, private key, and certificate chain must be PEM-encoded. *

    *
  • *
  • *

    * The current time must be between the Not Before and Not After certificate fields. *

    *
  • *
  • *

    * The Issuer field must not be empty. *

    *
  • *
  • *

    * The OCSP authority URL, if present, must not exceed 1000 characters. *

    *
  • *
  • *

    * To import a new certificate, omit the CertificateArn argument. Include this argument only when you * want to replace a previously imported certificate. *

    *
  • *
  • *

    * When you import a certificate by using the CLI, you must specify the certificate, the certificate chain, and the * private key by their file names preceded by fileb://. For example, you can specify a certificate * saved in the C:\temp folder as fileb://C:\temp\certificate_to_import.pem. If you are * making an HTTP or HTTPS Query request, include these arguments as BLOBs. *

    *
  • *
  • *

    * When you import a certificate by using an SDK, you must specify the certificate, the certificate chain, and the * private key files in the manner required by the programming language you're using. *

    *
  • *
  • *

    * The cryptographic algorithm of an imported certificate must match the algorithm of the signing CA. For example, * if the signing CA key type is RSA, then the certificate key type must also be RSA. *

    *
  • *
*

* This operation returns the Amazon Resource Name (ARN) * of the imported certificate. *

* * @param importCertificateRequest * @return A Java Future containing the result of the ImportCertificate operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ResourceNotFoundException The specified certificate cannot be found in the caller's account or the * caller's account cannot be found.
  • *
  • LimitExceededException An ACM quota has been exceeded.
  • *
  • InvalidTagException One or both of the values that make up the key-value pair is not valid. For * example, you cannot specify a tag value that begins with aws:.
  • *
  • TooManyTagsException The request contains too many tags. Try the request again with fewer tags.
  • *
  • TagPolicyException A specified tag did not comply with an existing tag policy and was rejected.
  • *
  • InvalidParameterException An input parameter was invalid.
  • *
  • InvalidArnException The requested Amazon Resource Name (ARN) does not refer to an existing resource.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AcmException Base class for all service exceptions. Unknown exceptions will be thrown as an instance * of this type.
  • *
* @sample AcmAsyncClient.ImportCertificate * @see AWS API * Documentation */ @Override public CompletableFuture importCertificate(ImportCertificateRequest importCertificateRequest) { List metricPublishers = resolveMetricPublishers(clientConfiguration, importCertificateRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "ACM"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ImportCertificate"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ImportCertificateResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ImportCertificate") .withMarshaller(new ImportCertificateRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withMetricCollector(apiCallMetricCollector).withInput(importCertificateRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Retrieves a list of certificate ARNs and domain names. You can request that only certificates that match a * specific status be listed. You can also filter by specific attributes of the certificate. Default filtering * returns only RSA_2048 certificates. For more information, see Filters. *

* * @param listCertificatesRequest * @return A Java Future containing the result of the ListCertificates operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • InvalidArgsException One or more of of request parameters specified is not valid.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AcmException Base class for all service exceptions. Unknown exceptions will be thrown as an instance * of this type.
  • *
* @sample AcmAsyncClient.ListCertificates * @see AWS API * Documentation */ @Override public CompletableFuture listCertificates(ListCertificatesRequest listCertificatesRequest) { List metricPublishers = resolveMetricPublishers(clientConfiguration, listCertificatesRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "ACM"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListCertificates"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListCertificatesResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ListCertificates") .withMarshaller(new ListCertificatesRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withMetricCollector(apiCallMetricCollector).withInput(listCertificatesRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Retrieves a list of certificate ARNs and domain names. You can request that only certificates that match a * specific status be listed. You can also filter by specific attributes of the certificate. Default filtering * returns only RSA_2048 certificates. For more information, see Filters. *

*
*

* This is a variant of {@link #listCertificates(software.amazon.awssdk.services.acm.model.ListCertificatesRequest)} * operation. The return type is a custom publisher that can be subscribed to request a stream of response pages. * SDK will internally handle making service calls for you. *

*

* When the operation is called, an instance of this class is returned. At this point, no service calls are made yet * and so there is no guarantee that the request is valid. If there are errors in your request, you will see the * failures only after you start streaming the data. The subscribe method should be called as a request to start * streaming data. For more info, see * {@link org.reactivestreams.Publisher#subscribe(org.reactivestreams.Subscriber)}. Each call to the subscribe * method will result in a new {@link org.reactivestreams.Subscription} i.e., a new contract to stream data from the * starting request. *

* *

* The following are few ways to use the response class: *

* 1) Using the subscribe helper method * *
     * {@code
     * software.amazon.awssdk.services.acm.paginators.ListCertificatesPublisher publisher = client.listCertificatesPaginator(request);
     * CompletableFuture future = publisher.subscribe(res -> { // Do something with the response });
     * future.get();
     * }
     * 
* * 2) Using a custom subscriber * *
     * {@code
     * software.amazon.awssdk.services.acm.paginators.ListCertificatesPublisher publisher = client.listCertificatesPaginator(request);
     * publisher.subscribe(new Subscriber() {
     * 
     * public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
     * 
     * 
     * public void onNext(software.amazon.awssdk.services.acm.model.ListCertificatesResponse response) { //... };
     * });}
     * 
* * As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2. *

* Please notice that the configuration of MaxItems won't limit the number of results you get with the paginator. * It only limits the number of results in each page. *

*

* Note: If you prefer to have control on service calls, use the * {@link #listCertificates(software.amazon.awssdk.services.acm.model.ListCertificatesRequest)} operation. *

* * @param listCertificatesRequest * @return A custom publisher that can be subscribed to request a stream of response pages.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • InvalidArgsException One or more of of request parameters specified is not valid.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AcmException Base class for all service exceptions. Unknown exceptions will be thrown as an instance * of this type.
  • *
* @sample AcmAsyncClient.ListCertificates * @see AWS API * Documentation */ public ListCertificatesPublisher listCertificatesPaginator(ListCertificatesRequest listCertificatesRequest) { return new ListCertificatesPublisher(this, applyPaginatorUserAgent(listCertificatesRequest)); } /** *

* Lists the tags that have been applied to the ACM certificate. Use the certificate's Amazon Resource Name (ARN) to * specify the certificate. To add a tag to an ACM certificate, use the AddTagsToCertificate action. To * delete a tag, use the RemoveTagsFromCertificate action. *

* * @param listTagsForCertificateRequest * @return A Java Future containing the result of the ListTagsForCertificate operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ResourceNotFoundException The specified certificate cannot be found in the caller's account or the * caller's account cannot be found.
  • *
  • InvalidArnException The requested Amazon Resource Name (ARN) does not refer to an existing resource.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AcmException Base class for all service exceptions. Unknown exceptions will be thrown as an instance * of this type.
  • *
* @sample AcmAsyncClient.ListTagsForCertificate * @see AWS * API Documentation */ @Override public CompletableFuture listTagsForCertificate( ListTagsForCertificateRequest listTagsForCertificateRequest) { List metricPublishers = resolveMetricPublishers(clientConfiguration, listTagsForCertificateRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "ACM"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListTagsForCertificate"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListTagsForCertificateResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ListTagsForCertificate") .withMarshaller(new ListTagsForCertificateRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withMetricCollector(apiCallMetricCollector).withInput(listTagsForCertificateRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Adds or modifies account-level configurations in ACM. *

*

* The supported configuration option is DaysBeforeExpiry. This option specifies the number of days * prior to certificate expiration when ACM starts generating EventBridge events. ACM sends one event * per day per certificate until the certificate expires. By default, accounts receive events starting 45 days * before certificate expiration. *

* * @param putAccountConfigurationRequest * @return A Java Future containing the result of the PutAccountConfiguration operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ValidationException The supplied input failed to satisfy constraints of an Amazon Web Services * service.
  • *
  • ThrottlingException The request was denied because it exceeded a quota.
  • *
  • AccessDeniedException You do not have access required to perform this action.
  • *
  • ConflictException You are trying to update a resource or configuration that is already being created * or updated. Wait for the previous operation to finish and try again.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AcmException Base class for all service exceptions. Unknown exceptions will be thrown as an instance * of this type.
  • *
* @sample AcmAsyncClient.PutAccountConfiguration * @see AWS * API Documentation */ @Override public CompletableFuture putAccountConfiguration( PutAccountConfigurationRequest putAccountConfigurationRequest) { List metricPublishers = resolveMetricPublishers(clientConfiguration, putAccountConfigurationRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "ACM"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PutAccountConfiguration"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, PutAccountConfigurationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("PutAccountConfiguration") .withMarshaller(new PutAccountConfigurationRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withMetricCollector(apiCallMetricCollector).withInput(putAccountConfigurationRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Remove one or more tags from an ACM certificate. A tag consists of a key-value pair. If you do not specify the * value portion of the tag when calling this function, the tag will be removed regardless of value. If you specify * a value, the tag is removed only if it is associated with the specified value. *

*

* To add tags to a certificate, use the AddTagsToCertificate action. To view all of the tags that have been * applied to a specific ACM certificate, use the ListTagsForCertificate action. *

* * @param removeTagsFromCertificateRequest * @return A Java Future containing the result of the RemoveTagsFromCertificate operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ResourceNotFoundException The specified certificate cannot be found in the caller's account or the * caller's account cannot be found.
  • *
  • InvalidArnException The requested Amazon Resource Name (ARN) does not refer to an existing resource.
  • *
  • InvalidTagException One or both of the values that make up the key-value pair is not valid. For * example, you cannot specify a tag value that begins with aws:.
  • *
  • TagPolicyException A specified tag did not comply with an existing tag policy and was rejected.
  • *
  • InvalidParameterException An input parameter was invalid.
  • *
  • ThrottlingException The request was denied because it exceeded a quota.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AcmException Base class for all service exceptions. Unknown exceptions will be thrown as an instance * of this type.
  • *
* @sample AcmAsyncClient.RemoveTagsFromCertificate * @see AWS * API Documentation */ @Override public CompletableFuture removeTagsFromCertificate( RemoveTagsFromCertificateRequest removeTagsFromCertificateRequest) { List metricPublishers = resolveMetricPublishers(clientConfiguration, removeTagsFromCertificateRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "ACM"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "RemoveTagsFromCertificate"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, RemoveTagsFromCertificateResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("RemoveTagsFromCertificate") .withMarshaller(new RemoveTagsFromCertificateRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withMetricCollector(apiCallMetricCollector).withInput(removeTagsFromCertificateRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Renews an eligible ACM certificate. At this time, only exported private certificates can be renewed with this * operation. In order to renew your ACM PCA certificates with ACM, you must first grant the ACM service principal * permission to do so. For more information, see Testing Managed Renewal in the * ACM User Guide. *

* * @param renewCertificateRequest * @return A Java Future containing the result of the RenewCertificate operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ResourceNotFoundException The specified certificate cannot be found in the caller's account or the * caller's account cannot be found.
  • *
  • InvalidArnException The requested Amazon Resource Name (ARN) does not refer to an existing resource.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AcmException Base class for all service exceptions. Unknown exceptions will be thrown as an instance * of this type.
  • *
* @sample AcmAsyncClient.RenewCertificate * @see AWS API * Documentation */ @Override public CompletableFuture renewCertificate(RenewCertificateRequest renewCertificateRequest) { List metricPublishers = resolveMetricPublishers(clientConfiguration, renewCertificateRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "ACM"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "RenewCertificate"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, RenewCertificateResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("RenewCertificate") .withMarshaller(new RenewCertificateRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withMetricCollector(apiCallMetricCollector).withInput(renewCertificateRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Requests an ACM certificate for use with other Amazon Web Services services. To request an ACM certificate, you * must specify a fully qualified domain name (FQDN) in the DomainName parameter. You can also specify * additional FQDNs in the SubjectAlternativeNames parameter. *

*

* If you are requesting a private certificate, domain validation is not required. If you are requesting a public * certificate, each domain name that you specify must be validated to verify that you own or control the domain. * You can use DNS * validation or email * validation. We recommend that you use DNS validation. ACM issues public certificates after receiving approval * from the domain owner. *

* *

* ACM behavior differs from the https://tools.ietf.org/html/rfc6125#appendix-B.2RFC * 6125 specification of the certificate validation process. first checks for a subject alternative name, and, if it * finds one, ignores the common name (CN) *

*
* * @param requestCertificateRequest * @return A Java Future containing the result of the RequestCertificate operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • LimitExceededException An ACM quota has been exceeded.
  • *
  • InvalidDomainValidationOptionsException One or more values in the DomainValidationOption * structure is incorrect.
  • *
  • InvalidArnException The requested Amazon Resource Name (ARN) does not refer to an existing resource.
  • *
  • InvalidTagException One or both of the values that make up the key-value pair is not valid. For * example, you cannot specify a tag value that begins with aws:.
  • *
  • TooManyTagsException The request contains too many tags. Try the request again with fewer tags.
  • *
  • TagPolicyException A specified tag did not comply with an existing tag policy and was rejected.
  • *
  • InvalidParameterException An input parameter was invalid.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AcmException Base class for all service exceptions. Unknown exceptions will be thrown as an instance * of this type.
  • *
* @sample AcmAsyncClient.RequestCertificate * @see AWS API * Documentation */ @Override public CompletableFuture requestCertificate(RequestCertificateRequest requestCertificateRequest) { List metricPublishers = resolveMetricPublishers(clientConfiguration, requestCertificateRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "ACM"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "RequestCertificate"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, RequestCertificateResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("RequestCertificate") .withMarshaller(new RequestCertificateRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withMetricCollector(apiCallMetricCollector).withInput(requestCertificateRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Resends the email that requests domain ownership validation. The domain owner or an authorized representative * must approve the ACM certificate before it can be issued. The certificate can be approved by clicking a link in * the mail to navigate to the Amazon certificate approval website and then clicking I Approve. However, the * validation email can be blocked by spam filters. Therefore, if you do not receive the original mail, you can * request that the mail be resent within 72 hours of requesting the ACM certificate. If more than 72 hours have * elapsed since your original request or since your last attempt to resend validation mail, you must request a new * certificate. For more information about setting up your contact email addresses, see Configure Email for your Domain. *

* * @param resendValidationEmailRequest * @return A Java Future containing the result of the ResendValidationEmail operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ResourceNotFoundException The specified certificate cannot be found in the caller's account or the * caller's account cannot be found.
  • *
  • InvalidStateException Processing has reached an invalid state.
  • *
  • InvalidArnException The requested Amazon Resource Name (ARN) does not refer to an existing resource.
  • *
  • InvalidDomainValidationOptionsException One or more values in the DomainValidationOption * structure is incorrect.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AcmException Base class for all service exceptions. Unknown exceptions will be thrown as an instance * of this type.
  • *
* @sample AcmAsyncClient.ResendValidationEmail * @see AWS API * Documentation */ @Override public CompletableFuture resendValidationEmail( ResendValidationEmailRequest resendValidationEmailRequest) { List metricPublishers = resolveMetricPublishers(clientConfiguration, resendValidationEmailRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "ACM"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ResendValidationEmail"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ResendValidationEmailResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ResendValidationEmail") .withMarshaller(new ResendValidationEmailRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withMetricCollector(apiCallMetricCollector).withInput(resendValidationEmailRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Updates a certificate. Currently, you can use this function to specify whether to opt in to or out of recording * your certificate in a certificate transparency log. For more information, see * Opting Out of Certificate Transparency Logging. *

* * @param updateCertificateOptionsRequest * @return A Java Future containing the result of the UpdateCertificateOptions operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ResourceNotFoundException The specified certificate cannot be found in the caller's account or the * caller's account cannot be found.
  • *
  • LimitExceededException An ACM quota has been exceeded.
  • *
  • InvalidStateException Processing has reached an invalid state.
  • *
  • InvalidArnException The requested Amazon Resource Name (ARN) does not refer to an existing resource.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AcmException Base class for all service exceptions. Unknown exceptions will be thrown as an instance * of this type.
  • *
* @sample AcmAsyncClient.UpdateCertificateOptions * @see AWS * API Documentation */ @Override public CompletableFuture updateCertificateOptions( UpdateCertificateOptionsRequest updateCertificateOptionsRequest) { List metricPublishers = resolveMetricPublishers(clientConfiguration, updateCertificateOptionsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "ACM"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateCertificateOptions"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, UpdateCertificateOptionsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("UpdateCertificateOptions") .withMarshaller(new UpdateCertificateOptionsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withMetricCollector(apiCallMetricCollector).withInput(updateCertificateOptionsRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } @Override public void close() { clientHandler.close(); } private > T init(T builder) { return builder .clientConfiguration(clientConfiguration) .defaultServiceExceptionSupplier(AcmException::builder) .protocol(AwsJsonProtocol.AWS_JSON) .protocolVersion("1.1") .registerModeledException( ExceptionMetadata.builder().errorCode("InvalidTagException") .exceptionBuilderSupplier(InvalidTagException::builder).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("AccessDeniedException") .exceptionBuilderSupplier(AccessDeniedException::builder).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("TooManyTagsException") .exceptionBuilderSupplier(TooManyTagsException::builder).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ConflictException") .exceptionBuilderSupplier(ConflictException::builder).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("InvalidParameterException") .exceptionBuilderSupplier(InvalidParameterException::builder).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ResourceInUseException") .exceptionBuilderSupplier(ResourceInUseException::builder).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ResourceNotFoundException") .exceptionBuilderSupplier(ResourceNotFoundException::builder).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("InvalidArgsException") .exceptionBuilderSupplier(InvalidArgsException::builder).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("InvalidArnException") .exceptionBuilderSupplier(InvalidArnException::builder).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ThrottlingException") .exceptionBuilderSupplier(ThrottlingException::builder).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ValidationException") .exceptionBuilderSupplier(ValidationException::builder).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("TagPolicyException") .exceptionBuilderSupplier(TagPolicyException::builder).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("RequestInProgressException") .exceptionBuilderSupplier(RequestInProgressException::builder).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("InvalidStateException") .exceptionBuilderSupplier(InvalidStateException::builder).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("InvalidDomainValidationOptionsException") .exceptionBuilderSupplier(InvalidDomainValidationOptionsException::builder).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("LimitExceededException") .exceptionBuilderSupplier(LimitExceededException::builder).build()); } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); } if (publishers == null || publishers.isEmpty()) { publishers = clientConfiguration.option(SdkClientOption.METRIC_PUBLISHERS); } if (publishers == null) { publishers = Collections.emptyList(); } return publishers; } private T applyPaginatorUserAgent(T request) { Consumer userAgentApplier = b -> b.addApiName(ApiName.builder() .version(VersionInfo.SDK_VERSION).name("PAGINATED").build()); AwsRequestOverrideConfiguration overrideConfiguration = request.overrideConfiguration() .map(c -> c.toBuilder().applyMutation(userAgentApplier).build()) .orElse((AwsRequestOverrideConfiguration.builder().applyMutation(userAgentApplier).build())); return (T) request.toBuilder().overrideConfiguration(overrideConfiguration).build(); } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, JsonOperationMetadata operationMetadata) { return protocolFactory.createErrorResponseHandler(operationMetadata); } @Override public AcmAsyncWaiter waiter() { return AcmAsyncWaiter.builder().client(this).scheduledExecutorService(executorService).build(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy