-
Notifications
You must be signed in to change notification settings - Fork 639
/
api_op_GetTraceSummaries.go
318 lines (266 loc) · 9.82 KB
/
api_op_GetTraceSummaries.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package xray
import (
"context"
"time"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/internal/awsutil"
"github.com/aws/aws-sdk-go-v2/private/protocol"
)
// Please also see https://docs.aws.amazon.com/goto/WebAPI/xray-2016-04-12/GetTraceSummariesRequest
type GetTraceSummariesInput struct {
_ struct{} `type:"structure"`
// The end of the time frame for which to retrieve traces.
//
// EndTime is a required field
EndTime *time.Time `type:"timestamp" required:"true"`
// Specify a filter expression to retrieve trace summaries for services or requests
// that meet certain requirements.
FilterExpression *string `type:"string"`
// Specify the pagination token returned by a previous request to retrieve the
// next page of results.
NextToken *string `type:"string"`
// Set to true to get summaries for only a subset of available traces.
Sampling *bool `type:"boolean"`
// A paramater to indicate whether to enable sampling on trace summaries. Input
// parameters are Name and Value.
SamplingStrategy *SamplingStrategy `type:"structure"`
// The start of the time frame for which to retrieve traces.
//
// StartTime is a required field
StartTime *time.Time `type:"timestamp" required:"true"`
// A parameter to indicate whether to query trace summaries by TraceId or Event
// time.
TimeRangeType TimeRangeType `type:"string" enum:"true"`
}
// String returns the string representation
func (s GetTraceSummariesInput) String() string {
return awsutil.Prettify(s)
}
// Validate inspects the fields of the type to determine if they are valid.
func (s *GetTraceSummariesInput) Validate() error {
invalidParams := aws.ErrInvalidParams{Context: "GetTraceSummariesInput"}
if s.EndTime == nil {
invalidParams.Add(aws.NewErrParamRequired("EndTime"))
}
if s.StartTime == nil {
invalidParams.Add(aws.NewErrParamRequired("StartTime"))
}
if invalidParams.Len() > 0 {
return invalidParams
}
return nil
}
// MarshalFields encodes the AWS API shape using the passed in protocol encoder.
func (s GetTraceSummariesInput) MarshalFields(e protocol.FieldEncoder) error {
e.SetValue(protocol.HeaderTarget, "Content-Type", protocol.StringValue("application/json"), protocol.Metadata{})
if s.EndTime != nil {
v := *s.EndTime
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "EndTime",
protocol.TimeValue{V: v, Format: protocol.UnixTimeFormatName, QuotedFormatTime: true}, metadata)
}
if s.FilterExpression != nil {
v := *s.FilterExpression
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "FilterExpression", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if s.NextToken != nil {
v := *s.NextToken
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "NextToken", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if s.Sampling != nil {
v := *s.Sampling
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "Sampling", protocol.BoolValue(v), metadata)
}
if s.SamplingStrategy != nil {
v := s.SamplingStrategy
metadata := protocol.Metadata{}
e.SetFields(protocol.BodyTarget, "SamplingStrategy", v, metadata)
}
if s.StartTime != nil {
v := *s.StartTime
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "StartTime",
protocol.TimeValue{V: v, Format: protocol.UnixTimeFormatName, QuotedFormatTime: true}, metadata)
}
if len(s.TimeRangeType) > 0 {
v := s.TimeRangeType
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "TimeRangeType", protocol.QuotedValue{ValueMarshaler: v}, metadata)
}
return nil
}
// Please also see https://docs.aws.amazon.com/goto/WebAPI/xray-2016-04-12/GetTraceSummariesResult
type GetTraceSummariesOutput struct {
_ struct{} `type:"structure"`
// The start time of this page of results.
ApproximateTime *time.Time `type:"timestamp"`
// If the requested time frame contained more than one page of results, you
// can use this token to retrieve the next page. The first page contains the
// most most recent results, closest to the end of the time frame.
NextToken *string `type:"string"`
// Trace IDs and metadata for traces that were found in the specified time frame.
TraceSummaries []TraceSummary `type:"list"`
// The total number of traces processed, including traces that did not match
// the specified filter expression.
TracesProcessedCount *int64 `type:"long"`
}
// String returns the string representation
func (s GetTraceSummariesOutput) String() string {
return awsutil.Prettify(s)
}
// MarshalFields encodes the AWS API shape using the passed in protocol encoder.
func (s GetTraceSummariesOutput) MarshalFields(e protocol.FieldEncoder) error {
if s.ApproximateTime != nil {
v := *s.ApproximateTime
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "ApproximateTime",
protocol.TimeValue{V: v, Format: protocol.UnixTimeFormatName, QuotedFormatTime: true}, metadata)
}
if s.NextToken != nil {
v := *s.NextToken
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "NextToken", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if s.TraceSummaries != nil {
v := s.TraceSummaries
metadata := protocol.Metadata{}
ls0 := e.List(protocol.BodyTarget, "TraceSummaries", metadata)
ls0.Start()
for _, v1 := range v {
ls0.ListAddFields(v1)
}
ls0.End()
}
if s.TracesProcessedCount != nil {
v := *s.TracesProcessedCount
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "TracesProcessedCount", protocol.Int64Value(v), metadata)
}
return nil
}
const opGetTraceSummaries = "GetTraceSummaries"
// GetTraceSummariesRequest returns a request value for making API operation for
// AWS X-Ray.
//
// Retrieves IDs and metadata for traces available for a specified time frame
// using an optional filter. To get the full traces, pass the trace IDs to BatchGetTraces.
//
// A filter expression can target traced requests that hit specific service
// nodes or edges, have errors, or come from a known user. For example, the
// following filter expression targets traces that pass through api.example.com:
//
// service("api.example.com")
//
// This filter expression finds traces that have an annotation named account
// with the value 12345:
//
// annotation.account = "12345"
//
// For a full list of indexed fields and keywords that you can use in filter
// expressions, see Using Filter Expressions (https://docs.aws.amazon.com/xray/latest/devguide/xray-console-filters.html)
// in the AWS X-Ray Developer Guide.
//
// // Example sending a request using GetTraceSummariesRequest.
// req := client.GetTraceSummariesRequest(params)
// resp, err := req.Send(context.TODO())
// if err == nil {
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/xray-2016-04-12/GetTraceSummaries
func (c *Client) GetTraceSummariesRequest(input *GetTraceSummariesInput) GetTraceSummariesRequest {
op := &aws.Operation{
Name: opGetTraceSummaries,
HTTPMethod: "POST",
HTTPPath: "/TraceSummaries",
Paginator: &aws.Paginator{
InputTokens: []string{"NextToken"},
OutputTokens: []string{"NextToken"},
LimitToken: "",
TruncationToken: "",
},
}
if input == nil {
input = &GetTraceSummariesInput{}
}
req := c.newRequest(op, input, &GetTraceSummariesOutput{})
return GetTraceSummariesRequest{Request: req, Input: input, Copy: c.GetTraceSummariesRequest}
}
// GetTraceSummariesRequest is the request type for the
// GetTraceSummaries API operation.
type GetTraceSummariesRequest struct {
*aws.Request
Input *GetTraceSummariesInput
Copy func(*GetTraceSummariesInput) GetTraceSummariesRequest
}
// Send marshals and sends the GetTraceSummaries API request.
func (r GetTraceSummariesRequest) Send(ctx context.Context) (*GetTraceSummariesResponse, error) {
r.Request.SetContext(ctx)
err := r.Request.Send()
if err != nil {
return nil, err
}
resp := &GetTraceSummariesResponse{
GetTraceSummariesOutput: r.Request.Data.(*GetTraceSummariesOutput),
response: &aws.Response{Request: r.Request},
}
return resp, nil
}
// NewGetTraceSummariesRequestPaginator returns a paginator for GetTraceSummaries.
// Use Next method to get the next page, and CurrentPage to get the current
// response page from the paginator. Next will return false, if there are
// no more pages, or an error was encountered.
//
// Note: This operation can generate multiple requests to a service.
//
// // Example iterating over pages.
// req := client.GetTraceSummariesRequest(input)
// p := xray.NewGetTraceSummariesRequestPaginator(req)
//
// for p.Next(context.TODO()) {
// page := p.CurrentPage()
// }
//
// if err := p.Err(); err != nil {
// return err
// }
//
func NewGetTraceSummariesPaginator(req GetTraceSummariesRequest) GetTraceSummariesPaginator {
return GetTraceSummariesPaginator{
Pager: aws.Pager{
NewRequest: func(ctx context.Context) (*aws.Request, error) {
var inCpy *GetTraceSummariesInput
if req.Input != nil {
tmp := *req.Input
inCpy = &tmp
}
newReq := req.Copy(inCpy)
newReq.SetContext(ctx)
return newReq.Request, nil
},
},
}
}
// GetTraceSummariesPaginator is used to paginate the request. This can be done by
// calling Next and CurrentPage.
type GetTraceSummariesPaginator struct {
aws.Pager
}
func (p *GetTraceSummariesPaginator) CurrentPage() *GetTraceSummariesOutput {
return p.Pager.CurrentPage().(*GetTraceSummariesOutput)
}
// GetTraceSummariesResponse is the response type for the
// GetTraceSummaries API operation.
type GetTraceSummariesResponse struct {
*GetTraceSummariesOutput
response *aws.Response
}
// SDKResponseMetdata returns the response metadata for the
// GetTraceSummaries request.
func (r *GetTraceSummariesResponse) SDKResponseMetdata() *aws.Response {
return r.response
}