src

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

api_op_CreateTrafficPolicyVersion.go (5346B)


      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 // 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.
     22 func (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, c.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.
     39 type 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 (https://docs.aws.amazon.com/Route53/latest/APIReference/API_CreateTrafficPolicy.html)
     44 	// .
     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 	noSmithyDocumentSerde
     59 }
     60 
     61 // A complex type that contains the response information for the
     62 // CreateTrafficPolicyVersion request.
     63 type CreateTrafficPolicyVersionOutput struct {
     64 
     65 	// A unique URL that represents a new traffic policy version.
     66 	//
     67 	// This member is required.
     68 	Location *string
     69 
     70 	// A complex type that contains settings for the new version of the traffic policy.
     71 	//
     72 	// This member is required.
     73 	TrafficPolicy *types.TrafficPolicy
     74 
     75 	// Metadata pertaining to the operation's result.
     76 	ResultMetadata middleware.Metadata
     77 
     78 	noSmithyDocumentSerde
     79 }
     80 
     81 func (c *Client) addOperationCreateTrafficPolicyVersionMiddlewares(stack *middleware.Stack, options Options) (err error) {
     82 	if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
     83 		return err
     84 	}
     85 	err = stack.Serialize.Add(&awsRestxml_serializeOpCreateTrafficPolicyVersion{}, middleware.After)
     86 	if err != nil {
     87 		return err
     88 	}
     89 	err = stack.Deserialize.Add(&awsRestxml_deserializeOpCreateTrafficPolicyVersion{}, middleware.After)
     90 	if err != nil {
     91 		return err
     92 	}
     93 	if err := addProtocolFinalizerMiddlewares(stack, options, "CreateTrafficPolicyVersion"); err != nil {
     94 		return fmt.Errorf("add protocol finalizers: %v", err)
     95 	}
     96 
     97 	if err = addlegacyEndpointContextSetter(stack, options); err != nil {
     98 		return err
     99 	}
    100 	if err = addSetLoggerMiddleware(stack, options); err != nil {
    101 		return err
    102 	}
    103 	if err = addClientRequestID(stack); err != nil {
    104 		return err
    105 	}
    106 	if err = addComputeContentLength(stack); err != nil {
    107 		return err
    108 	}
    109 	if err = addResolveEndpointMiddleware(stack, options); err != nil {
    110 		return err
    111 	}
    112 	if err = addComputePayloadSHA256(stack); err != nil {
    113 		return err
    114 	}
    115 	if err = addRetry(stack, options); err != nil {
    116 		return err
    117 	}
    118 	if err = addRawResponseToMetadata(stack); err != nil {
    119 		return err
    120 	}
    121 	if err = addRecordResponseTiming(stack); err != nil {
    122 		return err
    123 	}
    124 	if err = addClientUserAgent(stack, options); err != nil {
    125 		return err
    126 	}
    127 	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
    128 		return err
    129 	}
    130 	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
    131 		return err
    132 	}
    133 	if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
    134 		return err
    135 	}
    136 	if err = addOpCreateTrafficPolicyVersionValidationMiddleware(stack); err != nil {
    137 		return err
    138 	}
    139 	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateTrafficPolicyVersion(options.Region), middleware.Before); err != nil {
    140 		return err
    141 	}
    142 	if err = addRecursionDetection(stack); err != nil {
    143 		return err
    144 	}
    145 	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
    146 		return err
    147 	}
    148 	if err = addResponseErrorMiddleware(stack); err != nil {
    149 		return err
    150 	}
    151 	if err = addRequestResponseLogging(stack, options); err != nil {
    152 		return err
    153 	}
    154 	if err = addDisableHTTPSMiddleware(stack, options); err != nil {
    155 		return err
    156 	}
    157 	return nil
    158 }
    159 
    160 func newServiceMetadataMiddleware_opCreateTrafficPolicyVersion(region string) *awsmiddleware.RegisterServiceMetadata {
    161 	return &awsmiddleware.RegisterServiceMetadata{
    162 		Region:        region,
    163 		ServiceID:     ServiceID,
    164 		OperationName: "CreateTrafficPolicyVersion",
    165 	}
    166 }