api_op_CreateVPCAssociationAuthorization.go (5099B)
1 // Code generated by smithy-go-codegen DO NOT EDIT. 2 3 package route53 4 5 import ( 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/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. If you want to 20 // associate multiple VPCs that you created by using one account with a hosted zone 21 // that you created by using a different account, you must submit one authorization 22 // request for each VPC. 23 func (c *Client) CreateVPCAssociationAuthorization(ctx context.Context, params *CreateVPCAssociationAuthorizationInput, optFns ...func(*Options)) (*CreateVPCAssociationAuthorizationOutput, error) { 24 if params == nil { 25 params = &CreateVPCAssociationAuthorizationInput{} 26 } 27 28 result, metadata, err := c.invokeOperation(ctx, "CreateVPCAssociationAuthorization", params, optFns, c.addOperationCreateVPCAssociationAuthorizationMiddlewares) 29 if err != nil { 30 return nil, err 31 } 32 33 out := result.(*CreateVPCAssociationAuthorizationOutput) 34 out.ResultMetadata = metadata 35 return out, nil 36 } 37 38 // A complex type that contains information about the request to authorize 39 // associating a VPC with your private hosted zone. Authorization is only required 40 // when a private hosted zone and a VPC were created by using different accounts. 41 type CreateVPCAssociationAuthorizationInput struct { 42 43 // The ID of the private hosted zone that you want to authorize associating a VPC 44 // with. 45 // 46 // This member is required. 47 HostedZoneId *string 48 49 // A complex type that contains the VPC ID and region for the VPC that you want to 50 // authorize associating with your hosted zone. 51 // 52 // This member is required. 53 VPC *types.VPC 54 55 noSmithyDocumentSerde 56 } 57 58 // A complex type that contains the response information from a 59 // CreateVPCAssociationAuthorization request. 60 type CreateVPCAssociationAuthorizationOutput struct { 61 62 // The ID of the hosted zone that you authorized associating a VPC with. 63 // 64 // This member is required. 65 HostedZoneId *string 66 67 // The VPC that you authorized associating with a hosted zone. 68 // 69 // This member is required. 70 VPC *types.VPC 71 72 // Metadata pertaining to the operation's result. 73 ResultMetadata middleware.Metadata 74 75 noSmithyDocumentSerde 76 } 77 78 func (c *Client) addOperationCreateVPCAssociationAuthorizationMiddlewares(stack *middleware.Stack, options Options) (err error) { 79 err = stack.Serialize.Add(&awsRestxml_serializeOpCreateVPCAssociationAuthorization{}, middleware.After) 80 if err != nil { 81 return err 82 } 83 err = stack.Deserialize.Add(&awsRestxml_deserializeOpCreateVPCAssociationAuthorization{}, middleware.After) 84 if err != nil { 85 return err 86 } 87 if err = addSetLoggerMiddleware(stack, options); err != nil { 88 return err 89 } 90 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 91 return err 92 } 93 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 94 return err 95 } 96 if err = addResolveEndpointMiddleware(stack, options); err != nil { 97 return err 98 } 99 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 100 return err 101 } 102 if err = addRetryMiddlewares(stack, options); err != nil { 103 return err 104 } 105 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 106 return err 107 } 108 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 109 return err 110 } 111 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 112 return err 113 } 114 if err = addClientUserAgent(stack); err != nil { 115 return err 116 } 117 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 118 return err 119 } 120 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 121 return err 122 } 123 if err = addOpCreateVPCAssociationAuthorizationValidationMiddleware(stack); err != nil { 124 return err 125 } 126 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateVPCAssociationAuthorization(options.Region), middleware.Before); err != nil { 127 return err 128 } 129 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 130 return err 131 } 132 if err = addResponseErrorMiddleware(stack); err != nil { 133 return err 134 } 135 if err = addSanitizeURLMiddleware(stack); err != nil { 136 return err 137 } 138 if err = addRequestResponseLogging(stack, options); err != nil { 139 return err 140 } 141 return nil 142 } 143 144 func newServiceMetadataMiddleware_opCreateVPCAssociationAuthorization(region string) *awsmiddleware.RegisterServiceMetadata { 145 return &awsmiddleware.RegisterServiceMetadata{ 146 Region: region, 147 ServiceID: ServiceID, 148 SigningName: "route53", 149 OperationName: "CreateVPCAssociationAuthorization", 150 } 151 }