@databricks/sdk-uc-metastores 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/package.js +7 -0
- package/dist/package.js.map +1 -0
- package/dist/v1/client.d.ts +88 -84
- package/dist/v1/client.d.ts.map +1 -1
- package/dist/v1/client.js +472 -587
- package/dist/v1/client.js.map +1 -1
- package/dist/v1/index.d.ts +3 -7
- package/dist/v1/index.js +4 -7
- package/dist/v1/model.d.ts +449 -456
- package/dist/v1/model.d.ts.map +1 -1
- package/dist/v1/model.js +339 -448
- 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,590 +1,475 @@
|
|
|
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 { marshalAccountsCreateMetastoreAssignmentRequestSchema, marshalAccountsCreateMetastoreRequestSchema, marshalAccountsUpdateMetastoreAssignmentRequestSchema, marshalAccountsUpdateMetastoreRequestSchema, marshalCreateMetastoreAssignmentRequestSchema, marshalCreateMetastoreRequestSchema, marshalUpdateMetastoreAssignmentRequestSchema, marshalUpdateMetastoreRequestSchema, unmarshalAccountsCreateMetastoreAssignmentResponseSchema, unmarshalAccountsCreateMetastoreResponseSchema, unmarshalAccountsDeleteMetastoreAssignmentResponseSchema, unmarshalAccountsDeleteMetastoreResponseSchema, unmarshalAccountsGetMetastoreAssignmentResponseSchema, unmarshalAccountsGetMetastoreResponseSchema, unmarshalAccountsListMetastoresResponseSchema, unmarshalAccountsListWorkspaceIdsForMetastoreResponseSchema, unmarshalAccountsUpdateMetastoreAssignmentResponseSchema, unmarshalAccountsUpdateMetastoreResponseSchema, unmarshalCreateMetastoreAssignmentResponseSchema, unmarshalDeleteMetastoreAssignmentResponseSchema, unmarshalDeleteMetastoreResponseSchema, unmarshalGetMetastoreSummaryResponseSchema, unmarshalListMetastoresResponseSchema, unmarshalMetastoreAssignmentSchema, unmarshalMetastoreInfoSchema, unmarshalUpdateMetastoreAssignmentResponseSchema } 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
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
* Gets an array of the available metastores (as __MetastoreInfo__ objects). The caller must be an admin to retrieve this info.
|
|
476
|
-
* There is no guarantee of a specific ordering of the elements in the array.
|
|
477
|
-
*
|
|
478
|
-
* NOTE: we recommend using max_results=0 to use the paginated version of this API. Unpaginated calls will be deprecated soon.
|
|
479
|
-
*
|
|
480
|
-
* PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may contain zero results while still providing a next_page_token.
|
|
481
|
-
* Clients must continue reading pages until next_page_token is absent, which is the only indication that the end of results has been reached.
|
|
482
|
-
*/
|
|
483
|
-
async listMetastores(req, options) {
|
|
484
|
-
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
485
|
-
const url = `${host}/api/2.1/unity-catalog/metastores`;
|
|
486
|
-
const params = new URLSearchParams();
|
|
487
|
-
if (req.maxResults !== undefined) {
|
|
488
|
-
params.append('max_results', String(req.maxResults));
|
|
489
|
-
}
|
|
490
|
-
if (req.pageToken !== undefined) {
|
|
491
|
-
params.append('page_token', req.pageToken);
|
|
492
|
-
}
|
|
493
|
-
const query = params.toString();
|
|
494
|
-
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
495
|
-
let resp;
|
|
496
|
-
const call = async (callSignal) => {
|
|
497
|
-
const headers = new Headers();
|
|
498
|
-
if (workspaceId !== undefined) {
|
|
499
|
-
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
500
|
-
}
|
|
501
|
-
headers.set('User-Agent', this.userAgent);
|
|
502
|
-
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
503
|
-
const respBody = await executeHttpCall({
|
|
504
|
-
request: httpReq,
|
|
505
|
-
httpClient,
|
|
506
|
-
logger: this.logger,
|
|
507
|
-
});
|
|
508
|
-
resp = parseResponse(respBody, unmarshalListMetastoresResponseSchema);
|
|
509
|
-
};
|
|
510
|
-
await executeCall(call, options);
|
|
511
|
-
if (resp === undefined) {
|
|
512
|
-
throw new Error('operation completed without a result.');
|
|
513
|
-
}
|
|
514
|
-
return resp;
|
|
515
|
-
}
|
|
516
|
-
async *listMetastoresIter(req, options) {
|
|
517
|
-
const pageReq = { ...req };
|
|
518
|
-
for (;;) {
|
|
519
|
-
const resp = await this.listMetastores(pageReq, options);
|
|
520
|
-
for (const item of resp.metastores ?? []) {
|
|
521
|
-
yield item;
|
|
522
|
-
}
|
|
523
|
-
if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
|
|
524
|
-
return;
|
|
525
|
-
}
|
|
526
|
-
pageReq.pageToken = resp.nextPageToken;
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
/**
|
|
530
|
-
* Updates information for a specific metastore. The caller must be a metastore admin.
|
|
531
|
-
* If the __owner__ field is set to the empty string (**""**), the ownership is updated
|
|
532
|
-
* to the System User.
|
|
533
|
-
*/
|
|
534
|
-
async updateMetastore(req, options) {
|
|
535
|
-
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
536
|
-
const url = `${host}/api/2.1/unity-catalog/metastores/${req.id ?? ''}`;
|
|
537
|
-
const body = marshalRequest(req, marshalUpdateMetastoreRequestSchema);
|
|
538
|
-
let resp;
|
|
539
|
-
const call = async (callSignal) => {
|
|
540
|
-
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
541
|
-
if (workspaceId !== undefined) {
|
|
542
|
-
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
543
|
-
}
|
|
544
|
-
headers.set('User-Agent', this.userAgent);
|
|
545
|
-
const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
|
|
546
|
-
const respBody = await executeHttpCall({
|
|
547
|
-
request: httpReq,
|
|
548
|
-
httpClient,
|
|
549
|
-
logger: this.logger,
|
|
550
|
-
});
|
|
551
|
-
resp = parseResponse(respBody, unmarshalMetastoreInfoSchema);
|
|
552
|
-
};
|
|
553
|
-
await executeCall(call, options);
|
|
554
|
-
if (resp === undefined) {
|
|
555
|
-
throw new Error('operation completed without a result.');
|
|
556
|
-
}
|
|
557
|
-
return resp;
|
|
558
|
-
}
|
|
559
|
-
/**
|
|
560
|
-
* Updates a metastore assignment. This operation can be used to update __metastore_id__ or __default_catalog_name__
|
|
561
|
-
* for a specified Workspace, if the Workspace is already assigned a metastore.
|
|
562
|
-
* The caller must be an account admin to update __metastore_id__; otherwise, the caller can be a Workspace admin.
|
|
563
|
-
*/
|
|
564
|
-
async updateMetastoreAssignment(req, options) {
|
|
565
|
-
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
566
|
-
const url = `${host}/api/2.1/unity-catalog/workspaces/${String(req.workspaceId ?? '')}/metastore`;
|
|
567
|
-
const body = marshalRequest(req, marshalUpdateMetastoreAssignmentRequestSchema);
|
|
568
|
-
let resp;
|
|
569
|
-
const call = async (callSignal) => {
|
|
570
|
-
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
571
|
-
if (workspaceId !== undefined) {
|
|
572
|
-
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
573
|
-
}
|
|
574
|
-
headers.set('User-Agent', this.userAgent);
|
|
575
|
-
const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
|
|
576
|
-
const respBody = await executeHttpCall({
|
|
577
|
-
request: httpReq,
|
|
578
|
-
httpClient,
|
|
579
|
-
logger: this.logger,
|
|
580
|
-
});
|
|
581
|
-
resp = parseResponse(respBody, unmarshalUpdateMetastoreAssignmentResponseSchema);
|
|
582
|
-
};
|
|
583
|
-
await executeCall(call, options);
|
|
584
|
-
if (resp === undefined) {
|
|
585
|
-
throw new Error('operation completed without a result.');
|
|
586
|
-
}
|
|
587
|
-
return resp;
|
|
588
|
-
}
|
|
589
|
-
}
|
|
14
|
+
var MetastoresClient = 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
|
+
/** Creates a Unity Catalog metastore. */
|
|
35
|
+
async createAccountsMetastore(req, options) {
|
|
36
|
+
const { host, accountId, httpClient } = await this.resolveConfig();
|
|
37
|
+
const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ""}/metastores`;
|
|
38
|
+
const body = marshalRequest(req, marshalAccountsCreateMetastoreRequestSchema);
|
|
39
|
+
let resp;
|
|
40
|
+
const call = async (callSignal) => {
|
|
41
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
42
|
+
headers.set("User-Agent", this.userAgent);
|
|
43
|
+
resp = parseResponse(await executeHttpCall({
|
|
44
|
+
request: buildHttpRequest("POST", url, headers, callSignal, body),
|
|
45
|
+
httpClient,
|
|
46
|
+
logger: this.logger
|
|
47
|
+
}), unmarshalAccountsCreateMetastoreResponseSchema);
|
|
48
|
+
};
|
|
49
|
+
await executeCall(call, options);
|
|
50
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
51
|
+
return resp;
|
|
52
|
+
}
|
|
53
|
+
/** Creates an assignment to a metastore for a workspace */
|
|
54
|
+
async createAccountsMetastoreAssignment(req, options) {
|
|
55
|
+
const { host, accountId, httpClient } = await this.resolveConfig();
|
|
56
|
+
const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ""}/workspaces/${String(req.workspaceId ?? "")}/metastores/${req.metastoreId ?? ""}`;
|
|
57
|
+
const body = marshalRequest(req, marshalAccountsCreateMetastoreAssignmentRequestSchema);
|
|
58
|
+
let resp;
|
|
59
|
+
const call = async (callSignal) => {
|
|
60
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
61
|
+
headers.set("User-Agent", this.userAgent);
|
|
62
|
+
resp = parseResponse(await executeHttpCall({
|
|
63
|
+
request: buildHttpRequest("POST", url, headers, callSignal, body),
|
|
64
|
+
httpClient,
|
|
65
|
+
logger: this.logger
|
|
66
|
+
}), unmarshalAccountsCreateMetastoreAssignmentResponseSchema);
|
|
67
|
+
};
|
|
68
|
+
await executeCall(call, options);
|
|
69
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
70
|
+
return resp;
|
|
71
|
+
}
|
|
72
|
+
/** Deletes a Unity Catalog metastore for an account, both specified by ID. */
|
|
73
|
+
async deleteAccountsMetastore(req, options) {
|
|
74
|
+
const { host, accountId, httpClient } = await this.resolveConfig();
|
|
75
|
+
const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ""}/metastores/${req.metastoreId ?? ""}`;
|
|
76
|
+
const params = new URLSearchParams();
|
|
77
|
+
if (req.force !== void 0) params.append("force", String(req.force));
|
|
78
|
+
const query = params.toString();
|
|
79
|
+
const fullUrl = query !== "" ? `${url}?${query}` : url;
|
|
80
|
+
let resp;
|
|
81
|
+
const call = async (callSignal) => {
|
|
82
|
+
const headers = new Headers();
|
|
83
|
+
headers.set("User-Agent", this.userAgent);
|
|
84
|
+
resp = parseResponse(await executeHttpCall({
|
|
85
|
+
request: buildHttpRequest("DELETE", fullUrl, headers, callSignal),
|
|
86
|
+
httpClient,
|
|
87
|
+
logger: this.logger
|
|
88
|
+
}), unmarshalAccountsDeleteMetastoreResponseSchema);
|
|
89
|
+
};
|
|
90
|
+
await executeCall(call, options);
|
|
91
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
92
|
+
return resp;
|
|
93
|
+
}
|
|
94
|
+
/** Deletes a metastore assignment to a workspace, leaving the workspace with no metastore. */
|
|
95
|
+
async deleteAccountsMetastoreAssignment(req, options) {
|
|
96
|
+
const { host, accountId, httpClient } = await this.resolveConfig();
|
|
97
|
+
const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ""}/workspaces/${String(req.workspaceId ?? "")}/metastores/${req.metastoreId ?? ""}`;
|
|
98
|
+
let resp;
|
|
99
|
+
const call = async (callSignal) => {
|
|
100
|
+
const headers = new Headers();
|
|
101
|
+
headers.set("User-Agent", this.userAgent);
|
|
102
|
+
resp = parseResponse(await executeHttpCall({
|
|
103
|
+
request: buildHttpRequest("DELETE", url, headers, callSignal),
|
|
104
|
+
httpClient,
|
|
105
|
+
logger: this.logger
|
|
106
|
+
}), unmarshalAccountsDeleteMetastoreAssignmentResponseSchema);
|
|
107
|
+
};
|
|
108
|
+
await executeCall(call, options);
|
|
109
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
110
|
+
return resp;
|
|
111
|
+
}
|
|
112
|
+
/** Gets a Unity Catalog metastore from an account, both specified by ID. */
|
|
113
|
+
async getAccountsMetastore(req, options) {
|
|
114
|
+
const { host, accountId, httpClient } = await this.resolveConfig();
|
|
115
|
+
const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ""}/metastores/${req.metastoreId ?? ""}`;
|
|
116
|
+
let resp;
|
|
117
|
+
const call = async (callSignal) => {
|
|
118
|
+
const headers = new Headers();
|
|
119
|
+
headers.set("User-Agent", this.userAgent);
|
|
120
|
+
resp = parseResponse(await executeHttpCall({
|
|
121
|
+
request: buildHttpRequest("GET", url, headers, callSignal),
|
|
122
|
+
httpClient,
|
|
123
|
+
logger: this.logger
|
|
124
|
+
}), unmarshalAccountsGetMetastoreResponseSchema);
|
|
125
|
+
};
|
|
126
|
+
await executeCall(call, options);
|
|
127
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
128
|
+
return resp;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Gets the metastore assignment, if any, for the workspace specified by ID.
|
|
132
|
+
* If the workspace is assigned a metastore, the mapping will be returned.
|
|
133
|
+
* If no metastore is assigned to the workspace, the assignment will not be
|
|
134
|
+
* found and a 404 returned.
|
|
135
|
+
*/
|
|
136
|
+
async getMetastoreAssignment(req, options) {
|
|
137
|
+
const { host, accountId, httpClient } = await this.resolveConfig();
|
|
138
|
+
const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ""}/workspaces/${String(req.workspaceId ?? "")}/metastore`;
|
|
139
|
+
let resp;
|
|
140
|
+
const call = async (callSignal) => {
|
|
141
|
+
const headers = new Headers();
|
|
142
|
+
headers.set("User-Agent", this.userAgent);
|
|
143
|
+
resp = parseResponse(await executeHttpCall({
|
|
144
|
+
request: buildHttpRequest("GET", url, headers, callSignal),
|
|
145
|
+
httpClient,
|
|
146
|
+
logger: this.logger
|
|
147
|
+
}), unmarshalAccountsGetMetastoreAssignmentResponseSchema);
|
|
148
|
+
};
|
|
149
|
+
await executeCall(call, options);
|
|
150
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
151
|
+
return resp;
|
|
152
|
+
}
|
|
153
|
+
/** Gets all Unity Catalog metastores associated with an account specified by ID. */
|
|
154
|
+
async listAccountsMetastores(req, options) {
|
|
155
|
+
const { host, accountId, httpClient } = await this.resolveConfig();
|
|
156
|
+
const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ""}/metastores`;
|
|
157
|
+
let resp;
|
|
158
|
+
const call = async (callSignal) => {
|
|
159
|
+
const headers = new Headers();
|
|
160
|
+
headers.set("User-Agent", this.userAgent);
|
|
161
|
+
resp = parseResponse(await executeHttpCall({
|
|
162
|
+
request: buildHttpRequest("GET", url, headers, callSignal),
|
|
163
|
+
httpClient,
|
|
164
|
+
logger: this.logger
|
|
165
|
+
}), unmarshalAccountsListMetastoresResponseSchema);
|
|
166
|
+
};
|
|
167
|
+
await executeCall(call, options);
|
|
168
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
169
|
+
return resp;
|
|
170
|
+
}
|
|
171
|
+
/** Gets a list of all <Databricks> workspace IDs that have been assigned to given metastore. */
|
|
172
|
+
async listMetastoreAssignments(req, options) {
|
|
173
|
+
const { host, accountId, httpClient } = await this.resolveConfig();
|
|
174
|
+
const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ""}/metastores/${req.metastoreId ?? ""}/workspaces`;
|
|
175
|
+
let resp;
|
|
176
|
+
const call = async (callSignal) => {
|
|
177
|
+
const headers = new Headers();
|
|
178
|
+
headers.set("User-Agent", this.userAgent);
|
|
179
|
+
resp = parseResponse(await executeHttpCall({
|
|
180
|
+
request: buildHttpRequest("GET", url, headers, callSignal),
|
|
181
|
+
httpClient,
|
|
182
|
+
logger: this.logger
|
|
183
|
+
}), unmarshalAccountsListWorkspaceIdsForMetastoreResponseSchema);
|
|
184
|
+
};
|
|
185
|
+
await executeCall(call, options);
|
|
186
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
187
|
+
return resp;
|
|
188
|
+
}
|
|
189
|
+
/** Updates an existing Unity Catalog metastore. */
|
|
190
|
+
async updateAccountsMetastore(req, options) {
|
|
191
|
+
const { host, accountId, httpClient } = await this.resolveConfig();
|
|
192
|
+
const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ""}/metastores/${req.metastoreId ?? ""}`;
|
|
193
|
+
const body = marshalRequest(req, marshalAccountsUpdateMetastoreRequestSchema);
|
|
194
|
+
let resp;
|
|
195
|
+
const call = async (callSignal) => {
|
|
196
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
197
|
+
headers.set("User-Agent", this.userAgent);
|
|
198
|
+
resp = parseResponse(await executeHttpCall({
|
|
199
|
+
request: buildHttpRequest("PUT", url, headers, callSignal, body),
|
|
200
|
+
httpClient,
|
|
201
|
+
logger: this.logger
|
|
202
|
+
}), unmarshalAccountsUpdateMetastoreResponseSchema);
|
|
203
|
+
};
|
|
204
|
+
await executeCall(call, options);
|
|
205
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
206
|
+
return resp;
|
|
207
|
+
}
|
|
208
|
+
/** Updates an assignment to a metastore for a workspace. Currently, only the default catalog may be updated. */
|
|
209
|
+
async updateAccountsMetastoreAssignment(req, options) {
|
|
210
|
+
const { host, accountId, httpClient } = await this.resolveConfig();
|
|
211
|
+
const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ""}/workspaces/${String(req.workspaceId ?? "")}/metastores/${req.metastoreId ?? ""}`;
|
|
212
|
+
const body = marshalRequest(req, marshalAccountsUpdateMetastoreAssignmentRequestSchema);
|
|
213
|
+
let resp;
|
|
214
|
+
const call = async (callSignal) => {
|
|
215
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
216
|
+
headers.set("User-Agent", this.userAgent);
|
|
217
|
+
resp = parseResponse(await executeHttpCall({
|
|
218
|
+
request: buildHttpRequest("PUT", url, headers, callSignal, body),
|
|
219
|
+
httpClient,
|
|
220
|
+
logger: this.logger
|
|
221
|
+
}), unmarshalAccountsUpdateMetastoreAssignmentResponseSchema);
|
|
222
|
+
};
|
|
223
|
+
await executeCall(call, options);
|
|
224
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
225
|
+
return resp;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Creates a new metastore based on a provided name and optional storage root path.
|
|
229
|
+
* By default (if the __owner__ field is not set), the owner of the new metastore is the user calling
|
|
230
|
+
* the __createMetastore__ API. If the __owner__ field is set to the empty string (**""**), the ownership is
|
|
231
|
+
* assigned to the System User instead.
|
|
232
|
+
*/
|
|
233
|
+
async createMetastore(req, options) {
|
|
234
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
235
|
+
const url = `${host}/api/2.1/unity-catalog/metastores`;
|
|
236
|
+
const body = marshalRequest(req, marshalCreateMetastoreRequestSchema);
|
|
237
|
+
let resp;
|
|
238
|
+
const call = async (callSignal) => {
|
|
239
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
240
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
241
|
+
headers.set("User-Agent", this.userAgent);
|
|
242
|
+
resp = parseResponse(await executeHttpCall({
|
|
243
|
+
request: buildHttpRequest("POST", url, headers, callSignal, body),
|
|
244
|
+
httpClient,
|
|
245
|
+
logger: this.logger
|
|
246
|
+
}), unmarshalMetastoreInfoSchema);
|
|
247
|
+
};
|
|
248
|
+
await executeCall(call, options);
|
|
249
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
250
|
+
return resp;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Creates a new metastore assignment.
|
|
254
|
+
* If an assignment for the same __workspace_id__ exists, it will be overwritten by the new __metastore_id__ and
|
|
255
|
+
* __default_catalog_name__. The caller must be an account admin.
|
|
256
|
+
*/
|
|
257
|
+
async createMetastoreAssignment(req, options) {
|
|
258
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
259
|
+
const url = `${host}/api/2.1/unity-catalog/workspaces/${String(req.workspaceId ?? "")}/metastore`;
|
|
260
|
+
const body = marshalRequest(req, marshalCreateMetastoreAssignmentRequestSchema);
|
|
261
|
+
let resp;
|
|
262
|
+
const call = async (callSignal) => {
|
|
263
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
264
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
265
|
+
headers.set("User-Agent", this.userAgent);
|
|
266
|
+
resp = parseResponse(await executeHttpCall({
|
|
267
|
+
request: buildHttpRequest("PUT", url, headers, callSignal, body),
|
|
268
|
+
httpClient,
|
|
269
|
+
logger: this.logger
|
|
270
|
+
}), unmarshalCreateMetastoreAssignmentResponseSchema);
|
|
271
|
+
};
|
|
272
|
+
await executeCall(call, options);
|
|
273
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
274
|
+
return resp;
|
|
275
|
+
}
|
|
276
|
+
/** Deletes a metastore. The caller must be a metastore admin. */
|
|
277
|
+
async deleteMetastore(req, options) {
|
|
278
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
279
|
+
const url = `${host}/api/2.1/unity-catalog/metastores/${req.id ?? ""}`;
|
|
280
|
+
const params = new URLSearchParams();
|
|
281
|
+
if (req.force !== void 0) params.append("force", String(req.force));
|
|
282
|
+
const query = params.toString();
|
|
283
|
+
const fullUrl = query !== "" ? `${url}?${query}` : url;
|
|
284
|
+
let resp;
|
|
285
|
+
const call = async (callSignal) => {
|
|
286
|
+
const headers = new Headers();
|
|
287
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
288
|
+
headers.set("User-Agent", this.userAgent);
|
|
289
|
+
resp = parseResponse(await executeHttpCall({
|
|
290
|
+
request: buildHttpRequest("DELETE", fullUrl, headers, callSignal),
|
|
291
|
+
httpClient,
|
|
292
|
+
logger: this.logger
|
|
293
|
+
}), unmarshalDeleteMetastoreResponseSchema);
|
|
294
|
+
};
|
|
295
|
+
await executeCall(call, options);
|
|
296
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
297
|
+
return resp;
|
|
298
|
+
}
|
|
299
|
+
/** Deletes a metastore assignment. The caller must be an account administrator. */
|
|
300
|
+
async deleteMetastoreAssignment(req, options) {
|
|
301
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
302
|
+
const url = `${host}/api/2.1/unity-catalog/workspaces/${String(req.workspaceId ?? "")}/metastore`;
|
|
303
|
+
const params = new URLSearchParams();
|
|
304
|
+
if (req.metastoreId !== void 0) params.append("metastore_id", req.metastoreId);
|
|
305
|
+
const query = params.toString();
|
|
306
|
+
const fullUrl = query !== "" ? `${url}?${query}` : url;
|
|
307
|
+
let resp;
|
|
308
|
+
const call = async (callSignal) => {
|
|
309
|
+
const headers = new Headers();
|
|
310
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
311
|
+
headers.set("User-Agent", this.userAgent);
|
|
312
|
+
resp = parseResponse(await executeHttpCall({
|
|
313
|
+
request: buildHttpRequest("DELETE", fullUrl, headers, callSignal),
|
|
314
|
+
httpClient,
|
|
315
|
+
logger: this.logger
|
|
316
|
+
}), unmarshalDeleteMetastoreAssignmentResponseSchema);
|
|
317
|
+
};
|
|
318
|
+
await executeCall(call, options);
|
|
319
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
320
|
+
return resp;
|
|
321
|
+
}
|
|
322
|
+
/** Gets the metastore assignment for the workspace being accessed. */
|
|
323
|
+
async getCurrentMetastoreAssignment(_req, options) {
|
|
324
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
325
|
+
const url = `${host}/api/2.1/unity-catalog/current-metastore-assignment`;
|
|
326
|
+
let resp;
|
|
327
|
+
const call = async (callSignal) => {
|
|
328
|
+
const headers = new Headers();
|
|
329
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
330
|
+
headers.set("User-Agent", this.userAgent);
|
|
331
|
+
resp = parseResponse(await executeHttpCall({
|
|
332
|
+
request: buildHttpRequest("GET", url, headers, callSignal),
|
|
333
|
+
httpClient,
|
|
334
|
+
logger: this.logger
|
|
335
|
+
}), unmarshalMetastoreAssignmentSchema);
|
|
336
|
+
};
|
|
337
|
+
await executeCall(call, options);
|
|
338
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
339
|
+
return resp;
|
|
340
|
+
}
|
|
341
|
+
/** Gets a metastore that matches the supplied ID. The caller must be a metastore admin to retrieve this info. */
|
|
342
|
+
async getMetastore(req, options) {
|
|
343
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
344
|
+
const url = `${host}/api/2.1/unity-catalog/metastores/${req.id ?? ""}`;
|
|
345
|
+
let resp;
|
|
346
|
+
const call = async (callSignal) => {
|
|
347
|
+
const headers = new Headers();
|
|
348
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
349
|
+
headers.set("User-Agent", this.userAgent);
|
|
350
|
+
resp = parseResponse(await executeHttpCall({
|
|
351
|
+
request: buildHttpRequest("GET", url, headers, callSignal),
|
|
352
|
+
httpClient,
|
|
353
|
+
logger: this.logger
|
|
354
|
+
}), unmarshalMetastoreInfoSchema);
|
|
355
|
+
};
|
|
356
|
+
await executeCall(call, options);
|
|
357
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
358
|
+
return resp;
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Gets information about a metastore.
|
|
362
|
+
* This summary includes the storage credential, the cloud vendor, the cloud region, and the global metastore ID.
|
|
363
|
+
*/
|
|
364
|
+
async getMetastoreSummary(_req, options) {
|
|
365
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
366
|
+
const url = `${host}/api/2.1/unity-catalog/metastore_summary`;
|
|
367
|
+
let resp;
|
|
368
|
+
const call = async (callSignal) => {
|
|
369
|
+
const headers = new Headers();
|
|
370
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
371
|
+
headers.set("User-Agent", this.userAgent);
|
|
372
|
+
resp = parseResponse(await executeHttpCall({
|
|
373
|
+
request: buildHttpRequest("GET", url, headers, callSignal),
|
|
374
|
+
httpClient,
|
|
375
|
+
logger: this.logger
|
|
376
|
+
}), unmarshalGetMetastoreSummaryResponseSchema);
|
|
377
|
+
};
|
|
378
|
+
await executeCall(call, options);
|
|
379
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
380
|
+
return resp;
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* Gets an array of the available metastores (as __MetastoreInfo__ objects). The caller must be an admin to retrieve this info.
|
|
384
|
+
* There is no guarantee of a specific ordering of the elements in the array.
|
|
385
|
+
*
|
|
386
|
+
* NOTE: we recommend using max_results=0 to use the paginated version of this API. Unpaginated calls will be deprecated soon.
|
|
387
|
+
*
|
|
388
|
+
* PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may contain zero results while still providing a next_page_token.
|
|
389
|
+
* Clients must continue reading pages until next_page_token is absent, which is the only indication that the end of results has been reached.
|
|
390
|
+
*/
|
|
391
|
+
async listMetastores(req, options) {
|
|
392
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
393
|
+
const url = `${host}/api/2.1/unity-catalog/metastores`;
|
|
394
|
+
const params = new URLSearchParams();
|
|
395
|
+
if (req.maxResults !== void 0) params.append("max_results", String(req.maxResults));
|
|
396
|
+
if (req.pageToken !== void 0) params.append("page_token", req.pageToken);
|
|
397
|
+
const query = params.toString();
|
|
398
|
+
const fullUrl = query !== "" ? `${url}?${query}` : url;
|
|
399
|
+
let resp;
|
|
400
|
+
const call = async (callSignal) => {
|
|
401
|
+
const headers = new Headers();
|
|
402
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
403
|
+
headers.set("User-Agent", this.userAgent);
|
|
404
|
+
resp = parseResponse(await executeHttpCall({
|
|
405
|
+
request: buildHttpRequest("GET", fullUrl, headers, callSignal),
|
|
406
|
+
httpClient,
|
|
407
|
+
logger: this.logger
|
|
408
|
+
}), unmarshalListMetastoresResponseSchema);
|
|
409
|
+
};
|
|
410
|
+
await executeCall(call, options);
|
|
411
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
412
|
+
return resp;
|
|
413
|
+
}
|
|
414
|
+
async *listMetastoresIter(req, options) {
|
|
415
|
+
const pageReq = { ...req };
|
|
416
|
+
for (;;) {
|
|
417
|
+
const resp = await this.listMetastores(pageReq, options);
|
|
418
|
+
for (const item of resp.metastores ?? []) yield item;
|
|
419
|
+
if (resp.nextPageToken === void 0 || resp.nextPageToken === "") return;
|
|
420
|
+
pageReq.pageToken = resp.nextPageToken;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Updates information for a specific metastore. The caller must be a metastore admin.
|
|
425
|
+
* If the __owner__ field is set to the empty string (**""**), the ownership is updated
|
|
426
|
+
* to the System User.
|
|
427
|
+
*/
|
|
428
|
+
async updateMetastore(req, options) {
|
|
429
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
430
|
+
const url = `${host}/api/2.1/unity-catalog/metastores/${req.id ?? ""}`;
|
|
431
|
+
const body = marshalRequest(req, marshalUpdateMetastoreRequestSchema);
|
|
432
|
+
let resp;
|
|
433
|
+
const call = async (callSignal) => {
|
|
434
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
435
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
436
|
+
headers.set("User-Agent", this.userAgent);
|
|
437
|
+
resp = parseResponse(await executeHttpCall({
|
|
438
|
+
request: buildHttpRequest("PATCH", url, headers, callSignal, body),
|
|
439
|
+
httpClient,
|
|
440
|
+
logger: this.logger
|
|
441
|
+
}), unmarshalMetastoreInfoSchema);
|
|
442
|
+
};
|
|
443
|
+
await executeCall(call, options);
|
|
444
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
445
|
+
return resp;
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* Updates a metastore assignment. This operation can be used to update __metastore_id__ or __default_catalog_name__
|
|
449
|
+
* for a specified Workspace, if the Workspace is already assigned a metastore.
|
|
450
|
+
* The caller must be an account admin to update __metastore_id__; otherwise, the caller can be a Workspace admin.
|
|
451
|
+
*/
|
|
452
|
+
async updateMetastoreAssignment(req, options) {
|
|
453
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
454
|
+
const url = `${host}/api/2.1/unity-catalog/workspaces/${String(req.workspaceId ?? "")}/metastore`;
|
|
455
|
+
const body = marshalRequest(req, marshalUpdateMetastoreAssignmentRequestSchema);
|
|
456
|
+
let resp;
|
|
457
|
+
const call = async (callSignal) => {
|
|
458
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
459
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
460
|
+
headers.set("User-Agent", this.userAgent);
|
|
461
|
+
resp = parseResponse(await executeHttpCall({
|
|
462
|
+
request: buildHttpRequest("PATCH", url, headers, callSignal, body),
|
|
463
|
+
httpClient,
|
|
464
|
+
logger: this.logger
|
|
465
|
+
}), unmarshalUpdateMetastoreAssignmentResponseSchema);
|
|
466
|
+
};
|
|
467
|
+
await executeCall(call, options);
|
|
468
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
469
|
+
return resp;
|
|
470
|
+
}
|
|
471
|
+
};
|
|
472
|
+
|
|
473
|
+
//#endregion
|
|
474
|
+
export { MetastoresClient };
|
|
590
475
|
//# sourceMappingURL=client.js.map
|