src

Go monorepo.
git clone git://code.dwrz.net/src
Log | Files | Refs

api_op_ChangeResourceRecordSets.go (10547B)


      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.
     20 //
     21 // # Deleting Resource Record Sets
     22 //
     23 // To delete a resource record set, you must specify all the same values that you
     24 // specified when you created it.
     25 //
     26 // # Change Batches and Transactional Changes
     27 //
     28 // The request body must include a document with a ChangeResourceRecordSetsRequest
     29 // element. The request body contains a list of change items, known as a change
     30 // batch. Change batches are considered transactional changes. Route 53 validates
     31 // the changes in the request and then either makes all or none of the changes in
     32 // the change batch request. This ensures that DNS routing isn't adversely affected
     33 // by partial changes to the resource record sets in a hosted zone.
     34 //
     35 // For example, suppose a change batch request contains two changes: it deletes
     36 // the CNAME resource record set for www.example.com and creates an alias resource
     37 // record set for www.example.com. If validation for both records succeeds, Route
     38 // 53 deletes the first resource record set and creates the second resource record
     39 // set in a single operation. If validation for either the DELETE or the CREATE
     40 // action fails, then the request is canceled, and the original CNAME record
     41 // continues to exist.
     42 //
     43 // If you try to delete the same resource record set more than once in a single
     44 // change batch, Route 53 returns an InvalidChangeBatch error.
     45 //
     46 // # Traffic Flow
     47 //
     48 // To create resource record sets for complex routing configurations, use either
     49 // the traffic flow visual editor in the Route 53 console or the API actions for
     50 // traffic policies and traffic policy instances. Save the configuration as a
     51 // traffic policy, then associate the traffic policy with one or more domain names
     52 // (such as example.com) or subdomain names (such as www.example.com), in the same
     53 // hosted zone or in multiple hosted zones. You can roll back the updates if the
     54 // new configuration isn't performing as expected. For more information, see [Using Traffic Flow to Route DNS Traffic]in
     55 // the Amazon Route 53 Developer Guide.
     56 //
     57 // # Create, Delete, and Upsert
     58 //
     59 // Use ChangeResourceRecordsSetsRequest to perform the following actions:
     60 //
     61 //   - CREATE : Creates a resource record set that has the specified values.
     62 //
     63 //   - DELETE : Deletes an existing resource record set that has the specified
     64 //     values.
     65 //
     66 //   - UPSERT : If a resource set doesn't exist, Route 53 creates it. If a resource
     67 //     set exists Route 53 updates it with the values in the request.
     68 //
     69 // # Syntaxes for Creating, Updating, and Deleting Resource Record Sets
     70 //
     71 // The syntax for a request depends on the type of resource record set that you
     72 // want to create, delete, or update, such as weighted, alias, or failover. The XML
     73 // elements in your request must appear in the order listed in the syntax.
     74 //
     75 // For an example for each type of resource record set, see "Examples."
     76 //
     77 // Don't refer to the syntax in the "Parameter Syntax" section, which includes all
     78 // of the elements for every kind of resource record set that you can create,
     79 // delete, or update by using ChangeResourceRecordSets .
     80 //
     81 // # Change Propagation to Route 53 DNS Servers
     82 //
     83 // When you submit a ChangeResourceRecordSets request, Route 53 propagates your
     84 // changes to all of the Route 53 authoritative DNS servers managing the hosted
     85 // zone. While your changes are propagating, GetChange returns a status of PENDING
     86 // . When propagation is complete, GetChange returns a status of INSYNC . Changes
     87 // generally propagate to all Route 53 name servers managing the hosted zone within
     88 // 60 seconds. For more information, see [GetChange].
     89 //
     90 // # Limits on ChangeResourceRecordSets Requests
     91 //
     92 // For information about the limits on a ChangeResourceRecordSets request, see [Limits] in
     93 // the Amazon Route 53 Developer Guide.
     94 //
     95 // [Limits]: https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DNSLimitations.html
     96 // [GetChange]: https://docs.aws.amazon.com/Route53/latest/APIReference/API_GetChange.html
     97 // [Using Traffic Flow to Route DNS Traffic]: https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/traffic-flow.html
     98 func (c *Client) ChangeResourceRecordSets(ctx context.Context, params *ChangeResourceRecordSetsInput, optFns ...func(*Options)) (*ChangeResourceRecordSetsOutput, error) {
     99 	if params == nil {
    100 		params = &ChangeResourceRecordSetsInput{}
    101 	}
    102 
    103 	result, metadata, err := c.invokeOperation(ctx, "ChangeResourceRecordSets", params, optFns, c.addOperationChangeResourceRecordSetsMiddlewares)
    104 	if err != nil {
    105 		return nil, err
    106 	}
    107 
    108 	out := result.(*ChangeResourceRecordSetsOutput)
    109 	out.ResultMetadata = metadata
    110 	return out, nil
    111 }
    112 
    113 // A complex type that contains change information for the resource record set.
    114 type ChangeResourceRecordSetsInput struct {
    115 
    116 	// A complex type that contains an optional comment and the Changes element.
    117 	//
    118 	// This member is required.
    119 	ChangeBatch *types.ChangeBatch
    120 
    121 	// The ID of the hosted zone that contains the resource record sets that you want
    122 	// to change.
    123 	//
    124 	// This member is required.
    125 	HostedZoneId *string
    126 
    127 	noSmithyDocumentSerde
    128 }
    129 
    130 // A complex type containing the response for the request.
    131 type ChangeResourceRecordSetsOutput struct {
    132 
    133 	// A complex type that contains information about changes made to your hosted zone.
    134 	//
    135 	// This element contains an ID that you use when performing a [GetChange] action to get
    136 	// detailed information about the change.
    137 	//
    138 	// [GetChange]: https://docs.aws.amazon.com/Route53/latest/APIReference/API_GetChange.html
    139 	//
    140 	// This member is required.
    141 	ChangeInfo *types.ChangeInfo
    142 
    143 	// Metadata pertaining to the operation's result.
    144 	ResultMetadata middleware.Metadata
    145 
    146 	noSmithyDocumentSerde
    147 }
    148 
    149 func (c *Client) addOperationChangeResourceRecordSetsMiddlewares(stack *middleware.Stack, options Options) (err error) {
    150 	if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
    151 		return err
    152 	}
    153 	err = stack.Serialize.Add(&awsRestxml_serializeOpChangeResourceRecordSets{}, middleware.After)
    154 	if err != nil {
    155 		return err
    156 	}
    157 	err = stack.Deserialize.Add(&awsRestxml_deserializeOpChangeResourceRecordSets{}, middleware.After)
    158 	if err != nil {
    159 		return err
    160 	}
    161 	if err := addProtocolFinalizerMiddlewares(stack, options, "ChangeResourceRecordSets"); err != nil {
    162 		return fmt.Errorf("add protocol finalizers: %v", err)
    163 	}
    164 
    165 	if err = addlegacyEndpointContextSetter(stack, options); err != nil {
    166 		return err
    167 	}
    168 	if err = addSetLoggerMiddleware(stack, options); err != nil {
    169 		return err
    170 	}
    171 	if err = addClientRequestID(stack); err != nil {
    172 		return err
    173 	}
    174 	if err = addComputeContentLength(stack); err != nil {
    175 		return err
    176 	}
    177 	if err = addResolveEndpointMiddleware(stack, options); err != nil {
    178 		return err
    179 	}
    180 	if err = addComputePayloadSHA256(stack); err != nil {
    181 		return err
    182 	}
    183 	if err = addRetry(stack, options); err != nil {
    184 		return err
    185 	}
    186 	if err = addRawResponseToMetadata(stack); err != nil {
    187 		return err
    188 	}
    189 	if err = addRecordResponseTiming(stack); err != nil {
    190 		return err
    191 	}
    192 	if err = addSpanRetryLoop(stack, options); err != nil {
    193 		return err
    194 	}
    195 	if err = addClientUserAgent(stack, options); err != nil {
    196 		return err
    197 	}
    198 	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
    199 		return err
    200 	}
    201 	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
    202 		return err
    203 	}
    204 	if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
    205 		return err
    206 	}
    207 	if err = addTimeOffsetBuild(stack, c); err != nil {
    208 		return err
    209 	}
    210 	if err = addUserAgentRetryMode(stack, options); err != nil {
    211 		return err
    212 	}
    213 	if err = addCredentialSource(stack, options); err != nil {
    214 		return err
    215 	}
    216 	if err = addOpChangeResourceRecordSetsValidationMiddleware(stack); err != nil {
    217 		return err
    218 	}
    219 	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opChangeResourceRecordSets(options.Region), middleware.Before); err != nil {
    220 		return err
    221 	}
    222 	if err = addRecursionDetection(stack); err != nil {
    223 		return err
    224 	}
    225 	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
    226 		return err
    227 	}
    228 	if err = addResponseErrorMiddleware(stack); err != nil {
    229 		return err
    230 	}
    231 	if err = route53cust.HandleCustomErrorDeserialization(stack); err != nil {
    232 		return err
    233 	}
    234 	if err = addSanitizeURLMiddleware(stack); err != nil {
    235 		return err
    236 	}
    237 	if err = addRequestResponseLogging(stack, options); err != nil {
    238 		return err
    239 	}
    240 	if err = addDisableHTTPSMiddleware(stack, options); err != nil {
    241 		return err
    242 	}
    243 	if err = addInterceptBeforeRetryLoop(stack, options); err != nil {
    244 		return err
    245 	}
    246 	if err = addInterceptAttempt(stack, options); err != nil {
    247 		return err
    248 	}
    249 	if err = addInterceptExecution(stack, options); err != nil {
    250 		return err
    251 	}
    252 	if err = addInterceptBeforeSerialization(stack, options); err != nil {
    253 		return err
    254 	}
    255 	if err = addInterceptAfterSerialization(stack, options); err != nil {
    256 		return err
    257 	}
    258 	if err = addInterceptBeforeSigning(stack, options); err != nil {
    259 		return err
    260 	}
    261 	if err = addInterceptAfterSigning(stack, options); err != nil {
    262 		return err
    263 	}
    264 	if err = addInterceptTransmit(stack, options); err != nil {
    265 		return err
    266 	}
    267 	if err = addInterceptBeforeDeserialization(stack, options); err != nil {
    268 		return err
    269 	}
    270 	if err = addInterceptAfterDeserialization(stack, options); err != nil {
    271 		return err
    272 	}
    273 	if err = addSpanInitializeStart(stack); err != nil {
    274 		return err
    275 	}
    276 	if err = addSpanInitializeEnd(stack); err != nil {
    277 		return err
    278 	}
    279 	if err = addSpanBuildRequestStart(stack); err != nil {
    280 		return err
    281 	}
    282 	if err = addSpanBuildRequestEnd(stack); err != nil {
    283 		return err
    284 	}
    285 	return nil
    286 }
    287 
    288 func newServiceMetadataMiddleware_opChangeResourceRecordSets(region string) *awsmiddleware.RegisterServiceMetadata {
    289 	return &awsmiddleware.RegisterServiceMetadata{
    290 		Region:        region,
    291 		ServiceID:     ServiceID,
    292 		OperationName: "ChangeResourceRecordSets",
    293 	}
    294 }