DeleteCertificateAuthority - Amazon Private Certificate Authority
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

DeleteCertificateAuthority

以下 Java 示例显示了如何使用该DeleteCertificateAuthority操作。

此操作将删除您使用该CreateCertificateAuthority操作创建的私有证书颁发机构 (CA)。DeleteCertificateAuthority 操作要求您提供要删除的 CA 的 ARN。您可以通过调用操作来找到 ARN。ListCertificateAuthorities如果私有 CA 的状态为 CREATINGPENDING_CERTIFICATE,则可立即将其删除。但是,如果您已经导入此证书,则无法立即将其删除。必须先通过调用UpdateCertificateAuthority操作来禁用 CA,然后将Status参数设置为DISABLED。然后,您可以使用 DeleteCertificateAuthority 操作中的 PermanentDeletionTimeInDays 参数指定天数(7 到 30 天)。在此期间,私有 CA 可以还原到 disabled 状态。默认情况下,如果未设置 PermanentDeletionTimeInDays 参数,则还原期为 30 天。在此期间后,私有 CA 将被永久删除,无法还原。有关更多信息,请参阅 还原 CA

有关向您展示如何使用该RestoreCertificateAuthority操作的 Java 示例,请参阅RestoreCertificateAuthority

package com.amazonaws.samples; import com.amazonaws.auth.AWSCredentials; import com.amazonaws.auth.profile.ProfileCredentialsProvider; import com.amazonaws.client.builder.AwsClientBuilder; import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration; import com.amazonaws.auth.AWSStaticCredentialsProvider; import com.amazonaws.services.acmpca.AWSACMPCA; import com.amazonaws.services.acmpca.AWSACMPCAClientBuilder; import com.amazonaws.services.acmpca.model.DeleteCertificateAuthorityRequest; import com.amazonaws.AmazonClientException; import com.amazonaws.services.acmpca.model.ResourceNotFoundException; import com.amazonaws.services.acmpca.model.InvalidArnException; import com.amazonaws.services.acmpca.model.InvalidStateException; import com.amazonaws.services.acmpca.model.RequestFailedException; public class DeleteCertificateAuthority { public static void main(String[] args) throws Exception{ // Retrieve your credentials from the C:\Users\name\.aws\credentials file // in Windows or the .aws/credentials file in Linux. AWSCredentials credentials = null; try { credentials = new ProfileCredentialsProvider("default").getCredentials(); } catch (Exception e) { throw new AmazonClientException("Cannot load your credentials from disk", e); } // Define the endpoint for your sample. String endpointRegion = "region"; // Substitute your region here, e.g. "us-west-2" String endpointProtocol = "https://acm-pca." + endpointRegion + ".amazonaws.com/"; EndpointConfiguration endpoint = new AwsClientBuilder.EndpointConfiguration(endpointProtocol, endpointRegion); // Create a client that you can use to make requests. AWSACMPCA client = AWSACMPCAClientBuilder.standard() .withEndpointConfiguration(endpoint) .withCredentials(new AWSStaticCredentialsProvider(credentials)) .build(); // Create a requrest object and set the ARN of the private CA to delete. DeleteCertificateAuthorityRequest req = new DeleteCertificateAuthorityRequest(); // Set the certificate authority ARN. req.withCertificateAuthorityArn("arn:aws:acm-pca:us-east-1:111122223333:certificate-authority/11223344-1234-1122-2233-112233445566"); // Set the recovery period. req.withPermanentDeletionTimeInDays(12); // Delete the CA. try { client.deleteCertificateAuthority(req); } catch (ResourceNotFoundException ex) { throw ex; } catch (InvalidArnException ex) { throw ex; } catch (InvalidStateException ex) { throw ex; } catch (RequestFailedException ex) { throw ex; } } }