src

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

api_op_CreateTrafficPolicy.go (4656B)


      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 traffic policy, which you use to create multiple DNS resource record
     15 // sets for one domain name (such as example.com) or one subdomain name (such as
     16 // www.example.com).
     17 func (c *Client) CreateTrafficPolicy(ctx context.Context, params *CreateTrafficPolicyInput, optFns ...func(*Options)) (*CreateTrafficPolicyOutput, error) {
     18 	if params == nil {
     19 		params = &CreateTrafficPolicyInput{}
     20 	}
     21 
     22 	result, metadata, err := c.invokeOperation(ctx, "CreateTrafficPolicy", params, optFns, c.addOperationCreateTrafficPolicyMiddlewares)
     23 	if err != nil {
     24 		return nil, err
     25 	}
     26 
     27 	out := result.(*CreateTrafficPolicyOutput)
     28 	out.ResultMetadata = metadata
     29 	return out, nil
     30 }
     31 
     32 // A complex type that contains information about the traffic policy that you want
     33 // to create.
     34 type CreateTrafficPolicyInput struct {
     35 
     36 	// The definition of this traffic policy in JSON format. For more information, see
     37 	// Traffic Policy Document Format (https://docs.aws.amazon.com/Route53/latest/APIReference/api-policies-traffic-policy-document-format.html)
     38 	// .
     39 	//
     40 	// This member is required.
     41 	Document *string
     42 
     43 	// The name of the traffic policy.
     44 	//
     45 	// This member is required.
     46 	Name *string
     47 
     48 	// (Optional) Any comments that you want to include about the traffic policy.
     49 	Comment *string
     50 
     51 	noSmithyDocumentSerde
     52 }
     53 
     54 // A complex type that contains the response information for the
     55 // CreateTrafficPolicy request.
     56 type CreateTrafficPolicyOutput struct {
     57 
     58 	// A unique URL that represents a new traffic policy.
     59 	//
     60 	// This member is required.
     61 	Location *string
     62 
     63 	// A complex type that contains settings for the new traffic policy.
     64 	//
     65 	// This member is required.
     66 	TrafficPolicy *types.TrafficPolicy
     67 
     68 	// Metadata pertaining to the operation's result.
     69 	ResultMetadata middleware.Metadata
     70 
     71 	noSmithyDocumentSerde
     72 }
     73 
     74 func (c *Client) addOperationCreateTrafficPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) {
     75 	if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
     76 		return err
     77 	}
     78 	err = stack.Serialize.Add(&awsRestxml_serializeOpCreateTrafficPolicy{}, middleware.After)
     79 	if err != nil {
     80 		return err
     81 	}
     82 	err = stack.Deserialize.Add(&awsRestxml_deserializeOpCreateTrafficPolicy{}, middleware.After)
     83 	if err != nil {
     84 		return err
     85 	}
     86 	if err := addProtocolFinalizerMiddlewares(stack, options, "CreateTrafficPolicy"); err != nil {
     87 		return fmt.Errorf("add protocol finalizers: %v", err)
     88 	}
     89 
     90 	if err = addlegacyEndpointContextSetter(stack, options); err != nil {
     91 		return err
     92 	}
     93 	if err = addSetLoggerMiddleware(stack, options); err != nil {
     94 		return err
     95 	}
     96 	if err = addClientRequestID(stack); err != nil {
     97 		return err
     98 	}
     99 	if err = addComputeContentLength(stack); err != nil {
    100 		return err
    101 	}
    102 	if err = addResolveEndpointMiddleware(stack, options); err != nil {
    103 		return err
    104 	}
    105 	if err = addComputePayloadSHA256(stack); err != nil {
    106 		return err
    107 	}
    108 	if err = addRetry(stack, options); err != nil {
    109 		return err
    110 	}
    111 	if err = addRawResponseToMetadata(stack); err != nil {
    112 		return err
    113 	}
    114 	if err = addRecordResponseTiming(stack); err != nil {
    115 		return err
    116 	}
    117 	if err = addClientUserAgent(stack, options); err != nil {
    118 		return err
    119 	}
    120 	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
    121 		return err
    122 	}
    123 	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
    124 		return err
    125 	}
    126 	if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
    127 		return err
    128 	}
    129 	if err = addOpCreateTrafficPolicyValidationMiddleware(stack); err != nil {
    130 		return err
    131 	}
    132 	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateTrafficPolicy(options.Region), middleware.Before); err != nil {
    133 		return err
    134 	}
    135 	if err = addRecursionDetection(stack); err != nil {
    136 		return err
    137 	}
    138 	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
    139 		return err
    140 	}
    141 	if err = addResponseErrorMiddleware(stack); err != nil {
    142 		return err
    143 	}
    144 	if err = addRequestResponseLogging(stack, options); err != nil {
    145 		return err
    146 	}
    147 	if err = addDisableHTTPSMiddleware(stack, options); err != nil {
    148 		return err
    149 	}
    150 	return nil
    151 }
    152 
    153 func newServiceMetadataMiddleware_opCreateTrafficPolicy(region string) *awsmiddleware.RegisterServiceMetadata {
    154 	return &awsmiddleware.RegisterServiceMetadata{
    155 		Region:        region,
    156 		ServiceID:     ServiceID,
    157 		OperationName: "CreateTrafficPolicy",
    158 	}
    159 }