src

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

api_op_DisassociateVPCFromHostedZone.go (6328B)


      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 // Disassociates an Amazon Virtual Private Cloud (Amazon VPC) from an Amazon Route
     15 // 53 private hosted zone. Note the following:
     16 //
     17 //   - You can't disassociate the last Amazon VPC from a private hosted zone.
     18 //
     19 //   - You can't convert a private hosted zone into a public hosted zone.
     20 //
     21 //   - You can submit a DisassociateVPCFromHostedZone request using either the
     22 //     account that created the hosted zone or the account that created the Amazon VPC.
     23 //
     24 //   - Some services, such as Cloud Map and Amazon Elastic File System (Amazon
     25 //     EFS) automatically create hosted zones and associate VPCs with the hosted zones.
     26 //     A service can create a hosted zone using your account or using its own account.
     27 //     You can disassociate a VPC from a hosted zone only if the service created the
     28 //     hosted zone using your account. When you run DisassociateVPCFromHostedZone (https://docs.aws.amazon.com/Route53/latest/APIReference/API_ListHostedZonesByVPC.html)
     29 //     , if the hosted zone has a value for OwningAccount , you can use
     30 //     DisassociateVPCFromHostedZone . If the hosted zone has a value for
     31 //     OwningService , you can't use DisassociateVPCFromHostedZone .
     32 //
     33 // When revoking access, the hosted zone and the Amazon VPC must belong to the
     34 // same partition. A partition is a group of Amazon Web Services Regions. Each
     35 // Amazon Web Services account is scoped to one partition. The following are the
     36 // supported partitions:
     37 //   - aws - Amazon Web Services Regions
     38 //   - aws-cn - China Regions
     39 //   - aws-us-gov - Amazon Web Services GovCloud (US) Region
     40 //
     41 // For more information, see Access Management (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)
     42 // in the Amazon Web Services General Reference.
     43 func (c *Client) DisassociateVPCFromHostedZone(ctx context.Context, params *DisassociateVPCFromHostedZoneInput, optFns ...func(*Options)) (*DisassociateVPCFromHostedZoneOutput, error) {
     44 	if params == nil {
     45 		params = &DisassociateVPCFromHostedZoneInput{}
     46 	}
     47 
     48 	result, metadata, err := c.invokeOperation(ctx, "DisassociateVPCFromHostedZone", params, optFns, c.addOperationDisassociateVPCFromHostedZoneMiddlewares)
     49 	if err != nil {
     50 		return nil, err
     51 	}
     52 
     53 	out := result.(*DisassociateVPCFromHostedZoneOutput)
     54 	out.ResultMetadata = metadata
     55 	return out, nil
     56 }
     57 
     58 // A complex type that contains information about the VPC that you want to
     59 // disassociate from a specified private hosted zone.
     60 type DisassociateVPCFromHostedZoneInput struct {
     61 
     62 	// The ID of the private hosted zone that you want to disassociate a VPC from.
     63 	//
     64 	// This member is required.
     65 	HostedZoneId *string
     66 
     67 	// A complex type that contains information about the VPC that you're
     68 	// disassociating from the specified hosted zone.
     69 	//
     70 	// This member is required.
     71 	VPC *types.VPC
     72 
     73 	// Optional: A comment about the disassociation request.
     74 	Comment *string
     75 
     76 	noSmithyDocumentSerde
     77 }
     78 
     79 // A complex type that contains the response information for the disassociate
     80 // request.
     81 type DisassociateVPCFromHostedZoneOutput struct {
     82 
     83 	// A complex type that describes the changes made to the specified private hosted
     84 	// 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) addOperationDisassociateVPCFromHostedZoneMiddlewares(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_serializeOpDisassociateVPCFromHostedZone{}, middleware.After)
    100 	if err != nil {
    101 		return err
    102 	}
    103 	err = stack.Deserialize.Add(&awsRestxml_deserializeOpDisassociateVPCFromHostedZone{}, middleware.After)
    104 	if err != nil {
    105 		return err
    106 	}
    107 	if err := addProtocolFinalizerMiddlewares(stack, options, "DisassociateVPCFromHostedZone"); 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 = addClientUserAgent(stack, options); err != nil {
    139 		return err
    140 	}
    141 	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
    142 		return err
    143 	}
    144 	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
    145 		return err
    146 	}
    147 	if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
    148 		return err
    149 	}
    150 	if err = addOpDisassociateVPCFromHostedZoneValidationMiddleware(stack); err != nil {
    151 		return err
    152 	}
    153 	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDisassociateVPCFromHostedZone(options.Region), middleware.Before); err != nil {
    154 		return err
    155 	}
    156 	if err = addRecursionDetection(stack); err != nil {
    157 		return err
    158 	}
    159 	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
    160 		return err
    161 	}
    162 	if err = addResponseErrorMiddleware(stack); err != nil {
    163 		return err
    164 	}
    165 	if err = addSanitizeURLMiddleware(stack); err != nil {
    166 		return err
    167 	}
    168 	if err = addRequestResponseLogging(stack, options); err != nil {
    169 		return err
    170 	}
    171 	if err = addDisableHTTPSMiddleware(stack, options); err != nil {
    172 		return err
    173 	}
    174 	return nil
    175 }
    176 
    177 func newServiceMetadataMiddleware_opDisassociateVPCFromHostedZone(region string) *awsmiddleware.RegisterServiceMetadata {
    178 	return &awsmiddleware.RegisterServiceMetadata{
    179 		Region:        region,
    180 		ServiceID:     ServiceID,
    181 		OperationName: "DisassociateVPCFromHostedZone",
    182 	}
    183 }