api_op_AssociateVPCWithHostedZone.go (5782B)
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 // Associates an Amazon VPC with a private hosted zone. To perform the 15 // association, the VPC and the private hosted zone must already exist. You can't 16 // convert a public hosted zone into a private hosted zone. If you want to 17 // associate a VPC that was created by using one Amazon Web Services account with a 18 // private hosted zone that was created by using a different account, the Amazon 19 // Web Services account that created the private hosted zone must first submit a 20 // CreateVPCAssociationAuthorization request. Then the account that created the VPC 21 // must submit an AssociateVPCWithHostedZone request. When granting access, the 22 // hosted zone and the Amazon VPC must belong to the same partition. A partition is 23 // a group of Amazon Web Services Regions. Each Amazon Web Services account is 24 // scoped to one partition. The following are the supported partitions: 25 // - aws - Amazon Web Services Regions 26 // - aws-cn - China Regions 27 // - aws-us-gov - Amazon Web Services GovCloud (US) Region 28 // 29 // For more information, see Access Management (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) 30 // in the Amazon Web Services General Reference. 31 func (c *Client) AssociateVPCWithHostedZone(ctx context.Context, params *AssociateVPCWithHostedZoneInput, optFns ...func(*Options)) (*AssociateVPCWithHostedZoneOutput, error) { 32 if params == nil { 33 params = &AssociateVPCWithHostedZoneInput{} 34 } 35 36 result, metadata, err := c.invokeOperation(ctx, "AssociateVPCWithHostedZone", params, optFns, c.addOperationAssociateVPCWithHostedZoneMiddlewares) 37 if err != nil { 38 return nil, err 39 } 40 41 out := result.(*AssociateVPCWithHostedZoneOutput) 42 out.ResultMetadata = metadata 43 return out, nil 44 } 45 46 // A complex type that contains information about the request to associate a VPC 47 // with a private hosted zone. 48 type AssociateVPCWithHostedZoneInput struct { 49 50 // The ID of the private hosted zone that you want to associate an Amazon VPC 51 // with. Note that you can't associate a VPC with a hosted zone that doesn't have 52 // an existing VPC association. 53 // 54 // This member is required. 55 HostedZoneId *string 56 57 // A complex type that contains information about the VPC that you want to 58 // associate with a private hosted zone. 59 // 60 // This member is required. 61 VPC *types.VPC 62 63 // Optional: A comment about the association request. 64 Comment *string 65 66 noSmithyDocumentSerde 67 } 68 69 // A complex type that contains the response information for the 70 // AssociateVPCWithHostedZone request. 71 type AssociateVPCWithHostedZoneOutput struct { 72 73 // A complex type that describes the changes made to your hosted zone. 74 // 75 // This member is required. 76 ChangeInfo *types.ChangeInfo 77 78 // Metadata pertaining to the operation's result. 79 ResultMetadata middleware.Metadata 80 81 noSmithyDocumentSerde 82 } 83 84 func (c *Client) addOperationAssociateVPCWithHostedZoneMiddlewares(stack *middleware.Stack, options Options) (err error) { 85 if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { 86 return err 87 } 88 err = stack.Serialize.Add(&awsRestxml_serializeOpAssociateVPCWithHostedZone{}, middleware.After) 89 if err != nil { 90 return err 91 } 92 err = stack.Deserialize.Add(&awsRestxml_deserializeOpAssociateVPCWithHostedZone{}, middleware.After) 93 if err != nil { 94 return err 95 } 96 if err := addProtocolFinalizerMiddlewares(stack, options, "AssociateVPCWithHostedZone"); err != nil { 97 return fmt.Errorf("add protocol finalizers: %v", err) 98 } 99 100 if err = addlegacyEndpointContextSetter(stack, options); err != nil { 101 return err 102 } 103 if err = addSetLoggerMiddleware(stack, options); err != nil { 104 return err 105 } 106 if err = addClientRequestID(stack); err != nil { 107 return err 108 } 109 if err = addComputeContentLength(stack); err != nil { 110 return err 111 } 112 if err = addResolveEndpointMiddleware(stack, options); err != nil { 113 return err 114 } 115 if err = addComputePayloadSHA256(stack); err != nil { 116 return err 117 } 118 if err = addRetry(stack, options); err != nil { 119 return err 120 } 121 if err = addRawResponseToMetadata(stack); err != nil { 122 return err 123 } 124 if err = addRecordResponseTiming(stack); err != nil { 125 return err 126 } 127 if err = addClientUserAgent(stack, options); err != nil { 128 return err 129 } 130 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 131 return err 132 } 133 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 134 return err 135 } 136 if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { 137 return err 138 } 139 if err = addOpAssociateVPCWithHostedZoneValidationMiddleware(stack); err != nil { 140 return err 141 } 142 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opAssociateVPCWithHostedZone(options.Region), middleware.Before); err != nil { 143 return err 144 } 145 if err = addRecursionDetection(stack); err != nil { 146 return err 147 } 148 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 149 return err 150 } 151 if err = addResponseErrorMiddleware(stack); err != nil { 152 return err 153 } 154 if err = addSanitizeURLMiddleware(stack); err != nil { 155 return err 156 } 157 if err = addRequestResponseLogging(stack, options); err != nil { 158 return err 159 } 160 if err = addDisableHTTPSMiddleware(stack, options); err != nil { 161 return err 162 } 163 return nil 164 } 165 166 func newServiceMetadataMiddleware_opAssociateVPCWithHostedZone(region string) *awsmiddleware.RegisterServiceMetadata { 167 return &awsmiddleware.RegisterServiceMetadata{ 168 Region: region, 169 ServiceID: ServiceID, 170 OperationName: "AssociateVPCWithHostedZone", 171 } 172 }