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