@databricks/sdk-dataquality 0.34.0 → 0.36.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/v1/client.js CHANGED
@@ -1,454 +1,373 @@
1
- // Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
2
- import { VERSION as AUTH_VERSION } from '@databricks/sdk-auth';
3
- import { createDefault } from '@databricks/sdk-core/clientinfo';
4
- import { NoOpLogger } from '@databricks/sdk-core/logger';
5
- import { resolveClientConfig } from './transport';
6
- import { buildHttpRequest, executeCall, executeHttpCall, marshalRequest, parseResponse, } from './utils';
7
- import pkgJson from '../../package.json' with { type: 'json' };
8
- import { marshalCancelRefreshRequestSchema, marshalMonitorSchema, marshalRefreshSchema, unmarshalCancelRefreshResponseSchema, unmarshalListMonitorResponseSchema, unmarshalListRefreshResponseSchema, unmarshalMonitorSchema, unmarshalRefreshSchema, } from './model';
9
- // Package identity segment for this client to be used in the User-Agent header.
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
- key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''),
12
- value: pkgJson.version,
11
+ key: "sdk-js-" + name.replace(/^@[^/]+\/sdk-/, ""),
12
+ value: version
13
13
  };
14
- export class DataQualityClient {
15
- options;
16
- logger;
17
- // User-Agent header value. Composed once at construction from
18
- // createDefault() merged with this package's identity and the active
19
- // credential's name.
20
- userAgent;
21
- // Memoized configuration. The profile is resolved once, lazily, on the first
22
- // request, then reused; host, workspaceId/accountId, and credentials are
23
- // filled from it when not set explicitly on the options.
24
- config;
25
- constructor(options) {
26
- this.options = options;
27
- this.logger = options.logger ?? new NoOpLogger();
28
- const info = createDefault()
29
- .with(PACKAGE_SEGMENT)
30
- .with({ key: 'sdk-js-auth', value: AUTH_VERSION })
31
- .with({ key: 'auth', value: options.credentials?.name() ?? 'default' });
32
- this.userAgent = info.toString();
33
- }
34
- resolveConfig() {
35
- this.config ??= resolveClientConfig(this.options);
36
- return this.config;
37
- }
38
- /**
39
- * Cancels a data quality monitor refresh. Currently only supported for the `table` `object_type`.
40
- * The call must be made in the same workspace as where the monitor was created.
41
- *
42
- * The caller must have either of the following sets of permissions:
43
- * 1. **MANAGE** and **USE_CATALOG** on the table's parent catalog.
44
- * 2. **USE_CATALOG** on the table's parent catalog, and **MANAGE** and **USE_SCHEMA** on the table's parent schema.
45
- * 3. **USE_CATALOG** on the table's parent catalog, **USE_SCHEMA** on the table's parent schema, and **MANAGE** on the table.
46
- */
47
- async cancelRefresh(req, options) {
48
- const { host, workspaceId, httpClient } = await this.resolveConfig();
49
- const url = `${host}/api/data-quality/v1/monitors/${req.objectType ?? ''}/${req.objectId ?? ''}/refreshes/${String(req.refreshId ?? '')}/cancel`;
50
- const body = marshalRequest(req, marshalCancelRefreshRequestSchema);
51
- let resp;
52
- const call = async (callSignal) => {
53
- const headers = new Headers({ 'Content-Type': 'application/json' });
54
- if (workspaceId !== undefined) {
55
- headers.set('X-Databricks-Workspace-Id', workspaceId);
56
- }
57
- headers.set('User-Agent', this.userAgent);
58
- const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
59
- const respBody = await executeHttpCall({
60
- request: httpReq,
61
- httpClient,
62
- logger: this.logger,
63
- });
64
- resp = parseResponse(respBody, unmarshalCancelRefreshResponseSchema);
65
- };
66
- await executeCall(call, options);
67
- if (resp === undefined) {
68
- throw new Error('operation completed without a result.');
69
- }
70
- return resp;
71
- }
72
- /**
73
- * 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.
74
- *
75
- * For the `table` `object_type`, the caller must have either of the following sets of permissions:
76
- * 1. **MANAGE** and **USE_CATALOG** on the table's parent catalog, **USE_SCHEMA** on the table's parent schema, and **SELECT** on the table
77
- * 2. **USE_CATALOG** on the table's parent catalog, **MANAGE** and **USE_SCHEMA** on the table's parent schema, and **SELECT** on the table.
78
- * 3. **USE_CATALOG** on the table's parent catalog, **USE_SCHEMA** on the table's parent schema, and **MANAGE** and **SELECT** on the table.
79
- *
80
- * Workspace assets, such as the dashboard, will be created in the workspace where this call was made.
81
- *
82
- * For the `schema` `object_type`, the caller must have either of the following sets of permissions:
83
- * 1. **MANAGE** and **USE_CATALOG** on the schema's parent catalog.
84
- * 2. **USE_CATALOG** on the schema's parent catalog, and **MANAGE** and **USE_SCHEMA** on the schema.
85
- */
86
- async createMonitor(req, options) {
87
- const { host, workspaceId, httpClient } = await this.resolveConfig();
88
- const url = `${host}/api/data-quality/v1/monitors`;
89
- const body = marshalRequest(req.monitor, marshalMonitorSchema);
90
- let resp;
91
- const call = async (callSignal) => {
92
- const headers = new Headers({ 'Content-Type': 'application/json' });
93
- if (workspaceId !== undefined) {
94
- headers.set('X-Databricks-Workspace-Id', workspaceId);
95
- }
96
- headers.set('User-Agent', this.userAgent);
97
- const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
98
- const respBody = await executeHttpCall({
99
- request: httpReq,
100
- httpClient,
101
- logger: this.logger,
102
- });
103
- resp = parseResponse(respBody, unmarshalMonitorSchema);
104
- };
105
- await executeCall(call, options);
106
- if (resp === undefined) {
107
- throw new Error('operation completed without a result.');
108
- }
109
- return resp;
110
- }
111
- /**
112
- * Creates a refresh. Currently only supported for the `table` `object_type`.
113
- * The call must be made in the same workspace as where the monitor was created.
114
- *
115
- * The caller must have either of the following sets of permissions:
116
- * 1. **MANAGE** and **USE_CATALOG** on the table's parent catalog.
117
- * 2. **USE_CATALOG** on the table's parent catalog, and **MANAGE** and **USE_SCHEMA** on the table's parent schema.
118
- * 3. **USE_CATALOG** on the table's parent catalog, **USE_SCHEMA** on the table's parent schema, and **MANAGE** on the table.
119
- */
120
- async createRefresh(req, options) {
121
- const { host, workspaceId, httpClient } = await this.resolveConfig();
122
- const url = `${host}/api/data-quality/v1/monitors/${req.refresh?.objectType ?? ''}/${req.refresh?.objectId ?? ''}/refreshes`;
123
- const body = marshalRequest(req.refresh, marshalRefreshSchema);
124
- let resp;
125
- const call = async (callSignal) => {
126
- const headers = new Headers({ 'Content-Type': 'application/json' });
127
- if (workspaceId !== undefined) {
128
- headers.set('X-Databricks-Workspace-Id', workspaceId);
129
- }
130
- headers.set('User-Agent', this.userAgent);
131
- const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
132
- const respBody = await executeHttpCall({
133
- request: httpReq,
134
- httpClient,
135
- logger: this.logger,
136
- });
137
- resp = parseResponse(respBody, unmarshalRefreshSchema);
138
- };
139
- await executeCall(call, options);
140
- if (resp === undefined) {
141
- throw new Error('operation completed without a result.');
142
- }
143
- return resp;
144
- }
145
- /**
146
- * Delete a data quality monitor on Unity Catalog object.
147
- *
148
- * For the `table` `object_type`, the caller must have either of the following sets of permissions:
149
- * **MANAGE** and **USE_CATALOG** on the table's parent catalog.
150
- * **USE_CATALOG** on the table's parent catalog, and **MANAGE** and **USE_SCHEMA** on the table's parent schema.
151
- * **USE_CATALOG** on the table's parent catalog, **USE_SCHEMA** on the table's parent schema, and **MANAGE** on the table.
152
- *
153
- * Note that the metric tables and dashboard will not be deleted as part of this call; those
154
- * assets must be manually cleaned up (if desired).
155
- *
156
- * For the `schema` `object_type`, the caller must have either of the following sets of permissions:
157
- * 1. **MANAGE** and **USE_CATALOG** on the schema's parent catalog.
158
- * 2. **USE_CATALOG** on the schema's parent catalog, and **MANAGE** and **USE_SCHEMA** on the schema.
159
- */
160
- async deleteMonitor(req, options) {
161
- const { host, workspaceId, httpClient } = await this.resolveConfig();
162
- const url = `${host}/api/data-quality/v1/monitors/${req.objectType ?? ''}/${req.objectId ?? ''}`;
163
- const call = async (callSignal) => {
164
- const headers = new Headers();
165
- if (workspaceId !== undefined) {
166
- headers.set('X-Databricks-Workspace-Id', workspaceId);
167
- }
168
- headers.set('User-Agent', this.userAgent);
169
- const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
170
- await executeHttpCall({
171
- request: httpReq,
172
- httpClient,
173
- logger: this.logger,
174
- });
175
- };
176
- await executeCall(call, options);
177
- }
178
- /** (Unimplemented) Delete a refresh */
179
- async deleteRefresh(req, options) {
180
- const { host, workspaceId, httpClient } = await this.resolveConfig();
181
- const url = `${host}/api/data-quality/v1/monitors/${req.objectType ?? ''}/${req.objectId ?? ''}/refreshes/${String(req.refreshId ?? '')}`;
182
- const call = async (callSignal) => {
183
- const headers = new Headers();
184
- if (workspaceId !== undefined) {
185
- headers.set('X-Databricks-Workspace-Id', workspaceId);
186
- }
187
- headers.set('User-Agent', this.userAgent);
188
- const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
189
- await executeHttpCall({
190
- request: httpReq,
191
- httpClient,
192
- logger: this.logger,
193
- });
194
- };
195
- await executeCall(call, options);
196
- }
197
- /**
198
- * Read a data quality monitor on a Unity Catalog object.
199
- *
200
- * For the `table` `object_type`, the caller must have either of the following sets of permissions:
201
- * 1. **MANAGE** and **USE_CATALOG** on the table's parent catalog.
202
- * 2. **USE_CATALOG** on the table's parent catalog, and **MANAGE** and **USE_SCHEMA** on the table's parent schema.
203
- * 3. **USE_CATALOG** on the table's parent catalog, **USE_SCHEMA** on the table's parent schema, and **SELECT** on the table.
204
- *
205
- * For the `schema` `object_type`, the caller must have either of the following sets of permissions:
206
- * 1. **MANAGE** and **USE_CATALOG** on the schema's parent catalog.
207
- * 2. **USE_CATALOG** on the schema's parent catalog, and **USE_SCHEMA** on the schema.
208
- *
209
- * The returned information includes configuration values on the entity and parent entity as well as information on
210
- * assets created by the monitor. Some information (e.g. dashboard) may be filtered out
211
- * if the caller is in a different workspace than where the monitor was created.
212
- */
213
- async getMonitor(req, options) {
214
- const { host, workspaceId, httpClient } = await this.resolveConfig();
215
- const url = `${host}/api/data-quality/v1/monitors/${req.objectType ?? ''}/${req.objectId ?? ''}`;
216
- let resp;
217
- const call = async (callSignal) => {
218
- const headers = new Headers();
219
- if (workspaceId !== undefined) {
220
- headers.set('X-Databricks-Workspace-Id', workspaceId);
221
- }
222
- headers.set('User-Agent', this.userAgent);
223
- const httpReq = buildHttpRequest('GET', url, headers, callSignal);
224
- const respBody = await executeHttpCall({
225
- request: httpReq,
226
- httpClient,
227
- logger: this.logger,
228
- });
229
- resp = parseResponse(respBody, unmarshalMonitorSchema);
230
- };
231
- await executeCall(call, options);
232
- if (resp === undefined) {
233
- throw new Error('operation completed without a result.');
234
- }
235
- return resp;
236
- }
237
- /**
238
- * Get data quality monitor refresh. The call must be made in the same workspace as where the monitor was created.
239
- *
240
- * For the `table` `object_type`, the caller must have either of the following sets of permissions:
241
- * 1. **MANAGE** and **USE_CATALOG** on the table's parent catalog.
242
- * 2. **USE_CATALOG** on the table's parent catalog, and **MANAGE** and **USE_SCHEMA** on the table's parent schema.
243
- * 3. **USE_CATALOG** on the table's parent catalog, **USE_SCHEMA** on the table's parent schema, and **SELECT** on the table.
244
- *
245
- * For the `schema` `object_type`, the caller must have either of the following sets of permissions:
246
- * 1. **MANAGE** and **USE_CATALOG** on the schema's parent catalog.
247
- * 2. **USE_CATALOG** on the schema's parent catalog, and **USE_SCHEMA** on the schema.
248
- */
249
- async getRefresh(req, options) {
250
- const { host, workspaceId, httpClient } = await this.resolveConfig();
251
- const url = `${host}/api/data-quality/v1/monitors/${req.objectType ?? ''}/${req.objectId ?? ''}/refreshes/${String(req.refreshId ?? '')}`;
252
- let resp;
253
- const call = async (callSignal) => {
254
- const headers = new Headers();
255
- if (workspaceId !== undefined) {
256
- headers.set('X-Databricks-Workspace-Id', workspaceId);
257
- }
258
- headers.set('User-Agent', this.userAgent);
259
- const httpReq = buildHttpRequest('GET', url, headers, callSignal);
260
- const respBody = await executeHttpCall({
261
- request: httpReq,
262
- httpClient,
263
- logger: this.logger,
264
- });
265
- resp = parseResponse(respBody, unmarshalRefreshSchema);
266
- };
267
- await executeCall(call, options);
268
- if (resp === undefined) {
269
- throw new Error('operation completed without a result.');
270
- }
271
- return resp;
272
- }
273
- /** (Unimplemented) List data quality monitors. */
274
- async listMonitor(req, options) {
275
- const { host, workspaceId, httpClient } = await this.resolveConfig();
276
- const url = `${host}/api/data-quality/v1/monitors`;
277
- const params = new URLSearchParams();
278
- if (req.pageToken !== undefined) {
279
- params.append('page_token', req.pageToken);
280
- }
281
- if (req.pageSize !== undefined) {
282
- params.append('page_size', String(req.pageSize));
283
- }
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 !== undefined) {
290
- headers.set('X-Databricks-Workspace-Id', workspaceId);
291
- }
292
- headers.set('User-Agent', this.userAgent);
293
- const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
294
- const respBody = await executeHttpCall({
295
- request: httpReq,
296
- httpClient,
297
- logger: this.logger,
298
- });
299
- resp = parseResponse(respBody, unmarshalListMonitorResponseSchema);
300
- };
301
- await executeCall(call, options);
302
- if (resp === undefined) {
303
- throw new Error('operation completed without a result.');
304
- }
305
- return resp;
306
- }
307
- async *listMonitorIter(req, options) {
308
- const pageReq = { ...req };
309
- for (;;) {
310
- const resp = await this.listMonitor(pageReq, options);
311
- for (const item of resp.monitors ?? []) {
312
- yield item;
313
- }
314
- if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
315
- return;
316
- }
317
- pageReq.pageToken = resp.nextPageToken;
318
- }
319
- }
320
- /**
321
- * List data quality monitor refreshes. The call must be made in the same workspace as where the monitor was created.
322
- *
323
- * For the `table` `object_type`, the caller must have either of the following sets of permissions:
324
- * 1. **MANAGE** and **USE_CATALOG** on the table's parent catalog.
325
- * 2. **USE_CATALOG** on the table's parent catalog, and **MANAGE** and **USE_SCHEMA** on the table's parent schema.
326
- * 3. **USE_CATALOG** on the table's parent catalog, **USE_SCHEMA** on the table's parent schema, and **SELECT** on the table.
327
- *
328
- * For the `schema` `object_type`, the caller must have either of the following sets of permissions:
329
- * 1. **MANAGE** and **USE_CATALOG** on the schema's parent catalog.
330
- * 2. **USE_CATALOG** on the schema's parent catalog, and **USE_SCHEMA** on the schema.
331
- */
332
- async listRefresh(req, options) {
333
- const { host, workspaceId, httpClient } = await this.resolveConfig();
334
- const url = `${host}/api/data-quality/v1/monitors/${req.objectType ?? ''}/${req.objectId ?? ''}/refreshes`;
335
- const params = new URLSearchParams();
336
- if (req.pageToken !== undefined) {
337
- params.append('page_token', req.pageToken);
338
- }
339
- if (req.pageSize !== undefined) {
340
- params.append('page_size', String(req.pageSize));
341
- }
342
- const query = params.toString();
343
- const fullUrl = query !== '' ? `${url}?${query}` : url;
344
- let resp;
345
- const call = async (callSignal) => {
346
- const headers = new Headers();
347
- if (workspaceId !== undefined) {
348
- headers.set('X-Databricks-Workspace-Id', workspaceId);
349
- }
350
- headers.set('User-Agent', this.userAgent);
351
- const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
352
- const respBody = await executeHttpCall({
353
- request: httpReq,
354
- httpClient,
355
- logger: this.logger,
356
- });
357
- resp = parseResponse(respBody, unmarshalListRefreshResponseSchema);
358
- };
359
- await executeCall(call, options);
360
- if (resp === undefined) {
361
- throw new Error('operation completed without a result.');
362
- }
363
- return resp;
364
- }
365
- async *listRefreshIter(req, options) {
366
- const pageReq = { ...req };
367
- for (;;) {
368
- const resp = await this.listRefresh(pageReq, options);
369
- for (const item of resp.refreshes ?? []) {
370
- yield item;
371
- }
372
- if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
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