api_op_CreateTrafficPolicyInstance.go (6207B)
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 resource record sets in a specified hosted zone based on the settings 15 // in 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. After you submit an 20 // CreateTrafficPolicyInstance request, there's a brief delay while Amazon Route 53 21 // creates the resource record sets that are specified in the traffic policy 22 // definition. Use GetTrafficPolicyInstance with the id of new traffic policy 23 // instance to confirm that the CreateTrafficPolicyInstance request completed 24 // successfully. For more information, see the State response element. 25 func (c *Client) CreateTrafficPolicyInstance(ctx context.Context, params *CreateTrafficPolicyInstanceInput, optFns ...func(*Options)) (*CreateTrafficPolicyInstanceOutput, error) { 26 if params == nil { 27 params = &CreateTrafficPolicyInstanceInput{} 28 } 29 30 result, metadata, err := c.invokeOperation(ctx, "CreateTrafficPolicyInstance", params, optFns, c.addOperationCreateTrafficPolicyInstanceMiddlewares) 31 if err != nil { 32 return nil, err 33 } 34 35 out := result.(*CreateTrafficPolicyInstanceOutput) 36 out.ResultMetadata = metadata 37 return out, nil 38 } 39 40 // A complex type that contains information about the resource record sets that 41 // you want to create based on a specified traffic policy. 42 type CreateTrafficPolicyInstanceInput struct { 43 44 // The ID of the hosted zone that you want Amazon Route 53 to create resource 45 // record sets in by using the configuration in a traffic policy. 46 // 47 // This member is required. 48 HostedZoneId *string 49 50 // The domain name (such as example.com) or subdomain name (such as 51 // www.example.com) for which Amazon Route 53 responds to DNS queries by using the 52 // resource record sets that Route 53 creates for this traffic policy instance. 53 // 54 // This member is required. 55 Name *string 56 57 // (Optional) The TTL that you want Amazon Route 53 to assign to all of the 58 // resource record sets that it creates in the specified hosted zone. 59 // 60 // This member is required. 61 TTL *int64 62 63 // The ID of the traffic policy that you want to use to create resource record 64 // sets in the specified hosted zone. 65 // 66 // This member is required. 67 TrafficPolicyId *string 68 69 // The version of the traffic policy that you want to use to create resource 70 // record sets in the specified hosted zone. 71 // 72 // This member is required. 73 TrafficPolicyVersion *int32 74 75 noSmithyDocumentSerde 76 } 77 78 // A complex type that contains the response information for the 79 // CreateTrafficPolicyInstance request. 80 type CreateTrafficPolicyInstanceOutput struct { 81 82 // A unique URL that represents a new traffic policy instance. 83 // 84 // This member is required. 85 Location *string 86 87 // A complex type that contains settings for the new traffic policy instance. 88 // 89 // This member is required. 90 TrafficPolicyInstance *types.TrafficPolicyInstance 91 92 // Metadata pertaining to the operation's result. 93 ResultMetadata middleware.Metadata 94 95 noSmithyDocumentSerde 96 } 97 98 func (c *Client) addOperationCreateTrafficPolicyInstanceMiddlewares(stack *middleware.Stack, options Options) (err error) { 99 if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { 100 return err 101 } 102 err = stack.Serialize.Add(&awsRestxml_serializeOpCreateTrafficPolicyInstance{}, middleware.After) 103 if err != nil { 104 return err 105 } 106 err = stack.Deserialize.Add(&awsRestxml_deserializeOpCreateTrafficPolicyInstance{}, middleware.After) 107 if err != nil { 108 return err 109 } 110 if err := addProtocolFinalizerMiddlewares(stack, options, "CreateTrafficPolicyInstance"); err != nil { 111 return fmt.Errorf("add protocol finalizers: %v", err) 112 } 113 114 if err = addlegacyEndpointContextSetter(stack, options); err != nil { 115 return err 116 } 117 if err = addSetLoggerMiddleware(stack, options); err != nil { 118 return err 119 } 120 if err = addClientRequestID(stack); err != nil { 121 return err 122 } 123 if err = addComputeContentLength(stack); err != nil { 124 return err 125 } 126 if err = addResolveEndpointMiddleware(stack, options); err != nil { 127 return err 128 } 129 if err = addComputePayloadSHA256(stack); err != nil { 130 return err 131 } 132 if err = addRetry(stack, options); err != nil { 133 return err 134 } 135 if err = addRawResponseToMetadata(stack); err != nil { 136 return err 137 } 138 if err = addRecordResponseTiming(stack); err != nil { 139 return err 140 } 141 if err = addClientUserAgent(stack, options); err != nil { 142 return err 143 } 144 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 145 return err 146 } 147 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 148 return err 149 } 150 if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { 151 return err 152 } 153 if err = addOpCreateTrafficPolicyInstanceValidationMiddleware(stack); err != nil { 154 return err 155 } 156 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateTrafficPolicyInstance(options.Region), middleware.Before); err != nil { 157 return err 158 } 159 if err = addRecursionDetection(stack); err != nil { 160 return err 161 } 162 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 163 return err 164 } 165 if err = addResponseErrorMiddleware(stack); err != nil { 166 return err 167 } 168 if err = addSanitizeURLMiddleware(stack); err != nil { 169 return err 170 } 171 if err = addRequestResponseLogging(stack, options); err != nil { 172 return err 173 } 174 if err = addDisableHTTPSMiddleware(stack, options); err != nil { 175 return err 176 } 177 return nil 178 } 179 180 func newServiceMetadataMiddleware_opCreateTrafficPolicyInstance(region string) *awsmiddleware.RegisterServiceMetadata { 181 return &awsmiddleware.RegisterServiceMetadata{ 182 Region: region, 183 ServiceID: ServiceID, 184 OperationName: "CreateTrafficPolicyInstance", 185 } 186 }