api_op_CreateTrafficPolicyInstance.go (4754B)
1 // Code generated by smithy-go-codegen DO NOT EDIT. 2 3 package route53 4 5 import ( 6 "context" 7 8 "github.com/aws/aws-sdk-go-v2/service/route53/types" 9 "github.com/aws/smithy-go/middleware" 10 ) 11 12 // Creates resource record sets in a specified hosted zone based on the settings 13 // in a specified traffic policy version. In addition, CreateTrafficPolicyInstance 14 // associates the resource record sets with a specified domain name (such as 15 // example.com) or subdomain name (such as www.example.com). Amazon Route 53 16 // responds to DNS queries for the domain or subdomain name by using the resource 17 // record sets that CreateTrafficPolicyInstance created. 18 // 19 // After you submit an CreateTrafficPolicyInstance request, there's a brief delay 20 // while Amazon Route 53 creates the resource record sets that are specified in the 21 // traffic policy definition. Use GetTrafficPolicyInstance with the id of new 22 // traffic policy instance to confirm that the CreateTrafficPolicyInstance request 23 // completed successfully. For more information, see the State response element. 24 func (c *Client) CreateTrafficPolicyInstance(ctx context.Context, params *CreateTrafficPolicyInstanceInput, optFns ...func(*Options)) (*CreateTrafficPolicyInstanceOutput, error) { 25 if params == nil { 26 params = &CreateTrafficPolicyInstanceInput{} 27 } 28 29 result, metadata, err := c.invokeOperation(ctx, "CreateTrafficPolicyInstance", params, optFns, c.addOperationCreateTrafficPolicyInstanceMiddlewares) 30 if err != nil { 31 return nil, err 32 } 33 34 out := result.(*CreateTrafficPolicyInstanceOutput) 35 out.ResultMetadata = metadata 36 return out, nil 37 } 38 39 // A complex type that contains information about the resource record sets that 40 // you want to create based on a specified traffic policy. 41 type CreateTrafficPolicyInstanceInput struct { 42 43 // The ID of the hosted zone that you want Amazon Route 53 to create resource 44 // record sets in by using the configuration in a traffic policy. 45 // 46 // This member is required. 47 HostedZoneId *string 48 49 // The domain name (such as example.com) or subdomain name (such as 50 // www.example.com) for which Amazon Route 53 responds to DNS queries by using the 51 // resource record sets that Route 53 creates for this traffic policy instance. 52 // 53 // This member is required. 54 Name *string 55 56 // (Optional) The TTL that you want Amazon Route 53 to assign to all of the 57 // resource record sets that it creates in the specified hosted zone. 58 // 59 // This member is required. 60 TTL *int64 61 62 // The ID of the traffic policy that you want to use to create resource record 63 // sets in the specified hosted zone. 64 // 65 // This member is required. 66 TrafficPolicyId *string 67 68 // The version of the traffic policy that you want to use to create resource 69 // record sets in the specified hosted zone. 70 // 71 // This member is required. 72 TrafficPolicyVersion *int32 73 74 noSmithyDocumentSerde 75 } 76 77 // A complex type that contains the response information for the 78 // CreateTrafficPolicyInstance request. 79 type CreateTrafficPolicyInstanceOutput struct { 80 81 // A unique URL that represents a new traffic policy instance. 82 // 83 // This member is required. 84 Location *string 85 86 // A complex type that contains settings for the new traffic policy instance. 87 // 88 // This member is required. 89 TrafficPolicyInstance *types.TrafficPolicyInstance 90 91 // Metadata pertaining to the operation's result. 92 ResultMetadata middleware.Metadata 93 94 noSmithyDocumentSerde 95 } 96 97 func (c *Client) addOperationCreateTrafficPolicyInstanceMiddlewares(stack *middleware.Stack, options Options) (err error) { 98 err = stack.Serialize.Add(&awsRestxml_serializeOpCreateTrafficPolicyInstance{}, middleware.After) 99 if err != nil { 100 return err 101 } 102 err = stack.Deserialize.Add(&awsRestxml_deserializeOpCreateTrafficPolicyInstance{}, middleware.After) 103 if err != nil { 104 return err 105 } 106 107 if err = addComputeContentLength(stack); err != nil { 108 return err 109 } 110 if err = addResolveEndpointMiddleware(stack, options); err != nil { 111 return err 112 } 113 if err = addComputePayloadSHA256(stack); err != nil { 114 return err 115 } 116 if err = addRecordResponseTiming(stack, options); err != nil { 117 return err 118 } 119 if err = addCredentialSource(stack, options); err != nil { 120 return err 121 } 122 if err = addOpCreateTrafficPolicyInstanceValidationMiddleware(stack); err != nil { 123 return err 124 } 125 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 126 return err 127 } 128 if err = addResponseErrorMiddleware(stack); err != nil { 129 return err 130 } 131 if err = addSanitizeURLMiddleware(stack); err != nil { 132 return err 133 } 134 if err = addRequestResponseLogging(stack, options); err != nil { 135 return err 136 } 137 if err = addDisableHTTPSMiddleware(stack, options); err != nil { 138 return err 139 } 140 if err = addInterceptors(stack, options); err != nil { 141 return err 142 } 143 return nil 144 }