@databricks/sdk-dataquality 0.33.0 → 0.35.0
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/dist/package.js +7 -0
- package/dist/package.js.map +1 -0
- package/dist/v1/client.d.ts +129 -125
- package/dist/v1/client.d.ts.map +1 -1
- package/dist/v1/client.js +370 -451
- package/dist/v1/client.js.map +1 -1
- package/dist/v1/index.d.ts +3 -8
- package/dist/v1/index.js +4 -8
- package/dist/v1/model.d.ts +416 -441
- package/dist/v1/model.d.ts.map +1 -1
- package/dist/v1/model.js +392 -531
- package/dist/v1/model.js.map +1 -1
- package/dist/v1/transport.d.ts +21 -17
- package/dist/v1/transport.d.ts.map +1 -1
- package/dist/v1/transport.js +60 -69
- package/dist/v1/transport.js.map +1 -1
- package/dist/v1/utils.d.ts +18 -14
- package/dist/v1/utils.d.ts.map +1 -1
- package/dist/v1/utils.js +76 -103
- package/dist/v1/utils.js.map +1 -1
- package/package.json +5 -5
- package/dist/v1/index.d.ts.map +0 -1
- package/dist/v1/index.js.map +0 -1
package/dist/v1/client.js
CHANGED
|
@@ -1,454 +1,373 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { resolveClientConfig } from "./transport.js";
|
|
2
|
+
import { buildHttpRequest, executeCall, executeHttpCall, marshalRequest, parseResponse } from "./utils.js";
|
|
3
|
+
import { name, version } from "../package.js";
|
|
4
|
+
import { marshalCancelRefreshRequestSchema, marshalMonitorSchema, marshalRefreshSchema, unmarshalCancelRefreshResponseSchema, unmarshalListMonitorResponseSchema, unmarshalListRefreshResponseSchema, unmarshalMonitorSchema, unmarshalRefreshSchema } from "./model.js";
|
|
5
|
+
import { VERSION } from "@databricks/sdk-auth";
|
|
6
|
+
import { createDefault } from "@databricks/sdk-core/clientinfo";
|
|
7
|
+
import { NoOpLogger } from "@databricks/sdk-core/logger";
|
|
8
|
+
|
|
9
|
+
//#region src/v1/client.ts
|
|
10
10
|
const PACKAGE_SEGMENT = {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
key: "sdk-js-" + name.replace(/^@[^/]+\/sdk-/, ""),
|
|
12
|
+
value: version
|
|
13
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
|
-
return;
|
|
374
|
-
}
|
|
375
|
-
pageReq.pageToken = resp.nextPageToken;
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
/**
|
|
379
|
-
* Update a data quality monitor on Unity Catalog object.
|
|
380
|
-
*
|
|
381
|
-
* For the `table` `object_type`, the caller must have either of the following sets of permissions:
|
|
382
|
-
* 1. **MANAGE** and **USE_CATALOG** on the table's parent catalog.
|
|
383
|
-
* 2. **USE_CATALOG** on the table's parent catalog, and **MANAGE** and **USE_SCHEMA** on the table's parent schema.
|
|
384
|
-
* 3. **USE_CATALOG** on the table's parent catalog, **USE_SCHEMA** on the table's parent schema, and **MANAGE** on the table.
|
|
385
|
-
*
|
|
386
|
-
* For the `schema` `object_type`, the caller must have either of the following sets of permissions:
|
|
387
|
-
* 1. **MANAGE** and **USE_CATALOG** on the schema's parent catalog.
|
|
388
|
-
* 2. **USE_CATALOG** on the schema's parent catalog, and **MANAGE** and **USE_SCHEMA** on the schema.
|
|
389
|
-
*/
|
|
390
|
-
async updateMonitor(req, options) {
|
|
391
|
-
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
392
|
-
const url = `${host}/api/data-quality/v1/monitors/${req.objectType ?? ''}/${req.objectId ?? ''}`;
|
|
393
|
-
const params = new URLSearchParams();
|
|
394
|
-
if (req.updateMask !== undefined) {
|
|
395
|
-
params.append('update_mask', req.updateMask.toString());
|
|
396
|
-
}
|
|
397
|
-
const query = params.toString();
|
|
398
|
-
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
399
|
-
const body = marshalRequest(req.monitor, marshalMonitorSchema);
|
|
400
|
-
let resp;
|
|
401
|
-
const call = async (callSignal) => {
|
|
402
|
-
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
403
|
-
if (workspaceId !== undefined) {
|
|
404
|
-
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
405
|
-
}
|
|
406
|
-
headers.set('User-Agent', this.userAgent);
|
|
407
|
-
const httpReq = buildHttpRequest('PATCH', fullUrl, headers, callSignal, body);
|
|
408
|
-
const respBody = await executeHttpCall({
|
|
409
|
-
request: httpReq,
|
|
410
|
-
httpClient,
|
|
411
|
-
logger: this.logger,
|
|
412
|
-
});
|
|
413
|
-
resp = parseResponse(respBody, unmarshalMonitorSchema);
|
|
414
|
-
};
|
|
415
|
-
await executeCall(call, options);
|
|
416
|
-
if (resp === undefined) {
|
|
417
|
-
throw new Error('operation completed without a result.');
|
|
418
|
-
}
|
|
419
|
-
return resp;
|
|
420
|
-
}
|
|
421
|
-
/** (Unimplemented) Update a refresh */
|
|
422
|
-
async updateRefresh(req, options) {
|
|
423
|
-
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
424
|
-
const url = `${host}/api/data-quality/v1/monitors/${req.objectType ?? ''}/${req.objectId ?? ''}/refreshes/${String(req.refreshId ?? '')}`;
|
|
425
|
-
const params = new URLSearchParams();
|
|
426
|
-
if (req.updateMask !== undefined) {
|
|
427
|
-
params.append('update_mask', req.updateMask.toString());
|
|
428
|
-
}
|
|
429
|
-
const query = params.toString();
|
|
430
|
-
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
431
|
-
const body = marshalRequest(req.refresh, marshalRefreshSchema);
|
|
432
|
-
let resp;
|
|
433
|
-
const call = async (callSignal) => {
|
|
434
|
-
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
435
|
-
if (workspaceId !== undefined) {
|
|
436
|
-
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
437
|
-
}
|
|
438
|
-
headers.set('User-Agent', this.userAgent);
|
|
439
|
-
const httpReq = buildHttpRequest('PATCH', fullUrl, headers, callSignal, body);
|
|
440
|
-
const respBody = await executeHttpCall({
|
|
441
|
-
request: httpReq,
|
|
442
|
-
httpClient,
|
|
443
|
-
logger: this.logger,
|
|
444
|
-
});
|
|
445
|
-
resp = parseResponse(respBody, unmarshalRefreshSchema);
|
|
446
|
-
};
|
|
447
|
-
await executeCall(call, options);
|
|
448
|
-
if (resp === undefined) {
|
|
449
|
-
throw new Error('operation completed without a result.');
|
|
450
|
-
}
|
|
451
|
-
return resp;
|
|
452
|
-
}
|
|
453
|
-
}
|
|
14
|
+
var DataQualityClient = class {
|
|
15
|
+
options;
|
|
16
|
+
logger;
|
|
17
|
+
userAgent;
|
|
18
|
+
config;
|
|
19
|
+
constructor(options) {
|
|
20
|
+
this.options = options;
|
|
21
|
+
this.logger = options.logger ?? new NoOpLogger();
|
|
22
|
+
this.userAgent = createDefault().with(PACKAGE_SEGMENT).with({
|
|
23
|
+
key: "sdk-js-auth",
|
|
24
|
+
value: VERSION
|
|
25
|
+
}).with({
|
|
26
|
+
key: "auth",
|
|
27
|
+
value: options.credentials?.name() ?? "default"
|
|
28
|
+
}).toString();
|
|
29
|
+
}
|
|
30
|
+
resolveConfig() {
|
|
31
|
+
this.config ??= resolveClientConfig(this.options);
|
|
32
|
+
return this.config;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Cancels a data quality monitor refresh. Currently only supported for the `table` `object_type`.
|
|
36
|
+
* The call must be made in the same workspace as where the monitor was created.
|
|
37
|
+
*
|
|
38
|
+
* The caller must have either of the following sets of permissions:
|
|
39
|
+
* 1. **MANAGE** and **USE_CATALOG** on the table's parent catalog.
|
|
40
|
+
* 2. **USE_CATALOG** on the table's parent catalog, and **MANAGE** and **USE_SCHEMA** on the table's parent schema.
|
|
41
|
+
* 3. **USE_CATALOG** on the table's parent catalog, **USE_SCHEMA** on the table's parent schema, and **MANAGE** on the table.
|
|
42
|
+
*/
|
|
43
|
+
async cancelRefresh(req, options) {
|
|
44
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
45
|
+
const url = `${host}/api/data-quality/v1/monitors/${req.objectType ?? ""}/${req.objectId ?? ""}/refreshes/${String(req.refreshId ?? "")}/cancel`;
|
|
46
|
+
const body = marshalRequest(req, marshalCancelRefreshRequestSchema);
|
|
47
|
+
let resp;
|
|
48
|
+
const call = async (callSignal) => {
|
|
49
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
50
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
51
|
+
headers.set("User-Agent", this.userAgent);
|
|
52
|
+
resp = parseResponse(await executeHttpCall({
|
|
53
|
+
request: buildHttpRequest("POST", url, headers, callSignal, body),
|
|
54
|
+
httpClient,
|
|
55
|
+
logger: this.logger
|
|
56
|
+
}), unmarshalCancelRefreshResponseSchema);
|
|
57
|
+
};
|
|
58
|
+
await executeCall(call, options);
|
|
59
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
60
|
+
return resp;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Create a data quality monitor on a Unity Catalog object. The caller must provide either `anomaly_detection_config` for a schema monitor or `data_profiling_config` for a table monitor.
|
|
64
|
+
*
|
|
65
|
+
* For the `table` `object_type`, the caller must have either of the following sets of permissions:
|
|
66
|
+
* 1. **MANAGE** and **USE_CATALOG** on the table's parent catalog, **USE_SCHEMA** on the table's parent schema, and **SELECT** on the table
|
|
67
|
+
* 2. **USE_CATALOG** on the table's parent catalog, **MANAGE** and **USE_SCHEMA** on the table's parent schema, and **SELECT** on the table.
|
|
68
|
+
* 3. **USE_CATALOG** on the table's parent catalog, **USE_SCHEMA** on the table's parent schema, and **MANAGE** and **SELECT** on the table.
|
|
69
|
+
*
|
|
70
|
+
* Workspace assets, such as the dashboard, will be created in the workspace where this call was made.
|
|
71
|
+
*
|
|
72
|
+
* For the `schema` `object_type`, the caller must have either of the following sets of permissions:
|
|
73
|
+
* 1. **MANAGE** and **USE_CATALOG** on the schema's parent catalog.
|
|
74
|
+
* 2. **USE_CATALOG** on the schema's parent catalog, and **MANAGE** and **USE_SCHEMA** on the schema.
|
|
75
|
+
*/
|
|
76
|
+
async createMonitor(req, options) {
|
|
77
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
78
|
+
const url = `${host}/api/data-quality/v1/monitors`;
|
|
79
|
+
const body = marshalRequest(req.monitor, marshalMonitorSchema);
|
|
80
|
+
let resp;
|
|
81
|
+
const call = async (callSignal) => {
|
|
82
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
83
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
84
|
+
headers.set("User-Agent", this.userAgent);
|
|
85
|
+
resp = parseResponse(await executeHttpCall({
|
|
86
|
+
request: buildHttpRequest("POST", url, headers, callSignal, body),
|
|
87
|
+
httpClient,
|
|
88
|
+
logger: this.logger
|
|
89
|
+
}), unmarshalMonitorSchema);
|
|
90
|
+
};
|
|
91
|
+
await executeCall(call, options);
|
|
92
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
93
|
+
return resp;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Creates a refresh. Currently only supported for the `table` `object_type`.
|
|
97
|
+
* The call must be made in the same workspace as where the monitor was created.
|
|
98
|
+
*
|
|
99
|
+
* The caller must have either of the following sets of permissions:
|
|
100
|
+
* 1. **MANAGE** and **USE_CATALOG** on the table's parent catalog.
|
|
101
|
+
* 2. **USE_CATALOG** on the table's parent catalog, and **MANAGE** and **USE_SCHEMA** on the table's parent schema.
|
|
102
|
+
* 3. **USE_CATALOG** on the table's parent catalog, **USE_SCHEMA** on the table's parent schema, and **MANAGE** on the table.
|
|
103
|
+
*/
|
|
104
|
+
async createRefresh(req, options) {
|
|
105
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
106
|
+
const url = `${host}/api/data-quality/v1/monitors/${req.refresh?.objectType ?? ""}/${req.refresh?.objectId ?? ""}/refreshes`;
|
|
107
|
+
const body = marshalRequest(req.refresh, marshalRefreshSchema);
|
|
108
|
+
let resp;
|
|
109
|
+
const call = async (callSignal) => {
|
|
110
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
111
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
112
|
+
headers.set("User-Agent", this.userAgent);
|
|
113
|
+
resp = parseResponse(await executeHttpCall({
|
|
114
|
+
request: buildHttpRequest("POST", url, headers, callSignal, body),
|
|
115
|
+
httpClient,
|
|
116
|
+
logger: this.logger
|
|
117
|
+
}), unmarshalRefreshSchema);
|
|
118
|
+
};
|
|
119
|
+
await executeCall(call, options);
|
|
120
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
121
|
+
return resp;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Delete a data quality monitor on Unity Catalog object.
|
|
125
|
+
*
|
|
126
|
+
* For the `table` `object_type`, the caller must have either of the following sets of permissions:
|
|
127
|
+
* **MANAGE** and **USE_CATALOG** on the table's parent catalog.
|
|
128
|
+
* **USE_CATALOG** on the table's parent catalog, and **MANAGE** and **USE_SCHEMA** on the table's parent schema.
|
|
129
|
+
* **USE_CATALOG** on the table's parent catalog, **USE_SCHEMA** on the table's parent schema, and **MANAGE** on the table.
|
|
130
|
+
*
|
|
131
|
+
* Note that the metric tables and dashboard will not be deleted as part of this call; those
|
|
132
|
+
* assets must be manually cleaned up (if desired).
|
|
133
|
+
*
|
|
134
|
+
* For the `schema` `object_type`, the caller must have either of the following sets of permissions:
|
|
135
|
+
* 1. **MANAGE** and **USE_CATALOG** on the schema's parent catalog.
|
|
136
|
+
* 2. **USE_CATALOG** on the schema's parent catalog, and **MANAGE** and **USE_SCHEMA** on the schema.
|
|
137
|
+
*/
|
|
138
|
+
async deleteMonitor(req, options) {
|
|
139
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
140
|
+
const url = `${host}/api/data-quality/v1/monitors/${req.objectType ?? ""}/${req.objectId ?? ""}`;
|
|
141
|
+
const call = async (callSignal) => {
|
|
142
|
+
const headers = new Headers();
|
|
143
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
144
|
+
headers.set("User-Agent", this.userAgent);
|
|
145
|
+
await executeHttpCall({
|
|
146
|
+
request: buildHttpRequest("DELETE", url, headers, callSignal),
|
|
147
|
+
httpClient,
|
|
148
|
+
logger: this.logger
|
|
149
|
+
});
|
|
150
|
+
};
|
|
151
|
+
await executeCall(call, options);
|
|
152
|
+
}
|
|
153
|
+
/** (Unimplemented) Delete a refresh */
|
|
154
|
+
async deleteRefresh(req, options) {
|
|
155
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
156
|
+
const url = `${host}/api/data-quality/v1/monitors/${req.objectType ?? ""}/${req.objectId ?? ""}/refreshes/${String(req.refreshId ?? "")}`;
|
|
157
|
+
const call = async (callSignal) => {
|
|
158
|
+
const headers = new Headers();
|
|
159
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
160
|
+
headers.set("User-Agent", this.userAgent);
|
|
161
|
+
await executeHttpCall({
|
|
162
|
+
request: buildHttpRequest("DELETE", url, headers, callSignal),
|
|
163
|
+
httpClient,
|
|
164
|
+
logger: this.logger
|
|
165
|
+
});
|
|
166
|
+
};
|
|
167
|
+
await executeCall(call, options);
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Read a data quality monitor on a Unity Catalog object.
|
|
171
|
+
*
|
|
172
|
+
* For the `table` `object_type`, the caller must have either of the following sets of permissions:
|
|
173
|
+
* 1. **MANAGE** and **USE_CATALOG** on the table's parent catalog.
|
|
174
|
+
* 2. **USE_CATALOG** on the table's parent catalog, and **MANAGE** and **USE_SCHEMA** on the table's parent schema.
|
|
175
|
+
* 3. **USE_CATALOG** on the table's parent catalog, **USE_SCHEMA** on the table's parent schema, and **SELECT** on the table.
|
|
176
|
+
*
|
|
177
|
+
* For the `schema` `object_type`, the caller must have either of the following sets of permissions:
|
|
178
|
+
* 1. **MANAGE** and **USE_CATALOG** on the schema's parent catalog.
|
|
179
|
+
* 2. **USE_CATALOG** on the schema's parent catalog, and **USE_SCHEMA** on the schema.
|
|
180
|
+
*
|
|
181
|
+
* The returned information includes configuration values on the entity and parent entity as well as information on
|
|
182
|
+
* assets created by the monitor. Some information (e.g. dashboard) may be filtered out
|
|
183
|
+
* if the caller is in a different workspace than where the monitor was created.
|
|
184
|
+
*/
|
|
185
|
+
async getMonitor(req, options) {
|
|
186
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
187
|
+
const url = `${host}/api/data-quality/v1/monitors/${req.objectType ?? ""}/${req.objectId ?? ""}`;
|
|
188
|
+
let resp;
|
|
189
|
+
const call = async (callSignal) => {
|
|
190
|
+
const headers = new Headers();
|
|
191
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
192
|
+
headers.set("User-Agent", this.userAgent);
|
|
193
|
+
resp = parseResponse(await executeHttpCall({
|
|
194
|
+
request: buildHttpRequest("GET", url, headers, callSignal),
|
|
195
|
+
httpClient,
|
|
196
|
+
logger: this.logger
|
|
197
|
+
}), unmarshalMonitorSchema);
|
|
198
|
+
};
|
|
199
|
+
await executeCall(call, options);
|
|
200
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
201
|
+
return resp;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Get data quality monitor refresh. The call must be made in the same workspace as where the monitor was created.
|
|
205
|
+
*
|
|
206
|
+
* For the `table` `object_type`, the caller must have either of the following sets of permissions:
|
|
207
|
+
* 1. **MANAGE** and **USE_CATALOG** on the table's parent catalog.
|
|
208
|
+
* 2. **USE_CATALOG** on the table's parent catalog, and **MANAGE** and **USE_SCHEMA** on the table's parent schema.
|
|
209
|
+
* 3. **USE_CATALOG** on the table's parent catalog, **USE_SCHEMA** on the table's parent schema, and **SELECT** on the table.
|
|
210
|
+
*
|
|
211
|
+
* For the `schema` `object_type`, the caller must have either of the following sets of permissions:
|
|
212
|
+
* 1. **MANAGE** and **USE_CATALOG** on the schema's parent catalog.
|
|
213
|
+
* 2. **USE_CATALOG** on the schema's parent catalog, and **USE_SCHEMA** on the schema.
|
|
214
|
+
*/
|
|
215
|
+
async getRefresh(req, options) {
|
|
216
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
217
|
+
const url = `${host}/api/data-quality/v1/monitors/${req.objectType ?? ""}/${req.objectId ?? ""}/refreshes/${String(req.refreshId ?? "")}`;
|
|
218
|
+
let resp;
|
|
219
|
+
const call = async (callSignal) => {
|
|
220
|
+
const headers = new Headers();
|
|
221
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
222
|
+
headers.set("User-Agent", this.userAgent);
|
|
223
|
+
resp = parseResponse(await executeHttpCall({
|
|
224
|
+
request: buildHttpRequest("GET", url, headers, callSignal),
|
|
225
|
+
httpClient,
|
|
226
|
+
logger: this.logger
|
|
227
|
+
}), unmarshalRefreshSchema);
|
|
228
|
+
};
|
|
229
|
+
await executeCall(call, options);
|
|
230
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
231
|
+
return resp;
|
|
232
|
+
}
|
|
233
|
+
/** (Unimplemented) List data quality monitors. */
|
|
234
|
+
async listMonitor(req, options) {
|
|
235
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
236
|
+
const url = `${host}/api/data-quality/v1/monitors`;
|
|
237
|
+
const params = new URLSearchParams();
|
|
238
|
+
if (req.pageToken !== void 0) params.append("page_token", req.pageToken);
|
|
239
|
+
if (req.pageSize !== void 0) params.append("page_size", String(req.pageSize));
|
|
240
|
+
const query = params.toString();
|
|
241
|
+
const fullUrl = query !== "" ? `${url}?${query}` : url;
|
|
242
|
+
let resp;
|
|
243
|
+
const call = async (callSignal) => {
|
|
244
|
+
const headers = new Headers();
|
|
245
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
246
|
+
headers.set("User-Agent", this.userAgent);
|
|
247
|
+
resp = parseResponse(await executeHttpCall({
|
|
248
|
+
request: buildHttpRequest("GET", fullUrl, headers, callSignal),
|
|
249
|
+
httpClient,
|
|
250
|
+
logger: this.logger
|
|
251
|
+
}), unmarshalListMonitorResponseSchema);
|
|
252
|
+
};
|
|
253
|
+
await executeCall(call, options);
|
|
254
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
255
|
+
return resp;
|
|
256
|
+
}
|
|
257
|
+
async *listMonitorIter(req, options) {
|
|
258
|
+
const pageReq = { ...req };
|
|
259
|
+
for (;;) {
|
|
260
|
+
const resp = await this.listMonitor(pageReq, options);
|
|
261
|
+
for (const item of resp.monitors ?? []) yield item;
|
|
262
|
+
if (resp.nextPageToken === void 0 || resp.nextPageToken === "") return;
|
|
263
|
+
pageReq.pageToken = resp.nextPageToken;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* List data quality monitor refreshes. The call must be made in the same workspace as where the monitor was created.
|
|
268
|
+
*
|
|
269
|
+
* For the `table` `object_type`, the caller must have either of the following sets of permissions:
|
|
270
|
+
* 1. **MANAGE** and **USE_CATALOG** on the table's parent catalog.
|
|
271
|
+
* 2. **USE_CATALOG** on the table's parent catalog, and **MANAGE** and **USE_SCHEMA** on the table's parent schema.
|
|
272
|
+
* 3. **USE_CATALOG** on the table's parent catalog, **USE_SCHEMA** on the table's parent schema, and **SELECT** on the table.
|
|
273
|
+
*
|
|
274
|
+
* For the `schema` `object_type`, the caller must have either of the following sets of permissions:
|
|
275
|
+
* 1. **MANAGE** and **USE_CATALOG** on the schema's parent catalog.
|
|
276
|
+
* 2. **USE_CATALOG** on the schema's parent catalog, and **USE_SCHEMA** on the schema.
|
|
277
|
+
*/
|
|
278
|
+
async listRefresh(req, options) {
|
|
279
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
280
|
+
const url = `${host}/api/data-quality/v1/monitors/${req.objectType ?? ""}/${req.objectId ?? ""}/refreshes`;
|
|
281
|
+
const params = new URLSearchParams();
|
|
282
|
+
if (req.pageToken !== void 0) params.append("page_token", req.pageToken);
|
|
283
|
+
if (req.pageSize !== void 0) params.append("page_size", String(req.pageSize));
|
|
284
|
+
const query = params.toString();
|
|
285
|
+
const fullUrl = query !== "" ? `${url}?${query}` : url;
|
|
286
|
+
let resp;
|
|
287
|
+
const call = async (callSignal) => {
|
|
288
|
+
const headers = new Headers();
|
|
289
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
290
|
+
headers.set("User-Agent", this.userAgent);
|
|
291
|
+
resp = parseResponse(await executeHttpCall({
|
|
292
|
+
request: buildHttpRequest("GET", fullUrl, headers, callSignal),
|
|
293
|
+
httpClient,
|
|
294
|
+
logger: this.logger
|
|
295
|
+
}), unmarshalListRefreshResponseSchema);
|
|
296
|
+
};
|
|
297
|
+
await executeCall(call, options);
|
|
298
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
299
|
+
return resp;
|
|
300
|
+
}
|
|
301
|
+
async *listRefreshIter(req, options) {
|
|
302
|
+
const pageReq = { ...req };
|
|
303
|
+
for (;;) {
|
|
304
|
+
const resp = await this.listRefresh(pageReq, options);
|
|
305
|
+
for (const item of resp.refreshes ?? []) yield item;
|
|
306
|
+
if (resp.nextPageToken === void 0 || resp.nextPageToken === "") return;
|
|
307
|
+
pageReq.pageToken = resp.nextPageToken;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Update a data quality monitor on Unity Catalog object.
|
|
312
|
+
*
|
|
313
|
+
* For the `table` `object_type`, the caller must have either of the following sets of permissions:
|
|
314
|
+
* 1. **MANAGE** and **USE_CATALOG** on the table's parent catalog.
|
|
315
|
+
* 2. **USE_CATALOG** on the table's parent catalog, and **MANAGE** and **USE_SCHEMA** on the table's parent schema.
|
|
316
|
+
* 3. **USE_CATALOG** on the table's parent catalog, **USE_SCHEMA** on the table's parent schema, and **MANAGE** on the table.
|
|
317
|
+
*
|
|
318
|
+
* For the `schema` `object_type`, the caller must have either of the following sets of permissions:
|
|
319
|
+
* 1. **MANAGE** and **USE_CATALOG** on the schema's parent catalog.
|
|
320
|
+
* 2. **USE_CATALOG** on the schema's parent catalog, and **MANAGE** and **USE_SCHEMA** on the schema.
|
|
321
|
+
*/
|
|
322
|
+
async updateMonitor(req, options) {
|
|
323
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
324
|
+
const url = `${host}/api/data-quality/v1/monitors/${req.objectType ?? ""}/${req.objectId ?? ""}`;
|
|
325
|
+
const params = new URLSearchParams();
|
|
326
|
+
if (req.updateMask !== void 0) params.append("update_mask", req.updateMask.toString());
|
|
327
|
+
const query = params.toString();
|
|
328
|
+
const fullUrl = query !== "" ? `${url}?${query}` : url;
|
|
329
|
+
const body = marshalRequest(req.monitor, marshalMonitorSchema);
|
|
330
|
+
let resp;
|
|
331
|
+
const call = async (callSignal) => {
|
|
332
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
333
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
334
|
+
headers.set("User-Agent", this.userAgent);
|
|
335
|
+
resp = parseResponse(await executeHttpCall({
|
|
336
|
+
request: buildHttpRequest("PATCH", fullUrl, headers, callSignal, body),
|
|
337
|
+
httpClient,
|
|
338
|
+
logger: this.logger
|
|
339
|
+
}), unmarshalMonitorSchema);
|
|
340
|
+
};
|
|
341
|
+
await executeCall(call, options);
|
|
342
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
343
|
+
return resp;
|
|
344
|
+
}
|
|
345
|
+
/** (Unimplemented) Update a refresh */
|
|
346
|
+
async updateRefresh(req, options) {
|
|
347
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
348
|
+
const url = `${host}/api/data-quality/v1/monitors/${req.objectType ?? ""}/${req.objectId ?? ""}/refreshes/${String(req.refreshId ?? "")}`;
|
|
349
|
+
const params = new URLSearchParams();
|
|
350
|
+
if (req.updateMask !== void 0) params.append("update_mask", req.updateMask.toString());
|
|
351
|
+
const query = params.toString();
|
|
352
|
+
const fullUrl = query !== "" ? `${url}?${query}` : url;
|
|
353
|
+
const body = marshalRequest(req.refresh, marshalRefreshSchema);
|
|
354
|
+
let resp;
|
|
355
|
+
const call = async (callSignal) => {
|
|
356
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
357
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
358
|
+
headers.set("User-Agent", this.userAgent);
|
|
359
|
+
resp = parseResponse(await executeHttpCall({
|
|
360
|
+
request: buildHttpRequest("PATCH", fullUrl, headers, callSignal, body),
|
|
361
|
+
httpClient,
|
|
362
|
+
logger: this.logger
|
|
363
|
+
}), unmarshalRefreshSchema);
|
|
364
|
+
};
|
|
365
|
+
await executeCall(call, options);
|
|
366
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
367
|
+
return resp;
|
|
368
|
+
}
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
//#endregion
|
|
372
|
+
export { DataQualityClient };
|
|
454
373
|
//# sourceMappingURL=client.js.map
|