1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package acmpca
4
5import (
6	"context"
7	awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
8	"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
9	"github.com/aws/aws-sdk-go-v2/service/acmpca/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Lists information about your private certificate authority (CA) or one that has
15// been shared with you. You specify the private CA on input by its ARN (Amazon
16// Resource Name). The output contains the status of your CA. This can be any of
17// the following:
18//
19// * CREATING - ACM Private CA is creating your private certificate
20// authority.
21//
22// * PENDING_CERTIFICATE - The certificate is pending. You must use
23// your ACM Private CA-hosted or on-premises root or subordinate CA to sign your
24// private CA CSR and then import it into PCA.
25//
26// * ACTIVE - Your private CA is
27// active.
28//
29// * DISABLED - Your private CA has been disabled.
30//
31// * EXPIRED - Your
32// private CA certificate has expired.
33//
34// * FAILED - Your private CA has failed. Your
35// CA can fail because of problems such a network outage or back-end AWS failure or
36// other errors. A failed CA can never return to the pending state. You must create
37// a new CA.
38//
39// * DELETED - Your private CA is within the restoration period, after
40// which it is permanently deleted. The length of time remaining in the CA's
41// restoration period is also included in this action's output.
42func (c *Client) DescribeCertificateAuthority(ctx context.Context, params *DescribeCertificateAuthorityInput, optFns ...func(*Options)) (*DescribeCertificateAuthorityOutput, error) {
43	if params == nil {
44		params = &DescribeCertificateAuthorityInput{}
45	}
46
47	result, metadata, err := c.invokeOperation(ctx, "DescribeCertificateAuthority", params, optFns, addOperationDescribeCertificateAuthorityMiddlewares)
48	if err != nil {
49		return nil, err
50	}
51
52	out := result.(*DescribeCertificateAuthorityOutput)
53	out.ResultMetadata = metadata
54	return out, nil
55}
56
57type DescribeCertificateAuthorityInput struct {
58
59	// The Amazon Resource Name (ARN) that was returned when you called
60	// CreateCertificateAuthority
61	// (https://docs.aws.amazon.com/acm-pca/latest/APIReference/API_CreateCertificateAuthority.html).
62	// This must be of the form:
63	// arn:aws:acm-pca:region:account:certificate-authority/12345678-1234-1234-1234-123456789012
64	// .
65	//
66	// This member is required.
67	CertificateAuthorityArn *string
68}
69
70type DescribeCertificateAuthorityOutput struct {
71
72	// A CertificateAuthority
73	// (https://docs.aws.amazon.com/acm-pca/latest/APIReference/API_CertificateAuthority.html)
74	// structure that contains information about your private CA.
75	CertificateAuthority *types.CertificateAuthority
76
77	// Metadata pertaining to the operation's result.
78	ResultMetadata middleware.Metadata
79}
80
81func addOperationDescribeCertificateAuthorityMiddlewares(stack *middleware.Stack, options Options) (err error) {
82	err = stack.Serialize.Add(&awsAwsjson11_serializeOpDescribeCertificateAuthority{}, middleware.After)
83	if err != nil {
84		return err
85	}
86	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDescribeCertificateAuthority{}, middleware.After)
87	if err != nil {
88		return err
89	}
90	if err = addSetLoggerMiddleware(stack, options); err != nil {
91		return err
92	}
93	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
94		return err
95	}
96	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
97		return err
98	}
99	if err = addResolveEndpointMiddleware(stack, options); err != nil {
100		return err
101	}
102	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
103		return err
104	}
105	if err = addRetryMiddlewares(stack, options); err != nil {
106		return err
107	}
108	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
109		return err
110	}
111	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
112		return err
113	}
114	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
115		return err
116	}
117	if err = addClientUserAgent(stack); err != nil {
118		return err
119	}
120	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
121		return err
122	}
123	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
124		return err
125	}
126	if err = addOpDescribeCertificateAuthorityValidationMiddleware(stack); err != nil {
127		return err
128	}
129	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeCertificateAuthority(options.Region), middleware.Before); err != nil {
130		return err
131	}
132	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
133		return err
134	}
135	if err = addResponseErrorMiddleware(stack); err != nil {
136		return err
137	}
138	if err = addRequestResponseLogging(stack, options); err != nil {
139		return err
140	}
141	return nil
142}
143
144func newServiceMetadataMiddleware_opDescribeCertificateAuthority(region string) *awsmiddleware.RegisterServiceMetadata {
145	return &awsmiddleware.RegisterServiceMetadata{
146		Region:        region,
147		ServiceID:     ServiceID,
148		SigningName:   "acm-pca",
149		OperationName: "DescribeCertificateAuthority",
150	}
151}
152