api_op_DisassociateVPCFromHostedZone.go (4930B)
1 // Code generated by smithy-go-codegen DO NOT EDIT. 2 3 package route53 4 5 import ( 6 "context" 7 8 "github.com/aws/aws-sdk-go-v2/service/route53/types" 9 "github.com/aws/smithy-go/middleware" 10 ) 11 12 // Disassociates an Amazon Virtual Private Cloud (Amazon VPC) from an Amazon Route 13 // 53 private hosted zone. Note the following: 14 // 15 // - You can't disassociate the last Amazon VPC from a private hosted zone. 16 // 17 // - You can't convert a private hosted zone into a public hosted zone. 18 // 19 // - You can submit a DisassociateVPCFromHostedZone request using either the 20 // account that created the hosted zone or the account that created the Amazon VPC. 21 // 22 // - Some services, such as Cloud Map and Amazon Elastic File System (Amazon 23 // EFS) automatically create hosted zones and associate VPCs with the hosted zones. 24 // A service can create a hosted zone using your account or using its own account. 25 // You can disassociate a VPC from a hosted zone only if the service created the 26 // hosted zone using your account. 27 // 28 // When you run [DisassociateVPCFromHostedZone], if the hosted zone has a value for OwningAccount , you can use 29 // 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. 36 // 37 // The following are the supported partitions: 38 // 39 // - aws - Amazon Web Services Regions 40 // 41 // - aws-cn - China Regions 42 // 43 // - aws-us-gov - Amazon Web Services GovCloud (US) Region 44 // 45 // For more information, see [Access Management] in the Amazon Web Services General Reference. 46 // 47 // [Access Management]: https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html 48 // [DisassociateVPCFromHostedZone]: https://docs.aws.amazon.com/Route53/latest/APIReference/API_ListHostedZonesByVPC.html 49 func (c *Client) DisassociateVPCFromHostedZone(ctx context.Context, params *DisassociateVPCFromHostedZoneInput, optFns ...func(*Options)) (*DisassociateVPCFromHostedZoneOutput, error) { 50 if params == nil { 51 params = &DisassociateVPCFromHostedZoneInput{} 52 } 53 54 result, metadata, err := c.invokeOperation(ctx, "DisassociateVPCFromHostedZone", params, optFns, c.addOperationDisassociateVPCFromHostedZoneMiddlewares) 55 if err != nil { 56 return nil, err 57 } 58 59 out := result.(*DisassociateVPCFromHostedZoneOutput) 60 out.ResultMetadata = metadata 61 return out, nil 62 } 63 64 // A complex type that contains information about the VPC that you want to 65 // disassociate from a specified private hosted zone. 66 type DisassociateVPCFromHostedZoneInput struct { 67 68 // The ID of the private hosted zone that you want to disassociate a VPC from. 69 // 70 // This member is required. 71 HostedZoneId *string 72 73 // A complex type that contains information about the VPC that you're 74 // disassociating from the specified hosted zone. 75 // 76 // This member is required. 77 VPC *types.VPC 78 79 // Optional: A comment about the disassociation request. 80 Comment *string 81 82 noSmithyDocumentSerde 83 } 84 85 // A complex type that contains the response information for the disassociate 86 // request. 87 type DisassociateVPCFromHostedZoneOutput struct { 88 89 // A complex type that describes the changes made to the specified private hosted 90 // zone. 91 // 92 // This member is required. 93 ChangeInfo *types.ChangeInfo 94 95 // Metadata pertaining to the operation's result. 96 ResultMetadata middleware.Metadata 97 98 noSmithyDocumentSerde 99 } 100 101 func (c *Client) addOperationDisassociateVPCFromHostedZoneMiddlewares(stack *middleware.Stack, options Options) (err error) { 102 err = stack.Serialize.Add(&awsRestxml_serializeOpDisassociateVPCFromHostedZone{}, middleware.After) 103 if err != nil { 104 return err 105 } 106 err = stack.Deserialize.Add(&awsRestxml_deserializeOpDisassociateVPCFromHostedZone{}, middleware.After) 107 if err != nil { 108 return err 109 } 110 111 if err = addComputeContentLength(stack); err != nil { 112 return err 113 } 114 if err = addResolveEndpointMiddleware(stack, options); err != nil { 115 return err 116 } 117 if err = addComputePayloadSHA256(stack); err != nil { 118 return err 119 } 120 if err = addRecordResponseTiming(stack, options); err != nil { 121 return err 122 } 123 if err = addCredentialSource(stack, options); err != nil { 124 return err 125 } 126 if err = addOpDisassociateVPCFromHostedZoneValidationMiddleware(stack); err != nil { 127 return err 128 } 129 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 130 return err 131 } 132 if err = addResponseErrorMiddleware(stack); err != nil { 133 return err 134 } 135 if err = addSanitizeURLMiddleware(stack); err != nil { 136 return err 137 } 138 if err = addRequestResponseLogging(stack, options); err != nil { 139 return err 140 } 141 if err = addDisableHTTPSMiddleware(stack, options); err != nil { 142 return err 143 } 144 if err = addInterceptors(stack, options); err != nil { 145 return err 146 } 147 return nil 148 }