@databricks/sdk-alerts 0.1.0-dev.2 → 0.1.0-dev.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/v1/model.ts DELETED
@@ -1,620 +0,0 @@
1
- // Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
2
-
3
- import {Temporal} from '@js-temporal/polyfill';
4
- import {FieldMask} from '@databricks/sdk-core/wkt';
5
- import type {FieldMaskSchema} from '@databricks/sdk-core/wkt';
6
- import {z} from 'zod';
7
-
8
- export enum AlertOperator {
9
- GREATER_THAN = 'GREATER_THAN',
10
- GREATER_THAN_OR_EQUAL = 'GREATER_THAN_OR_EQUAL',
11
- LESS_THAN = 'LESS_THAN',
12
- LESS_THAN_OR_EQUAL = 'LESS_THAN_OR_EQUAL',
13
- EQUAL = 'EQUAL',
14
- NOT_EQUAL = 'NOT_EQUAL',
15
- IS_NULL = 'IS_NULL',
16
- }
17
-
18
- export enum AlertState {
19
- UNKNOWN = 'UNKNOWN',
20
- OK = 'OK',
21
- TRIGGERED = 'TRIGGERED',
22
- }
23
-
24
- export enum LifecycleState {
25
- ACTIVE = 'ACTIVE',
26
- TRASHED = 'TRASHED',
27
- }
28
-
29
- export interface Alert {
30
- /** UUID identifying the alert. */
31
- id?: string | undefined;
32
- /** The display name of the alert. */
33
- displayName?: string | undefined;
34
- /** UUID of the query attached to the alert. */
35
- queryId?: string | undefined;
36
- /** 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. */
37
- state?: AlertState | undefined;
38
- /** 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. */
39
- secondsToRetrigger?: number | undefined;
40
- /** The workspace state of the alert. Used for tracking trashed status. */
41
- lifecycleState?: LifecycleState | undefined;
42
- /** Timestamp when the alert was last triggered, if the alert has been triggered before. */
43
- triggerTime?: Temporal.Instant | undefined;
44
- /** Custom body of alert notification, if it exists. See [here](/sql/user/alerts/index.html) for custom templating instructions. */
45
- customBody?: string | undefined;
46
- /** Custom subject of alert notification, if it exists. This can include email subject entries and Slack notification headers, for example. See [here](/sql/user/alerts/index.html) for custom templating instructions. */
47
- customSubject?: string | undefined;
48
- /** Trigger conditions of the alert. */
49
- condition?: AlertCondition | undefined;
50
- /** The owner's username. This field is set to "Unavailable" if the user has been deleted. */
51
- ownerUserName?: string | undefined;
52
- /** The workspace path of the folder containing the alert. */
53
- parentPath?: string | undefined;
54
- /** The timestamp indicating when the alert was created. */
55
- createTime?: Temporal.Instant | undefined;
56
- /** The timestamp indicating when the alert was updated. */
57
- updateTime?: Temporal.Instant | undefined;
58
- /** Whether to notify alert subscribers when alert returns back to normal. */
59
- notifyOnOk?: boolean | undefined;
60
- }
61
-
62
- export interface AlertCondition {
63
- /** Operator used for comparison in alert evaluation. */
64
- op?: AlertOperator | undefined;
65
- /** Name of the column from the query result to use for comparison in alert evaluation. */
66
- operand?: AlertOperand | undefined;
67
- /** Threshold value used for comparison in alert evaluation. */
68
- threshold?: AlertOperand | undefined;
69
- /** Alert state if result is empty. */
70
- emptyResultState?: AlertState | undefined;
71
- }
72
-
73
- export interface AlertOperand {
74
- /** Only one of the following fields may be set, depending on the type of operand/threshold. */
75
- operand?:
76
- | {$case: 'value'; value: AlertOperandValue}
77
- | {$case: 'column'; column: AlertOperandColumn}
78
- | undefined;
79
- }
80
-
81
- export interface AlertOperandColumn {
82
- name?: string | undefined;
83
- }
84
-
85
- export interface AlertOperandValue {
86
- /** Only one of the following fields may be set, depending on the type of threshold value. */
87
- thresholdValue?:
88
- | {$case: 'stringValue'; stringValue: string}
89
- | {$case: 'doubleValue'; doubleValue: number}
90
- | {$case: 'boolValue'; boolValue: boolean}
91
- | undefined;
92
- }
93
-
94
- export interface CreateAlertRequest {
95
- alert?: CreateAlertRequestAlert | undefined;
96
- /** If true, automatically resolve alert display name conflicts. Otherwise, fail the request if the alert's display name conflicts with an existing alert's display name. */
97
- autoResolveDisplayName?: boolean | undefined;
98
- }
99
-
100
- export interface CreateAlertRequestAlert {
101
- /** UUID identifying the alert. */
102
- id?: string | undefined;
103
- /** The display name of the alert. */
104
- displayName?: string | undefined;
105
- /** UUID of the query attached to the alert. */
106
- queryId?: string | undefined;
107
- /** 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. */
108
- state?: AlertState | undefined;
109
- /** 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. */
110
- secondsToRetrigger?: number | undefined;
111
- /** The workspace state of the alert. Used for tracking trashed status. */
112
- lifecycleState?: LifecycleState | undefined;
113
- /** Timestamp when the alert was last triggered, if the alert has been triggered before. */
114
- triggerTime?: Temporal.Instant | undefined;
115
- /** Custom body of alert notification, if it exists. See [here](/sql/user/alerts/index.html) for custom templating instructions. */
116
- customBody?: string | undefined;
117
- /** Custom subject of alert notification, if it exists. This can include email subject entries and Slack notification headers, for example. See [here](/sql/user/alerts/index.html) for custom templating instructions. */
118
- customSubject?: string | undefined;
119
- /** Trigger conditions of the alert. */
120
- condition?: AlertCondition | undefined;
121
- /** The owner's username. This field is set to "Unavailable" if the user has been deleted. */
122
- ownerUserName?: string | undefined;
123
- /** The workspace path of the folder containing the alert. */
124
- parentPath?: string | undefined;
125
- /** The timestamp indicating when the alert was created. */
126
- createTime?: Temporal.Instant | undefined;
127
- /** The timestamp indicating when the alert was updated. */
128
- updateTime?: Temporal.Instant | undefined;
129
- /** Whether to notify alert subscribers when alert returns back to normal. */
130
- notifyOnOk?: boolean | undefined;
131
- }
132
-
133
- /**
134
- * Represents an empty message, similar to google.protobuf.Empty, which is not available in the firm
135
- * right now.
136
- */
137
- // eslint-disable-next-line @typescript-eslint/no-empty-object-type
138
- export interface Empty {}
139
-
140
- export interface GetAlertRequest {
141
- id?: string | undefined;
142
- }
143
-
144
- export interface ListAlertsRequest {
145
- pageToken?: string | undefined;
146
- pageSize?: number | undefined;
147
- }
148
-
149
- export interface ListAlertsResponse {
150
- results?: ListAlertsResponseAlert[] | undefined;
151
- nextPageToken?: string | undefined;
152
- }
153
-
154
- export interface ListAlertsResponseAlert {
155
- /** UUID identifying the alert. */
156
- id?: string | undefined;
157
- /** The display name of the alert. */
158
- displayName?: string | undefined;
159
- /** UUID of the query attached to the alert. */
160
- queryId?: string | undefined;
161
- /** 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. */
162
- state?: AlertState | undefined;
163
- /** 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. */
164
- secondsToRetrigger?: number | undefined;
165
- /** The workspace state of the alert. Used for tracking trashed status. */
166
- lifecycleState?: LifecycleState | undefined;
167
- /** Timestamp when the alert was last triggered, if the alert has been triggered before. */
168
- triggerTime?: Temporal.Instant | undefined;
169
- /** Custom body of alert notification, if it exists. See [here](/sql/user/alerts/index.html) for custom templating instructions. */
170
- customBody?: string | undefined;
171
- /** Custom subject of alert notification, if it exists. This can include email subject entries and Slack notification headers, for example. See [here](/sql/user/alerts/index.html) for custom templating instructions. */
172
- customSubject?: string | undefined;
173
- /** Trigger conditions of the alert. */
174
- condition?: AlertCondition | undefined;
175
- /** The owner's username. This field is set to "Unavailable" if the user has been deleted. */
176
- ownerUserName?: string | undefined;
177
- /** The workspace path of the folder containing the alert. */
178
- parentPath?: string | undefined;
179
- /** The timestamp indicating when the alert was created. */
180
- createTime?: Temporal.Instant | undefined;
181
- /** The timestamp indicating when the alert was updated. */
182
- updateTime?: Temporal.Instant | undefined;
183
- /** Whether to notify alert subscribers when alert returns back to normal. */
184
- notifyOnOk?: boolean | undefined;
185
- }
186
-
187
- export interface TrashAlertRequest {
188
- id?: string | undefined;
189
- }
190
-
191
- export interface UpdateAlertRequest {
192
- alert?: UpdateAlertRequestAlert | undefined;
193
- updateMask?: FieldMask<UpdateAlertRequestAlert> | undefined;
194
- id?: string | undefined;
195
- /** If true, automatically resolve alert display name conflicts. Otherwise, fail the request if the alert's display name conflicts with an existing alert's display name. */
196
- autoResolveDisplayName?: boolean | undefined;
197
- }
198
-
199
- export interface UpdateAlertRequestAlert {
200
- /** UUID identifying the alert. */
201
- id?: string | undefined;
202
- /** The display name of the alert. */
203
- displayName?: string | undefined;
204
- /** UUID of the query attached to the alert. */
205
- queryId?: string | undefined;
206
- /** 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. */
207
- state?: AlertState | undefined;
208
- /** 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. */
209
- secondsToRetrigger?: number | undefined;
210
- /** The workspace state of the alert. Used for tracking trashed status. */
211
- lifecycleState?: LifecycleState | undefined;
212
- /** Timestamp when the alert was last triggered, if the alert has been triggered before. */
213
- triggerTime?: Temporal.Instant | undefined;
214
- /** Custom body of alert notification, if it exists. See [here](/sql/user/alerts/index.html) for custom templating instructions. */
215
- customBody?: string | undefined;
216
- /** Custom subject of alert notification, if it exists. This can include email subject entries and Slack notification headers, for example. See [here](/sql/user/alerts/index.html) for custom templating instructions. */
217
- customSubject?: string | undefined;
218
- /** Trigger conditions of the alert. */
219
- condition?: AlertCondition | undefined;
220
- /** The owner's username. This field is set to "Unavailable" if the user has been deleted. */
221
- ownerUserName?: string | undefined;
222
- /** The workspace path of the folder containing the alert. */
223
- parentPath?: string | undefined;
224
- /** The timestamp indicating when the alert was created. */
225
- createTime?: Temporal.Instant | undefined;
226
- /** The timestamp indicating when the alert was updated. */
227
- updateTime?: Temporal.Instant | undefined;
228
- /** Whether to notify alert subscribers when alert returns back to normal. */
229
- notifyOnOk?: boolean | undefined;
230
- }
231
-
232
- export const unmarshalAlertSchema: z.ZodType<Alert> = z
233
- .object({
234
- id: z.string().optional(),
235
- display_name: z.string().optional(),
236
- query_id: z.string().optional(),
237
- state: z.enum(AlertState).optional(),
238
- seconds_to_retrigger: z.number().optional(),
239
- lifecycle_state: z.enum(LifecycleState).optional(),
240
- trigger_time: z
241
- .string()
242
- .transform(s => Temporal.Instant.from(s))
243
- .optional(),
244
- custom_body: z.string().optional(),
245
- custom_subject: z.string().optional(),
246
- condition: z.lazy(() => unmarshalAlertConditionSchema).optional(),
247
- owner_user_name: z.string().optional(),
248
- parent_path: z.string().optional(),
249
- create_time: z
250
- .string()
251
- .transform(s => Temporal.Instant.from(s))
252
- .optional(),
253
- update_time: z
254
- .string()
255
- .transform(s => Temporal.Instant.from(s))
256
- .optional(),
257
- notify_on_ok: z.boolean().optional(),
258
- })
259
- .transform(d => ({
260
- id: d.id,
261
- displayName: d.display_name,
262
- queryId: d.query_id,
263
- state: d.state,
264
- secondsToRetrigger: d.seconds_to_retrigger,
265
- lifecycleState: d.lifecycle_state,
266
- triggerTime: d.trigger_time,
267
- customBody: d.custom_body,
268
- customSubject: d.custom_subject,
269
- condition: d.condition,
270
- ownerUserName: d.owner_user_name,
271
- parentPath: d.parent_path,
272
- createTime: d.create_time,
273
- updateTime: d.update_time,
274
- notifyOnOk: d.notify_on_ok,
275
- }));
276
-
277
- export const unmarshalAlertConditionSchema: z.ZodType<AlertCondition> = z
278
- .object({
279
- op: z.enum(AlertOperator).optional(),
280
- operand: z.lazy(() => unmarshalAlertOperandSchema).optional(),
281
- threshold: z.lazy(() => unmarshalAlertOperandSchema).optional(),
282
- empty_result_state: z.enum(AlertState).optional(),
283
- })
284
- .transform(d => ({
285
- op: d.op,
286
- operand: d.operand,
287
- threshold: d.threshold,
288
- emptyResultState: d.empty_result_state,
289
- }));
290
-
291
- export const unmarshalAlertOperandSchema: z.ZodType<AlertOperand> = z
292
- .object({
293
- value: z.lazy(() => unmarshalAlertOperandValueSchema).optional(),
294
- column: z.lazy(() => unmarshalAlertOperandColumnSchema).optional(),
295
- })
296
- .transform(d => ({
297
- operand:
298
- d.value !== undefined
299
- ? {$case: 'value' as const, value: d.value}
300
- : d.column !== undefined
301
- ? {$case: 'column' as const, column: d.column}
302
- : undefined,
303
- }));
304
-
305
- export const unmarshalAlertOperandColumnSchema: z.ZodType<AlertOperandColumn> =
306
- z
307
- .object({
308
- name: z.string().optional(),
309
- })
310
- .transform(d => ({
311
- name: d.name,
312
- }));
313
-
314
- export const unmarshalAlertOperandValueSchema: z.ZodType<AlertOperandValue> = z
315
- .object({
316
- string_value: z.string().optional(),
317
- double_value: z.number().optional(),
318
- bool_value: z.boolean().optional(),
319
- })
320
- .transform(d => ({
321
- thresholdValue:
322
- d.string_value !== undefined
323
- ? {$case: 'stringValue' as const, stringValue: d.string_value}
324
- : d.double_value !== undefined
325
- ? {$case: 'doubleValue' as const, doubleValue: d.double_value}
326
- : d.bool_value !== undefined
327
- ? {$case: 'boolValue' as const, boolValue: d.bool_value}
328
- : undefined,
329
- }));
330
-
331
- export const unmarshalEmptySchema: z.ZodType<Empty> = z.object({});
332
-
333
- export const unmarshalListAlertsResponseSchema: z.ZodType<ListAlertsResponse> =
334
- z
335
- .object({
336
- results: z
337
- .array(z.lazy(() => unmarshalListAlertsResponseAlertSchema))
338
- .optional(),
339
- next_page_token: z.string().optional(),
340
- })
341
- .transform(d => ({
342
- results: d.results,
343
- nextPageToken: d.next_page_token,
344
- }));
345
-
346
- export const unmarshalListAlertsResponseAlertSchema: z.ZodType<ListAlertsResponseAlert> =
347
- z
348
- .object({
349
- id: z.string().optional(),
350
- display_name: z.string().optional(),
351
- query_id: z.string().optional(),
352
- state: z.enum(AlertState).optional(),
353
- seconds_to_retrigger: z.number().optional(),
354
- lifecycle_state: z.enum(LifecycleState).optional(),
355
- trigger_time: z
356
- .string()
357
- .transform(s => Temporal.Instant.from(s))
358
- .optional(),
359
- custom_body: z.string().optional(),
360
- custom_subject: z.string().optional(),
361
- condition: z.lazy(() => unmarshalAlertConditionSchema).optional(),
362
- owner_user_name: z.string().optional(),
363
- parent_path: z.string().optional(),
364
- create_time: z
365
- .string()
366
- .transform(s => Temporal.Instant.from(s))
367
- .optional(),
368
- update_time: z
369
- .string()
370
- .transform(s => Temporal.Instant.from(s))
371
- .optional(),
372
- notify_on_ok: z.boolean().optional(),
373
- })
374
- .transform(d => ({
375
- id: d.id,
376
- displayName: d.display_name,
377
- queryId: d.query_id,
378
- state: d.state,
379
- secondsToRetrigger: d.seconds_to_retrigger,
380
- lifecycleState: d.lifecycle_state,
381
- triggerTime: d.trigger_time,
382
- customBody: d.custom_body,
383
- customSubject: d.custom_subject,
384
- condition: d.condition,
385
- ownerUserName: d.owner_user_name,
386
- parentPath: d.parent_path,
387
- createTime: d.create_time,
388
- updateTime: d.update_time,
389
- notifyOnOk: d.notify_on_ok,
390
- }));
391
-
392
- export const marshalAlertConditionSchema: z.ZodType = z
393
- .object({
394
- op: z.enum(AlertOperator).optional(),
395
- operand: z.lazy(() => marshalAlertOperandSchema).optional(),
396
- threshold: z.lazy(() => marshalAlertOperandSchema).optional(),
397
- emptyResultState: z.enum(AlertState).optional(),
398
- })
399
- .transform(d => ({
400
- op: d.op,
401
- operand: d.operand,
402
- threshold: d.threshold,
403
- empty_result_state: d.emptyResultState,
404
- }));
405
-
406
- export const marshalAlertOperandSchema: z.ZodType = z
407
- .object({
408
- operand: z
409
- .discriminatedUnion('$case', [
410
- z.object({
411
- $case: z.literal('value'),
412
- value: z.lazy(() => marshalAlertOperandValueSchema),
413
- }),
414
- z.object({
415
- $case: z.literal('column'),
416
- column: z.lazy(() => marshalAlertOperandColumnSchema),
417
- }),
418
- ])
419
- .optional(),
420
- })
421
- .transform(d => ({
422
- ...(d.operand?.$case === 'value' && {value: d.operand.value}),
423
- ...(d.operand?.$case === 'column' && {column: d.operand.column}),
424
- }));
425
-
426
- export const marshalAlertOperandColumnSchema: z.ZodType = z
427
- .object({
428
- name: z.string().optional(),
429
- })
430
- .transform(d => ({
431
- name: d.name,
432
- }));
433
-
434
- export const marshalAlertOperandValueSchema: z.ZodType = z
435
- .object({
436
- thresholdValue: z
437
- .discriminatedUnion('$case', [
438
- z.object({$case: z.literal('stringValue'), stringValue: z.string()}),
439
- z.object({$case: z.literal('doubleValue'), doubleValue: z.number()}),
440
- z.object({$case: z.literal('boolValue'), boolValue: z.boolean()}),
441
- ])
442
- .optional(),
443
- })
444
- .transform(d => ({
445
- ...(d.thresholdValue?.$case === 'stringValue' && {
446
- string_value: d.thresholdValue.stringValue,
447
- }),
448
- ...(d.thresholdValue?.$case === 'doubleValue' && {
449
- double_value: d.thresholdValue.doubleValue,
450
- }),
451
- ...(d.thresholdValue?.$case === 'boolValue' && {
452
- bool_value: d.thresholdValue.boolValue,
453
- }),
454
- }));
455
-
456
- export const marshalCreateAlertRequestSchema: z.ZodType = z
457
- .object({
458
- alert: z.lazy(() => marshalCreateAlertRequestAlertSchema).optional(),
459
- autoResolveDisplayName: z.boolean().optional(),
460
- })
461
- .transform(d => ({
462
- alert: d.alert,
463
- auto_resolve_display_name: d.autoResolveDisplayName,
464
- }));
465
-
466
- export const marshalCreateAlertRequestAlertSchema: z.ZodType = z
467
- .object({
468
- id: z.string().optional(),
469
- displayName: z.string().optional(),
470
- queryId: z.string().optional(),
471
- state: z.enum(AlertState).optional(),
472
- secondsToRetrigger: z.number().optional(),
473
- lifecycleState: z.enum(LifecycleState).optional(),
474
- triggerTime: z
475
- .any()
476
- .transform((d: Temporal.Instant) => d.toString())
477
- .optional(),
478
- customBody: z.string().optional(),
479
- customSubject: z.string().optional(),
480
- condition: z.lazy(() => marshalAlertConditionSchema).optional(),
481
- ownerUserName: z.string().optional(),
482
- parentPath: z.string().optional(),
483
- createTime: z
484
- .any()
485
- .transform((d: Temporal.Instant) => d.toString())
486
- .optional(),
487
- updateTime: z
488
- .any()
489
- .transform((d: Temporal.Instant) => d.toString())
490
- .optional(),
491
- notifyOnOk: z.boolean().optional(),
492
- })
493
- .transform(d => ({
494
- id: d.id,
495
- display_name: d.displayName,
496
- query_id: d.queryId,
497
- state: d.state,
498
- seconds_to_retrigger: d.secondsToRetrigger,
499
- lifecycle_state: d.lifecycleState,
500
- trigger_time: d.triggerTime,
501
- custom_body: d.customBody,
502
- custom_subject: d.customSubject,
503
- condition: d.condition,
504
- owner_user_name: d.ownerUserName,
505
- parent_path: d.parentPath,
506
- create_time: d.createTime,
507
- update_time: d.updateTime,
508
- notify_on_ok: d.notifyOnOk,
509
- }));
510
-
511
- export const marshalUpdateAlertRequestSchema: z.ZodType = z
512
- .object({
513
- alert: z.lazy(() => marshalUpdateAlertRequestAlertSchema).optional(),
514
- updateMask: z
515
- .any()
516
- .transform((m: FieldMask) => m.toString())
517
- .optional(),
518
- id: z.string().optional(),
519
- autoResolveDisplayName: z.boolean().optional(),
520
- })
521
- .transform(d => ({
522
- alert: d.alert,
523
- update_mask: d.updateMask,
524
- id: d.id,
525
- auto_resolve_display_name: d.autoResolveDisplayName,
526
- }));
527
-
528
- export const marshalUpdateAlertRequestAlertSchema: z.ZodType = z
529
- .object({
530
- id: z.string().optional(),
531
- displayName: z.string().optional(),
532
- queryId: z.string().optional(),
533
- state: z.enum(AlertState).optional(),
534
- secondsToRetrigger: z.number().optional(),
535
- lifecycleState: z.enum(LifecycleState).optional(),
536
- triggerTime: z
537
- .any()
538
- .transform((d: Temporal.Instant) => d.toString())
539
- .optional(),
540
- customBody: z.string().optional(),
541
- customSubject: z.string().optional(),
542
- condition: z.lazy(() => marshalAlertConditionSchema).optional(),
543
- ownerUserName: z.string().optional(),
544
- parentPath: z.string().optional(),
545
- createTime: z
546
- .any()
547
- .transform((d: Temporal.Instant) => d.toString())
548
- .optional(),
549
- updateTime: z
550
- .any()
551
- .transform((d: Temporal.Instant) => d.toString())
552
- .optional(),
553
- notifyOnOk: z.boolean().optional(),
554
- })
555
- .transform(d => ({
556
- id: d.id,
557
- display_name: d.displayName,
558
- query_id: d.queryId,
559
- state: d.state,
560
- seconds_to_retrigger: d.secondsToRetrigger,
561
- lifecycle_state: d.lifecycleState,
562
- trigger_time: d.triggerTime,
563
- custom_body: d.customBody,
564
- custom_subject: d.customSubject,
565
- condition: d.condition,
566
- owner_user_name: d.ownerUserName,
567
- parent_path: d.parentPath,
568
- create_time: d.createTime,
569
- update_time: d.updateTime,
570
- notify_on_ok: d.notifyOnOk,
571
- }));
572
-
573
- const alertConditionFieldMaskSchema: FieldMaskSchema = {
574
- emptyResultState: {wire: 'empty_result_state'},
575
- op: {wire: 'op'},
576
- operand: {wire: 'operand', children: () => alertOperandFieldMaskSchema},
577
- threshold: {wire: 'threshold', children: () => alertOperandFieldMaskSchema},
578
- };
579
-
580
- const alertOperandFieldMaskSchema: FieldMaskSchema = {
581
- column: {wire: 'column', children: () => alertOperandColumnFieldMaskSchema},
582
- value: {wire: 'value', children: () => alertOperandValueFieldMaskSchema},
583
- };
584
-
585
- const alertOperandColumnFieldMaskSchema: FieldMaskSchema = {
586
- name: {wire: 'name'},
587
- };
588
-
589
- const alertOperandValueFieldMaskSchema: FieldMaskSchema = {
590
- boolValue: {wire: 'bool_value'},
591
- doubleValue: {wire: 'double_value'},
592
- stringValue: {wire: 'string_value'},
593
- };
594
-
595
- const updateAlertRequestAlertFieldMaskSchema: FieldMaskSchema = {
596
- condition: {wire: 'condition', children: () => alertConditionFieldMaskSchema},
597
- createTime: {wire: 'create_time'},
598
- customBody: {wire: 'custom_body'},
599
- customSubject: {wire: 'custom_subject'},
600
- displayName: {wire: 'display_name'},
601
- id: {wire: 'id'},
602
- lifecycleState: {wire: 'lifecycle_state'},
603
- notifyOnOk: {wire: 'notify_on_ok'},
604
- ownerUserName: {wire: 'owner_user_name'},
605
- parentPath: {wire: 'parent_path'},
606
- queryId: {wire: 'query_id'},
607
- secondsToRetrigger: {wire: 'seconds_to_retrigger'},
608
- state: {wire: 'state'},
609
- triggerTime: {wire: 'trigger_time'},
610
- updateTime: {wire: 'update_time'},
611
- };
612
-
613
- export function updateAlertRequestAlertFieldMask(
614
- ...paths: string[]
615
- ): FieldMask<UpdateAlertRequestAlert> {
616
- return FieldMask.build<UpdateAlertRequestAlert>(
617
- paths,
618
- updateAlertRequestAlertFieldMaskSchema
619
- );
620
- }
@@ -1,73 +0,0 @@
1
- // Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
2
-
3
- import type {Credentials} from '@databricks/sdk-auth';
4
- import {defaultCredentials} from '@databricks/sdk-auth/credentials';
5
- import type {
6
- HttpClient,
7
- HttpRequest,
8
- HttpResponse,
9
- } from '@databricks/sdk-core/http';
10
- import {newFetchHttpClient} from '@databricks/sdk-core/http';
11
- import type {ClientOptions} from '@databricks/sdk-options/client';
12
-
13
- /** Creates a new HTTP client with the given options. */
14
- export function newHttpClient(options?: ClientOptions): HttpClient {
15
- const opts = options ?? {};
16
-
17
- // If an HTTP client is provided, use it as-is. Throw if other options are
18
- // also set, since they would be silently ignored.
19
- if (opts.httpClient !== undefined) {
20
- if (opts.credentials !== undefined || opts.timeout !== undefined) {
21
- throw new Error(
22
- 'httpClient cannot be combined with credentials or timeout'
23
- );
24
- }
25
- return opts.httpClient;
26
- }
27
-
28
- const credentials = opts.credentials ?? defaultCredentials();
29
-
30
- const base = newFetchHttpClient();
31
- let client: HttpClient = new AuthHttpClient(base, credentials);
32
-
33
- if (opts.timeout !== undefined) {
34
- client = new TimeoutHttpClient(client, opts.timeout);
35
- }
36
-
37
- return client;
38
- }
39
-
40
- /** Wraps an HttpClient and adds authentication headers to requests. */
41
- class AuthHttpClient implements HttpClient {
42
- constructor(
43
- private readonly base: HttpClient,
44
- private readonly credentials: Credentials
45
- ) {}
46
-
47
- async send(request: HttpRequest): Promise<HttpResponse> {
48
- const authHeaders = await this.credentials.authHeaders();
49
- // Do not modify the original request.
50
- const headers = new Headers(request.headers);
51
- for (const h of authHeaders) {
52
- headers.set(h.key, h.value);
53
- }
54
- return this.base.send({...request, headers});
55
- }
56
- }
57
-
58
- /** Wraps an HttpClient and applies a default timeout to requests. */
59
- class TimeoutHttpClient implements HttpClient {
60
- constructor(
61
- private readonly base: HttpClient,
62
- private readonly timeout: number
63
- ) {}
64
-
65
- async send(request: HttpRequest): Promise<HttpResponse> {
66
- const timeoutSignal = AbortSignal.timeout(this.timeout);
67
- const signal =
68
- request.signal !== undefined
69
- ? AbortSignal.any([request.signal, timeoutSignal])
70
- : timeoutSignal;
71
- return this.base.send({...request, signal});
72
- }
73
- }