api_op_CreateTrafficPolicyInstance.go (5432B)
1 // Code generated by smithy-go-codegen DO NOT EDIT. 2 3 package route53 4 5 import ( 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 resource record sets in a specified hosted zone based on the settings in 15 // a specified traffic policy version. In addition, CreateTrafficPolicyInstance 16 // associates the resource record sets with a specified domain name (such as 17 // example.com) or subdomain name (such as www.example.com). Amazon Route 53 18 // responds to DNS queries for the domain or subdomain name by using the resource 19 // record sets that CreateTrafficPolicyInstance created. 20 func (c *Client) CreateTrafficPolicyInstance(ctx context.Context, params *CreateTrafficPolicyInstanceInput, optFns ...func(*Options)) (*CreateTrafficPolicyInstanceOutput, error) { 21 if params == nil { 22 params = &CreateTrafficPolicyInstanceInput{} 23 } 24 25 result, metadata, err := c.invokeOperation(ctx, "CreateTrafficPolicyInstance", params, optFns, c.addOperationCreateTrafficPolicyInstanceMiddlewares) 26 if err != nil { 27 return nil, err 28 } 29 30 out := result.(*CreateTrafficPolicyInstanceOutput) 31 out.ResultMetadata = metadata 32 return out, nil 33 } 34 35 // A complex type that contains information about the resource record sets that you 36 // want to create based on a specified traffic policy. 37 type CreateTrafficPolicyInstanceInput struct { 38 39 // The ID of the hosted zone that you want Amazon Route 53 to create resource 40 // record sets in by using the configuration in a traffic policy. 41 // 42 // This member is required. 43 HostedZoneId *string 44 45 // The domain name (such as example.com) or subdomain name (such as 46 // www.example.com) for which Amazon Route 53 responds to DNS queries by using the 47 // resource record sets that Route 53 creates for this traffic policy instance. 48 // 49 // This member is required. 50 Name *string 51 52 // (Optional) The TTL that you want Amazon Route 53 to assign to all of the 53 // resource record sets that it creates in the specified hosted zone. 54 // 55 // This member is required. 56 TTL *int64 57 58 // The ID of the traffic policy that you want to use to create resource record sets 59 // in the specified hosted zone. 60 // 61 // This member is required. 62 TrafficPolicyId *string 63 64 // The version of the traffic policy that you want to use to create resource record 65 // sets in the specified hosted zone. 66 // 67 // This member is required. 68 TrafficPolicyVersion *int32 69 70 noSmithyDocumentSerde 71 } 72 73 // A complex type that contains the response information for the 74 // CreateTrafficPolicyInstance request. 75 type CreateTrafficPolicyInstanceOutput struct { 76 77 // A unique URL that represents a new traffic policy instance. 78 // 79 // This member is required. 80 Location *string 81 82 // A complex type that contains settings for the new 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) addOperationCreateTrafficPolicyInstanceMiddlewares(stack *middleware.Stack, options Options) (err error) { 94 err = stack.Serialize.Add(&awsRestxml_serializeOpCreateTrafficPolicyInstance{}, middleware.After) 95 if err != nil { 96 return err 97 } 98 err = stack.Deserialize.Add(&awsRestxml_deserializeOpCreateTrafficPolicyInstance{}, middleware.After) 99 if err != nil { 100 return err 101 } 102 if err = addSetLoggerMiddleware(stack, options); err != nil { 103 return err 104 } 105 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 106 return err 107 } 108 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 109 return err 110 } 111 if err = addResolveEndpointMiddleware(stack, options); err != nil { 112 return err 113 } 114 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 115 return err 116 } 117 if err = addRetryMiddlewares(stack, options); err != nil { 118 return err 119 } 120 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 121 return err 122 } 123 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 124 return err 125 } 126 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 127 return err 128 } 129 if err = addClientUserAgent(stack); err != nil { 130 return err 131 } 132 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 133 return err 134 } 135 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 136 return err 137 } 138 if err = addOpCreateTrafficPolicyInstanceValidationMiddleware(stack); err != nil { 139 return err 140 } 141 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateTrafficPolicyInstance(options.Region), middleware.Before); err != nil { 142 return err 143 } 144 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 145 return err 146 } 147 if err = addResponseErrorMiddleware(stack); err != nil { 148 return err 149 } 150 if err = addSanitizeURLMiddleware(stack); err != nil { 151 return err 152 } 153 if err = addRequestResponseLogging(stack, options); err != nil { 154 return err 155 } 156 return nil 157 } 158 159 func newServiceMetadataMiddleware_opCreateTrafficPolicyInstance(region string) *awsmiddleware.RegisterServiceMetadata { 160 return &awsmiddleware.RegisterServiceMetadata{ 161 Region: region, 162 ServiceID: ServiceID, 163 SigningName: "route53", 164 OperationName: "CreateTrafficPolicyInstance", 165 } 166 }