-
Notifications
You must be signed in to change notification settings - Fork 2
/
view.go
402 lines (346 loc) · 14.9 KB
/
view.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
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
// Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package logs
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// You can add logs data to your Observability Cloud dashboards without turning your logs into metrics first. A log view displays log lines in a table form in a dashboard and shows you in detail what is happening and why.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-signalfx/sdk/v5/go/signalfx/logs"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := logs.NewView(ctx, "myLogView", &logs.ViewArgs{
// Columns: logs.ViewColumnArray{
// &logs.ViewColumnArgs{
// Name: pulumi.String("severity"),
// },
// &logs.ViewColumnArgs{
// Name: pulumi.String("time"),
// },
// &logs.ViewColumnArgs{
// Name: pulumi.String("amount.currency_code"),
// },
// &logs.ViewColumnArgs{
// Name: pulumi.String("amount.nanos"),
// },
// &logs.ViewColumnArgs{
// Name: pulumi.String("amount.units"),
// },
// &logs.ViewColumnArgs{
// Name: pulumi.String("message"),
// },
// },
// Description: pulumi.String("Lorem ipsum dolor sit amet, laudem tibique iracundia at mea. Nam posse dolores ex, nec cu adhuc putent honestatis"),
// ProgramText: pulumi.String("logs(filter=field('message') == 'Transaction processed' and field('service.name') == 'paymentservice').publish()\n\n"),
// SortOptions: logs.ViewSortOptionArray{
// &logs.ViewSortOptionArgs{
// Descending: pulumi.Bool(false),
// Field: pulumi.String("severity"),
// },
// },
// TimeRange: pulumi.Int(900),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
type View struct {
pulumi.CustomResourceState
// The column headers to show on the log view.
Columns ViewColumnArrayOutput `pulumi:"columns"`
// The connection that the log view uses to fetch data. This could be Splunk Enterprise, Splunk Enterprise Cloud or Observability Cloud.
DefaultConnection pulumi.StringPtrOutput `pulumi:"defaultConnection"`
// Description of the log view.
Description pulumi.StringPtrOutput `pulumi:"description"`
// Seconds since epoch. Used for visualization. Conflicts with `timeRange`.
EndTime pulumi.IntPtrOutput `pulumi:"endTime"`
// Name of the log view.
Name pulumi.StringOutput `pulumi:"name"`
// Signalflow program text for the log view. More info at https://developers.signalfx.com/docs/signalflow-overview.
ProgramText pulumi.StringOutput `pulumi:"programText"`
// The sorting options configuration to specify if the log view table needs to be sorted in a particular field.
SortOptions ViewSortOptionArrayOutput `pulumi:"sortOptions"`
// Seconds since epoch. Used for visualization. Conflicts with `timeRange`.
StartTime pulumi.IntPtrOutput `pulumi:"startTime"`
// From when to display data. SignalFx time syntax (e.g. `"-5m"`, `"-1h"`). Conflicts with `startTime` and `endTime`.
TimeRange pulumi.IntPtrOutput `pulumi:"timeRange"`
// The URL of the log view.
Url pulumi.StringOutput `pulumi:"url"`
}
// NewView registers a new resource with the given unique name, arguments, and options.
func NewView(ctx *pulumi.Context,
name string, args *ViewArgs, opts ...pulumi.ResourceOption) (*View, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.ProgramText == nil {
return nil, errors.New("invalid value for required argument 'ProgramText'")
}
var resource View
err := ctx.RegisterResource("signalfx:logs/view:View", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetView gets an existing View resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetView(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ViewState, opts ...pulumi.ResourceOption) (*View, error) {
var resource View
err := ctx.ReadResource("signalfx:logs/view:View", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering View resources.
type viewState struct {
// The column headers to show on the log view.
Columns []ViewColumn `pulumi:"columns"`
// The connection that the log view uses to fetch data. This could be Splunk Enterprise, Splunk Enterprise Cloud or Observability Cloud.
DefaultConnection *string `pulumi:"defaultConnection"`
// Description of the log view.
Description *string `pulumi:"description"`
// Seconds since epoch. Used for visualization. Conflicts with `timeRange`.
EndTime *int `pulumi:"endTime"`
// Name of the log view.
Name *string `pulumi:"name"`
// Signalflow program text for the log view. More info at https://developers.signalfx.com/docs/signalflow-overview.
ProgramText *string `pulumi:"programText"`
// The sorting options configuration to specify if the log view table needs to be sorted in a particular field.
SortOptions []ViewSortOption `pulumi:"sortOptions"`
// Seconds since epoch. Used for visualization. Conflicts with `timeRange`.
StartTime *int `pulumi:"startTime"`
// From when to display data. SignalFx time syntax (e.g. `"-5m"`, `"-1h"`). Conflicts with `startTime` and `endTime`.
TimeRange *int `pulumi:"timeRange"`
// The URL of the log view.
Url *string `pulumi:"url"`
}
type ViewState struct {
// The column headers to show on the log view.
Columns ViewColumnArrayInput
// The connection that the log view uses to fetch data. This could be Splunk Enterprise, Splunk Enterprise Cloud or Observability Cloud.
DefaultConnection pulumi.StringPtrInput
// Description of the log view.
Description pulumi.StringPtrInput
// Seconds since epoch. Used for visualization. Conflicts with `timeRange`.
EndTime pulumi.IntPtrInput
// Name of the log view.
Name pulumi.StringPtrInput
// Signalflow program text for the log view. More info at https://developers.signalfx.com/docs/signalflow-overview.
ProgramText pulumi.StringPtrInput
// The sorting options configuration to specify if the log view table needs to be sorted in a particular field.
SortOptions ViewSortOptionArrayInput
// Seconds since epoch. Used for visualization. Conflicts with `timeRange`.
StartTime pulumi.IntPtrInput
// From when to display data. SignalFx time syntax (e.g. `"-5m"`, `"-1h"`). Conflicts with `startTime` and `endTime`.
TimeRange pulumi.IntPtrInput
// The URL of the log view.
Url pulumi.StringPtrInput
}
func (ViewState) ElementType() reflect.Type {
return reflect.TypeOf((*viewState)(nil)).Elem()
}
type viewArgs struct {
// The column headers to show on the log view.
Columns []ViewColumn `pulumi:"columns"`
// The connection that the log view uses to fetch data. This could be Splunk Enterprise, Splunk Enterprise Cloud or Observability Cloud.
DefaultConnection *string `pulumi:"defaultConnection"`
// Description of the log view.
Description *string `pulumi:"description"`
// Seconds since epoch. Used for visualization. Conflicts with `timeRange`.
EndTime *int `pulumi:"endTime"`
// Name of the log view.
Name *string `pulumi:"name"`
// Signalflow program text for the log view. More info at https://developers.signalfx.com/docs/signalflow-overview.
ProgramText string `pulumi:"programText"`
// The sorting options configuration to specify if the log view table needs to be sorted in a particular field.
SortOptions []ViewSortOption `pulumi:"sortOptions"`
// Seconds since epoch. Used for visualization. Conflicts with `timeRange`.
StartTime *int `pulumi:"startTime"`
// From when to display data. SignalFx time syntax (e.g. `"-5m"`, `"-1h"`). Conflicts with `startTime` and `endTime`.
TimeRange *int `pulumi:"timeRange"`
}
// The set of arguments for constructing a View resource.
type ViewArgs struct {
// The column headers to show on the log view.
Columns ViewColumnArrayInput
// The connection that the log view uses to fetch data. This could be Splunk Enterprise, Splunk Enterprise Cloud or Observability Cloud.
DefaultConnection pulumi.StringPtrInput
// Description of the log view.
Description pulumi.StringPtrInput
// Seconds since epoch. Used for visualization. Conflicts with `timeRange`.
EndTime pulumi.IntPtrInput
// Name of the log view.
Name pulumi.StringPtrInput
// Signalflow program text for the log view. More info at https://developers.signalfx.com/docs/signalflow-overview.
ProgramText pulumi.StringInput
// The sorting options configuration to specify if the log view table needs to be sorted in a particular field.
SortOptions ViewSortOptionArrayInput
// Seconds since epoch. Used for visualization. Conflicts with `timeRange`.
StartTime pulumi.IntPtrInput
// From when to display data. SignalFx time syntax (e.g. `"-5m"`, `"-1h"`). Conflicts with `startTime` and `endTime`.
TimeRange pulumi.IntPtrInput
}
func (ViewArgs) ElementType() reflect.Type {
return reflect.TypeOf((*viewArgs)(nil)).Elem()
}
type ViewInput interface {
pulumi.Input
ToViewOutput() ViewOutput
ToViewOutputWithContext(ctx context.Context) ViewOutput
}
func (*View) ElementType() reflect.Type {
return reflect.TypeOf((**View)(nil)).Elem()
}
func (i *View) ToViewOutput() ViewOutput {
return i.ToViewOutputWithContext(context.Background())
}
func (i *View) ToViewOutputWithContext(ctx context.Context) ViewOutput {
return pulumi.ToOutputWithContext(ctx, i).(ViewOutput)
}
// ViewArrayInput is an input type that accepts ViewArray and ViewArrayOutput values.
// You can construct a concrete instance of `ViewArrayInput` via:
//
// ViewArray{ ViewArgs{...} }
type ViewArrayInput interface {
pulumi.Input
ToViewArrayOutput() ViewArrayOutput
ToViewArrayOutputWithContext(context.Context) ViewArrayOutput
}
type ViewArray []ViewInput
func (ViewArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*View)(nil)).Elem()
}
func (i ViewArray) ToViewArrayOutput() ViewArrayOutput {
return i.ToViewArrayOutputWithContext(context.Background())
}
func (i ViewArray) ToViewArrayOutputWithContext(ctx context.Context) ViewArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(ViewArrayOutput)
}
// ViewMapInput is an input type that accepts ViewMap and ViewMapOutput values.
// You can construct a concrete instance of `ViewMapInput` via:
//
// ViewMap{ "key": ViewArgs{...} }
type ViewMapInput interface {
pulumi.Input
ToViewMapOutput() ViewMapOutput
ToViewMapOutputWithContext(context.Context) ViewMapOutput
}
type ViewMap map[string]ViewInput
func (ViewMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*View)(nil)).Elem()
}
func (i ViewMap) ToViewMapOutput() ViewMapOutput {
return i.ToViewMapOutputWithContext(context.Background())
}
func (i ViewMap) ToViewMapOutputWithContext(ctx context.Context) ViewMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(ViewMapOutput)
}
type ViewOutput struct{ *pulumi.OutputState }
func (ViewOutput) ElementType() reflect.Type {
return reflect.TypeOf((**View)(nil)).Elem()
}
func (o ViewOutput) ToViewOutput() ViewOutput {
return o
}
func (o ViewOutput) ToViewOutputWithContext(ctx context.Context) ViewOutput {
return o
}
// The column headers to show on the log view.
func (o ViewOutput) Columns() ViewColumnArrayOutput {
return o.ApplyT(func(v *View) ViewColumnArrayOutput { return v.Columns }).(ViewColumnArrayOutput)
}
// The connection that the log view uses to fetch data. This could be Splunk Enterprise, Splunk Enterprise Cloud or Observability Cloud.
func (o ViewOutput) DefaultConnection() pulumi.StringPtrOutput {
return o.ApplyT(func(v *View) pulumi.StringPtrOutput { return v.DefaultConnection }).(pulumi.StringPtrOutput)
}
// Description of the log view.
func (o ViewOutput) Description() pulumi.StringPtrOutput {
return o.ApplyT(func(v *View) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput)
}
// Seconds since epoch. Used for visualization. Conflicts with `timeRange`.
func (o ViewOutput) EndTime() pulumi.IntPtrOutput {
return o.ApplyT(func(v *View) pulumi.IntPtrOutput { return v.EndTime }).(pulumi.IntPtrOutput)
}
// Name of the log view.
func (o ViewOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *View) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// Signalflow program text for the log view. More info at https://developers.signalfx.com/docs/signalflow-overview.
func (o ViewOutput) ProgramText() pulumi.StringOutput {
return o.ApplyT(func(v *View) pulumi.StringOutput { return v.ProgramText }).(pulumi.StringOutput)
}
// The sorting options configuration to specify if the log view table needs to be sorted in a particular field.
func (o ViewOutput) SortOptions() ViewSortOptionArrayOutput {
return o.ApplyT(func(v *View) ViewSortOptionArrayOutput { return v.SortOptions }).(ViewSortOptionArrayOutput)
}
// Seconds since epoch. Used for visualization. Conflicts with `timeRange`.
func (o ViewOutput) StartTime() pulumi.IntPtrOutput {
return o.ApplyT(func(v *View) pulumi.IntPtrOutput { return v.StartTime }).(pulumi.IntPtrOutput)
}
// From when to display data. SignalFx time syntax (e.g. `"-5m"`, `"-1h"`). Conflicts with `startTime` and `endTime`.
func (o ViewOutput) TimeRange() pulumi.IntPtrOutput {
return o.ApplyT(func(v *View) pulumi.IntPtrOutput { return v.TimeRange }).(pulumi.IntPtrOutput)
}
// The URL of the log view.
func (o ViewOutput) Url() pulumi.StringOutput {
return o.ApplyT(func(v *View) pulumi.StringOutput { return v.Url }).(pulumi.StringOutput)
}
type ViewArrayOutput struct{ *pulumi.OutputState }
func (ViewArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*View)(nil)).Elem()
}
func (o ViewArrayOutput) ToViewArrayOutput() ViewArrayOutput {
return o
}
func (o ViewArrayOutput) ToViewArrayOutputWithContext(ctx context.Context) ViewArrayOutput {
return o
}
func (o ViewArrayOutput) Index(i pulumi.IntInput) ViewOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *View {
return vs[0].([]*View)[vs[1].(int)]
}).(ViewOutput)
}
type ViewMapOutput struct{ *pulumi.OutputState }
func (ViewMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*View)(nil)).Elem()
}
func (o ViewMapOutput) ToViewMapOutput() ViewMapOutput {
return o
}
func (o ViewMapOutput) ToViewMapOutputWithContext(ctx context.Context) ViewMapOutput {
return o
}
func (o ViewMapOutput) MapIndex(k pulumi.StringInput) ViewOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *View {
return vs[0].(map[string]*View)[vs[1].(string)]
}).(ViewOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ViewInput)(nil)).Elem(), &View{})
pulumi.RegisterInputType(reflect.TypeOf((*ViewArrayInput)(nil)).Elem(), ViewArray{})
pulumi.RegisterInputType(reflect.TypeOf((*ViewMapInput)(nil)).Elem(), ViewMap{})
pulumi.RegisterOutputType(ViewOutput{})
pulumi.RegisterOutputType(ViewArrayOutput{})
pulumi.RegisterOutputType(ViewMapOutput{})
}