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/smithy-go/middleware" 10 smithyhttp "github.com/aws/smithy-go/transport/http" 11) 12 13// Deletes a private certificate authority (CA). You must provide the Amazon 14// Resource Name (ARN) of the private CA that you want to delete. You can find the 15// ARN by calling the ListCertificateAuthorities 16// (https://docs.aws.amazon.com/acm-pca/latest/APIReference/API_ListCertificateAuthorities.html) 17// action. Deleting a CA will invalidate other CAs and certificates below it in 18// your CA hierarchy. Before you can delete a CA that you have created and 19// activated, you must disable it. To do this, call the UpdateCertificateAuthority 20// (https://docs.aws.amazon.com/acm-pca/latest/APIReference/API_UpdateCertificateAuthority.html) 21// action and set the CertificateAuthorityStatus parameter to DISABLED. 22// Additionally, you can delete a CA if you are waiting for it to be created (that 23// is, the status of the CA is CREATING). You can also delete it if the CA has been 24// created but you haven't yet imported the signed certificate into ACM Private CA 25// (that is, the status of the CA is PENDING_CERTIFICATE). When you successfully 26// call DeleteCertificateAuthority 27// (https://docs.aws.amazon.com/acm-pca/latest/APIReference/API_DeleteCertificateAuthority.html), 28// the CA's status changes to DELETED. However, the CA won't be permanently deleted 29// until the restoration period has passed. By default, if you do not set the 30// PermanentDeletionTimeInDays parameter, the CA remains restorable for 30 days. 31// You can set the parameter from 7 to 30 days. The DescribeCertificateAuthority 32// (https://docs.aws.amazon.com/acm-pca/latest/APIReference/API_DescribeCertificateAuthority.html) 33// action returns the time remaining in the restoration window of a private CA in 34// the DELETED state. To restore an eligible CA, call the 35// RestoreCertificateAuthority 36// (https://docs.aws.amazon.com/acm-pca/latest/APIReference/API_RestoreCertificateAuthority.html) 37// action. 38func (c *Client) DeleteCertificateAuthority(ctx context.Context, params *DeleteCertificateAuthorityInput, optFns ...func(*Options)) (*DeleteCertificateAuthorityOutput, error) { 39 if params == nil { 40 params = &DeleteCertificateAuthorityInput{} 41 } 42 43 result, metadata, err := c.invokeOperation(ctx, "DeleteCertificateAuthority", params, optFns, addOperationDeleteCertificateAuthorityMiddlewares) 44 if err != nil { 45 return nil, err 46 } 47 48 out := result.(*DeleteCertificateAuthorityOutput) 49 out.ResultMetadata = metadata 50 return out, nil 51} 52 53type DeleteCertificateAuthorityInput struct { 54 55 // The Amazon Resource Name (ARN) that was returned when you called 56 // CreateCertificateAuthority 57 // (https://docs.aws.amazon.com/acm-pca/latest/APIReference/API_CreateCertificateAuthority.html). 58 // This must have the following form: 59 // arn:aws:acm-pca:region:account:certificate-authority/12345678-1234-1234-1234-123456789012 60 // . 61 // 62 // This member is required. 63 CertificateAuthorityArn *string 64 65 // The number of days to make a CA restorable after it has been deleted. This can 66 // be anywhere from 7 to 30 days, with 30 being the default. 67 PermanentDeletionTimeInDays *int32 68} 69 70type DeleteCertificateAuthorityOutput struct { 71 // Metadata pertaining to the operation's result. 72 ResultMetadata middleware.Metadata 73} 74 75func addOperationDeleteCertificateAuthorityMiddlewares(stack *middleware.Stack, options Options) (err error) { 76 err = stack.Serialize.Add(&awsAwsjson11_serializeOpDeleteCertificateAuthority{}, middleware.After) 77 if err != nil { 78 return err 79 } 80 err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDeleteCertificateAuthority{}, middleware.After) 81 if err != nil { 82 return err 83 } 84 if err = addSetLoggerMiddleware(stack, options); err != nil { 85 return err 86 } 87 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 88 return err 89 } 90 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 91 return err 92 } 93 if err = addResolveEndpointMiddleware(stack, options); err != nil { 94 return err 95 } 96 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 97 return err 98 } 99 if err = addRetryMiddlewares(stack, options); err != nil { 100 return err 101 } 102 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 103 return err 104 } 105 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 106 return err 107 } 108 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 109 return err 110 } 111 if err = addClientUserAgent(stack); err != nil { 112 return err 113 } 114 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 115 return err 116 } 117 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 118 return err 119 } 120 if err = addOpDeleteCertificateAuthorityValidationMiddleware(stack); err != nil { 121 return err 122 } 123 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteCertificateAuthority(options.Region), middleware.Before); err != nil { 124 return err 125 } 126 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 127 return err 128 } 129 if err = addResponseErrorMiddleware(stack); err != nil { 130 return err 131 } 132 if err = addRequestResponseLogging(stack, options); err != nil { 133 return err 134 } 135 return nil 136} 137 138func newServiceMetadataMiddleware_opDeleteCertificateAuthority(region string) *awsmiddleware.RegisterServiceMetadata { 139 return &awsmiddleware.RegisterServiceMetadata{ 140 Region: region, 141 ServiceID: ServiceID, 142 SigningName: "acm-pca", 143 OperationName: "DeleteCertificateAuthority", 144 } 145} 146