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