-
Notifications
You must be signed in to change notification settings - Fork 37
/
model.go
executable file
·3813 lines (3091 loc) · 140 KB
/
model.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
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:"-"`
}
func (s *AccessControl) UnmarshalJSON(b []byte) error {
return marshal.Unmarshal(b, s)
}
func (s AccessControl) MarshalJSON() ([]byte, error) {
return marshal.Marshal(s)
}
type Alert struct {
// Timestamp when the alert was created.
CreatedAt string `json:"created_at,omitempty"`
// Alert ID.
Id string `json:"id,omitempty"`
// Timestamp when the alert was last triggered.
LastTriggeredAt string `json:"last_triggered_at,omitempty"`
// Name of the alert.
Name string `json:"name,omitempty"`
// Alert configuration options.
Options *AlertOptions `json:"options,omitempty"`
// The identifier of the workspace folder containing the object.
Parent string `json:"parent,omitempty"`
Query *AlertQuery `json:"query,omitempty"`
// Number of seconds after being triggered before the alert rearms itself
// and can be triggered again. If `null`, alert will never be triggered
// again.
Rearm int `json:"rearm,omitempty"`
// State of the alert. Possible values are: `unknown` (yet to be evaluated),
// `triggered` (evaluated and fulfilled trigger conditions), or `ok`
// (evaluated and did not fulfill trigger conditions).
State AlertState `json:"state,omitempty"`
// Timestamp when the alert was last updated.
UpdatedAt string `json:"updated_at,omitempty"`
User *User `json:"user,omitempty"`
ForceSendFields []string `json:"-"`
}
func (s *Alert) UnmarshalJSON(b []byte) error {
return marshal.Unmarshal(b, s)
}
func (s Alert) MarshalJSON() ([]byte, error) {
return marshal.Marshal(s)
}
// 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:"-"`
}
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)
}
}
// 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:"-"`
}
func (s *AlertQuery) UnmarshalJSON(b []byte) error {
return marshal.Unmarshal(b, s)
}
func (s AlertQuery) MarshalJSON() ([]byte, error) {
return marshal.Marshal(s)
}
// State of the alert. Possible values are: `unknown` (yet to be evaluated),
// `triggered` (evaluated and fulfilled trigger conditions), or `ok` (evaluated
// and did not fulfill trigger conditions).
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)
}
}
// Type always returns AlertState to satisfy [pflag.Value] interface
func (f *AlertState) Type() string {
return "AlertState"
}
// Describes metadata for a particular chunk, within a result set; this
// structure is used both within a manifest, and when fetching individual chunk
// data or links.
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:"-"`
}
func (s *BaseChunkInfo) UnmarshalJSON(b []byte) error {
return marshal.Unmarshal(b, s)
}
func (s BaseChunkInfo) MarshalJSON() ([]byte, error) {
return marshal.Marshal(s)
}
// Cancel statement execution
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:"-"`
}
type CancelExecutionResponse struct {
}
type Channel struct {
DbsqlVersion string `json:"dbsql_version,omitempty"`
Name ChannelName `json:"name,omitempty"`
ForceSendFields []string `json:"-"`
}
func (s *Channel) UnmarshalJSON(b []byte) error {
return marshal.Unmarshal(b, s)
}
func (s Channel) MarshalJSON() ([]byte, error) {
return marshal.Marshal(s)
}
// Channel information for the SQL warehouse at the time of query execution
type ChannelInfo struct {
// DBSQL Version the channel is mapped to
DbsqlVersion string `json:"dbsql_version,omitempty"`
// Name of the channel
Name ChannelName `json:"name,omitempty"`
ForceSendFields []string `json:"-"`
}
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`
const ChannelNameChannelNameUnspecified ChannelName = `CHANNEL_NAME_UNSPECIFIED`
// 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`, `CHANNEL_NAME_UNSPECIFIED`:
*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", "CHANNEL_NAME_UNSPECIFIED"`, v)
}
}
// Type always returns ChannelName to satisfy [pflag.Value] interface
func (f *ChannelName) Type() string {
return "ChannelName"
}
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:"-"`
}
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)
}
}
// Type always returns ColumnInfoTypeName to satisfy [pflag.Value] interface
func (f *ColumnInfoTypeName) Type() string {
return "ColumnInfoTypeName"
}
type CreateAlert struct {
// Name of the alert.
Name string `json:"name"`
// Alert configuration options.
Options AlertOptions `json:"options"`
// The identifier of the workspace folder containing the object.
Parent string `json:"parent,omitempty"`
// Query ID.
QueryId string `json:"query_id"`
// Number of seconds after being triggered before the alert rearms itself
// and can be triggered again. If `null`, alert will never be triggered
// again.
Rearm int `json:"rearm,omitempty"`
ForceSendFields []string `json:"-"`
}
func (s *CreateAlert) UnmarshalJSON(b []byte) error {
return marshal.Unmarshal(b, s)
}
func (s CreateAlert) MarshalJSON() ([]byte, error) {
return marshal.Marshal(s)
}
// Add visualization to a query
type CreateQueryVisualizationRequest struct {
// A short description of this visualization. This is not displayed in the
// UI.
Description string `json:"description,omitempty"`
// The name of the visualization that appears on dashboards and the query
// screen.
Name string `json:"name,omitempty"`
// The options object varies widely from one visualization type to the next
// and is unsupported. Databricks does not recommend modifying visualization
// settings in JSON.
Options any `json:"options"`
// The identifier returned by :method:queries/create
QueryId string `json:"query_id"`
// The type of visualization: chart, table, pivot table, and so on.
Type string `json:"type"`
ForceSendFields []string `json:"-"`
}
func (s *CreateQueryVisualizationRequest) UnmarshalJSON(b []byte) error {
return marshal.Unmarshal(b, s)
}
func (s CreateQueryVisualizationRequest) MarshalJSON() ([]byte, error) {
return marshal.Marshal(s)
}
type CreateWarehouseRequest struct {
// The amount of time in minutes that a SQL warehouse must be idle (i.e., no
// RUNNING queries) before it is automatically stopped.
//
// Supported values: - Must be == 0 or >= 10 mins - 0 indicates no autostop.
//
// Defaults to 120 mins
AutoStopMins int `json:"auto_stop_mins,omitempty"`
// Channel Details
Channel *Channel `json:"channel,omitempty"`
// Size of the clusters allocated for this warehouse. Increasing the size of
// a spark cluster allows you to run larger queries on it. If you want to
// increase the number of concurrent queries, please tune max_num_clusters.
//
// Supported values: - 2X-Small - X-Small - Small - Medium - Large - X-Large
// - 2X-Large - 3X-Large - 4X-Large
ClusterSize string `json:"cluster_size,omitempty"`
// warehouse creator name
CreatorName string `json:"creator_name,omitempty"`
// Configures whether the warehouse should use Photon optimized clusters.
//
// Defaults to false.
EnablePhoton bool `json:"enable_photon,omitempty"`
// Configures whether the warehouse should use serverless compute
EnableServerlessCompute bool `json:"enable_serverless_compute,omitempty"`
// Deprecated. Instance profile used to pass IAM role to the cluster
InstanceProfileArn string `json:"instance_profile_arn,omitempty"`
// Maximum number of clusters that the autoscaler will create to handle
// concurrent queries.
//
// Supported values: - Must be >= min_num_clusters - Must be <= 30.
//
// Defaults to min_clusters if unset.
MaxNumClusters int `json:"max_num_clusters,omitempty"`
// Minimum number of available clusters that will be maintained for this SQL
// warehouse. Increasing this will ensure that a larger number of clusters
// are always running and therefore may reduce the cold start time for new
// queries. This is similar to reserved vs. revocable cores in a resource
// manager.
//
// Supported values: - Must be > 0 - Must be <= min(max_num_clusters, 30)
//
// Defaults to 1
MinNumClusters int `json:"min_num_clusters,omitempty"`
// Logical name for the cluster.
//
// Supported values: - Must be unique within an org. - Must be less than 100
// characters.
Name string `json:"name,omitempty"`
// Configurations whether the warehouse should use spot instances.
SpotInstancePolicy SpotInstancePolicy `json:"spot_instance_policy,omitempty"`
// A set of key-value pairs that will be tagged on all resources (e.g., AWS
// instances and EBS volumes) associated with this SQL warehouse.
//
// Supported values: - Number of tags < 45.
Tags *EndpointTags `json:"tags,omitempty"`
// Warehouse type: `PRO` or `CLASSIC`. If you want to use serverless
// compute, you must set to `PRO` and also set the field
// `enable_serverless_compute` to `true`.
WarehouseType CreateWarehouseRequestWarehouseType `json:"warehouse_type,omitempty"`
ForceSendFields []string `json:"-"`
}
func (s *CreateWarehouseRequest) UnmarshalJSON(b []byte) error {
return marshal.Unmarshal(b, s)
}
func (s CreateWarehouseRequest) MarshalJSON() ([]byte, error) {
return marshal.Marshal(s)
}
// Warehouse type: `PRO` or `CLASSIC`. If you want to use serverless compute,
// you must set to `PRO` and also set the field `enable_serverless_compute` to
// `true`.
type CreateWarehouseRequestWarehouseType string
const CreateWarehouseRequestWarehouseTypeClassic CreateWarehouseRequestWarehouseType = `CLASSIC`
const CreateWarehouseRequestWarehouseTypePro CreateWarehouseRequestWarehouseType = `PRO`
const CreateWarehouseRequestWarehouseTypeTypeUnspecified CreateWarehouseRequestWarehouseType = `TYPE_UNSPECIFIED`
// String representation for [fmt.Print]
func (f *CreateWarehouseRequestWarehouseType) String() string {
return string(*f)
}
// Set raw string value and validate it against allowed values
func (f *CreateWarehouseRequestWarehouseType) Set(v string) error {
switch v {
case `CLASSIC`, `PRO`, `TYPE_UNSPECIFIED`:
*f = CreateWarehouseRequestWarehouseType(v)
return nil
default:
return fmt.Errorf(`value "%s" is not one of "CLASSIC", "PRO", "TYPE_UNSPECIFIED"`, v)
}
}
// Type always returns CreateWarehouseRequestWarehouseType to satisfy [pflag.Value] interface
func (f *CreateWarehouseRequestWarehouseType) Type() string {
return "CreateWarehouseRequestWarehouseType"
}
type CreateWarehouseResponse struct {
// Id for the SQL warehouse. This value is unique across all SQL warehouses.
Id string `json:"id,omitempty"`
ForceSendFields []string `json:"-"`
}
func (s *CreateWarehouseResponse) UnmarshalJSON(b []byte) error {
return marshal.Unmarshal(b, s)
}
func (s CreateWarehouseResponse) MarshalJSON() ([]byte, error) {
return marshal.Marshal(s)
}
type CreateWidget struct {
// Dashboard ID returned by :method:dashboards/create.
DashboardId string `json:"dashboard_id"`
// Widget ID returned by :method:dashboardwidgets/create
Id string `json:"-" url:"-"`
Options WidgetOptions `json:"options"`
// If this is a textbox widget, the application displays this text. This
// field is ignored if the widget contains a visualization in the
// `visualization` field.
Text string `json:"text,omitempty"`
// Query Vizualization ID returned by :method:queryvisualizations/create.
VisualizationId string `json:"visualization_id,omitempty"`
// Width of a widget
Width int `json:"width"`
ForceSendFields []string `json:"-"`
}
func (s *CreateWidget) UnmarshalJSON(b []byte) error {
return marshal.Unmarshal(b, s)
}
func (s CreateWidget) MarshalJSON() ([]byte, error) {
return marshal.Marshal(s)
}
// A JSON representing a dashboard containing widgets of visualizations and text
// boxes.
type Dashboard struct {
// Whether the authenticated user can edit the query definition.
CanEdit bool `json:"can_edit,omitempty"`
// Timestamp when this dashboard was created.
CreatedAt string `json:"created_at,omitempty"`
// In the web application, query filters that share a name are coupled to a
// single selection box if this value is `true`.
DashboardFiltersEnabled bool `json:"dashboard_filters_enabled,omitempty"`
// The ID for this dashboard.
Id string `json:"id,omitempty"`
// Indicates whether a dashboard is trashed. Trashed dashboards won't appear
// in list views. If this boolean is `true`, the `options` property for this
// dashboard includes a `moved_to_trash_at` timestamp. Items in trash are
// permanently deleted after 30 days.
IsArchived bool `json:"is_archived,omitempty"`
// Whether a dashboard is a draft. Draft dashboards only appear in list
// views for their owners.
IsDraft bool `json:"is_draft,omitempty"`
// Indicates whether this query object appears in the current user's
// favorites list. This flag determines whether the star icon for favorites
// is selected.
IsFavorite bool `json:"is_favorite,omitempty"`
// The title of the dashboard that appears in list views and at the top of
// the dashboard page.
Name string `json:"name,omitempty"`
Options *DashboardOptions `json:"options,omitempty"`
// The identifier of the workspace folder containing the object.
Parent string `json:"parent,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
PermissionTier PermissionLevel `json:"permission_tier,omitempty"`
// URL slug. Usually mirrors the query name with dashes (`-`) instead of
// spaces. Appears in the URL for this query.
Slug string `json:"slug,omitempty"`
Tags []string `json:"tags,omitempty"`
// Timestamp when this dashboard was last updated.
UpdatedAt string `json:"updated_at,omitempty"`
User *User `json:"user,omitempty"`
// The ID of the user who owns the dashboard.
UserId int `json:"user_id,omitempty"`
Widgets []Widget `json:"widgets,omitempty"`
ForceSendFields []string `json:"-"`
}
func (s *Dashboard) UnmarshalJSON(b []byte) error {
return marshal.Unmarshal(b, s)
}
func (s Dashboard) MarshalJSON() ([]byte, error) {
return marshal.Marshal(s)
}
type DashboardEditContent struct {
DashboardId string `json:"-" url:"-"`
// The title of this dashboard that appears in list views and at the top of
// the dashboard page.
Name string `json:"name,omitempty"`
// Sets the **Run as** role for the object. Must be set to one of `"viewer"`
// (signifying "run as viewer" behavior) or `"owner"` (signifying "run as
// owner" behavior)
RunAsRole RunAsRole `json:"run_as_role,omitempty"`
Tags []string `json:"tags,omitempty"`
ForceSendFields []string `json:"-"`
}
func (s *DashboardEditContent) UnmarshalJSON(b []byte) error {
return marshal.Unmarshal(b, s)
}
func (s DashboardEditContent) MarshalJSON() ([]byte, error) {
return marshal.Marshal(s)
}
type DashboardOptions struct {
// The timestamp when this dashboard was moved to trash. Only present when
// the `is_archived` property is `true`. Trashed items are deleted after
// thirty days.
MovedToTrashAt string `json:"moved_to_trash_at,omitempty"`
ForceSendFields []string `json:"-"`
}
func (s *DashboardOptions) UnmarshalJSON(b []byte) error {
return marshal.Unmarshal(b, s)
}
func (s DashboardOptions) MarshalJSON() ([]byte, error) {
return marshal.Marshal(s)
}
type DashboardPostContent struct {
// Indicates whether the dashboard filters are enabled
DashboardFiltersEnabled bool `json:"dashboard_filters_enabled,omitempty"`
// Indicates whether this dashboard object should appear in the current
// user's favorites list.
IsFavorite bool `json:"is_favorite,omitempty"`
// The title of this dashboard that appears in list views and at the top of
// the dashboard page.
Name string `json:"name"`
// The identifier of the workspace folder containing the object.
Parent string `json:"parent,omitempty"`
// Sets the **Run as** role for the object. Must be set to one of `"viewer"`
// (signifying "run as viewer" behavior) or `"owner"` (signifying "run as
// owner" behavior)
RunAsRole RunAsRole `json:"run_as_role,omitempty"`
Tags []string `json:"tags,omitempty"`
ForceSendFields []string `json:"-"`
}
func (s *DashboardPostContent) UnmarshalJSON(b []byte) error {
return marshal.Unmarshal(b, s)
}
func (s DashboardPostContent) MarshalJSON() ([]byte, error) {
return marshal.Marshal(s)
}
// A JSON object representing a DBSQL data source / SQL warehouse.
type DataSource struct {
// 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
Id string `json:"id,omitempty"`
// The string name of this data source / SQL warehouse as it appears in the
// Databricks SQL web application.
Name string `json:"name,omitempty"`
// Reserved for internal use.
PauseReason string `json:"pause_reason,omitempty"`
// Reserved for internal use.
Paused int `json:"paused,omitempty"`
// Reserved for internal use.
SupportsAutoLimit bool `json:"supports_auto_limit,omitempty"`
// Reserved for internal use.
Syntax string `json:"syntax,omitempty"`
// The type of data source. For SQL warehouses, this will be
// `databricks_internal`.
Type string `json:"type,omitempty"`
// Reserved for internal use.
ViewOnly bool `json:"view_only,omitempty"`
// The ID of the associated SQL warehouse, if this data source is backed by
// a SQL warehouse.
WarehouseId string `json:"warehouse_id,omitempty"`
ForceSendFields []string `json:"-"`
}
func (s *DataSource) UnmarshalJSON(b []byte) error {
return marshal.Unmarshal(b, s)
}
func (s DataSource) MarshalJSON() ([]byte, error) {
return marshal.Marshal(s)
}
// Delete an alert
type DeleteAlertRequest struct {
AlertId string `json:"-" url:"-"`
}
// Remove a dashboard
type DeleteDashboardRequest struct {
DashboardId string `json:"-" url:"-"`
}
// Remove widget
type DeleteDashboardWidgetRequest struct {
// Widget ID returned by :method:dashboardwidgets/create
Id string `json:"-" url:"-"`
}
// Delete a query
type DeleteQueryRequest struct {
QueryId string `json:"-" url:"-"`
}
// Remove visualization
type DeleteQueryVisualizationRequest struct {
// Widget ID returned by :method:queryvizualisations/create
Id string `json:"-" url:"-"`
}
type DeleteResponse struct {
}
// Delete a warehouse
type DeleteWarehouseRequest struct {
// Required. Id of the SQL warehouse.
Id string `json:"-" url:"-"`
}
type DeleteWarehouseResponse struct {
}
// The fetch disposition provides two modes of fetching results: `INLINE` and
// `EXTERNAL_LINKS`.
//
// Statements executed with `INLINE` disposition will return result data inline,
// in `JSON_ARRAY` format, in a series of chunks. If a given statement produces
// a result set with a size larger than 25 MiB, that statement execution is
// aborted, and no result set will be available.
//
// **NOTE** Byte limits are computed based upon internal representations of the
// result set data, and might not match the sizes visible in JSON responses.
//
// Statements executed with `EXTERNAL_LINKS` disposition will return result data
// as external links: URLs that point to cloud storage internal to the
// workspace. Using `EXTERNAL_LINKS` disposition allows statements to generate
// arbitrarily sized result sets for fetching up to 100 GiB. The resulting links
// have two important properties:
//
// 1. They point to resources _external_ to the Databricks compute; therefore
// any associated authentication information (typically a personal access token,
// OAuth token, or similar) _must be removed_ when fetching from these links.
//
// 2. These are presigned URLs with a specific expiration, indicated in the
// response. The behavior when attempting to use an expired link is cloud
// specific.
type Disposition string
const DispositionExternalLinks Disposition = `EXTERNAL_LINKS`
const DispositionInline Disposition = `INLINE`
// String representation for [fmt.Print]
func (f *Disposition) String() string {
return string(*f)
}
// Set raw string value and validate it against allowed values
func (f *Disposition) Set(v string) error {
switch v {
case `EXTERNAL_LINKS`, `INLINE`:
*f = Disposition(v)
return nil
default:
return fmt.Errorf(`value "%s" is not one of "EXTERNAL_LINKS", "INLINE"`, v)
}
}
// Type always returns Disposition to satisfy [pflag.Value] interface
func (f *Disposition) Type() string {
return "Disposition"
}
type EditAlert struct {
AlertId string `json:"-" url:"-"`
// Name of the alert.
Name string `json:"name"`
// Alert configuration options.
Options AlertOptions `json:"options"`
// Query ID.
QueryId string `json:"query_id"`
// Number of seconds after being triggered before the alert rearms itself
// and can be triggered again. If `null`, alert will never be triggered
// again.
Rearm int `json:"rearm,omitempty"`
ForceSendFields []string `json:"-"`
}
func (s *EditAlert) UnmarshalJSON(b []byte) error {
return marshal.Unmarshal(b, s)
}
func (s EditAlert) MarshalJSON() ([]byte, error) {
return marshal.Marshal(s)
}
type EditWarehouseRequest struct {
// The amount of time in minutes that a SQL warehouse must be idle (i.e., no
// RUNNING queries) before it is automatically stopped.
//
// Supported values: - Must be == 0 or >= 10 mins - 0 indicates no autostop.
//
// Defaults to 120 mins
AutoStopMins int `json:"auto_stop_mins,omitempty"`
// Channel Details
Channel *Channel `json:"channel,omitempty"`
// Size of the clusters allocated for this warehouse. Increasing the size of
// a spark cluster allows you to run larger queries on it. If you want to
// increase the number of concurrent queries, please tune max_num_clusters.
//
// Supported values: - 2X-Small - X-Small - Small - Medium - Large - X-Large
// - 2X-Large - 3X-Large - 4X-Large
ClusterSize string `json:"cluster_size,omitempty"`
// warehouse creator name
CreatorName string `json:"creator_name,omitempty"`
// Configures whether the warehouse should use Photon optimized clusters.
//
// Defaults to false.
EnablePhoton bool `json:"enable_photon,omitempty"`
// Configures whether the warehouse should use serverless compute.
EnableServerlessCompute bool `json:"enable_serverless_compute,omitempty"`
// Required. Id of the warehouse to configure.
Id string `json:"-" url:"-"`
// Deprecated. Instance profile used to pass IAM role to the cluster
InstanceProfileArn string `json:"instance_profile_arn,omitempty"`
// Maximum number of clusters that the autoscaler will create to handle
// concurrent queries.
//
// Supported values: - Must be >= min_num_clusters - Must be <= 30.
//
// Defaults to min_clusters if unset.
MaxNumClusters int `json:"max_num_clusters,omitempty"`
// Minimum number of available clusters that will be maintained for this SQL
// warehouse. Increasing this will ensure that a larger number of clusters
// are always running and therefore may reduce the cold start time for new
// queries. This is similar to reserved vs. revocable cores in a resource
// manager.
//
// Supported values: - Must be > 0 - Must be <= min(max_num_clusters, 30)
//
// Defaults to 1
MinNumClusters int `json:"min_num_clusters,omitempty"`
// Logical name for the cluster.
//
// Supported values: - Must be unique within an org. - Must be less than 100
// characters.
Name string `json:"name,omitempty"`
// Configurations whether the warehouse should use spot instances.
SpotInstancePolicy SpotInstancePolicy `json:"spot_instance_policy,omitempty"`
// A set of key-value pairs that will be tagged on all resources (e.g., AWS
// instances and EBS volumes) associated with this SQL warehouse.
//
// Supported values: - Number of tags < 45.
Tags *EndpointTags `json:"tags,omitempty"`
// Warehouse type: `PRO` or `CLASSIC`. If you want to use serverless
// compute, you must set to `PRO` and also set the field
// `enable_serverless_compute` to `true`.
WarehouseType EditWarehouseRequestWarehouseType `json:"warehouse_type,omitempty"`
ForceSendFields []string `json:"-"`
}
func (s *EditWarehouseRequest) UnmarshalJSON(b []byte) error {
return marshal.Unmarshal(b, s)
}
func (s EditWarehouseRequest) MarshalJSON() ([]byte, error) {
return marshal.Marshal(s)
}
// Warehouse type: `PRO` or `CLASSIC`. If you want to use serverless compute,
// you must set to `PRO` and also set the field `enable_serverless_compute` to
// `true`.
type EditWarehouseRequestWarehouseType string
const EditWarehouseRequestWarehouseTypeClassic EditWarehouseRequestWarehouseType = `CLASSIC`
const EditWarehouseRequestWarehouseTypePro EditWarehouseRequestWarehouseType = `PRO`
const EditWarehouseRequestWarehouseTypeTypeUnspecified EditWarehouseRequestWarehouseType = `TYPE_UNSPECIFIED`
// String representation for [fmt.Print]
func (f *EditWarehouseRequestWarehouseType) String() string {
return string(*f)
}
// Set raw string value and validate it against allowed values
func (f *EditWarehouseRequestWarehouseType) Set(v string) error {
switch v {
case `CLASSIC`, `PRO`, `TYPE_UNSPECIFIED`:
*f = EditWarehouseRequestWarehouseType(v)
return nil
default:
return fmt.Errorf(`value "%s" is not one of "CLASSIC", "PRO", "TYPE_UNSPECIFIED"`, v)
}
}
// Type always returns EditWarehouseRequestWarehouseType to satisfy [pflag.Value] interface
func (f *EditWarehouseRequestWarehouseType) Type() string {
return "EditWarehouseRequestWarehouseType"
}