@databricks/sdk-dataquality 0.0.0-dev → 0.1.0-dev.2
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/LICENSE +203 -0
- package/dist/v1/client.d.ts +127 -0
- package/dist/v1/client.d.ts.map +1 -0
- package/dist/v1/client.js +445 -0
- package/dist/v1/client.js.map +1 -0
- package/dist/v1/index.d.ts +5 -0
- package/dist/v1/index.d.ts.map +1 -0
- package/dist/v1/index.js +5 -0
- package/dist/v1/index.js.map +1 -0
- package/dist/v1/model.d.ts +498 -0
- package/dist/v1/model.d.ts.map +1 -0
- package/dist/v1/model.js +578 -0
- package/dist/v1/model.js.map +1 -0
- package/dist/v1/transport.d.ts +5 -0
- package/dist/v1/transport.d.ts.map +1 -0
- package/dist/v1/transport.js +57 -0
- package/dist/v1/transport.js.map +1 -0
- package/dist/v1/utils.d.ts +21 -0
- package/dist/v1/utils.d.ts.map +1 -0
- package/dist/v1/utils.js +113 -0
- package/dist/v1/utils.js.map +1 -0
- package/package.json +38 -4
- package/src/v1/client.ts +549 -0
- package/src/v1/index.ts +43 -0
- package/src/v1/model.ts +1041 -0
- package/src/v1/transport.ts +73 -0
- package/src/v1/utils.ts +156 -0
- package/README.md +0 -1
- package/index.js +0 -1
package/src/v1/client.ts
ADDED
|
@@ -0,0 +1,549 @@
|
|
|
1
|
+
// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
import {VERSION as AUTH_VERSION} from '@databricks/sdk-auth';
|
|
4
|
+
import {createDefault} from '@databricks/sdk-core/clientinfo';
|
|
5
|
+
import type {Logger} from '@databricks/sdk-core/logger';
|
|
6
|
+
import {NoOpLogger} from '@databricks/sdk-core/logger';
|
|
7
|
+
import type {CallOptions} from '@databricks/sdk-options/call';
|
|
8
|
+
import type {ClientOptions} from '@databricks/sdk-options/client';
|
|
9
|
+
import type {HttpClient} from '@databricks/sdk-core/http';
|
|
10
|
+
import {newHttpClient} from './transport';
|
|
11
|
+
import {
|
|
12
|
+
buildHttpRequest,
|
|
13
|
+
executeCall,
|
|
14
|
+
executeHttpCall,
|
|
15
|
+
marshalRequest,
|
|
16
|
+
parseResponse,
|
|
17
|
+
} from './utils';
|
|
18
|
+
import pkgJson from '../../package.json' with {type: 'json'};
|
|
19
|
+
import type {
|
|
20
|
+
CancelRefreshRequest,
|
|
21
|
+
CancelRefreshResponse,
|
|
22
|
+
CreateMonitorRequest,
|
|
23
|
+
CreateRefreshRequest,
|
|
24
|
+
DeleteMonitorRequest,
|
|
25
|
+
DeleteRefreshRequest,
|
|
26
|
+
GetMonitorRequest,
|
|
27
|
+
GetRefreshRequest,
|
|
28
|
+
ListMonitorRequest,
|
|
29
|
+
ListMonitorResponse,
|
|
30
|
+
ListRefreshRequest,
|
|
31
|
+
ListRefreshResponse,
|
|
32
|
+
Monitor,
|
|
33
|
+
Refresh,
|
|
34
|
+
UpdateMonitorRequest,
|
|
35
|
+
UpdateRefreshRequest,
|
|
36
|
+
} from './model';
|
|
37
|
+
import {
|
|
38
|
+
marshalCancelRefreshRequestSchema,
|
|
39
|
+
marshalMonitorSchema,
|
|
40
|
+
marshalRefreshSchema,
|
|
41
|
+
unmarshalCancelRefreshResponseSchema,
|
|
42
|
+
unmarshalListMonitorResponseSchema,
|
|
43
|
+
unmarshalListRefreshResponseSchema,
|
|
44
|
+
unmarshalMonitorSchema,
|
|
45
|
+
unmarshalRefreshSchema,
|
|
46
|
+
} from './model';
|
|
47
|
+
|
|
48
|
+
// Package identity segment for this client to be used in the User-Agent header.
|
|
49
|
+
const PACKAGE_SEGMENT = {
|
|
50
|
+
key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''),
|
|
51
|
+
value: pkgJson.version,
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export class DataQualityClient {
|
|
55
|
+
private readonly host: string;
|
|
56
|
+
// Workspace ID used to route workspace-level calls on unified hosts (SPOG).
|
|
57
|
+
// When set, workspace-level methods send X-Databricks-Org-Id on every
|
|
58
|
+
// request.
|
|
59
|
+
private readonly workspaceId: string | undefined;
|
|
60
|
+
private readonly httpClient: HttpClient;
|
|
61
|
+
private readonly logger: Logger;
|
|
62
|
+
// User-Agent header value. Composed once at construction from
|
|
63
|
+
// createDefault() merged with this package's identity and the active
|
|
64
|
+
// credential's name.
|
|
65
|
+
private readonly userAgent: string;
|
|
66
|
+
|
|
67
|
+
constructor(options: ClientOptions) {
|
|
68
|
+
if (options.host === undefined) {
|
|
69
|
+
throw new Error('Host is required.');
|
|
70
|
+
}
|
|
71
|
+
this.host = options.host.replace(/\/$/, '');
|
|
72
|
+
this.workspaceId = options.workspaceId;
|
|
73
|
+
this.logger = options.logger ?? new NoOpLogger();
|
|
74
|
+
const info = createDefault()
|
|
75
|
+
.with(PACKAGE_SEGMENT)
|
|
76
|
+
.with({key: 'sdk-js-auth', value: AUTH_VERSION})
|
|
77
|
+
.with({key: 'auth', value: options.credentials?.name() ?? 'default'});
|
|
78
|
+
this.userAgent = info.toString();
|
|
79
|
+
this.httpClient = newHttpClient(options);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Cancels a data quality monitor refresh. Currently only supported for the `table` `object_type`.
|
|
84
|
+
* The call must be made in the same workspace as where the monitor was created.
|
|
85
|
+
*
|
|
86
|
+
* The caller must have either of the following sets of permissions:
|
|
87
|
+
* 1. **MANAGE** and **USE_CATALOG** on the table's parent catalog.
|
|
88
|
+
* 2. **USE_CATALOG** on the table's parent catalog, and **MANAGE** and **USE_SCHEMA** on the table's parent schema.
|
|
89
|
+
* 3. **USE_CATALOG** on the table's parent catalog, **USE_SCHEMA** on the table's parent schema, and **MANAGE** on the table.
|
|
90
|
+
*/
|
|
91
|
+
async cancelRefresh(
|
|
92
|
+
req: CancelRefreshRequest,
|
|
93
|
+
options?: CallOptions
|
|
94
|
+
): Promise<CancelRefreshResponse> {
|
|
95
|
+
const url = `${this.host}/api/data-quality/v1/monitors/${req.objectType ?? ''}/${req.objectId ?? ''}/refreshes/${String(req.refreshId ?? '')}/cancel`;
|
|
96
|
+
const body = marshalRequest(req, marshalCancelRefreshRequestSchema);
|
|
97
|
+
let resp: CancelRefreshResponse | undefined;
|
|
98
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
99
|
+
const headers = new Headers({'Content-Type': 'application/json'});
|
|
100
|
+
if (this.workspaceId !== undefined) {
|
|
101
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
102
|
+
}
|
|
103
|
+
headers.set('User-Agent', this.userAgent);
|
|
104
|
+
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
105
|
+
const respBody = await executeHttpCall({
|
|
106
|
+
request: httpReq,
|
|
107
|
+
httpClient: this.httpClient,
|
|
108
|
+
logger: this.logger,
|
|
109
|
+
});
|
|
110
|
+
resp = parseResponse(respBody, unmarshalCancelRefreshResponseSchema);
|
|
111
|
+
};
|
|
112
|
+
await executeCall(call, options);
|
|
113
|
+
if (resp === undefined) {
|
|
114
|
+
throw new Error('operation completed without a result.');
|
|
115
|
+
}
|
|
116
|
+
return resp;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* 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.
|
|
121
|
+
*
|
|
122
|
+
* For the `table` `object_type`, the caller must have either of the following sets of permissions:
|
|
123
|
+
* 1. **MANAGE** and **USE_CATALOG** on the table's parent catalog, **USE_SCHEMA** on the table's parent schema, and **SELECT** on the table
|
|
124
|
+
* 2. **USE_CATALOG** on the table's parent catalog, **MANAGE** and **USE_SCHEMA** on the table's parent schema, and **SELECT** on the table.
|
|
125
|
+
* 3. **USE_CATALOG** on the table's parent catalog, **USE_SCHEMA** on the table's parent schema, and **MANAGE** and **SELECT** on the table.
|
|
126
|
+
*
|
|
127
|
+
* Workspace assets, such as the dashboard, will be created in the workspace where this call was made.
|
|
128
|
+
*
|
|
129
|
+
* For the `schema` `object_type`, the caller must have either of the following sets of permissions:
|
|
130
|
+
* 1. **MANAGE** and **USE_CATALOG** on the schema's parent catalog.
|
|
131
|
+
* 2. **USE_CATALOG** on the schema's parent catalog, and **MANAGE** and **USE_SCHEMA** on the schema.
|
|
132
|
+
*/
|
|
133
|
+
async createMonitor(
|
|
134
|
+
req: CreateMonitorRequest,
|
|
135
|
+
options?: CallOptions
|
|
136
|
+
): Promise<Monitor> {
|
|
137
|
+
const url = `${this.host}/api/data-quality/v1/monitors`;
|
|
138
|
+
const body = marshalRequest(req.monitor, marshalMonitorSchema);
|
|
139
|
+
let resp: Monitor | undefined;
|
|
140
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
141
|
+
const headers = new Headers({'Content-Type': 'application/json'});
|
|
142
|
+
if (this.workspaceId !== undefined) {
|
|
143
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
144
|
+
}
|
|
145
|
+
headers.set('User-Agent', this.userAgent);
|
|
146
|
+
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
147
|
+
const respBody = await executeHttpCall({
|
|
148
|
+
request: httpReq,
|
|
149
|
+
httpClient: this.httpClient,
|
|
150
|
+
logger: this.logger,
|
|
151
|
+
});
|
|
152
|
+
resp = parseResponse(respBody, unmarshalMonitorSchema);
|
|
153
|
+
};
|
|
154
|
+
await executeCall(call, options);
|
|
155
|
+
if (resp === undefined) {
|
|
156
|
+
throw new Error('operation completed without a result.');
|
|
157
|
+
}
|
|
158
|
+
return resp;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Creates a refresh. Currently only supported for the `table` `object_type`.
|
|
163
|
+
* The call must be made in the same workspace as where the monitor was created.
|
|
164
|
+
*
|
|
165
|
+
* The caller must have either of the following sets of permissions:
|
|
166
|
+
* 1. **MANAGE** and **USE_CATALOG** on the table's parent catalog.
|
|
167
|
+
* 2. **USE_CATALOG** on the table's parent catalog, and **MANAGE** and **USE_SCHEMA** on the table's parent schema.
|
|
168
|
+
* 3. **USE_CATALOG** on the table's parent catalog, **USE_SCHEMA** on the table's parent schema, and **MANAGE** on the table.
|
|
169
|
+
*/
|
|
170
|
+
async createRefresh(
|
|
171
|
+
req: CreateRefreshRequest,
|
|
172
|
+
options?: CallOptions
|
|
173
|
+
): Promise<Refresh> {
|
|
174
|
+
const url = `${this.host}/api/data-quality/v1/monitors/${req.refresh?.objectType ?? ''}/${req.refresh?.objectId ?? ''}/refreshes`;
|
|
175
|
+
const body = marshalRequest(req.refresh, marshalRefreshSchema);
|
|
176
|
+
let resp: Refresh | undefined;
|
|
177
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
178
|
+
const headers = new Headers({'Content-Type': 'application/json'});
|
|
179
|
+
if (this.workspaceId !== undefined) {
|
|
180
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
181
|
+
}
|
|
182
|
+
headers.set('User-Agent', this.userAgent);
|
|
183
|
+
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
184
|
+
const respBody = await executeHttpCall({
|
|
185
|
+
request: httpReq,
|
|
186
|
+
httpClient: this.httpClient,
|
|
187
|
+
logger: this.logger,
|
|
188
|
+
});
|
|
189
|
+
resp = parseResponse(respBody, unmarshalRefreshSchema);
|
|
190
|
+
};
|
|
191
|
+
await executeCall(call, options);
|
|
192
|
+
if (resp === undefined) {
|
|
193
|
+
throw new Error('operation completed without a result.');
|
|
194
|
+
}
|
|
195
|
+
return resp;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Delete a data quality monitor on Unity Catalog object.
|
|
200
|
+
*
|
|
201
|
+
* For the `table` `object_type`, the caller must have either of the following sets of permissions:
|
|
202
|
+
* **MANAGE** and **USE_CATALOG** on the table's parent catalog.
|
|
203
|
+
* **USE_CATALOG** on the table's parent catalog, and **MANAGE** and **USE_SCHEMA** on the table's parent schema.
|
|
204
|
+
* **USE_CATALOG** on the table's parent catalog, **USE_SCHEMA** on the table's parent schema, and **MANAGE** on the table.
|
|
205
|
+
*
|
|
206
|
+
* Note that the metric tables and dashboard will not be deleted as part of this call; those
|
|
207
|
+
* assets must be manually cleaned up (if desired).
|
|
208
|
+
*
|
|
209
|
+
* For the `schema` `object_type`, the caller must have either of the following sets of permissions:
|
|
210
|
+
* 1. **MANAGE** and **USE_CATALOG** on the schema's parent catalog.
|
|
211
|
+
* 2. **USE_CATALOG** on the schema's parent catalog, and **MANAGE** and **USE_SCHEMA** on the schema.
|
|
212
|
+
*/
|
|
213
|
+
async deleteMonitor(
|
|
214
|
+
req: DeleteMonitorRequest,
|
|
215
|
+
options?: CallOptions
|
|
216
|
+
): Promise<void> {
|
|
217
|
+
const url = `${this.host}/api/data-quality/v1/monitors/${req.objectType ?? ''}/${req.objectId ?? ''}`;
|
|
218
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
219
|
+
const headers = new Headers();
|
|
220
|
+
if (this.workspaceId !== undefined) {
|
|
221
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
222
|
+
}
|
|
223
|
+
headers.set('User-Agent', this.userAgent);
|
|
224
|
+
const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
|
|
225
|
+
await executeHttpCall({
|
|
226
|
+
request: httpReq,
|
|
227
|
+
httpClient: this.httpClient,
|
|
228
|
+
logger: this.logger,
|
|
229
|
+
});
|
|
230
|
+
};
|
|
231
|
+
await executeCall(call, options);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/** (Unimplemented) Delete a refresh */
|
|
235
|
+
async deleteRefresh(
|
|
236
|
+
req: DeleteRefreshRequest,
|
|
237
|
+
options?: CallOptions
|
|
238
|
+
): Promise<void> {
|
|
239
|
+
const url = `${this.host}/api/data-quality/v1/monitors/${req.objectType ?? ''}/${req.objectId ?? ''}/refreshes/${String(req.refreshId ?? '')}`;
|
|
240
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
241
|
+
const headers = new Headers();
|
|
242
|
+
if (this.workspaceId !== undefined) {
|
|
243
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
244
|
+
}
|
|
245
|
+
headers.set('User-Agent', this.userAgent);
|
|
246
|
+
const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
|
|
247
|
+
await executeHttpCall({
|
|
248
|
+
request: httpReq,
|
|
249
|
+
httpClient: this.httpClient,
|
|
250
|
+
logger: this.logger,
|
|
251
|
+
});
|
|
252
|
+
};
|
|
253
|
+
await executeCall(call, options);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Read a data quality monitor on a Unity Catalog object.
|
|
258
|
+
*
|
|
259
|
+
* For the `table` `object_type`, the caller must have either of the following sets of permissions:
|
|
260
|
+
* 1. **MANAGE** and **USE_CATALOG** on the table's parent catalog.
|
|
261
|
+
* 2. **USE_CATALOG** on the table's parent catalog, and **MANAGE** and **USE_SCHEMA** on the table's parent schema.
|
|
262
|
+
* 3. **USE_CATALOG** on the table's parent catalog, **USE_SCHEMA** on the table's parent schema, and **SELECT** on the table.
|
|
263
|
+
*
|
|
264
|
+
* For the `schema` `object_type`, the caller must have either of the following sets of permissions:
|
|
265
|
+
* 1. **MANAGE** and **USE_CATALOG** on the schema's parent catalog.
|
|
266
|
+
* 2. **USE_CATALOG** on the schema's parent catalog, and **USE_SCHEMA** on the schema.
|
|
267
|
+
*
|
|
268
|
+
* The returned information includes configuration values on the entity and parent entity as well as information on
|
|
269
|
+
* assets created by the monitor. Some information (e.g. dashboard) may be filtered out
|
|
270
|
+
* if the caller is in a different workspace than where the monitor was created.
|
|
271
|
+
*/
|
|
272
|
+
async getMonitor(
|
|
273
|
+
req: GetMonitorRequest,
|
|
274
|
+
options?: CallOptions
|
|
275
|
+
): Promise<Monitor> {
|
|
276
|
+
const url = `${this.host}/api/data-quality/v1/monitors/${req.objectType ?? ''}/${req.objectId ?? ''}`;
|
|
277
|
+
let resp: Monitor | undefined;
|
|
278
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
279
|
+
const headers = new Headers();
|
|
280
|
+
if (this.workspaceId !== undefined) {
|
|
281
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
282
|
+
}
|
|
283
|
+
headers.set('User-Agent', this.userAgent);
|
|
284
|
+
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
|
|
285
|
+
const respBody = await executeHttpCall({
|
|
286
|
+
request: httpReq,
|
|
287
|
+
httpClient: this.httpClient,
|
|
288
|
+
logger: this.logger,
|
|
289
|
+
});
|
|
290
|
+
resp = parseResponse(respBody, unmarshalMonitorSchema);
|
|
291
|
+
};
|
|
292
|
+
await executeCall(call, options);
|
|
293
|
+
if (resp === undefined) {
|
|
294
|
+
throw new Error('operation completed without a result.');
|
|
295
|
+
}
|
|
296
|
+
return resp;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Get data quality monitor refresh. The call must be made in the same workspace as where the monitor was created.
|
|
301
|
+
*
|
|
302
|
+
* For the `table` `object_type`, the caller must have either of the following sets of permissions:
|
|
303
|
+
* 1. **MANAGE** and **USE_CATALOG** on the table's parent catalog.
|
|
304
|
+
* 2. **USE_CATALOG** on the table's parent catalog, and **MANAGE** and **USE_SCHEMA** on the table's parent schema.
|
|
305
|
+
* 3. **USE_CATALOG** on the table's parent catalog, **USE_SCHEMA** on the table's parent schema, and **SELECT** on the table.
|
|
306
|
+
*
|
|
307
|
+
* For the `schema` `object_type`, the caller must have either of the following sets of permissions:
|
|
308
|
+
* 1. **MANAGE** and **USE_CATALOG** on the schema's parent catalog.
|
|
309
|
+
* 2. **USE_CATALOG** on the schema's parent catalog, and **USE_SCHEMA** on the schema.
|
|
310
|
+
*/
|
|
311
|
+
async getRefresh(
|
|
312
|
+
req: GetRefreshRequest,
|
|
313
|
+
options?: CallOptions
|
|
314
|
+
): Promise<Refresh> {
|
|
315
|
+
const url = `${this.host}/api/data-quality/v1/monitors/${req.objectType ?? ''}/${req.objectId ?? ''}/refreshes/${String(req.refreshId ?? '')}`;
|
|
316
|
+
let resp: Refresh | undefined;
|
|
317
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
318
|
+
const headers = new Headers();
|
|
319
|
+
if (this.workspaceId !== undefined) {
|
|
320
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
321
|
+
}
|
|
322
|
+
headers.set('User-Agent', this.userAgent);
|
|
323
|
+
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
|
|
324
|
+
const respBody = await executeHttpCall({
|
|
325
|
+
request: httpReq,
|
|
326
|
+
httpClient: this.httpClient,
|
|
327
|
+
logger: this.logger,
|
|
328
|
+
});
|
|
329
|
+
resp = parseResponse(respBody, unmarshalRefreshSchema);
|
|
330
|
+
};
|
|
331
|
+
await executeCall(call, options);
|
|
332
|
+
if (resp === undefined) {
|
|
333
|
+
throw new Error('operation completed without a result.');
|
|
334
|
+
}
|
|
335
|
+
return resp;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/** (Unimplemented) List data quality monitors. */
|
|
339
|
+
async listMonitor(
|
|
340
|
+
req: ListMonitorRequest,
|
|
341
|
+
options?: CallOptions
|
|
342
|
+
): Promise<ListMonitorResponse> {
|
|
343
|
+
const url = `${this.host}/api/data-quality/v1/monitors`;
|
|
344
|
+
const params = new URLSearchParams();
|
|
345
|
+
if (req.pageToken !== undefined) {
|
|
346
|
+
params.append('page_token', req.pageToken);
|
|
347
|
+
}
|
|
348
|
+
if (req.pageSize !== undefined) {
|
|
349
|
+
params.append('page_size', String(req.pageSize));
|
|
350
|
+
}
|
|
351
|
+
const query = params.toString();
|
|
352
|
+
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
353
|
+
let resp: ListMonitorResponse | undefined;
|
|
354
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
355
|
+
const headers = new Headers();
|
|
356
|
+
if (this.workspaceId !== undefined) {
|
|
357
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
358
|
+
}
|
|
359
|
+
headers.set('User-Agent', this.userAgent);
|
|
360
|
+
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
361
|
+
const respBody = await executeHttpCall({
|
|
362
|
+
request: httpReq,
|
|
363
|
+
httpClient: this.httpClient,
|
|
364
|
+
logger: this.logger,
|
|
365
|
+
});
|
|
366
|
+
resp = parseResponse(respBody, unmarshalListMonitorResponseSchema);
|
|
367
|
+
};
|
|
368
|
+
await executeCall(call, options);
|
|
369
|
+
if (resp === undefined) {
|
|
370
|
+
throw new Error('operation completed without a result.');
|
|
371
|
+
}
|
|
372
|
+
return resp;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
async *listMonitorIter(
|
|
376
|
+
req: ListMonitorRequest,
|
|
377
|
+
options?: CallOptions
|
|
378
|
+
): AsyncGenerator<Monitor> {
|
|
379
|
+
const pageReq: ListMonitorRequest = {...req};
|
|
380
|
+
for (;;) {
|
|
381
|
+
const resp = await this.listMonitor(pageReq, options);
|
|
382
|
+
for (const item of resp.monitors ?? []) {
|
|
383
|
+
yield item;
|
|
384
|
+
}
|
|
385
|
+
if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
pageReq.pageToken = resp.nextPageToken;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* List data quality monitor refreshes. The call must be made in the same workspace as where the monitor was created.
|
|
394
|
+
*
|
|
395
|
+
* For the `table` `object_type`, the caller must have either of the following sets of permissions:
|
|
396
|
+
* 1. **MANAGE** and **USE_CATALOG** on the table's parent catalog.
|
|
397
|
+
* 2. **USE_CATALOG** on the table's parent catalog, and **MANAGE** and **USE_SCHEMA** on the table's parent schema.
|
|
398
|
+
* 3. **USE_CATALOG** on the table's parent catalog, **USE_SCHEMA** on the table's parent schema, and **SELECT** on the table.
|
|
399
|
+
*
|
|
400
|
+
* For the `schema` `object_type`, the caller must have either of the following sets of permissions:
|
|
401
|
+
* 1. **MANAGE** and **USE_CATALOG** on the schema's parent catalog.
|
|
402
|
+
* 2. **USE_CATALOG** on the schema's parent catalog, and **USE_SCHEMA** on the schema.
|
|
403
|
+
*/
|
|
404
|
+
async listRefresh(
|
|
405
|
+
req: ListRefreshRequest,
|
|
406
|
+
options?: CallOptions
|
|
407
|
+
): Promise<ListRefreshResponse> {
|
|
408
|
+
const url = `${this.host}/api/data-quality/v1/monitors/${req.objectType ?? ''}/${req.objectId ?? ''}/refreshes`;
|
|
409
|
+
const params = new URLSearchParams();
|
|
410
|
+
if (req.pageToken !== undefined) {
|
|
411
|
+
params.append('page_token', req.pageToken);
|
|
412
|
+
}
|
|
413
|
+
if (req.pageSize !== undefined) {
|
|
414
|
+
params.append('page_size', String(req.pageSize));
|
|
415
|
+
}
|
|
416
|
+
const query = params.toString();
|
|
417
|
+
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
418
|
+
let resp: ListRefreshResponse | undefined;
|
|
419
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
420
|
+
const headers = new Headers();
|
|
421
|
+
if (this.workspaceId !== undefined) {
|
|
422
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
423
|
+
}
|
|
424
|
+
headers.set('User-Agent', this.userAgent);
|
|
425
|
+
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
426
|
+
const respBody = await executeHttpCall({
|
|
427
|
+
request: httpReq,
|
|
428
|
+
httpClient: this.httpClient,
|
|
429
|
+
logger: this.logger,
|
|
430
|
+
});
|
|
431
|
+
resp = parseResponse(respBody, unmarshalListRefreshResponseSchema);
|
|
432
|
+
};
|
|
433
|
+
await executeCall(call, options);
|
|
434
|
+
if (resp === undefined) {
|
|
435
|
+
throw new Error('operation completed without a result.');
|
|
436
|
+
}
|
|
437
|
+
return resp;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
async *listRefreshIter(
|
|
441
|
+
req: ListRefreshRequest,
|
|
442
|
+
options?: CallOptions
|
|
443
|
+
): AsyncGenerator<Refresh> {
|
|
444
|
+
const pageReq: ListRefreshRequest = {...req};
|
|
445
|
+
for (;;) {
|
|
446
|
+
const resp = await this.listRefresh(pageReq, options);
|
|
447
|
+
for (const item of resp.refreshes ?? []) {
|
|
448
|
+
yield item;
|
|
449
|
+
}
|
|
450
|
+
if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
pageReq.pageToken = resp.nextPageToken;
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* Update a data quality monitor on Unity Catalog object.
|
|
459
|
+
*
|
|
460
|
+
* For the `table` `object_type`, the caller must have either of the following sets of permissions:
|
|
461
|
+
* 1. **MANAGE** and **USE_CATALOG** on the table's parent catalog.
|
|
462
|
+
* 2. **USE_CATALOG** on the table's parent catalog, and **MANAGE** and **USE_SCHEMA** on the table's parent schema.
|
|
463
|
+
* 3. **USE_CATALOG** on the table's parent catalog, **USE_SCHEMA** on the table's parent schema, and **MANAGE** on the table.
|
|
464
|
+
*
|
|
465
|
+
* For the `schema` `object_type`, the caller must have either of the following sets of permissions:
|
|
466
|
+
* 1. **MANAGE** and **USE_CATALOG** on the schema's parent catalog.
|
|
467
|
+
* 2. **USE_CATALOG** on the schema's parent catalog, and **MANAGE** and **USE_SCHEMA** on the schema.
|
|
468
|
+
*/
|
|
469
|
+
async updateMonitor(
|
|
470
|
+
req: UpdateMonitorRequest,
|
|
471
|
+
options?: CallOptions
|
|
472
|
+
): Promise<Monitor> {
|
|
473
|
+
const url = `${this.host}/api/data-quality/v1/monitors/${req.objectType ?? ''}/${req.objectId ?? ''}`;
|
|
474
|
+
const params = new URLSearchParams();
|
|
475
|
+
if (req.updateMask !== undefined) {
|
|
476
|
+
params.append('update_mask', req.updateMask.toString());
|
|
477
|
+
}
|
|
478
|
+
const query = params.toString();
|
|
479
|
+
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
480
|
+
const body = marshalRequest(req.monitor, marshalMonitorSchema);
|
|
481
|
+
let resp: Monitor | undefined;
|
|
482
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
483
|
+
const headers = new Headers({'Content-Type': 'application/json'});
|
|
484
|
+
if (this.workspaceId !== undefined) {
|
|
485
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
486
|
+
}
|
|
487
|
+
headers.set('User-Agent', this.userAgent);
|
|
488
|
+
const httpReq = buildHttpRequest(
|
|
489
|
+
'PATCH',
|
|
490
|
+
fullUrl,
|
|
491
|
+
headers,
|
|
492
|
+
callSignal,
|
|
493
|
+
body
|
|
494
|
+
);
|
|
495
|
+
const respBody = await executeHttpCall({
|
|
496
|
+
request: httpReq,
|
|
497
|
+
httpClient: this.httpClient,
|
|
498
|
+
logger: this.logger,
|
|
499
|
+
});
|
|
500
|
+
resp = parseResponse(respBody, unmarshalMonitorSchema);
|
|
501
|
+
};
|
|
502
|
+
await executeCall(call, options);
|
|
503
|
+
if (resp === undefined) {
|
|
504
|
+
throw new Error('operation completed without a result.');
|
|
505
|
+
}
|
|
506
|
+
return resp;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
/** (Unimplemented) Update a refresh */
|
|
510
|
+
async updateRefresh(
|
|
511
|
+
req: UpdateRefreshRequest,
|
|
512
|
+
options?: CallOptions
|
|
513
|
+
): Promise<Refresh> {
|
|
514
|
+
const url = `${this.host}/api/data-quality/v1/monitors/${req.objectType ?? ''}/${req.objectId ?? ''}/refreshes/${String(req.refreshId ?? '')}`;
|
|
515
|
+
const params = new URLSearchParams();
|
|
516
|
+
if (req.updateMask !== undefined) {
|
|
517
|
+
params.append('update_mask', req.updateMask.toString());
|
|
518
|
+
}
|
|
519
|
+
const query = params.toString();
|
|
520
|
+
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
521
|
+
const body = marshalRequest(req.refresh, marshalRefreshSchema);
|
|
522
|
+
let resp: Refresh | undefined;
|
|
523
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
524
|
+
const headers = new Headers({'Content-Type': 'application/json'});
|
|
525
|
+
if (this.workspaceId !== undefined) {
|
|
526
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
527
|
+
}
|
|
528
|
+
headers.set('User-Agent', this.userAgent);
|
|
529
|
+
const httpReq = buildHttpRequest(
|
|
530
|
+
'PATCH',
|
|
531
|
+
fullUrl,
|
|
532
|
+
headers,
|
|
533
|
+
callSignal,
|
|
534
|
+
body
|
|
535
|
+
);
|
|
536
|
+
const respBody = await executeHttpCall({
|
|
537
|
+
request: httpReq,
|
|
538
|
+
httpClient: this.httpClient,
|
|
539
|
+
logger: this.logger,
|
|
540
|
+
});
|
|
541
|
+
resp = parseResponse(respBody, unmarshalRefreshSchema);
|
|
542
|
+
};
|
|
543
|
+
await executeCall(call, options);
|
|
544
|
+
if (resp === undefined) {
|
|
545
|
+
throw new Error('operation completed without a result.');
|
|
546
|
+
}
|
|
547
|
+
return resp;
|
|
548
|
+
}
|
|
549
|
+
}
|
package/src/v1/index.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
export {DataQualityClient} from './client';
|
|
4
|
+
|
|
5
|
+
export {
|
|
6
|
+
AggregationGranularity,
|
|
7
|
+
CronSchedulePauseStatus,
|
|
8
|
+
DataProfilingCustomMetricType,
|
|
9
|
+
DataProfilingStatus,
|
|
10
|
+
InferenceProblemType,
|
|
11
|
+
RefreshState,
|
|
12
|
+
RefreshTrigger,
|
|
13
|
+
} from './model';
|
|
14
|
+
|
|
15
|
+
export type {
|
|
16
|
+
AnomalyDetectionConfig,
|
|
17
|
+
CancelRefreshRequest,
|
|
18
|
+
CancelRefreshResponse,
|
|
19
|
+
CreateMonitorRequest,
|
|
20
|
+
CreateRefreshRequest,
|
|
21
|
+
CronSchedule,
|
|
22
|
+
DataProfilingConfig,
|
|
23
|
+
DataProfilingCustomMetric,
|
|
24
|
+
DeleteMonitorRequest,
|
|
25
|
+
DeleteRefreshRequest,
|
|
26
|
+
GetMonitorRequest,
|
|
27
|
+
GetRefreshRequest,
|
|
28
|
+
InferenceLogConfig,
|
|
29
|
+
ListMonitorRequest,
|
|
30
|
+
ListMonitorResponse,
|
|
31
|
+
ListRefreshRequest,
|
|
32
|
+
ListRefreshResponse,
|
|
33
|
+
Monitor,
|
|
34
|
+
NotificationDestination,
|
|
35
|
+
NotificationSettings,
|
|
36
|
+
Refresh,
|
|
37
|
+
SnapshotConfig,
|
|
38
|
+
TimeSeriesConfig,
|
|
39
|
+
UpdateMonitorRequest,
|
|
40
|
+
UpdateRefreshRequest,
|
|
41
|
+
} from './model';
|
|
42
|
+
|
|
43
|
+
export {monitorFieldMask, refreshFieldMask} from './model';
|