DescribeCertificateAuthority - Amazon Private Certificate Authority
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

DescribeCertificateAuthority

The following Java sample shows how to use the DescribeCertificateAuthority operation.

The operation lists information about your private certificate authority (CA). You must specify the ARN (Amazon Resource Name) of the private CA. The output contains the status of your CA. This can be any of the following:

  • CREATING – Amazon Private CA is creating your private certificate authority.

  • PENDING_CERTIFICATE – The certificate is pending. You must use your on-premises root or subordinate CA to sign your private CA CSR and then import it into PCA.

  • ACTIVE – Your private CA is active.

  • DISABLED – Your private CA has been disabled.

  • EXPIRED – Your private CA certificate has expired.

  • FAILED – Your private CA cannot be created.

  • DELETED – Your private CA is within the restoration period, after which it will be permanently deleted.

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.CertificateAuthority; import com.amazonaws.services.acmpca.model.DescribeCertificateAuthorityRequest; import com.amazonaws.services.acmpca.model.DescribeCertificateAuthorityResult; import com.amazonaws.AmazonClientException; import com.amazonaws.services.acmpca.model.ResourceNotFoundException; import com.amazonaws.services.acmpca.model.InvalidArnException; public class DescribeCertificateAuthority { 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 request object DescribeCertificateAuthorityRequest req = new DescribeCertificateAuthorityRequest(); // Set the certificate authority ARN. req.withCertificateAuthorityArn("arn:aws:acm-pca:us-east-1:111122223333:certificate-authority/11223344-1234-1122-2233-112233445566"); // Create a result object. DescribeCertificateAuthorityResult result = null; try { result = client.describeCertificateAuthority(req); } catch (ResourceNotFoundException ex) { throw ex; } catch (InvalidArnException ex) { throw ex; } // Retrieve and display information about the CA. CertificateAuthority PCA = result.getCertificateAuthority(); String strPCA = PCA.toString(); System.out.println(strPCA); } }