api_op_ChangeResourceRecordSets.go (8482B)
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 route53cust "github.com/aws/aws-sdk-go-v2/service/route53/internal/customizations" 10 "github.com/aws/aws-sdk-go-v2/service/route53/types" 11 "github.com/aws/smithy-go/middleware" 12 smithyhttp "github.com/aws/smithy-go/transport/http" 13 ) 14 15 // Creates, changes, or deletes a resource record set, which contains authoritative 16 // DNS information for a specified domain name or subdomain name. For example, you 17 // can use ChangeResourceRecordSets to create a resource record set that routes 18 // traffic for test.example.com to a web server that has an IP address of 19 // 192.0.2.44. Deleting Resource Record Sets To delete a resource record set, you 20 // must specify all the same values that you specified when you created it. Change 21 // Batches and Transactional Changes The request body must include a document with 22 // a ChangeResourceRecordSetsRequest element. The request body contains a list of 23 // change items, known as a change batch. Change batches are considered 24 // transactional changes. Route 53 validates the changes in the request and then 25 // either makes all or none of the changes in the change batch request. This 26 // ensures that DNS routing isn't adversely affected by partial changes to the 27 // resource record sets in a hosted zone. For example, suppose a change batch 28 // request contains two changes: it deletes the CNAME resource record set for 29 // www.example.com and creates an alias resource record set for www.example.com. If 30 // validation for both records succeeds, Route 53 deletes the first resource record 31 // set and creates the second resource record set in a single operation. If 32 // validation for either the DELETE or the CREATE action fails, then the request is 33 // canceled, and the original CNAME record continues to exist. If you try to delete 34 // the same resource record set more than once in a single change batch, Route 53 35 // returns an InvalidChangeBatch error. Traffic Flow To create resource record sets 36 // for complex routing configurations, use either the traffic flow visual editor in 37 // the Route 53 console or the API actions for traffic policies and traffic policy 38 // instances. Save the configuration as a traffic policy, then associate the 39 // traffic policy with one or more domain names (such as example.com) or subdomain 40 // names (such as www.example.com), in the same hosted zone or in multiple hosted 41 // zones. You can roll back the updates if the new configuration isn't performing 42 // as expected. For more information, see Using Traffic Flow to Route DNS Traffic 43 // (https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/traffic-flow.html) in 44 // the Amazon Route 53 Developer Guide. Create, Delete, and Upsert Use 45 // ChangeResourceRecordsSetsRequest to perform the following actions: 46 // 47 // * CREATE: 48 // Creates a resource record set that has the specified values. 49 // 50 // * DELETE: Deletes 51 // an existing resource record set that has the specified values. 52 // 53 // * UPSERT: If a 54 // resource set exists Route 53 updates it with the values in the 55 // request. 56 // 57 // Syntaxes for Creating, Updating, and Deleting Resource Record Sets The 58 // syntax for a request depends on the type of resource record set that you want to 59 // create, delete, or update, such as weighted, alias, or failover. The XML 60 // elements in your request must appear in the order listed in the syntax. For an 61 // example for each type of resource record set, see "Examples." Don't refer to the 62 // syntax in the "Parameter Syntax" section, which includes all of the elements for 63 // every kind of resource record set that you can create, delete, or update by 64 // using ChangeResourceRecordSets. Change Propagation to Route 53 DNS Servers When 65 // you submit a ChangeResourceRecordSets request, Route 53 propagates your changes 66 // to all of the Route 53 authoritative DNS servers. While your changes are 67 // propagating, GetChange returns a status of PENDING. When propagation is 68 // complete, GetChange returns a status of INSYNC. Changes generally propagate to 69 // all Route 53 name servers within 60 seconds. For more information, see GetChange 70 // (https://docs.aws.amazon.com/Route53/latest/APIReference/API_GetChange.html). 71 // Limits on ChangeResourceRecordSets Requests For information about the limits on 72 // a ChangeResourceRecordSets request, see Limits 73 // (https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DNSLimitations.html) 74 // in the Amazon Route 53 Developer Guide. 75 func (c *Client) ChangeResourceRecordSets(ctx context.Context, params *ChangeResourceRecordSetsInput, optFns ...func(*Options)) (*ChangeResourceRecordSetsOutput, error) { 76 if params == nil { 77 params = &ChangeResourceRecordSetsInput{} 78 } 79 80 result, metadata, err := c.invokeOperation(ctx, "ChangeResourceRecordSets", params, optFns, c.addOperationChangeResourceRecordSetsMiddlewares) 81 if err != nil { 82 return nil, err 83 } 84 85 out := result.(*ChangeResourceRecordSetsOutput) 86 out.ResultMetadata = metadata 87 return out, nil 88 } 89 90 // A complex type that contains change information for the resource record set. 91 type ChangeResourceRecordSetsInput struct { 92 93 // A complex type that contains an optional comment and the Changes element. 94 // 95 // This member is required. 96 ChangeBatch *types.ChangeBatch 97 98 // The ID of the hosted zone that contains the resource record sets that you want 99 // to change. 100 // 101 // This member is required. 102 HostedZoneId *string 103 104 noSmithyDocumentSerde 105 } 106 107 // A complex type containing the response for the request. 108 type ChangeResourceRecordSetsOutput struct { 109 110 // A complex type that contains information about changes made to your hosted zone. 111 // This element contains an ID that you use when performing a GetChange 112 // (https://docs.aws.amazon.com/Route53/latest/APIReference/API_GetChange.html) 113 // action to get detailed information about the change. 114 // 115 // This member is required. 116 ChangeInfo *types.ChangeInfo 117 118 // Metadata pertaining to the operation's result. 119 ResultMetadata middleware.Metadata 120 121 noSmithyDocumentSerde 122 } 123 124 func (c *Client) addOperationChangeResourceRecordSetsMiddlewares(stack *middleware.Stack, options Options) (err error) { 125 err = stack.Serialize.Add(&awsRestxml_serializeOpChangeResourceRecordSets{}, middleware.After) 126 if err != nil { 127 return err 128 } 129 err = stack.Deserialize.Add(&awsRestxml_deserializeOpChangeResourceRecordSets{}, middleware.After) 130 if err != nil { 131 return err 132 } 133 if err = addSetLoggerMiddleware(stack, options); err != nil { 134 return err 135 } 136 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 137 return err 138 } 139 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 140 return err 141 } 142 if err = addResolveEndpointMiddleware(stack, options); err != nil { 143 return err 144 } 145 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 146 return err 147 } 148 if err = addRetryMiddlewares(stack, options); err != nil { 149 return err 150 } 151 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 152 return err 153 } 154 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 155 return err 156 } 157 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 158 return err 159 } 160 if err = addClientUserAgent(stack); err != nil { 161 return err 162 } 163 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 164 return err 165 } 166 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 167 return err 168 } 169 if err = addOpChangeResourceRecordSetsValidationMiddleware(stack); err != nil { 170 return err 171 } 172 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opChangeResourceRecordSets(options.Region), middleware.Before); err != nil { 173 return err 174 } 175 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 176 return err 177 } 178 if err = addResponseErrorMiddleware(stack); err != nil { 179 return err 180 } 181 if err = route53cust.HandleCustomErrorDeserialization(stack); err != nil { 182 return err 183 } 184 if err = addSanitizeURLMiddleware(stack); err != nil { 185 return err 186 } 187 if err = addRequestResponseLogging(stack, options); err != nil { 188 return err 189 } 190 return nil 191 } 192 193 func newServiceMetadataMiddleware_opChangeResourceRecordSets(region string) *awsmiddleware.RegisterServiceMetadata { 194 return &awsmiddleware.RegisterServiceMetadata{ 195 Region: region, 196 ServiceID: ServiceID, 197 SigningName: "route53", 198 OperationName: "ChangeResourceRecordSets", 199 } 200 }