api_op_DeleteHostedZone.go (6488B)
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 // Deletes a hosted zone. If the hosted zone was created by another service, such 15 // as Cloud Map, see Deleting Public Hosted Zones That Were Created by Another 16 // Service 17 // (https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DeleteHostedZone.html#delete-public-hosted-zone-created-by-another-service) 18 // in the Amazon Route 53 Developer Guide for information about how to delete it. 19 // (The process is the same for public and private hosted zones that were created 20 // by another service.) If you want to keep your domain registration but you want 21 // to stop routing internet traffic to your website or web application, we 22 // recommend that you delete resource record sets in the hosted zone instead of 23 // deleting the hosted zone. If you delete a hosted zone, you can't undelete it. 24 // You must create a new hosted zone and update the name servers for your domain 25 // registration, which can require up to 48 hours to take effect. (If you delegated 26 // responsibility for a subdomain to a hosted zone and you delete the child hosted 27 // zone, you must update the name servers in the parent hosted zone.) In addition, 28 // if you delete a hosted zone, someone could hijack the domain and route traffic 29 // to their own resources using your domain name. If you want to avoid the monthly 30 // charge for the hosted zone, you can transfer DNS service for the domain to a 31 // free DNS service. When you transfer DNS service, you have to update the name 32 // servers for the domain registration. If the domain is registered with Route 53, 33 // see UpdateDomainNameservers 34 // (https://docs.aws.amazon.com/Route53/latest/APIReference/API_domains_UpdateDomainNameservers.html) 35 // for information about how to replace Route 53 name servers with name servers for 36 // the new DNS service. If the domain is registered with another registrar, use the 37 // method provided by the registrar to update name servers for the domain 38 // registration. For more information, perform an internet search on "free DNS 39 // service." You can delete a hosted zone only if it contains only the default SOA 40 // record and NS resource record sets. If the hosted zone contains other resource 41 // record sets, you must delete them before you can delete the hosted zone. If you 42 // try to delete a hosted zone that contains other resource record sets, the 43 // request fails, and Route 53 returns a HostedZoneNotEmpty error. For information 44 // about deleting records from your hosted zone, see ChangeResourceRecordSets 45 // (https://docs.aws.amazon.com/Route53/latest/APIReference/API_ChangeResourceRecordSets.html). 46 // To verify that the hosted zone has been deleted, do one of the following: 47 // 48 // * Use 49 // the GetHostedZone action to request information about the hosted zone. 50 // 51 // * Use 52 // the ListHostedZones action to get a list of the hosted zones associated with the 53 // current Amazon Web Services account. 54 func (c *Client) DeleteHostedZone(ctx context.Context, params *DeleteHostedZoneInput, optFns ...func(*Options)) (*DeleteHostedZoneOutput, error) { 55 if params == nil { 56 params = &DeleteHostedZoneInput{} 57 } 58 59 result, metadata, err := c.invokeOperation(ctx, "DeleteHostedZone", params, optFns, c.addOperationDeleteHostedZoneMiddlewares) 60 if err != nil { 61 return nil, err 62 } 63 64 out := result.(*DeleteHostedZoneOutput) 65 out.ResultMetadata = metadata 66 return out, nil 67 } 68 69 // A request to delete a hosted zone. 70 type DeleteHostedZoneInput struct { 71 72 // The ID of the hosted zone you want to delete. 73 // 74 // This member is required. 75 Id *string 76 77 noSmithyDocumentSerde 78 } 79 80 // A complex type that contains the response to a DeleteHostedZone request. 81 type DeleteHostedZoneOutput struct { 82 83 // A complex type that contains the ID, the status, and the date and time of a 84 // request to delete a 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) addOperationDeleteHostedZoneMiddlewares(stack *middleware.Stack, options Options) (err error) { 96 err = stack.Serialize.Add(&awsRestxml_serializeOpDeleteHostedZone{}, middleware.After) 97 if err != nil { 98 return err 99 } 100 err = stack.Deserialize.Add(&awsRestxml_deserializeOpDeleteHostedZone{}, middleware.After) 101 if err != nil { 102 return err 103 } 104 if err = addSetLoggerMiddleware(stack, options); err != nil { 105 return err 106 } 107 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 108 return err 109 } 110 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 111 return err 112 } 113 if err = addResolveEndpointMiddleware(stack, options); err != nil { 114 return err 115 } 116 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 117 return err 118 } 119 if err = addRetryMiddlewares(stack, options); err != nil { 120 return err 121 } 122 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 123 return err 124 } 125 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 126 return err 127 } 128 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 129 return err 130 } 131 if err = addClientUserAgent(stack); err != nil { 132 return err 133 } 134 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 135 return err 136 } 137 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 138 return err 139 } 140 if err = addOpDeleteHostedZoneValidationMiddleware(stack); err != nil { 141 return err 142 } 143 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteHostedZone(options.Region), middleware.Before); err != nil { 144 return err 145 } 146 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 147 return err 148 } 149 if err = addResponseErrorMiddleware(stack); err != nil { 150 return err 151 } 152 if err = addSanitizeURLMiddleware(stack); err != nil { 153 return err 154 } 155 if err = addRequestResponseLogging(stack, options); err != nil { 156 return err 157 } 158 return nil 159 } 160 161 func newServiceMetadataMiddleware_opDeleteHostedZone(region string) *awsmiddleware.RegisterServiceMetadata { 162 return &awsmiddleware.RegisterServiceMetadata{ 163 Region: region, 164 ServiceID: ServiceID, 165 SigningName: "route53", 166 OperationName: "DeleteHostedZone", 167 } 168 }