api_op_GetTrafficPolicy.go (4333B)
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 // Gets information about a specific traffic policy version. For information about 15 // how of deleting a traffic policy affects the response from GetTrafficPolicy , 16 // see DeleteTrafficPolicy (https://docs.aws.amazon.com/Route53/latest/APIReference/API_DeleteTrafficPolicy.html) 17 // . 18 func (c *Client) GetTrafficPolicy(ctx context.Context, params *GetTrafficPolicyInput, optFns ...func(*Options)) (*GetTrafficPolicyOutput, error) { 19 if params == nil { 20 params = &GetTrafficPolicyInput{} 21 } 22 23 result, metadata, err := c.invokeOperation(ctx, "GetTrafficPolicy", params, optFns, c.addOperationGetTrafficPolicyMiddlewares) 24 if err != nil { 25 return nil, err 26 } 27 28 out := result.(*GetTrafficPolicyOutput) 29 out.ResultMetadata = metadata 30 return out, nil 31 } 32 33 // Gets information about a specific traffic policy version. 34 type GetTrafficPolicyInput struct { 35 36 // The ID of the traffic policy that you want to get information about. 37 // 38 // This member is required. 39 Id *string 40 41 // The version number of the traffic policy that you want to get information about. 42 // 43 // This member is required. 44 Version *int32 45 46 noSmithyDocumentSerde 47 } 48 49 // A complex type that contains the response information for the request. 50 type GetTrafficPolicyOutput struct { 51 52 // A complex type that contains settings for the specified traffic policy. 53 // 54 // This member is required. 55 TrafficPolicy *types.TrafficPolicy 56 57 // Metadata pertaining to the operation's result. 58 ResultMetadata middleware.Metadata 59 60 noSmithyDocumentSerde 61 } 62 63 func (c *Client) addOperationGetTrafficPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) { 64 if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { 65 return err 66 } 67 err = stack.Serialize.Add(&awsRestxml_serializeOpGetTrafficPolicy{}, middleware.After) 68 if err != nil { 69 return err 70 } 71 err = stack.Deserialize.Add(&awsRestxml_deserializeOpGetTrafficPolicy{}, middleware.After) 72 if err != nil { 73 return err 74 } 75 if err := addProtocolFinalizerMiddlewares(stack, options, "GetTrafficPolicy"); err != nil { 76 return fmt.Errorf("add protocol finalizers: %v", err) 77 } 78 79 if err = addlegacyEndpointContextSetter(stack, options); err != nil { 80 return err 81 } 82 if err = addSetLoggerMiddleware(stack, options); err != nil { 83 return err 84 } 85 if err = addClientRequestID(stack); err != nil { 86 return err 87 } 88 if err = addComputeContentLength(stack); err != nil { 89 return err 90 } 91 if err = addResolveEndpointMiddleware(stack, options); err != nil { 92 return err 93 } 94 if err = addComputePayloadSHA256(stack); err != nil { 95 return err 96 } 97 if err = addRetry(stack, options); err != nil { 98 return err 99 } 100 if err = addRawResponseToMetadata(stack); err != nil { 101 return err 102 } 103 if err = addRecordResponseTiming(stack); err != nil { 104 return err 105 } 106 if err = addClientUserAgent(stack, options); err != nil { 107 return err 108 } 109 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 110 return err 111 } 112 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 113 return err 114 } 115 if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { 116 return err 117 } 118 if err = addOpGetTrafficPolicyValidationMiddleware(stack); err != nil { 119 return err 120 } 121 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetTrafficPolicy(options.Region), middleware.Before); err != nil { 122 return err 123 } 124 if err = addRecursionDetection(stack); err != nil { 125 return err 126 } 127 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 128 return err 129 } 130 if err = addResponseErrorMiddleware(stack); err != nil { 131 return err 132 } 133 if err = addRequestResponseLogging(stack, options); err != nil { 134 return err 135 } 136 if err = addDisableHTTPSMiddleware(stack, options); err != nil { 137 return err 138 } 139 return nil 140 } 141 142 func newServiceMetadataMiddleware_opGetTrafficPolicy(region string) *awsmiddleware.RegisterServiceMetadata { 143 return &awsmiddleware.RegisterServiceMetadata{ 144 Region: region, 145 ServiceID: ServiceID, 146 OperationName: "GetTrafficPolicy", 147 } 148 }