src

Go monorepo.
git clone git://code.dwrz.net/src
Log | Files | Refs

api_op_AssociateVPCWithHostedZone.go (7246B)


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