src

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

api_op_CreateVPCAssociationAuthorization.go (5472B)


      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. 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 	if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
     80 		return err
     81 	}
     82 	err = stack.Serialize.Add(&awsRestxml_serializeOpCreateVPCAssociationAuthorization{}, middleware.After)
     83 	if err != nil {
     84 		return err
     85 	}
     86 	err = stack.Deserialize.Add(&awsRestxml_deserializeOpCreateVPCAssociationAuthorization{}, middleware.After)
     87 	if err != nil {
     88 		return err
     89 	}
     90 	if err := addProtocolFinalizerMiddlewares(stack, options, "CreateVPCAssociationAuthorization"); err != nil {
     91 		return fmt.Errorf("add protocol finalizers: %v", err)
     92 	}
     93 
     94 	if err = addlegacyEndpointContextSetter(stack, options); err != nil {
     95 		return err
     96 	}
     97 	if err = addSetLoggerMiddleware(stack, options); err != nil {
     98 		return err
     99 	}
    100 	if err = addClientRequestID(stack); err != nil {
    101 		return err
    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 = addRetry(stack, options); err != nil {
    113 		return err
    114 	}
    115 	if err = addRawResponseToMetadata(stack); err != nil {
    116 		return err
    117 	}
    118 	if err = addRecordResponseTiming(stack); err != nil {
    119 		return err
    120 	}
    121 	if err = addClientUserAgent(stack, options); err != nil {
    122 		return err
    123 	}
    124 	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
    125 		return err
    126 	}
    127 	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
    128 		return err
    129 	}
    130 	if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
    131 		return err
    132 	}
    133 	if err = addOpCreateVPCAssociationAuthorizationValidationMiddleware(stack); err != nil {
    134 		return err
    135 	}
    136 	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateVPCAssociationAuthorization(options.Region), middleware.Before); err != nil {
    137 		return err
    138 	}
    139 	if err = addRecursionDetection(stack); err != nil {
    140 		return err
    141 	}
    142 	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
    143 		return err
    144 	}
    145 	if err = addResponseErrorMiddleware(stack); err != nil {
    146 		return err
    147 	}
    148 	if err = addSanitizeURLMiddleware(stack); err != nil {
    149 		return err
    150 	}
    151 	if err = addRequestResponseLogging(stack, options); err != nil {
    152 		return err
    153 	}
    154 	if err = addDisableHTTPSMiddleware(stack, options); err != nil {
    155 		return err
    156 	}
    157 	return nil
    158 }
    159 
    160 func newServiceMetadataMiddleware_opCreateVPCAssociationAuthorization(region string) *awsmiddleware.RegisterServiceMetadata {
    161 	return &awsmiddleware.RegisterServiceMetadata{
    162 		Region:        region,
    163 		ServiceID:     ServiceID,
    164 		OperationName: "CreateVPCAssociationAuthorization",
    165 	}
    166 }