api_op_ListTrafficPolicies.go (6054B)
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 the latest version for every traffic policy that is 15 // associated with the current Amazon Web Services account. Policies are listed in 16 // the order that they were created in. For information about how of deleting a 17 // traffic policy affects the response from ListTrafficPolicies , see 18 // DeleteTrafficPolicy (https://docs.aws.amazon.com/Route53/latest/APIReference/API_DeleteTrafficPolicy.html) 19 // . 20 func (c *Client) ListTrafficPolicies(ctx context.Context, params *ListTrafficPoliciesInput, optFns ...func(*Options)) (*ListTrafficPoliciesOutput, error) { 21 if params == nil { 22 params = &ListTrafficPoliciesInput{} 23 } 24 25 result, metadata, err := c.invokeOperation(ctx, "ListTrafficPolicies", params, optFns, c.addOperationListTrafficPoliciesMiddlewares) 26 if err != nil { 27 return nil, err 28 } 29 30 out := result.(*ListTrafficPoliciesOutput) 31 out.ResultMetadata = metadata 32 return out, nil 33 } 34 35 // A complex type that contains the information about the request to list the 36 // traffic policies that are associated with the current Amazon Web Services 37 // account. 38 type ListTrafficPoliciesInput struct { 39 40 // (Optional) The maximum number of traffic policies that you want Amazon Route 53 41 // to return in response to this request. If you have more than MaxItems traffic 42 // policies, the value of IsTruncated in the response is true , and the value of 43 // TrafficPolicyIdMarker is the ID of the first traffic policy that Route 53 will 44 // return if you submit another request. 45 MaxItems *int32 46 47 // (Conditional) For your first request to ListTrafficPolicies , don't include the 48 // TrafficPolicyIdMarker parameter. If you have more traffic policies than the 49 // value of MaxItems , ListTrafficPolicies returns only the first MaxItems traffic 50 // policies. To get the next group of policies, submit another request to 51 // ListTrafficPolicies . For the value of TrafficPolicyIdMarker , specify the value 52 // of TrafficPolicyIdMarker that was returned in the previous response. 53 TrafficPolicyIdMarker *string 54 55 noSmithyDocumentSerde 56 } 57 58 // A complex type that contains the response information for the request. 59 type ListTrafficPoliciesOutput struct { 60 61 // A flag that indicates whether there are more traffic policies to be listed. If 62 // the response was truncated, you can get the next group of traffic policies by 63 // submitting another ListTrafficPolicies request and specifying the value of 64 // TrafficPolicyIdMarker in the TrafficPolicyIdMarker request parameter. 65 // 66 // This member is required. 67 IsTruncated bool 68 69 // The value that you specified for the MaxItems parameter in the 70 // ListTrafficPolicies request that produced the current response. 71 // 72 // This member is required. 73 MaxItems *int32 74 75 // If the value of IsTruncated is true , TrafficPolicyIdMarker is the ID of the 76 // first traffic policy in the next group of MaxItems traffic policies. 77 // 78 // This member is required. 79 TrafficPolicyIdMarker *string 80 81 // A list that contains one TrafficPolicySummary element for each traffic policy 82 // that was created by the current Amazon Web Services account. 83 // 84 // This member is required. 85 TrafficPolicySummaries []types.TrafficPolicySummary 86 87 // Metadata pertaining to the operation's result. 88 ResultMetadata middleware.Metadata 89 90 noSmithyDocumentSerde 91 } 92 93 func (c *Client) addOperationListTrafficPoliciesMiddlewares(stack *middleware.Stack, options Options) (err error) { 94 if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { 95 return err 96 } 97 err = stack.Serialize.Add(&awsRestxml_serializeOpListTrafficPolicies{}, middleware.After) 98 if err != nil { 99 return err 100 } 101 err = stack.Deserialize.Add(&awsRestxml_deserializeOpListTrafficPolicies{}, middleware.After) 102 if err != nil { 103 return err 104 } 105 if err := addProtocolFinalizerMiddlewares(stack, options, "ListTrafficPolicies"); err != nil { 106 return fmt.Errorf("add protocol finalizers: %v", err) 107 } 108 109 if err = addlegacyEndpointContextSetter(stack, options); err != nil { 110 return err 111 } 112 if err = addSetLoggerMiddleware(stack, options); err != nil { 113 return err 114 } 115 if err = addClientRequestID(stack); err != nil { 116 return err 117 } 118 if err = addComputeContentLength(stack); err != nil { 119 return err 120 } 121 if err = addResolveEndpointMiddleware(stack, options); err != nil { 122 return err 123 } 124 if err = addComputePayloadSHA256(stack); err != nil { 125 return err 126 } 127 if err = addRetry(stack, options); err != nil { 128 return err 129 } 130 if err = addRawResponseToMetadata(stack); err != nil { 131 return err 132 } 133 if err = addRecordResponseTiming(stack); err != nil { 134 return err 135 } 136 if err = addClientUserAgent(stack, options); err != nil { 137 return err 138 } 139 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 140 return err 141 } 142 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 143 return err 144 } 145 if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { 146 return err 147 } 148 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListTrafficPolicies(options.Region), middleware.Before); err != nil { 149 return err 150 } 151 if err = addRecursionDetection(stack); err != nil { 152 return err 153 } 154 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 155 return err 156 } 157 if err = addResponseErrorMiddleware(stack); err != nil { 158 return err 159 } 160 if err = addRequestResponseLogging(stack, options); err != nil { 161 return err 162 } 163 if err = addDisableHTTPSMiddleware(stack, options); err != nil { 164 return err 165 } 166 return nil 167 } 168 169 func newServiceMetadataMiddleware_opListTrafficPolicies(region string) *awsmiddleware.RegisterServiceMetadata { 170 return &awsmiddleware.RegisterServiceMetadata{ 171 Region: region, 172 ServiceID: ServiceID, 173 OperationName: "ListTrafficPolicies", 174 } 175 }