-
Notifications
You must be signed in to change notification settings - Fork 66
Expand file tree
/
Copy pathmodel.go
More file actions
executable file
·6381 lines (5170 loc) · 238 KB
/
model.go
File metadata and controls
executable file
·6381 lines (5170 loc) · 238 KB
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
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
package sql
import (
"fmt"
"github.com/databricks/databricks-sdk-go/marshal"
)
type AccessControl struct {
GroupName string `json:"group_name,omitempty"`
// * `CAN_VIEW`: Can view the query * `CAN_RUN`: Can run the query *
// `CAN_EDIT`: Can edit the query * `CAN_MANAGE`: Can manage the query
PermissionLevel PermissionLevel `json:"permission_level,omitempty"`
UserName string `json:"user_name,omitempty"`
ForceSendFields []string `json:"-" url:"-"`
}
func (s *AccessControl) UnmarshalJSON(b []byte) error {
return marshal.Unmarshal(b, s)
}
func (s AccessControl) MarshalJSON() ([]byte, error) {
return marshal.Marshal(s)
}
type Aggregation string
const AggregationAvg Aggregation = `AVG`
const AggregationCount Aggregation = `COUNT`
const AggregationCountDistinct Aggregation = `COUNT_DISTINCT`
const AggregationMax Aggregation = `MAX`
const AggregationMedian Aggregation = `MEDIAN`
const AggregationMin Aggregation = `MIN`
const AggregationStddev Aggregation = `STDDEV`
const AggregationSum Aggregation = `SUM`
// String representation for [fmt.Print]
func (f *Aggregation) String() string {
return string(*f)
}
// Set raw string value and validate it against allowed values
func (f *Aggregation) Set(v string) error {
switch v {
case `AVG`, `COUNT`, `COUNT_DISTINCT`, `MAX`, `MEDIAN`, `MIN`, `STDDEV`, `SUM`:
*f = Aggregation(v)
return nil
default:
return fmt.Errorf(`value "%s" is not one of "AVG", "COUNT", "COUNT_DISTINCT", "MAX", "MEDIAN", "MIN", "STDDEV", "SUM"`, v)
}
}
// Values returns all possible values for Aggregation.
//
// There is no guarantee on the order of the values in the slice.
func (f *Aggregation) Values() []Aggregation {
return []Aggregation{
AggregationAvg,
AggregationCount,
AggregationCountDistinct,
AggregationMax,
AggregationMedian,
AggregationMin,
AggregationStddev,
AggregationSum,
}
}
// Type always returns Aggregation to satisfy [pflag.Value] interface
func (f *Aggregation) Type() string {
return "Aggregation"
}
type Alert struct {
// Trigger conditions of the alert.
Condition *AlertCondition `json:"condition,omitempty"`
// The timestamp indicating when the alert was created.
CreateTime string `json:"create_time,omitempty"`
// Custom body of alert notification, if it exists. See [here] for custom
// templating instructions.
//
// [here]: https://docs.databricks.com/sql/user/alerts/index.html
CustomBody string `json:"custom_body,omitempty"`
// Custom subject of alert notification, if it exists. This can include
// email subject entries and Slack notification headers, for example. See
// [here] for custom templating instructions.
//
// [here]: https://docs.databricks.com/sql/user/alerts/index.html
CustomSubject string `json:"custom_subject,omitempty"`
// The display name of the alert.
DisplayName string `json:"display_name,omitempty"`
// UUID identifying the alert.
Id string `json:"id,omitempty"`
// The workspace state of the alert. Used for tracking trashed status.
LifecycleState LifecycleState `json:"lifecycle_state,omitempty"`
// Whether to notify alert subscribers when alert returns back to normal.
NotifyOnOk bool `json:"notify_on_ok,omitempty"`
// The owner's username. This field is set to "Unavailable" if the user has
// been deleted.
OwnerUserName string `json:"owner_user_name,omitempty"`
// The workspace path of the folder containing the alert.
ParentPath string `json:"parent_path,omitempty"`
// UUID of the query attached to the alert.
QueryId string `json:"query_id,omitempty"`
// Number of seconds an alert must wait after being triggered to rearm
// itself. After rearming, it can be triggered again. If 0 or not specified,
// the alert will not be triggered again.
SecondsToRetrigger int `json:"seconds_to_retrigger,omitempty"`
// Current state of the alert's trigger status. This field is set to UNKNOWN
// if the alert has not yet been evaluated or ran into an error during the
// last evaluation.
State AlertState `json:"state,omitempty"`
// Timestamp when the alert was last triggered, if the alert has been
// triggered before.
TriggerTime string `json:"trigger_time,omitempty"`
// The timestamp indicating when the alert was updated.
UpdateTime string `json:"update_time,omitempty"`
ForceSendFields []string `json:"-" url:"-"`
}
func (s *Alert) UnmarshalJSON(b []byte) error {
return marshal.Unmarshal(b, s)
}
func (s Alert) MarshalJSON() ([]byte, error) {
return marshal.Marshal(s)
}
type AlertCondition struct {
// Alert state if result is empty.
EmptyResultState AlertState `json:"empty_result_state,omitempty"`
// Operator used for comparison in alert evaluation.
Op AlertOperator `json:"op,omitempty"`
// Name of the column from the query result to use for comparison in alert
// evaluation.
Operand *AlertConditionOperand `json:"operand,omitempty"`
// Threshold value used for comparison in alert evaluation.
Threshold *AlertConditionThreshold `json:"threshold,omitempty"`
}
type AlertConditionOperand struct {
Column *AlertOperandColumn `json:"column,omitempty"`
}
type AlertConditionThreshold struct {
Value *AlertOperandValue `json:"value,omitempty"`
}
// UNSPECIFIED - default unspecify value for proto enum, do not use it in the
// code UNKNOWN - alert not yet evaluated TRIGGERED - alert is triggered OK -
// alert is not triggered ERROR - alert evaluation failed
type AlertEvaluationState string
const AlertEvaluationStateError AlertEvaluationState = `ERROR`
const AlertEvaluationStateOk AlertEvaluationState = `OK`
const AlertEvaluationStateTriggered AlertEvaluationState = `TRIGGERED`
const AlertEvaluationStateUnknown AlertEvaluationState = `UNKNOWN`
// String representation for [fmt.Print]
func (f *AlertEvaluationState) String() string {
return string(*f)
}
// Set raw string value and validate it against allowed values
func (f *AlertEvaluationState) Set(v string) error {
switch v {
case `ERROR`, `OK`, `TRIGGERED`, `UNKNOWN`:
*f = AlertEvaluationState(v)
return nil
default:
return fmt.Errorf(`value "%s" is not one of "ERROR", "OK", "TRIGGERED", "UNKNOWN"`, v)
}
}
// Values returns all possible values for AlertEvaluationState.
//
// There is no guarantee on the order of the values in the slice.
func (f *AlertEvaluationState) Values() []AlertEvaluationState {
return []AlertEvaluationState{
AlertEvaluationStateError,
AlertEvaluationStateOk,
AlertEvaluationStateTriggered,
AlertEvaluationStateUnknown,
}
}
// Type always returns AlertEvaluationState to satisfy [pflag.Value] interface
func (f *AlertEvaluationState) Type() string {
return "AlertEvaluationState"
}
type AlertLifecycleState string
const AlertLifecycleStateActive AlertLifecycleState = `ACTIVE`
const AlertLifecycleStateDeleted AlertLifecycleState = `DELETED`
// String representation for [fmt.Print]
func (f *AlertLifecycleState) String() string {
return string(*f)
}
// Set raw string value and validate it against allowed values
func (f *AlertLifecycleState) Set(v string) error {
switch v {
case `ACTIVE`, `DELETED`:
*f = AlertLifecycleState(v)
return nil
default:
return fmt.Errorf(`value "%s" is not one of "ACTIVE", "DELETED"`, v)
}
}
// Values returns all possible values for AlertLifecycleState.
//
// There is no guarantee on the order of the values in the slice.
func (f *AlertLifecycleState) Values() []AlertLifecycleState {
return []AlertLifecycleState{
AlertLifecycleStateActive,
AlertLifecycleStateDeleted,
}
}
// Type always returns AlertLifecycleState to satisfy [pflag.Value] interface
func (f *AlertLifecycleState) Type() string {
return "AlertLifecycleState"
}
type AlertOperandColumn struct {
Name string `json:"name,omitempty"`
ForceSendFields []string `json:"-" url:"-"`
}
func (s *AlertOperandColumn) UnmarshalJSON(b []byte) error {
return marshal.Unmarshal(b, s)
}
func (s AlertOperandColumn) MarshalJSON() ([]byte, error) {
return marshal.Marshal(s)
}
type AlertOperandValue struct {
BoolValue bool `json:"bool_value,omitempty"`
DoubleValue float64 `json:"double_value,omitempty"`
StringValue string `json:"string_value,omitempty"`
ForceSendFields []string `json:"-" url:"-"`
}
func (s *AlertOperandValue) UnmarshalJSON(b []byte) error {
return marshal.Unmarshal(b, s)
}
func (s AlertOperandValue) MarshalJSON() ([]byte, error) {
return marshal.Marshal(s)
}
type AlertOperator string
const AlertOperatorEqual AlertOperator = `EQUAL`
const AlertOperatorGreaterThan AlertOperator = `GREATER_THAN`
const AlertOperatorGreaterThanOrEqual AlertOperator = `GREATER_THAN_OR_EQUAL`
const AlertOperatorIsNull AlertOperator = `IS_NULL`
const AlertOperatorLessThan AlertOperator = `LESS_THAN`
const AlertOperatorLessThanOrEqual AlertOperator = `LESS_THAN_OR_EQUAL`
const AlertOperatorNotEqual AlertOperator = `NOT_EQUAL`
// String representation for [fmt.Print]
func (f *AlertOperator) String() string {
return string(*f)
}
// Set raw string value and validate it against allowed values
func (f *AlertOperator) Set(v string) error {
switch v {
case `EQUAL`, `GREATER_THAN`, `GREATER_THAN_OR_EQUAL`, `IS_NULL`, `LESS_THAN`, `LESS_THAN_OR_EQUAL`, `NOT_EQUAL`:
*f = AlertOperator(v)
return nil
default:
return fmt.Errorf(`value "%s" is not one of "EQUAL", "GREATER_THAN", "GREATER_THAN_OR_EQUAL", "IS_NULL", "LESS_THAN", "LESS_THAN_OR_EQUAL", "NOT_EQUAL"`, v)
}
}
// Values returns all possible values for AlertOperator.
//
// There is no guarantee on the order of the values in the slice.
func (f *AlertOperator) Values() []AlertOperator {
return []AlertOperator{
AlertOperatorEqual,
AlertOperatorGreaterThan,
AlertOperatorGreaterThanOrEqual,
AlertOperatorIsNull,
AlertOperatorLessThan,
AlertOperatorLessThanOrEqual,
AlertOperatorNotEqual,
}
}
// Type always returns AlertOperator to satisfy [pflag.Value] interface
func (f *AlertOperator) Type() string {
return "AlertOperator"
}
// Alert configuration options.
type AlertOptions struct {
// Name of column in the query result to compare in alert evaluation.
Column string `json:"column"`
// Custom body of alert notification, if it exists. See [here] for custom
// templating instructions.
//
// [here]: https://docs.databricks.com/sql/user/alerts/index.html
CustomBody string `json:"custom_body,omitempty"`
// Custom subject of alert notification, if it exists. This includes email
// subject, Slack notification header, etc. See [here] for custom templating
// instructions.
//
// [here]: https://docs.databricks.com/sql/user/alerts/index.html
CustomSubject string `json:"custom_subject,omitempty"`
// State that alert evaluates to when query result is empty.
EmptyResultState AlertOptionsEmptyResultState `json:"empty_result_state,omitempty"`
// Whether or not the alert is muted. If an alert is muted, it will not
// notify users and notification destinations when triggered.
Muted bool `json:"muted,omitempty"`
// Operator used to compare in alert evaluation: `>`, `>=`, `<`, `<=`, `==`,
// `!=`
Op string `json:"op"`
// Value used to compare in alert evaluation. Supported types include
// strings (eg. 'foobar'), floats (eg. 123.4), and booleans (true).
Value any `json:"value"`
ForceSendFields []string `json:"-" url:"-"`
}
func (s *AlertOptions) UnmarshalJSON(b []byte) error {
return marshal.Unmarshal(b, s)
}
func (s AlertOptions) MarshalJSON() ([]byte, error) {
return marshal.Marshal(s)
}
// State that alert evaluates to when query result is empty.
type AlertOptionsEmptyResultState string
const AlertOptionsEmptyResultStateOk AlertOptionsEmptyResultState = `ok`
const AlertOptionsEmptyResultStateTriggered AlertOptionsEmptyResultState = `triggered`
const AlertOptionsEmptyResultStateUnknown AlertOptionsEmptyResultState = `unknown`
// String representation for [fmt.Print]
func (f *AlertOptionsEmptyResultState) String() string {
return string(*f)
}
// Set raw string value and validate it against allowed values
func (f *AlertOptionsEmptyResultState) Set(v string) error {
switch v {
case `ok`, `triggered`, `unknown`:
*f = AlertOptionsEmptyResultState(v)
return nil
default:
return fmt.Errorf(`value "%s" is not one of "ok", "triggered", "unknown"`, v)
}
}
// Values returns all possible values for AlertOptionsEmptyResultState.
//
// There is no guarantee on the order of the values in the slice.
func (f *AlertOptionsEmptyResultState) Values() []AlertOptionsEmptyResultState {
return []AlertOptionsEmptyResultState{
AlertOptionsEmptyResultStateOk,
AlertOptionsEmptyResultStateTriggered,
AlertOptionsEmptyResultStateUnknown,
}
}
// Type always returns AlertOptionsEmptyResultState to satisfy [pflag.Value] interface
func (f *AlertOptionsEmptyResultState) Type() string {
return "AlertOptionsEmptyResultState"
}
type AlertQuery struct {
// The timestamp when this query was created.
CreatedAt string `json:"created_at,omitempty"`
// Data source ID maps to the ID of the data source used by the resource and
// is distinct from the warehouse ID. [Learn more]
//
// [Learn more]: https://docs.databricks.com/api/workspace/datasources/list
DataSourceId string `json:"data_source_id,omitempty"`
// General description that conveys additional information about this query
// such as usage notes.
Description string `json:"description,omitempty"`
// Query ID.
Id string `json:"id,omitempty"`
// Indicates whether the query is trashed. Trashed queries can't be used in
// dashboards, or appear in search results. If this boolean is `true`, the
// `options` property for this query includes a `moved_to_trash_at`
// timestamp. Trashed queries are permanently deleted after 30 days.
IsArchived bool `json:"is_archived,omitempty"`
// Whether the query is a draft. Draft queries only appear in list views for
// their owners. Visualizations from draft queries cannot appear on
// dashboards.
IsDraft bool `json:"is_draft,omitempty"`
// Text parameter types are not safe from SQL injection for all types of
// data source. Set this Boolean parameter to `true` if a query either does
// not use any text type parameters or uses a data source type where text
// type parameters are handled safely.
IsSafe bool `json:"is_safe,omitempty"`
// The title of this query that appears in list views, widget headings, and
// on the query page.
Name string `json:"name,omitempty"`
Options *QueryOptions `json:"options,omitempty"`
// The text of the query to be run.
Query string `json:"query,omitempty"`
Tags []string `json:"tags,omitempty"`
// The timestamp at which this query was last updated.
UpdatedAt string `json:"updated_at,omitempty"`
// The ID of the user who owns the query.
UserId int `json:"user_id,omitempty"`
ForceSendFields []string `json:"-" url:"-"`
}
func (s *AlertQuery) UnmarshalJSON(b []byte) error {
return marshal.Unmarshal(b, s)
}
func (s AlertQuery) MarshalJSON() ([]byte, error) {
return marshal.Marshal(s)
}
type AlertState string
const AlertStateOk AlertState = `OK`
const AlertStateTriggered AlertState = `TRIGGERED`
const AlertStateUnknown AlertState = `UNKNOWN`
// String representation for [fmt.Print]
func (f *AlertState) String() string {
return string(*f)
}
// Set raw string value and validate it against allowed values
func (f *AlertState) Set(v string) error {
switch v {
case `OK`, `TRIGGERED`, `UNKNOWN`:
*f = AlertState(v)
return nil
default:
return fmt.Errorf(`value "%s" is not one of "OK", "TRIGGERED", "UNKNOWN"`, v)
}
}
// Values returns all possible values for AlertState.
//
// There is no guarantee on the order of the values in the slice.
func (f *AlertState) Values() []AlertState {
return []AlertState{
AlertStateOk,
AlertStateTriggered,
AlertStateUnknown,
}
}
// Type always returns AlertState to satisfy [pflag.Value] interface
func (f *AlertState) Type() string {
return "AlertState"
}
type AlertV2 struct {
// The timestamp indicating when the alert was created.
CreateTime string `json:"create_time,omitempty"`
// Custom description for the alert. support mustache template.
CustomDescription string `json:"custom_description,omitempty"`
// Custom summary for the alert. support mustache template.
CustomSummary string `json:"custom_summary,omitempty"`
// The display name of the alert.
DisplayName string `json:"display_name"`
// The actual identity that will be used to execute the alert. This is an
// output-only field that shows the resolved run-as identity after applying
// permissions and defaults.
EffectiveRunAs *AlertV2RunAs `json:"effective_run_as,omitempty"`
Evaluation AlertV2Evaluation `json:"evaluation"`
// UUID identifying the alert.
Id string `json:"id,omitempty"`
// Indicates whether the query is trashed.
LifecycleState AlertLifecycleState `json:"lifecycle_state,omitempty"`
// The owner's username. This field is set to "Unavailable" if the user has
// been deleted.
OwnerUserName string `json:"owner_user_name,omitempty"`
// The workspace path of the folder containing the alert. Can only be set on
// create, and cannot be updated.
ParentPath string `json:"parent_path,omitempty"`
// Text of the query to be run.
QueryText string `json:"query_text"`
// Specifies the identity that will be used to run the alert. This field
// allows you to configure alerts to run as a specific user or service
// principal. - For user identity: Set `user_name` to the email of an active
// workspace user. Users can only set this to their own email. - For service
// principal: Set `service_principal_name` to the application ID. Requires
// the `servicePrincipal/user` role. If not specified, the alert will run as
// the request user.
RunAs *AlertV2RunAs `json:"run_as,omitempty"`
// The run as username or application ID of service principal. On Create and
// Update, this field can be set to application ID of an active service
// principal. Setting this field requires the servicePrincipal/user role.
// Deprecated: Use `run_as` field instead. This field will be removed in a
// future release.
RunAsUserName string `json:"run_as_user_name,omitempty"`
Schedule CronSchedule `json:"schedule"`
// The timestamp indicating when the alert was updated.
UpdateTime string `json:"update_time,omitempty"`
// ID of the SQL warehouse attached to the alert.
WarehouseId string `json:"warehouse_id"`
ForceSendFields []string `json:"-" url:"-"`
}
func (s *AlertV2) UnmarshalJSON(b []byte) error {
return marshal.Unmarshal(b, s)
}
func (s AlertV2) MarshalJSON() ([]byte, error) {
return marshal.Marshal(s)
}
type AlertV2Evaluation struct {
// Operator used for comparison in alert evaluation.
ComparisonOperator ComparisonOperator `json:"comparison_operator"`
// Alert state if result is empty. Please avoid setting this field to be
// `UNKNOWN` because `UNKNOWN` state is planned to be deprecated.
EmptyResultState AlertEvaluationState `json:"empty_result_state,omitempty"`
// Timestamp of the last evaluation.
LastEvaluatedAt string `json:"last_evaluated_at,omitempty"`
// User or Notification Destination to notify when alert is triggered.
Notification *AlertV2Notification `json:"notification,omitempty"`
// Source column from result to use to evaluate alert
Source AlertV2OperandColumn `json:"source"`
// Latest state of alert evaluation.
State AlertEvaluationState `json:"state,omitempty"`
// Threshold to user for alert evaluation, can be a column or a value.
Threshold *AlertV2Operand `json:"threshold,omitempty"`
ForceSendFields []string `json:"-" url:"-"`
}
func (s *AlertV2Evaluation) UnmarshalJSON(b []byte) error {
return marshal.Unmarshal(b, s)
}
func (s AlertV2Evaluation) MarshalJSON() ([]byte, error) {
return marshal.Marshal(s)
}
type AlertV2Notification struct {
// Whether to notify alert subscribers when alert returns back to normal.
NotifyOnOk bool `json:"notify_on_ok,omitempty"`
// Number of seconds an alert waits after being triggered before it is
// allowed to send another notification. If set to 0 or omitted, the alert
// will not send any further notifications after the first trigger Setting
// this value to 1 allows the alert to send a notification on every
// evaluation where the condition is met, effectively making it always
// retrigger for notification purposes.
RetriggerSeconds int `json:"retrigger_seconds,omitempty"`
Subscriptions []AlertV2Subscription `json:"subscriptions,omitempty"`
ForceSendFields []string `json:"-" url:"-"`
}
func (s *AlertV2Notification) UnmarshalJSON(b []byte) error {
return marshal.Unmarshal(b, s)
}
func (s AlertV2Notification) MarshalJSON() ([]byte, error) {
return marshal.Marshal(s)
}
type AlertV2Operand struct {
Column *AlertV2OperandColumn `json:"column,omitempty"`
Value *AlertV2OperandValue `json:"value,omitempty"`
}
type AlertV2OperandColumn struct {
// If not set, the behavior is equivalent to using `First row` in the UI.
Aggregation Aggregation `json:"aggregation,omitempty"`
Display string `json:"display,omitempty"`
Name string `json:"name"`
ForceSendFields []string `json:"-" url:"-"`
}
func (s *AlertV2OperandColumn) UnmarshalJSON(b []byte) error {
return marshal.Unmarshal(b, s)
}
func (s AlertV2OperandColumn) MarshalJSON() ([]byte, error) {
return marshal.Marshal(s)
}
type AlertV2OperandValue struct {
BoolValue bool `json:"bool_value,omitempty"`
DoubleValue float64 `json:"double_value,omitempty"`
StringValue string `json:"string_value,omitempty"`
ForceSendFields []string `json:"-" url:"-"`
}
func (s *AlertV2OperandValue) UnmarshalJSON(b []byte) error {
return marshal.Unmarshal(b, s)
}
func (s AlertV2OperandValue) MarshalJSON() ([]byte, error) {
return marshal.Marshal(s)
}
type AlertV2RunAs struct {
// Application ID of an active service principal. Setting this field
// requires the `servicePrincipal/user` role.
ServicePrincipalName string `json:"service_principal_name,omitempty"`
// The email of an active workspace user. Can only set this field to their
// own email.
UserName string `json:"user_name,omitempty"`
ForceSendFields []string `json:"-" url:"-"`
}
func (s *AlertV2RunAs) UnmarshalJSON(b []byte) error {
return marshal.Unmarshal(b, s)
}
func (s AlertV2RunAs) MarshalJSON() ([]byte, error) {
return marshal.Marshal(s)
}
type AlertV2Subscription struct {
DestinationId string `json:"destination_id,omitempty"`
UserEmail string `json:"user_email,omitempty"`
ForceSendFields []string `json:"-" url:"-"`
}
func (s *AlertV2Subscription) UnmarshalJSON(b []byte) error {
return marshal.Unmarshal(b, s)
}
func (s AlertV2Subscription) MarshalJSON() ([]byte, error) {
return marshal.Marshal(s)
}
type BaseChunkInfo struct {
// The number of bytes in the result chunk. This field is not available when
// using `INLINE` disposition.
ByteCount int64 `json:"byte_count,omitempty"`
// The position within the sequence of result set chunks.
ChunkIndex int `json:"chunk_index,omitempty"`
// The number of rows within the result chunk.
RowCount int64 `json:"row_count,omitempty"`
// The starting row offset within the result set.
RowOffset int64 `json:"row_offset,omitempty"`
ForceSendFields []string `json:"-" url:"-"`
}
func (s *BaseChunkInfo) UnmarshalJSON(b []byte) error {
return marshal.Unmarshal(b, s)
}
func (s BaseChunkInfo) MarshalJSON() ([]byte, error) {
return marshal.Marshal(s)
}
type CancelExecutionRequest struct {
// The statement ID is returned upon successfully submitting a SQL
// statement, and is a required reference for all subsequent calls.
StatementId string `json:"-" url:"-"`
}
// Configures the channel name and DBSQL version of the warehouse.
// CHANNEL_NAME_CUSTOM should be chosen only when `dbsql_version` is specified.
type Channel struct {
DbsqlVersion string `json:"dbsql_version,omitempty"`
Name ChannelName `json:"name,omitempty"`
ForceSendFields []string `json:"-" url:"-"`
}
func (s *Channel) UnmarshalJSON(b []byte) error {
return marshal.Unmarshal(b, s)
}
func (s Channel) MarshalJSON() ([]byte, error) {
return marshal.Marshal(s)
}
// Details about a Channel.
type ChannelInfo struct {
// DB SQL Version the Channel is mapped to.
DbsqlVersion string `json:"dbsql_version,omitempty"`
// Name of the channel
Name ChannelName `json:"name,omitempty"`
ForceSendFields []string `json:"-" url:"-"`
}
func (s *ChannelInfo) UnmarshalJSON(b []byte) error {
return marshal.Unmarshal(b, s)
}
func (s ChannelInfo) MarshalJSON() ([]byte, error) {
return marshal.Marshal(s)
}
type ChannelName string
const ChannelNameChannelNameCurrent ChannelName = `CHANNEL_NAME_CURRENT`
const ChannelNameChannelNameCustom ChannelName = `CHANNEL_NAME_CUSTOM`
const ChannelNameChannelNamePreview ChannelName = `CHANNEL_NAME_PREVIEW`
const ChannelNameChannelNamePrevious ChannelName = `CHANNEL_NAME_PREVIOUS`
// String representation for [fmt.Print]
func (f *ChannelName) String() string {
return string(*f)
}
// Set raw string value and validate it against allowed values
func (f *ChannelName) Set(v string) error {
switch v {
case `CHANNEL_NAME_CURRENT`, `CHANNEL_NAME_CUSTOM`, `CHANNEL_NAME_PREVIEW`, `CHANNEL_NAME_PREVIOUS`:
*f = ChannelName(v)
return nil
default:
return fmt.Errorf(`value "%s" is not one of "CHANNEL_NAME_CURRENT", "CHANNEL_NAME_CUSTOM", "CHANNEL_NAME_PREVIEW", "CHANNEL_NAME_PREVIOUS"`, v)
}
}
// Values returns all possible values for ChannelName.
//
// There is no guarantee on the order of the values in the slice.
func (f *ChannelName) Values() []ChannelName {
return []ChannelName{
ChannelNameChannelNameCurrent,
ChannelNameChannelNameCustom,
ChannelNameChannelNamePreview,
ChannelNameChannelNamePrevious,
}
}
// Type always returns ChannelName to satisfy [pflag.Value] interface
func (f *ChannelName) Type() string {
return "ChannelName"
}
type ClientConfig struct {
AllowCustomJsVisualizations bool `json:"allow_custom_js_visualizations,omitempty"`
AllowDownloads bool `json:"allow_downloads,omitempty"`
AllowExternalShares bool `json:"allow_external_shares,omitempty"`
AllowSubscriptions bool `json:"allow_subscriptions,omitempty"`
DateFormat string `json:"date_format,omitempty"`
DateTimeFormat string `json:"date_time_format,omitempty"`
DisablePublish bool `json:"disable_publish,omitempty"`
EnableLegacyAutodetectTypes bool `json:"enable_legacy_autodetect_types,omitempty"`
FeatureShowPermissionsControl bool `json:"feature_show_permissions_control,omitempty"`
HidePlotlyModeBar bool `json:"hide_plotly_mode_bar,omitempty"`
ForceSendFields []string `json:"-" url:"-"`
}
func (s *ClientConfig) UnmarshalJSON(b []byte) error {
return marshal.Unmarshal(b, s)
}
func (s ClientConfig) MarshalJSON() ([]byte, error) {
return marshal.Marshal(s)
}
type ColumnInfo struct {
// The name of the column.
Name string `json:"name,omitempty"`
// The ordinal position of the column (starting at position 0).
Position int `json:"position,omitempty"`
// The format of the interval type.
TypeIntervalType string `json:"type_interval_type,omitempty"`
// The name of the base data type. This doesn't include details for complex
// types such as STRUCT, MAP or ARRAY.
TypeName ColumnInfoTypeName `json:"type_name,omitempty"`
// Specifies the number of digits in a number. This applies to the DECIMAL
// type.
TypePrecision int `json:"type_precision,omitempty"`
// Specifies the number of digits to the right of the decimal point in a
// number. This applies to the DECIMAL type.
TypeScale int `json:"type_scale,omitempty"`
// The full SQL type specification.
TypeText string `json:"type_text,omitempty"`
ForceSendFields []string `json:"-" url:"-"`
}
func (s *ColumnInfo) UnmarshalJSON(b []byte) error {
return marshal.Unmarshal(b, s)
}
func (s ColumnInfo) MarshalJSON() ([]byte, error) {
return marshal.Marshal(s)
}
// The name of the base data type. This doesn't include details for complex
// types such as STRUCT, MAP or ARRAY.
type ColumnInfoTypeName string
const ColumnInfoTypeNameArray ColumnInfoTypeName = `ARRAY`
const ColumnInfoTypeNameBinary ColumnInfoTypeName = `BINARY`
const ColumnInfoTypeNameBoolean ColumnInfoTypeName = `BOOLEAN`
const ColumnInfoTypeNameByte ColumnInfoTypeName = `BYTE`
const ColumnInfoTypeNameChar ColumnInfoTypeName = `CHAR`
const ColumnInfoTypeNameDate ColumnInfoTypeName = `DATE`
const ColumnInfoTypeNameDecimal ColumnInfoTypeName = `DECIMAL`
const ColumnInfoTypeNameDouble ColumnInfoTypeName = `DOUBLE`
const ColumnInfoTypeNameFloat ColumnInfoTypeName = `FLOAT`
const ColumnInfoTypeNameInt ColumnInfoTypeName = `INT`
const ColumnInfoTypeNameInterval ColumnInfoTypeName = `INTERVAL`
const ColumnInfoTypeNameLong ColumnInfoTypeName = `LONG`
const ColumnInfoTypeNameMap ColumnInfoTypeName = `MAP`
const ColumnInfoTypeNameNull ColumnInfoTypeName = `NULL`
const ColumnInfoTypeNameShort ColumnInfoTypeName = `SHORT`
const ColumnInfoTypeNameString ColumnInfoTypeName = `STRING`
const ColumnInfoTypeNameStruct ColumnInfoTypeName = `STRUCT`
const ColumnInfoTypeNameTimestamp ColumnInfoTypeName = `TIMESTAMP`
const ColumnInfoTypeNameUserDefinedType ColumnInfoTypeName = `USER_DEFINED_TYPE`
// String representation for [fmt.Print]
func (f *ColumnInfoTypeName) String() string {
return string(*f)
}
// Set raw string value and validate it against allowed values
func (f *ColumnInfoTypeName) Set(v string) error {
switch v {
case `ARRAY`, `BINARY`, `BOOLEAN`, `BYTE`, `CHAR`, `DATE`, `DECIMAL`, `DOUBLE`, `FLOAT`, `INT`, `INTERVAL`, `LONG`, `MAP`, `NULL`, `SHORT`, `STRING`, `STRUCT`, `TIMESTAMP`, `USER_DEFINED_TYPE`:
*f = ColumnInfoTypeName(v)
return nil
default:
return fmt.Errorf(`value "%s" is not one of "ARRAY", "BINARY", "BOOLEAN", "BYTE", "CHAR", "DATE", "DECIMAL", "DOUBLE", "FLOAT", "INT", "INTERVAL", "LONG", "MAP", "NULL", "SHORT", "STRING", "STRUCT", "TIMESTAMP", "USER_DEFINED_TYPE"`, v)
}
}
// Values returns all possible values for ColumnInfoTypeName.
//
// There is no guarantee on the order of the values in the slice.
func (f *ColumnInfoTypeName) Values() []ColumnInfoTypeName {
return []ColumnInfoTypeName{
ColumnInfoTypeNameArray,
ColumnInfoTypeNameBinary,
ColumnInfoTypeNameBoolean,
ColumnInfoTypeNameByte,
ColumnInfoTypeNameChar,
ColumnInfoTypeNameDate,
ColumnInfoTypeNameDecimal,
ColumnInfoTypeNameDouble,
ColumnInfoTypeNameFloat,
ColumnInfoTypeNameInt,
ColumnInfoTypeNameInterval,
ColumnInfoTypeNameLong,
ColumnInfoTypeNameMap,
ColumnInfoTypeNameNull,
ColumnInfoTypeNameShort,
ColumnInfoTypeNameString,
ColumnInfoTypeNameStruct,
ColumnInfoTypeNameTimestamp,
ColumnInfoTypeNameUserDefinedType,
}
}
// Type always returns ColumnInfoTypeName to satisfy [pflag.Value] interface
func (f *ColumnInfoTypeName) Type() string {
return "ColumnInfoTypeName"
}
type ComparisonOperator string
const ComparisonOperatorEqual ComparisonOperator = `EQUAL`
const ComparisonOperatorGreaterThan ComparisonOperator = `GREATER_THAN`
const ComparisonOperatorGreaterThanOrEqual ComparisonOperator = `GREATER_THAN_OR_EQUAL`
const ComparisonOperatorIsNotNull ComparisonOperator = `IS_NOT_NULL`
const ComparisonOperatorIsNull ComparisonOperator = `IS_NULL`
const ComparisonOperatorLessThan ComparisonOperator = `LESS_THAN`
const ComparisonOperatorLessThanOrEqual ComparisonOperator = `LESS_THAN_OR_EQUAL`
const ComparisonOperatorNotEqual ComparisonOperator = `NOT_EQUAL`
// String representation for [fmt.Print]
func (f *ComparisonOperator) String() string {
return string(*f)
}
// Set raw string value and validate it against allowed values
func (f *ComparisonOperator) Set(v string) error {
switch v {
case `EQUAL`, `GREATER_THAN`, `GREATER_THAN_OR_EQUAL`, `IS_NOT_NULL`, `IS_NULL`, `LESS_THAN`, `LESS_THAN_OR_EQUAL`, `NOT_EQUAL`:
*f = ComparisonOperator(v)
return nil
default:
return fmt.Errorf(`value "%s" is not one of "EQUAL", "GREATER_THAN", "GREATER_THAN_OR_EQUAL", "IS_NOT_NULL", "IS_NULL", "LESS_THAN", "LESS_THAN_OR_EQUAL", "NOT_EQUAL"`, v)
}
}
// Values returns all possible values for ComparisonOperator.
//
// There is no guarantee on the order of the values in the slice.
func (f *ComparisonOperator) Values() []ComparisonOperator {
return []ComparisonOperator{
ComparisonOperatorEqual,
ComparisonOperatorGreaterThan,
ComparisonOperatorGreaterThanOrEqual,
ComparisonOperatorIsNotNull,
ComparisonOperatorIsNull,
ComparisonOperatorLessThan,
ComparisonOperatorLessThanOrEqual,
ComparisonOperatorNotEqual,
}
}
// Type always returns ComparisonOperator to satisfy [pflag.Value] interface
func (f *ComparisonOperator) Type() string {
return "ComparisonOperator"
}