1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package cloudhsmv2 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/cloudhsmv2/types" 10 "github.com/aws/smithy-go/middleware" 11 smithyhttp "github.com/aws/smithy-go/transport/http" 12) 13 14// Claims an AWS CloudHSM cluster by submitting the cluster certificate issued by 15// your issuing certificate authority (CA) and the CA's root certificate. Before 16// you can claim a cluster, you must sign the cluster's certificate signing request 17// (CSR) with your issuing CA. To get the cluster's CSR, use DescribeClusters. 18func (c *Client) InitializeCluster(ctx context.Context, params *InitializeClusterInput, optFns ...func(*Options)) (*InitializeClusterOutput, error) { 19 if params == nil { 20 params = &InitializeClusterInput{} 21 } 22 23 result, metadata, err := c.invokeOperation(ctx, "InitializeCluster", params, optFns, addOperationInitializeClusterMiddlewares) 24 if err != nil { 25 return nil, err 26 } 27 28 out := result.(*InitializeClusterOutput) 29 out.ResultMetadata = metadata 30 return out, nil 31} 32 33type InitializeClusterInput struct { 34 35 // The identifier (ID) of the cluster that you are claiming. To find the cluster 36 // ID, use DescribeClusters. 37 // 38 // This member is required. 39 ClusterId *string 40 41 // The cluster certificate issued (signed) by your issuing certificate authority 42 // (CA). The certificate must be in PEM format and can contain a maximum of 5000 43 // characters. 44 // 45 // This member is required. 46 SignedCert *string 47 48 // The issuing certificate of the issuing certificate authority (CA) that issued 49 // (signed) the cluster certificate. You must use a self-signed certificate. The 50 // certificate used to sign the HSM CSR must be directly available, and thus must 51 // be the root certificate. The certificate must be in PEM format and can contain a 52 // maximum of 5000 characters. 53 // 54 // This member is required. 55 TrustAnchor *string 56} 57 58type InitializeClusterOutput struct { 59 60 // The cluster's state. 61 State types.ClusterState 62 63 // A description of the cluster's state. 64 StateMessage *string 65 66 // Metadata pertaining to the operation's result. 67 ResultMetadata middleware.Metadata 68} 69 70func addOperationInitializeClusterMiddlewares(stack *middleware.Stack, options Options) (err error) { 71 err = stack.Serialize.Add(&awsAwsjson11_serializeOpInitializeCluster{}, middleware.After) 72 if err != nil { 73 return err 74 } 75 err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpInitializeCluster{}, middleware.After) 76 if err != nil { 77 return err 78 } 79 if err = addSetLoggerMiddleware(stack, options); err != nil { 80 return err 81 } 82 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 83 return err 84 } 85 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 86 return err 87 } 88 if err = addResolveEndpointMiddleware(stack, options); err != nil { 89 return err 90 } 91 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 92 return err 93 } 94 if err = addRetryMiddlewares(stack, options); err != nil { 95 return err 96 } 97 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 98 return err 99 } 100 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 101 return err 102 } 103 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 104 return err 105 } 106 if err = addClientUserAgent(stack); err != nil { 107 return err 108 } 109 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 110 return err 111 } 112 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 113 return err 114 } 115 if err = addOpInitializeClusterValidationMiddleware(stack); err != nil { 116 return err 117 } 118 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opInitializeCluster(options.Region), middleware.Before); err != nil { 119 return err 120 } 121 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 122 return err 123 } 124 if err = addResponseErrorMiddleware(stack); err != nil { 125 return err 126 } 127 if err = addRequestResponseLogging(stack, options); err != nil { 128 return err 129 } 130 return nil 131} 132 133func newServiceMetadataMiddleware_opInitializeCluster(region string) *awsmiddleware.RegisterServiceMetadata { 134 return &awsmiddleware.RegisterServiceMetadata{ 135 Region: region, 136 ServiceID: ServiceID, 137 SigningName: "cloudhsm", 138 OperationName: "InitializeCluster", 139 } 140} 141