api_op_CreateTrafficPolicyVersion.go (3920B)
1 // Code generated by smithy-go-codegen DO NOT EDIT. 2 3 package route53 4 5 import ( 6 "context" 7 8 "github.com/aws/aws-sdk-go-v2/service/route53/types" 9 "github.com/aws/smithy-go/middleware" 10 ) 11 12 // Creates a new version of an existing traffic policy. When you create a new 13 // version of a traffic policy, you specify the ID of the traffic policy that you 14 // want to update and a JSON-formatted document that describes the new version. You 15 // use traffic policies to create multiple DNS resource record sets for one domain 16 // name (such as example.com) or one subdomain name (such as www.example.com). You 17 // can create a maximum of 1000 versions of a traffic policy. If you reach the 18 // limit and need to create another version, you'll need to start a new traffic 19 // policy. 20 func (c *Client) CreateTrafficPolicyVersion(ctx context.Context, params *CreateTrafficPolicyVersionInput, optFns ...func(*Options)) (*CreateTrafficPolicyVersionOutput, error) { 21 if params == nil { 22 params = &CreateTrafficPolicyVersionInput{} 23 } 24 25 result, metadata, err := c.invokeOperation(ctx, "CreateTrafficPolicyVersion", params, optFns, c.addOperationCreateTrafficPolicyVersionMiddlewares) 26 if err != nil { 27 return nil, err 28 } 29 30 out := result.(*CreateTrafficPolicyVersionOutput) 31 out.ResultMetadata = metadata 32 return out, nil 33 } 34 35 // A complex type that contains information about the traffic policy that you want 36 // to create a new version for. 37 type CreateTrafficPolicyVersionInput struct { 38 39 // The definition of this version of the traffic policy, in JSON format. You 40 // specified the JSON in the CreateTrafficPolicyVersion request. For more 41 // information about the JSON format, see [CreateTrafficPolicy]. 42 // 43 // [CreateTrafficPolicy]: https://docs.aws.amazon.com/Route53/latest/APIReference/API_CreateTrafficPolicy.html 44 // 45 // This member is required. 46 Document *string 47 48 // The ID of the traffic policy for which you want to create a new version. 49 // 50 // This member is required. 51 Id *string 52 53 // The comment that you specified in the CreateTrafficPolicyVersion request, if 54 // any. 55 Comment *string 56 57 noSmithyDocumentSerde 58 } 59 60 // A complex type that contains the response information for the 61 // CreateTrafficPolicyVersion request. 62 type CreateTrafficPolicyVersionOutput struct { 63 64 // A unique URL that represents a new traffic policy version. 65 // 66 // This member is required. 67 Location *string 68 69 // A complex type that contains settings for the new version of the traffic policy. 70 // 71 // This member is required. 72 TrafficPolicy *types.TrafficPolicy 73 74 // Metadata pertaining to the operation's result. 75 ResultMetadata middleware.Metadata 76 77 noSmithyDocumentSerde 78 } 79 80 func (c *Client) addOperationCreateTrafficPolicyVersionMiddlewares(stack *middleware.Stack, options Options) (err error) { 81 err = stack.Serialize.Add(&awsRestxml_serializeOpCreateTrafficPolicyVersion{}, middleware.After) 82 if err != nil { 83 return err 84 } 85 err = stack.Deserialize.Add(&awsRestxml_deserializeOpCreateTrafficPolicyVersion{}, middleware.After) 86 if err != nil { 87 return err 88 } 89 90 if err = addComputeContentLength(stack); err != nil { 91 return err 92 } 93 if err = addResolveEndpointMiddleware(stack, options); err != nil { 94 return err 95 } 96 if err = addComputePayloadSHA256(stack); err != nil { 97 return err 98 } 99 if err = addRecordResponseTiming(stack, options); err != nil { 100 return err 101 } 102 if err = addCredentialSource(stack, options); err != nil { 103 return err 104 } 105 if err = addOpCreateTrafficPolicyVersionValidationMiddleware(stack); err != nil { 106 return err 107 } 108 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 109 return err 110 } 111 if err = addResponseErrorMiddleware(stack); err != nil { 112 return err 113 } 114 if err = addRequestResponseLogging(stack, options); err != nil { 115 return err 116 } 117 if err = addDisableHTTPSMiddleware(stack, options); err != nil { 118 return err 119 } 120 if err = addInterceptors(stack, options); err != nil { 121 return err 122 } 123 return nil 124 }