1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package route53 4 5import ( 6 "context" 7 awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" 8 "github.com/aws/aws-sdk-go-v2/aws/signer/v4" 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// Creates a new version of an existing traffic policy. When you create a new 15// version of a traffic policy, you specify the ID of the traffic policy that you 16// want to update and a JSON-formatted document that describes the new version. You 17// use traffic policies to create multiple DNS resource record sets for one domain 18// name (such as example.com) or one subdomain name (such as www.example.com). You 19// can create a maximum of 1000 versions of a traffic policy. If you reach the 20// limit and need to create another version, you'll need to start a new traffic 21// policy. 22func (c *Client) CreateTrafficPolicyVersion(ctx context.Context, params *CreateTrafficPolicyVersionInput, optFns ...func(*Options)) (*CreateTrafficPolicyVersionOutput, error) { 23 if params == nil { 24 params = &CreateTrafficPolicyVersionInput{} 25 } 26 27 result, metadata, err := c.invokeOperation(ctx, "CreateTrafficPolicyVersion", params, optFns, addOperationCreateTrafficPolicyVersionMiddlewares) 28 if err != nil { 29 return nil, err 30 } 31 32 out := result.(*CreateTrafficPolicyVersionOutput) 33 out.ResultMetadata = metadata 34 return out, nil 35} 36 37// A complex type that contains information about the traffic policy that you want 38// to create a new version for. 39type CreateTrafficPolicyVersionInput struct { 40 41 // The definition of this version of the traffic policy, in JSON format. You 42 // specified the JSON in the CreateTrafficPolicyVersion request. For more 43 // information about the JSON format, see CreateTrafficPolicy 44 // (https://docs.aws.amazon.com/Route53/latest/APIReference/API_CreateTrafficPolicy.html). 45 // 46 // This member is required. 47 Document *string 48 49 // The ID of the traffic policy for which you want to create a new version. 50 // 51 // This member is required. 52 Id *string 53 54 // The comment that you specified in the CreateTrafficPolicyVersion request, if 55 // any. 56 Comment *string 57} 58 59// A complex type that contains the response information for the 60// CreateTrafficPolicyVersion request. 61type CreateTrafficPolicyVersionOutput struct { 62 63 // A unique URL that represents a new traffic policy version. 64 // 65 // This member is required. 66 Location *string 67 68 // A complex type that contains settings for the new version of the traffic policy. 69 // 70 // This member is required. 71 TrafficPolicy *types.TrafficPolicy 72 73 // Metadata pertaining to the operation's result. 74 ResultMetadata middleware.Metadata 75} 76 77func addOperationCreateTrafficPolicyVersionMiddlewares(stack *middleware.Stack, options Options) (err error) { 78 err = stack.Serialize.Add(&awsRestxml_serializeOpCreateTrafficPolicyVersion{}, middleware.After) 79 if err != nil { 80 return err 81 } 82 err = stack.Deserialize.Add(&awsRestxml_deserializeOpCreateTrafficPolicyVersion{}, middleware.After) 83 if err != nil { 84 return err 85 } 86 if err = addSetLoggerMiddleware(stack, options); err != nil { 87 return err 88 } 89 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 90 return err 91 } 92 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 93 return err 94 } 95 if err = addResolveEndpointMiddleware(stack, options); err != nil { 96 return err 97 } 98 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 99 return err 100 } 101 if err = addRetryMiddlewares(stack, options); err != nil { 102 return err 103 } 104 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 105 return err 106 } 107 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 108 return err 109 } 110 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 111 return err 112 } 113 if err = addClientUserAgent(stack); err != nil { 114 return err 115 } 116 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 117 return err 118 } 119 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 120 return err 121 } 122 if err = addOpCreateTrafficPolicyVersionValidationMiddleware(stack); err != nil { 123 return err 124 } 125 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateTrafficPolicyVersion(options.Region), middleware.Before); err != nil { 126 return err 127 } 128 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 129 return err 130 } 131 if err = addResponseErrorMiddleware(stack); err != nil { 132 return err 133 } 134 if err = addRequestResponseLogging(stack, options); err != nil { 135 return err 136 } 137 return nil 138} 139 140func newServiceMetadataMiddleware_opCreateTrafficPolicyVersion(region string) *awsmiddleware.RegisterServiceMetadata { 141 return &awsmiddleware.RegisterServiceMetadata{ 142 Region: region, 143 ServiceID: ServiceID, 144 SigningName: "route53", 145 OperationName: "CreateTrafficPolicyVersion", 146 } 147} 148