api_op_DisassociateVPCFromHostedZone.go (5941B)
1 // Code generated by smithy-go-codegen DO NOT EDIT. 2 3 package route53 4 5 import ( 6 "context" 7 awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" 8 "github.com/aws/aws-sdk-go-v2/aws/signer/v4" 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 18 // Amazon VPC from a private hosted zone. 19 // 20 // * You can't convert a private hosted 21 // zone into a public hosted zone. 22 // 23 // * You can submit a 24 // DisassociateVPCFromHostedZone request using either the account that created the 25 // hosted zone or the account that created the Amazon VPC. 26 // 27 // * Some services, such 28 // as Cloud Map and Amazon Elastic File System (Amazon EFS) automatically create 29 // hosted zones and associate VPCs with the hosted zones. A service can create a 30 // hosted zone using your account or using its own account. You can disassociate a 31 // VPC from a hosted zone only if the service created the hosted zone using your 32 // account. When you run DisassociateVPCFromHostedZone 33 // (https://docs.aws.amazon.com/Route53/latest/APIReference/API_ListHostedZonesByVPC.html), 34 // if the hosted zone has a value for OwningAccount, you can use 35 // DisassociateVPCFromHostedZone. If the hosted zone has a value for OwningService, 36 // you can't use DisassociateVPCFromHostedZone. 37 // 38 // When revoking access, the hosted 39 // zone and the Amazon VPC must belong to the same partition. A partition is a 40 // group of Amazon Web Services Regions. Each Amazon Web Services account is scoped 41 // to one partition. The following are the supported partitions: 42 // 43 // * aws - Amazon 44 // Web Services Regions 45 // 46 // * aws-cn - China Regions 47 // 48 // * aws-us-gov - Amazon Web 49 // Services GovCloud (US) Region 50 // 51 // For more information, see Access Management 52 // (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) in 53 // the Amazon Web Services General Reference. 54 func (c *Client) DisassociateVPCFromHostedZone(ctx context.Context, params *DisassociateVPCFromHostedZoneInput, optFns ...func(*Options)) (*DisassociateVPCFromHostedZoneOutput, error) { 55 if params == nil { 56 params = &DisassociateVPCFromHostedZoneInput{} 57 } 58 59 result, metadata, err := c.invokeOperation(ctx, "DisassociateVPCFromHostedZone", params, optFns, c.addOperationDisassociateVPCFromHostedZoneMiddlewares) 60 if err != nil { 61 return nil, err 62 } 63 64 out := result.(*DisassociateVPCFromHostedZoneOutput) 65 out.ResultMetadata = metadata 66 return out, nil 67 } 68 69 // A complex type that contains information about the VPC that you want to 70 // disassociate from a specified private hosted zone. 71 type DisassociateVPCFromHostedZoneInput struct { 72 73 // The ID of the private hosted zone that you want to disassociate a VPC from. 74 // 75 // This member is required. 76 HostedZoneId *string 77 78 // A complex type that contains information about the VPC that you're 79 // disassociating from the specified hosted zone. 80 // 81 // This member is required. 82 VPC *types.VPC 83 84 // Optional: A comment about the disassociation request. 85 Comment *string 86 87 noSmithyDocumentSerde 88 } 89 90 // A complex type that contains the response information for the disassociate 91 // request. 92 type DisassociateVPCFromHostedZoneOutput struct { 93 94 // A complex type that describes the changes made to the specified private hosted 95 // zone. 96 // 97 // This member is required. 98 ChangeInfo *types.ChangeInfo 99 100 // Metadata pertaining to the operation's result. 101 ResultMetadata middleware.Metadata 102 103 noSmithyDocumentSerde 104 } 105 106 func (c *Client) addOperationDisassociateVPCFromHostedZoneMiddlewares(stack *middleware.Stack, options Options) (err error) { 107 err = stack.Serialize.Add(&awsRestxml_serializeOpDisassociateVPCFromHostedZone{}, middleware.After) 108 if err != nil { 109 return err 110 } 111 err = stack.Deserialize.Add(&awsRestxml_deserializeOpDisassociateVPCFromHostedZone{}, middleware.After) 112 if err != nil { 113 return err 114 } 115 if err = addSetLoggerMiddleware(stack, options); err != nil { 116 return err 117 } 118 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 119 return err 120 } 121 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 122 return err 123 } 124 if err = addResolveEndpointMiddleware(stack, options); err != nil { 125 return err 126 } 127 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 128 return err 129 } 130 if err = addRetryMiddlewares(stack, options); err != nil { 131 return err 132 } 133 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 134 return err 135 } 136 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 137 return err 138 } 139 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 140 return err 141 } 142 if err = addClientUserAgent(stack); err != nil { 143 return err 144 } 145 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 146 return err 147 } 148 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 149 return err 150 } 151 if err = addOpDisassociateVPCFromHostedZoneValidationMiddleware(stack); err != nil { 152 return err 153 } 154 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDisassociateVPCFromHostedZone(options.Region), middleware.Before); err != nil { 155 return err 156 } 157 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 158 return err 159 } 160 if err = addResponseErrorMiddleware(stack); err != nil { 161 return err 162 } 163 if err = addSanitizeURLMiddleware(stack); err != nil { 164 return err 165 } 166 if err = addRequestResponseLogging(stack, options); err != nil { 167 return err 168 } 169 return nil 170 } 171 172 func newServiceMetadataMiddleware_opDisassociateVPCFromHostedZone(region string) *awsmiddleware.RegisterServiceMetadata { 173 return &awsmiddleware.RegisterServiceMetadata{ 174 Region: region, 175 ServiceID: ServiceID, 176 SigningName: "route53", 177 OperationName: "DisassociateVPCFromHostedZone", 178 } 179 }