api_op_AssociateVPCWithHostedZone.go (4386B)
1 // Code generated by smithy-go-codegen DO NOT EDIT. 2 3 package route53 4 5 import ( 6 "context" 7 8 "github.com/aws/aws-sdk-go-v2/service/route53/types" 9 "github.com/aws/smithy-go/middleware" 10 ) 11 12 // Associates an Amazon VPC with a private hosted zone. 13 // 14 // To perform the association, the VPC and the private hosted zone must already 15 // exist. You can't convert a public hosted zone into a private hosted zone. 16 // 17 // If you want to associate a VPC that was created by using one Amazon Web 18 // Services account with a private hosted zone that was created by using a 19 // different account, the Amazon Web Services account that created the private 20 // hosted zone must first submit a CreateVPCAssociationAuthorization request. Then 21 // the account that created the VPC must submit an AssociateVPCWithHostedZone 22 // request. 23 // 24 // When granting access, the hosted zone and the Amazon VPC must belong to the 25 // same partition. A partition is a group of Amazon Web Services Regions. Each 26 // Amazon Web Services account is scoped to one partition. 27 // 28 // The following are the supported partitions: 29 // 30 // - aws - Amazon Web Services Regions 31 // 32 // - aws-cn - China Regions 33 // 34 // - aws-us-gov - Amazon Web Services GovCloud (US) Region 35 // 36 // For more information, see [Access Management] in the Amazon Web Services General Reference. 37 // 38 // [Access Management]: https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html 39 func (c *Client) AssociateVPCWithHostedZone(ctx context.Context, params *AssociateVPCWithHostedZoneInput, optFns ...func(*Options)) (*AssociateVPCWithHostedZoneOutput, error) { 40 if params == nil { 41 params = &AssociateVPCWithHostedZoneInput{} 42 } 43 44 result, metadata, err := c.invokeOperation(ctx, "AssociateVPCWithHostedZone", params, optFns, c.addOperationAssociateVPCWithHostedZoneMiddlewares) 45 if err != nil { 46 return nil, err 47 } 48 49 out := result.(*AssociateVPCWithHostedZoneOutput) 50 out.ResultMetadata = metadata 51 return out, nil 52 } 53 54 // A complex type that contains information about the request to associate a VPC 55 // with a private hosted zone. 56 type AssociateVPCWithHostedZoneInput struct { 57 58 // The ID of the private hosted zone that you want to associate an Amazon VPC with. 59 // 60 // Note that you can't associate a VPC with a hosted zone that doesn't have an 61 // existing VPC association. 62 // 63 // This member is required. 64 HostedZoneId *string 65 66 // A complex type that contains information about the VPC that you want to 67 // associate with a private hosted zone. 68 // 69 // This member is required. 70 VPC *types.VPC 71 72 // Optional: A comment about the association request. 73 Comment *string 74 75 noSmithyDocumentSerde 76 } 77 78 // A complex type that contains the response information for the 79 // AssociateVPCWithHostedZone request. 80 type AssociateVPCWithHostedZoneOutput struct { 81 82 // A complex type that describes the changes made to your hosted zone. 83 // 84 // This member is required. 85 ChangeInfo *types.ChangeInfo 86 87 // Metadata pertaining to the operation's result. 88 ResultMetadata middleware.Metadata 89 90 noSmithyDocumentSerde 91 } 92 93 func (c *Client) addOperationAssociateVPCWithHostedZoneMiddlewares(stack *middleware.Stack, options Options) (err error) { 94 err = stack.Serialize.Add(&awsRestxml_serializeOpAssociateVPCWithHostedZone{}, middleware.After) 95 if err != nil { 96 return err 97 } 98 err = stack.Deserialize.Add(&awsRestxml_deserializeOpAssociateVPCWithHostedZone{}, middleware.After) 99 if err != nil { 100 return err 101 } 102 103 if err = addComputeContentLength(stack); err != nil { 104 return err 105 } 106 if err = addResolveEndpointMiddleware(stack, options); err != nil { 107 return err 108 } 109 if err = addComputePayloadSHA256(stack); err != nil { 110 return err 111 } 112 if err = addRecordResponseTiming(stack, options); err != nil { 113 return err 114 } 115 if err = addCredentialSource(stack, options); err != nil { 116 return err 117 } 118 if err = addOpAssociateVPCWithHostedZoneValidationMiddleware(stack); 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 = addSanitizeURLMiddleware(stack); err != nil { 128 return err 129 } 130 if err = addRequestResponseLogging(stack, options); err != nil { 131 return err 132 } 133 if err = addDisableHTTPSMiddleware(stack, options); err != nil { 134 return err 135 } 136 if err = addInterceptors(stack, options); err != nil { 137 return err 138 } 139 return nil 140 }