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 "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 // After you submit a UpdateTrafficPolicyInstance request, there's a brief delay
15 // while Route 53 creates the resource record sets that are specified in the
16 // traffic policy definition. Use GetTrafficPolicyInstance with the id of updated
17 // traffic policy instance confirm that the UpdateTrafficPolicyInstance request
18 // completed successfully. For more information, see the State response element.
19 //
20 // Updates the resource record sets in a specified hosted zone that were created
21 // based on the settings in a specified traffic policy version.
22 //
23 // When you update a traffic policy instance, Amazon Route 53 continues to respond
24 // to DNS queries for the root resource record set name (such as example.com) while
25 // it replaces one group of resource record sets with another. Route 53 performs
26 // the following operations:
27 //
28 // - Route 53 creates a new group of resource record sets based on the specified
29 // traffic policy. This is true regardless of how significant the differences are
30 // between the existing resource record sets and the new resource record sets.
31 //
32 // - When all of the new resource record sets have been created, Route 53 starts
33 // to respond to DNS queries for the root resource record set name (such as
34 // example.com) by using the new resource record sets.
35 //
36 // - Route 53 deletes the old group of resource record sets that are associated
37 // with the root resource record set name.
38 func (c *Client) UpdateTrafficPolicyInstance(ctx context.Context, params *UpdateTrafficPolicyInstanceInput, optFns ...func(*Options)) (*UpdateTrafficPolicyInstanceOutput, error) {
39 if params == nil {
40 params = &UpdateTrafficPolicyInstanceInput{}
41 }
42 43 result, metadata, err := c.invokeOperation(ctx, "UpdateTrafficPolicyInstance", params, optFns, c.addOperationUpdateTrafficPolicyInstanceMiddlewares)
44 if err != nil {
45 return nil, err
46 }
47 48 out := result.(*UpdateTrafficPolicyInstanceOutput)
49 out.ResultMetadata = metadata
50 return out, nil
51 }
52 53 // A complex type that contains information about the resource record sets that
54 // you want to update based on a specified traffic policy instance.
55 type UpdateTrafficPolicyInstanceInput struct {
56 57 // The ID of the traffic policy instance that you want to update.
58 //
59 // This member is required.
60 Id *string
61 62 // The TTL that you want Amazon Route 53 to assign to all of the updated resource
63 // record sets.
64 //
65 // This member is required.
66 TTL *int64
67 68 // The ID of the traffic policy that you want Amazon Route 53 to use to update
69 // resource record sets for the specified traffic policy instance.
70 //
71 // This member is required.
72 TrafficPolicyId *string
73 74 // The version of the traffic policy that you want Amazon Route 53 to use to
75 // update resource record sets for the specified traffic policy instance.
76 //
77 // This member is required.
78 TrafficPolicyVersion *int32
79 80 noSmithyDocumentSerde
81 }
82 83 // A complex type that contains information about the resource record sets that
84 // Amazon Route 53 created based on a specified traffic policy.
85 type UpdateTrafficPolicyInstanceOutput struct {
86 87 // A complex type that contains settings for the updated traffic policy instance.
88 //
89 // This member is required.
90 TrafficPolicyInstance *types.TrafficPolicyInstance
91 92 // Metadata pertaining to the operation's result.
93 ResultMetadata middleware.Metadata
94 95 noSmithyDocumentSerde
96 }
97 98 func (c *Client) addOperationUpdateTrafficPolicyInstanceMiddlewares(stack *middleware.Stack, options Options) (err error) {
99 if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
100 return err
101 }
102 err = stack.Serialize.Add(&awsRestxml_serializeOpUpdateTrafficPolicyInstance{}, middleware.After)
103 if err != nil {
104 return err
105 }
106 err = stack.Deserialize.Add(&awsRestxml_deserializeOpUpdateTrafficPolicyInstance{}, middleware.After)
107 if err != nil {
108 return err
109 }
110 if err := addProtocolFinalizerMiddlewares(stack, options, "UpdateTrafficPolicyInstance"); err != nil {
111 return fmt.Errorf("add protocol finalizers: %v", err)
112 }
113 114 if err = addlegacyEndpointContextSetter(stack, options); err != nil {
115 return err
116 }
117 if err = addSetLoggerMiddleware(stack, options); err != nil {
118 return err
119 }
120 if err = addClientRequestID(stack); err != nil {
121 return err
122 }
123 if err = addComputeContentLength(stack); err != nil {
124 return err
125 }
126 if err = addResolveEndpointMiddleware(stack, options); err != nil {
127 return err
128 }
129 if err = addComputePayloadSHA256(stack); err != nil {
130 return err
131 }
132 if err = addRetry(stack, options); err != nil {
133 return err
134 }
135 if err = addRawResponseToMetadata(stack); err != nil {
136 return err
137 }
138 if err = addRecordResponseTiming(stack); err != nil {
139 return err
140 }
141 if err = addSpanRetryLoop(stack, options); err != nil {
142 return err
143 }
144 if err = addClientUserAgent(stack, options); err != nil {
145 return err
146 }
147 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
148 return err
149 }
150 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
151 return err
152 }
153 if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
154 return err
155 }
156 if err = addTimeOffsetBuild(stack, c); err != nil {
157 return err
158 }
159 if err = addUserAgentRetryMode(stack, options); err != nil {
160 return err
161 }
162 if err = addCredentialSource(stack, options); err != nil {
163 return err
164 }
165 if err = addOpUpdateTrafficPolicyInstanceValidationMiddleware(stack); err != nil {
166 return err
167 }
168 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateTrafficPolicyInstance(options.Region), middleware.Before); err != nil {
169 return err
170 }
171 if err = addRecursionDetection(stack); err != nil {
172 return err
173 }
174 if err = addRequestIDRetrieverMiddleware(stack); err != nil {
175 return err
176 }
177 if err = addResponseErrorMiddleware(stack); err != nil {
178 return err
179 }
180 if err = addRequestResponseLogging(stack, options); err != nil {
181 return err
182 }
183 if err = addDisableHTTPSMiddleware(stack, options); err != nil {
184 return err
185 }
186 if err = addInterceptBeforeRetryLoop(stack, options); err != nil {
187 return err
188 }
189 if err = addInterceptAttempt(stack, options); err != nil {
190 return err
191 }
192 if err = addInterceptors(stack, options); err != nil {
193 return err
194 }
195 return nil
196 }
197 198 func newServiceMetadataMiddleware_opUpdateTrafficPolicyInstance(region string) *awsmiddleware.RegisterServiceMetadata {
199 return &awsmiddleware.RegisterServiceMetadata{
200 Region: region,
201 ServiceID: ServiceID,
202 OperationName: "UpdateTrafficPolicyInstance",
203 }
204 }
205