1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package acm 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// Exports a private certificate issued by a private certificate authority (CA) for 14// use anywhere. The exported file contains the certificate, the certificate chain, 15// and the encrypted private 2048-bit RSA key associated with the public key that 16// is embedded in the certificate. For security, you must assign a passphrase for 17// the private key when exporting it. For information about exporting and 18// formatting a certificate using the ACM console or CLI, see Export a Private 19// Certificate 20// (https://docs.aws.amazon.com/acm/latest/userguide/gs-acm-export-private.html). 21func (c *Client) ExportCertificate(ctx context.Context, params *ExportCertificateInput, optFns ...func(*Options)) (*ExportCertificateOutput, error) { 22 if params == nil { 23 params = &ExportCertificateInput{} 24 } 25 26 result, metadata, err := c.invokeOperation(ctx, "ExportCertificate", params, optFns, addOperationExportCertificateMiddlewares) 27 if err != nil { 28 return nil, err 29 } 30 31 out := result.(*ExportCertificateOutput) 32 out.ResultMetadata = metadata 33 return out, nil 34} 35 36type ExportCertificateInput struct { 37 38 // An Amazon Resource Name (ARN) of the issued certificate. This must be of the 39 // form: 40 // arn:aws:acm:region:account:certificate/12345678-1234-1234-1234-123456789012 41 // 42 // This member is required. 43 CertificateArn *string 44 45 // Passphrase to associate with the encrypted exported private key. If you want to 46 // later decrypt the private key, you must have the passphrase. You can use the 47 // following OpenSSL command to decrypt a private key: openssl rsa -in 48 // encrypted_key.pem -out decrypted_key.pem 49 // 50 // This member is required. 51 Passphrase []byte 52} 53 54type ExportCertificateOutput struct { 55 56 // The base64 PEM-encoded certificate. 57 Certificate *string 58 59 // The base64 PEM-encoded certificate chain. This does not include the certificate 60 // that you are exporting. 61 CertificateChain *string 62 63 // The encrypted private key associated with the public key in the certificate. The 64 // key is output in PKCS #8 format and is base64 PEM-encoded. 65 PrivateKey *string 66 67 // Metadata pertaining to the operation's result. 68 ResultMetadata middleware.Metadata 69} 70 71func addOperationExportCertificateMiddlewares(stack *middleware.Stack, options Options) (err error) { 72 err = stack.Serialize.Add(&awsAwsjson11_serializeOpExportCertificate{}, middleware.After) 73 if err != nil { 74 return err 75 } 76 err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpExportCertificate{}, middleware.After) 77 if err != nil { 78 return err 79 } 80 if err = addSetLoggerMiddleware(stack, options); err != nil { 81 return err 82 } 83 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 84 return err 85 } 86 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 87 return err 88 } 89 if err = addResolveEndpointMiddleware(stack, options); err != nil { 90 return err 91 } 92 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 93 return err 94 } 95 if err = addRetryMiddlewares(stack, options); err != nil { 96 return err 97 } 98 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 99 return err 100 } 101 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 102 return err 103 } 104 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 105 return err 106 } 107 if err = addClientUserAgent(stack); err != nil { 108 return err 109 } 110 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 111 return err 112 } 113 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 114 return err 115 } 116 if err = addOpExportCertificateValidationMiddleware(stack); err != nil { 117 return err 118 } 119 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opExportCertificate(options.Region), middleware.Before); err != nil { 120 return err 121 } 122 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 123 return err 124 } 125 if err = addResponseErrorMiddleware(stack); err != nil { 126 return err 127 } 128 if err = addRequestResponseLogging(stack, options); err != nil { 129 return err 130 } 131 return nil 132} 133 134func newServiceMetadataMiddleware_opExportCertificate(region string) *awsmiddleware.RegisterServiceMetadata { 135 return &awsmiddleware.RegisterServiceMetadata{ 136 Region: region, 137 ServiceID: ServiceID, 138 SigningName: "acm", 139 OperationName: "ExportCertificate", 140 } 141} 142