api_op_CreateVPCAssociationAuthorization.go (6883B)
1 // Code generated by smithy-go-codegen DO NOT EDIT. 2 3 package route53 4 5 import ( 6 "context" 7 "fmt" 8 awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" 9 "github.com/aws/aws-sdk-go-v2/service/route53/types" 10 "github.com/aws/smithy-go/middleware" 11 smithyhttp "github.com/aws/smithy-go/transport/http" 12 ) 13 14 // Authorizes the Amazon Web Services account that created a specified VPC to 15 // submit an AssociateVPCWithHostedZone request to associate the VPC with a 16 // specified hosted zone that was created by a different account. To submit a 17 // CreateVPCAssociationAuthorization request, you must use the account that created 18 // the hosted zone. After you authorize the association, use the account that 19 // created the VPC to submit an AssociateVPCWithHostedZone request. 20 // 21 // If you want to associate multiple VPCs that you created by using one account 22 // with a hosted zone that you created by using a different account, you must 23 // submit one authorization request for each VPC. 24 func (c *Client) CreateVPCAssociationAuthorization(ctx context.Context, params *CreateVPCAssociationAuthorizationInput, optFns ...func(*Options)) (*CreateVPCAssociationAuthorizationOutput, error) { 25 if params == nil { 26 params = &CreateVPCAssociationAuthorizationInput{} 27 } 28 29 result, metadata, err := c.invokeOperation(ctx, "CreateVPCAssociationAuthorization", params, optFns, c.addOperationCreateVPCAssociationAuthorizationMiddlewares) 30 if err != nil { 31 return nil, err 32 } 33 34 out := result.(*CreateVPCAssociationAuthorizationOutput) 35 out.ResultMetadata = metadata 36 return out, nil 37 } 38 39 // A complex type that contains information about the request to authorize 40 // associating a VPC with your private hosted zone. Authorization is only required 41 // when a private hosted zone and a VPC were created by using different accounts. 42 type CreateVPCAssociationAuthorizationInput struct { 43 44 // The ID of the private hosted zone that you want to authorize associating a VPC 45 // with. 46 // 47 // This member is required. 48 HostedZoneId *string 49 50 // A complex type that contains the VPC ID and region for the VPC that you want to 51 // authorize associating with your hosted zone. 52 // 53 // This member is required. 54 VPC *types.VPC 55 56 noSmithyDocumentSerde 57 } 58 59 // A complex type that contains the response information from a 60 // CreateVPCAssociationAuthorization request. 61 type CreateVPCAssociationAuthorizationOutput struct { 62 63 // The ID of the hosted zone that you authorized associating a VPC with. 64 // 65 // This member is required. 66 HostedZoneId *string 67 68 // The VPC that you authorized associating with a hosted zone. 69 // 70 // This member is required. 71 VPC *types.VPC 72 73 // Metadata pertaining to the operation's result. 74 ResultMetadata middleware.Metadata 75 76 noSmithyDocumentSerde 77 } 78 79 func (c *Client) addOperationCreateVPCAssociationAuthorizationMiddlewares(stack *middleware.Stack, options Options) (err error) { 80 if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { 81 return err 82 } 83 err = stack.Serialize.Add(&awsRestxml_serializeOpCreateVPCAssociationAuthorization{}, middleware.After) 84 if err != nil { 85 return err 86 } 87 err = stack.Deserialize.Add(&awsRestxml_deserializeOpCreateVPCAssociationAuthorization{}, middleware.After) 88 if err != nil { 89 return err 90 } 91 if err := addProtocolFinalizerMiddlewares(stack, options, "CreateVPCAssociationAuthorization"); err != nil { 92 return fmt.Errorf("add protocol finalizers: %v", err) 93 } 94 95 if err = addlegacyEndpointContextSetter(stack, options); err != nil { 96 return err 97 } 98 if err = addSetLoggerMiddleware(stack, options); err != nil { 99 return err 100 } 101 if err = addClientRequestID(stack); err != nil { 102 return err 103 } 104 if err = addComputeContentLength(stack); err != nil { 105 return err 106 } 107 if err = addResolveEndpointMiddleware(stack, options); err != nil { 108 return err 109 } 110 if err = addComputePayloadSHA256(stack); err != nil { 111 return err 112 } 113 if err = addRetry(stack, options); err != nil { 114 return err 115 } 116 if err = addRawResponseToMetadata(stack); err != nil { 117 return err 118 } 119 if err = addRecordResponseTiming(stack); err != nil { 120 return err 121 } 122 if err = addSpanRetryLoop(stack, options); err != nil { 123 return err 124 } 125 if err = addClientUserAgent(stack, options); err != nil { 126 return err 127 } 128 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 129 return err 130 } 131 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 132 return err 133 } 134 if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { 135 return err 136 } 137 if err = addTimeOffsetBuild(stack, c); err != nil { 138 return err 139 } 140 if err = addUserAgentRetryMode(stack, options); err != nil { 141 return err 142 } 143 if err = addCredentialSource(stack, options); err != nil { 144 return err 145 } 146 if err = addOpCreateVPCAssociationAuthorizationValidationMiddleware(stack); err != nil { 147 return err 148 } 149 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateVPCAssociationAuthorization(options.Region), middleware.Before); err != nil { 150 return err 151 } 152 if err = addRecursionDetection(stack); err != nil { 153 return err 154 } 155 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 156 return err 157 } 158 if err = addResponseErrorMiddleware(stack); err != nil { 159 return err 160 } 161 if err = addSanitizeURLMiddleware(stack); err != nil { 162 return err 163 } 164 if err = addRequestResponseLogging(stack, options); err != nil { 165 return err 166 } 167 if err = addDisableHTTPSMiddleware(stack, options); err != nil { 168 return err 169 } 170 if err = addInterceptBeforeRetryLoop(stack, options); err != nil { 171 return err 172 } 173 if err = addInterceptAttempt(stack, options); err != nil { 174 return err 175 } 176 if err = addInterceptExecution(stack, options); err != nil { 177 return err 178 } 179 if err = addInterceptBeforeSerialization(stack, options); err != nil { 180 return err 181 } 182 if err = addInterceptAfterSerialization(stack, options); err != nil { 183 return err 184 } 185 if err = addInterceptBeforeSigning(stack, options); err != nil { 186 return err 187 } 188 if err = addInterceptAfterSigning(stack, options); err != nil { 189 return err 190 } 191 if err = addInterceptTransmit(stack, options); err != nil { 192 return err 193 } 194 if err = addInterceptBeforeDeserialization(stack, options); err != nil { 195 return err 196 } 197 if err = addInterceptAfterDeserialization(stack, options); err != nil { 198 return err 199 } 200 if err = addSpanInitializeStart(stack); err != nil { 201 return err 202 } 203 if err = addSpanInitializeEnd(stack); err != nil { 204 return err 205 } 206 if err = addSpanBuildRequestStart(stack); err != nil { 207 return err 208 } 209 if err = addSpanBuildRequestEnd(stack); err != nil { 210 return err 211 } 212 return nil 213 } 214 215 func newServiceMetadataMiddleware_opCreateVPCAssociationAuthorization(region string) *awsmiddleware.RegisterServiceMetadata { 216 return &awsmiddleware.RegisterServiceMetadata{ 217 Region: region, 218 ServiceID: ServiceID, 219 OperationName: "CreateVPCAssociationAuthorization", 220 } 221 }