-
Notifications
You must be signed in to change notification settings - Fork 17
/
FilterPattern.go
359 lines (287 loc) · 8.22 KB
/
FilterPattern.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
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
package awslogs
import (
_init_ "github.com/aws/aws-cdk-go/awscdk/v2/jsii"
_jsii_ "github.com/aws/jsii-runtime-go/runtime"
)
// A collection of static methods to generate appropriate ILogPatterns.
//
// Example:
// // Search for all events where the component field is equal to
// // "HttpServer" and either error is true or the latency is higher
// // than 1000.
// pattern := logs.FilterPattern_All(logs.FilterPattern_StringValue(jsii.String("$.component"), jsii.String("="), jsii.String("HttpServer")), logs.FilterPattern_Any(logs.FilterPattern_BooleanValue(jsii.String("$.error"), jsii.Boolean(true)), logs.FilterPattern_NumberValue(jsii.String("$.latency"), jsii.String(">"), jsii.Number(1000))))
//
type FilterPattern interface {
}
// The jsii proxy struct for FilterPattern
type jsiiProxy_FilterPattern struct {
_ byte // padding
}
func NewFilterPattern() FilterPattern {
_init_.Initialize()
j := jsiiProxy_FilterPattern{}
_jsii_.Create(
"aws-cdk-lib.aws_logs.FilterPattern",
nil, // no parameters
&j,
)
return &j
}
func NewFilterPattern_Override(f FilterPattern) {
_init_.Initialize()
_jsii_.Create(
"aws-cdk-lib.aws_logs.FilterPattern",
nil, // no parameters
f,
)
}
// A JSON log pattern that matches if all given JSON log patterns match.
func FilterPattern_All(patterns ...JsonPattern) JsonPattern {
_init_.Initialize()
args := []interface{}{}
for _, a := range patterns {
args = append(args, a)
}
var returns JsonPattern
_jsii_.StaticInvoke(
"aws-cdk-lib.aws_logs.FilterPattern",
"all",
args,
&returns,
)
return returns
}
// A log pattern that matches all events.
func FilterPattern_AllEvents() IFilterPattern {
_init_.Initialize()
var returns IFilterPattern
_jsii_.StaticInvoke(
"aws-cdk-lib.aws_logs.FilterPattern",
"allEvents",
nil, // no parameters
&returns,
)
return returns
}
// A log pattern that matches if all the strings given appear in the event.
func FilterPattern_AllTerms(terms ...*string) IFilterPattern {
_init_.Initialize()
args := []interface{}{}
for _, a := range terms {
args = append(args, a)
}
var returns IFilterPattern
_jsii_.StaticInvoke(
"aws-cdk-lib.aws_logs.FilterPattern",
"allTerms",
args,
&returns,
)
return returns
}
// A JSON log pattern that matches if any of the given JSON log patterns match.
func FilterPattern_Any(patterns ...JsonPattern) JsonPattern {
_init_.Initialize()
args := []interface{}{}
for _, a := range patterns {
args = append(args, a)
}
var returns JsonPattern
_jsii_.StaticInvoke(
"aws-cdk-lib.aws_logs.FilterPattern",
"any",
args,
&returns,
)
return returns
}
// A log pattern that matches if any of the strings given appear in the event.
func FilterPattern_AnyTerm(terms ...*string) IFilterPattern {
_init_.Initialize()
args := []interface{}{}
for _, a := range terms {
args = append(args, a)
}
var returns IFilterPattern
_jsii_.StaticInvoke(
"aws-cdk-lib.aws_logs.FilterPattern",
"anyTerm",
args,
&returns,
)
return returns
}
// A log pattern that matches if any of the given term groups matches the event.
//
// A term group matches an event if all the terms in it appear in the event string.
func FilterPattern_AnyTermGroup(termGroups ...*[]*string) IFilterPattern {
_init_.Initialize()
args := []interface{}{}
for _, a := range termGroups {
args = append(args, a)
}
var returns IFilterPattern
_jsii_.StaticInvoke(
"aws-cdk-lib.aws_logs.FilterPattern",
"anyTermGroup",
args,
&returns,
)
return returns
}
// A JSON log pattern that matches if the field exists and equals the boolean value.
func FilterPattern_BooleanValue(jsonField *string, value *bool) JsonPattern {
_init_.Initialize()
if err := validateFilterPattern_BooleanValueParameters(jsonField, value); err != nil {
panic(err)
}
var returns JsonPattern
_jsii_.StaticInvoke(
"aws-cdk-lib.aws_logs.FilterPattern",
"booleanValue",
[]interface{}{jsonField, value},
&returns,
)
return returns
}
// A JSON log patter that matches if the field exists.
//
// This is a readable convenience wrapper over 'field = *'.
func FilterPattern_Exists(jsonField *string) JsonPattern {
_init_.Initialize()
if err := validateFilterPattern_ExistsParameters(jsonField); err != nil {
panic(err)
}
var returns JsonPattern
_jsii_.StaticInvoke(
"aws-cdk-lib.aws_logs.FilterPattern",
"exists",
[]interface{}{jsonField},
&returns,
)
return returns
}
// A JSON log pattern that matches if the field exists and has the special value 'null'.
func FilterPattern_IsNull(jsonField *string) JsonPattern {
_init_.Initialize()
if err := validateFilterPattern_IsNullParameters(jsonField); err != nil {
panic(err)
}
var returns JsonPattern
_jsii_.StaticInvoke(
"aws-cdk-lib.aws_logs.FilterPattern",
"isNull",
[]interface{}{jsonField},
&returns,
)
return returns
}
// Use the given string as log pattern.
//
// See https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html
// for information on writing log patterns.
func FilterPattern_Literal(logPatternString *string) IFilterPattern {
_init_.Initialize()
if err := validateFilterPattern_LiteralParameters(logPatternString); err != nil {
panic(err)
}
var returns IFilterPattern
_jsii_.StaticInvoke(
"aws-cdk-lib.aws_logs.FilterPattern",
"literal",
[]interface{}{logPatternString},
&returns,
)
return returns
}
// A JSON log pattern that matches if the field does not exist.
func FilterPattern_NotExists(jsonField *string) JsonPattern {
_init_.Initialize()
if err := validateFilterPattern_NotExistsParameters(jsonField); err != nil {
panic(err)
}
var returns JsonPattern
_jsii_.StaticInvoke(
"aws-cdk-lib.aws_logs.FilterPattern",
"notExists",
[]interface{}{jsonField},
&returns,
)
return returns
}
// A JSON log pattern that compares numerical values.
//
// This pattern only matches if the event is a JSON event, and the indicated field inside
// compares with the value in the indicated way.
//
// Use '$' to indicate the root of the JSON structure. The comparison operator can only
// compare equality or inequality. The '*' wildcard may appear in the value may at the
// start or at the end.
//
// For more information, see:
//
// https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html
func FilterPattern_NumberValue(jsonField *string, comparison *string, value *float64) JsonPattern {
_init_.Initialize()
if err := validateFilterPattern_NumberValueParameters(jsonField, comparison, value); err != nil {
panic(err)
}
var returns JsonPattern
_jsii_.StaticInvoke(
"aws-cdk-lib.aws_logs.FilterPattern",
"numberValue",
[]interface{}{jsonField, comparison, value},
&returns,
)
return returns
}
// A space delimited log pattern matcher.
//
// The log event is divided into space-delimited columns (optionally
// enclosed by "" or [] to capture spaces into column values), and names
// are given to each column.
//
// '...' may be specified once to match any number of columns.
//
// Afterwards, conditions may be added to individual columns.
func FilterPattern_SpaceDelimited(columns ...*string) SpaceDelimitedTextPattern {
_init_.Initialize()
args := []interface{}{}
for _, a := range columns {
args = append(args, a)
}
var returns SpaceDelimitedTextPattern
_jsii_.StaticInvoke(
"aws-cdk-lib.aws_logs.FilterPattern",
"spaceDelimited",
args,
&returns,
)
return returns
}
// A JSON log pattern that compares string values.
//
// This pattern only matches if the event is a JSON event, and the indicated field inside
// compares with the string value.
//
// Use '$' to indicate the root of the JSON structure. The comparison operator can only
// compare equality or inequality. The '*' wildcard may appear in the value may at the
// start or at the end.
//
// For more information, see:
//
// https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html
func FilterPattern_StringValue(jsonField *string, comparison *string, value *string) JsonPattern {
_init_.Initialize()
if err := validateFilterPattern_StringValueParameters(jsonField, comparison, value); err != nil {
panic(err)
}
var returns JsonPattern
_jsii_.StaticInvoke(
"aws-cdk-lib.aws_logs.FilterPattern",
"stringValue",
[]interface{}{jsonField, comparison, value},
&returns,
)
return returns
}