@databricks/sdk-sharing 0.0.0-dev → 0.1.0-dev.1
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 +178 -0
- package/dist/v1/client.d.ts.map +1 -0
- package/dist/v1/client.js +954 -0
- package/dist/v1/client.js.map +1 -0
- package/dist/v1/index.d.ts +4 -0
- package/dist/v1/index.d.ts.map +1 -0
- package/dist/v1/index.js +4 -0
- package/dist/v1/index.js.map +1 -0
- package/dist/v1/model.d.ts +1198 -0
- package/dist/v1/model.d.ts.map +1 -0
- package/dist/v1/model.js +1150 -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 +22 -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 +1217 -0
- package/src/v1/index.ts +93 -0
- package/src/v1/model.ts +2393 -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
|
@@ -0,0 +1,954 @@
|
|
|
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 { newHttpClient } from './transport';
|
|
6
|
+
import { buildHttpRequest, executeCall, executeHttpCall, marshalRequest, parseResponse, } from './utils';
|
|
7
|
+
import pkgJson from '../../package.json' with { type: 'json' };
|
|
8
|
+
import { marshalCreateProviderRequestSchema, marshalCreateRecipientRequestSchema, marshalCreateShareRequestSchema, marshalFederationPolicySchema, marshalRotateRecipientTokenRequestSchema, marshalUpdateProviderRequestSchema, marshalUpdateRecipientRequestSchema, marshalUpdateSharePermissionsRequestSchema, marshalUpdateShareRequestSchema, unmarshalDeleteProviderRequest_ResponseSchema, unmarshalDeleteRecipientRequest_ResponseSchema, unmarshalDeleteShareRequest_ResponseSchema, unmarshalFederationPolicySchema, unmarshalGetActivationUrlInfoRequest_ResponseSchema, unmarshalGetRecipientSharePermissionsRequest_ResponseSchema, unmarshalGetSharePermissionsRequest_ResponseSchema, unmarshalListFederationPoliciesResponseSchema, unmarshalListProviderShareAssetsResponseSchema, unmarshalListProviderSharesRequest_ResponseSchema, unmarshalListProvidersRequest_ResponseSchema, unmarshalListRecipientsRequest_ResponseSchema, unmarshalListSharesRequest_ResponseSchema, unmarshalProviderInfoSchema, unmarshalRecipientInfoSchema, unmarshalRetrieveToken_ResponseSchema, unmarshalShareInfoSchema, unmarshalUpdateSharePermissionsRequest_ResponseSchema, } from './model';
|
|
9
|
+
// Package identity segment for this client to be used in the User-Agent header.
|
|
10
|
+
const PACKAGE_SEGMENT = {
|
|
11
|
+
key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''),
|
|
12
|
+
value: pkgJson.version,
|
|
13
|
+
};
|
|
14
|
+
export class SharingClient {
|
|
15
|
+
host;
|
|
16
|
+
// Workspace ID used to route workspace-level calls on unified hosts (SPOG).
|
|
17
|
+
// When set, workspace-level methods send X-Databricks-Org-Id on every
|
|
18
|
+
// request.
|
|
19
|
+
workspaceId;
|
|
20
|
+
httpClient;
|
|
21
|
+
logger;
|
|
22
|
+
// User-Agent header value. Composed once at construction from
|
|
23
|
+
// createDefault() merged with this package's identity and the active
|
|
24
|
+
// credential's name.
|
|
25
|
+
userAgent;
|
|
26
|
+
constructor(options) {
|
|
27
|
+
if (options.host === undefined) {
|
|
28
|
+
throw new Error('Host is required.');
|
|
29
|
+
}
|
|
30
|
+
this.host = options.host.replace(/\/$/, '');
|
|
31
|
+
this.workspaceId = options.workspaceId;
|
|
32
|
+
this.logger = options.logger ?? new NoOpLogger();
|
|
33
|
+
const info = createDefault()
|
|
34
|
+
.with(PACKAGE_SEGMENT)
|
|
35
|
+
.with({ key: 'sdk-js-auth', value: AUTH_VERSION })
|
|
36
|
+
.with({ key: 'auth', value: options.credentials?.name() ?? 'default' });
|
|
37
|
+
this.userAgent = info.toString();
|
|
38
|
+
this.httpClient = newHttpClient(options);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Create a federation policy for an OIDC_FEDERATION recipient for sharing data from <Databricks> to non-<Databricks> recipients.
|
|
42
|
+
* The caller must be the owner of the recipient.
|
|
43
|
+
* When sharing data from <Databricks> to non-<Databricks> clients,
|
|
44
|
+
* you can define a federation policy to authenticate non-<Databricks> recipients.
|
|
45
|
+
* The federation policy validates OIDC claims in federated tokens and is defined at the recipient level.
|
|
46
|
+
* This enables secretless sharing clients to authenticate using OIDC tokens.
|
|
47
|
+
*
|
|
48
|
+
* Supported scenarios for federation policies:
|
|
49
|
+
* 1. **User-to-Machine (U2M) flow** (e.g., PowerBI): A user accesses a resource using their own identity.
|
|
50
|
+
* 2. **Machine-to-Machine (M2M) flow** (e.g., OAuth App): An OAuth App accesses a resource using its own identity,
|
|
51
|
+
* typically for tasks like running nightly jobs.
|
|
52
|
+
*
|
|
53
|
+
* For an overview, refer to:
|
|
54
|
+
* - Blog post: Overview of feature: https://www.databricks.com/blog/announcing-oidc-token-federation-enhanced-delta-sharing-security
|
|
55
|
+
*
|
|
56
|
+
* For detailed configuration guides based on your use case:
|
|
57
|
+
* - Creating a Federation Policy as a provider: https://docs.databricks.com/en/delta-sharing/create-recipient-oidc-fed
|
|
58
|
+
* - Configuration and usage for Machine-to-Machine (M2M) applications (e.g., Python Delta Sharing Client): https://docs.databricks.com/aws/en/delta-sharing/sharing-over-oidc-m2m
|
|
59
|
+
* - Configuration and usage for User-to-Machine (U2M) applications (e.g., PowerBI): https://docs.databricks.com/aws/en/delta-sharing/sharing-over-oidc-u2m
|
|
60
|
+
*/
|
|
61
|
+
async createFederationPolicy(req, options) {
|
|
62
|
+
const url = `${this.host}/api/2.0/data-sharing/recipients/${req.recipientName ?? ''}/federation-policies`;
|
|
63
|
+
const body = marshalRequest(req.policy, marshalFederationPolicySchema);
|
|
64
|
+
let resp;
|
|
65
|
+
const call = async (callSignal) => {
|
|
66
|
+
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
67
|
+
if (this.workspaceId !== undefined) {
|
|
68
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
69
|
+
}
|
|
70
|
+
headers.set('User-Agent', this.userAgent);
|
|
71
|
+
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
72
|
+
const respBody = await executeHttpCall({
|
|
73
|
+
request: httpReq,
|
|
74
|
+
httpClient: this.httpClient,
|
|
75
|
+
logger: this.logger,
|
|
76
|
+
});
|
|
77
|
+
resp = parseResponse(respBody, unmarshalFederationPolicySchema);
|
|
78
|
+
};
|
|
79
|
+
await executeCall(call, options);
|
|
80
|
+
if (resp === undefined) {
|
|
81
|
+
throw new Error('API call completed without a result.');
|
|
82
|
+
}
|
|
83
|
+
return resp;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Creates a new authentication provider minimally based on a name and authentication type.
|
|
87
|
+
* The caller must be an admin on the metastore.
|
|
88
|
+
*/
|
|
89
|
+
async createProvider(req, options) {
|
|
90
|
+
const url = `${this.host}/api/2.1/unity-catalog/providers`;
|
|
91
|
+
const body = marshalRequest(req, marshalCreateProviderRequestSchema);
|
|
92
|
+
let resp;
|
|
93
|
+
const call = async (callSignal) => {
|
|
94
|
+
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
95
|
+
if (this.workspaceId !== undefined) {
|
|
96
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
97
|
+
}
|
|
98
|
+
headers.set('User-Agent', this.userAgent);
|
|
99
|
+
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
100
|
+
const respBody = await executeHttpCall({
|
|
101
|
+
request: httpReq,
|
|
102
|
+
httpClient: this.httpClient,
|
|
103
|
+
logger: this.logger,
|
|
104
|
+
});
|
|
105
|
+
resp = parseResponse(respBody, unmarshalProviderInfoSchema);
|
|
106
|
+
};
|
|
107
|
+
await executeCall(call, options);
|
|
108
|
+
if (resp === undefined) {
|
|
109
|
+
throw new Error('API call completed without a result.');
|
|
110
|
+
}
|
|
111
|
+
return resp;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Creates a new recipient with the delta sharing authentication type in the metastore.
|
|
115
|
+
* The caller must be a metastore admin or have the **CREATE_RECIPIENT** privilege on the metastore.
|
|
116
|
+
*/
|
|
117
|
+
async createRecipient(req, options) {
|
|
118
|
+
const url = `${this.host}/api/2.1/unity-catalog/recipients`;
|
|
119
|
+
const body = marshalRequest(req, marshalCreateRecipientRequestSchema);
|
|
120
|
+
let resp;
|
|
121
|
+
const call = async (callSignal) => {
|
|
122
|
+
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
123
|
+
if (this.workspaceId !== undefined) {
|
|
124
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
125
|
+
}
|
|
126
|
+
headers.set('User-Agent', this.userAgent);
|
|
127
|
+
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
128
|
+
const respBody = await executeHttpCall({
|
|
129
|
+
request: httpReq,
|
|
130
|
+
httpClient: this.httpClient,
|
|
131
|
+
logger: this.logger,
|
|
132
|
+
});
|
|
133
|
+
resp = parseResponse(respBody, unmarshalRecipientInfoSchema);
|
|
134
|
+
};
|
|
135
|
+
await executeCall(call, options);
|
|
136
|
+
if (resp === undefined) {
|
|
137
|
+
throw new Error('API call completed without a result.');
|
|
138
|
+
}
|
|
139
|
+
return resp;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Creates a new share for data objects. Data objects can be added after creation with **update**.
|
|
143
|
+
* The caller must be a metastore admin or have the **CREATE_SHARE** privilege on the metastore.
|
|
144
|
+
*/
|
|
145
|
+
async createShare(req, options) {
|
|
146
|
+
const url = `${this.host}/api/2.1/unity-catalog/shares`;
|
|
147
|
+
const body = marshalRequest(req, marshalCreateShareRequestSchema);
|
|
148
|
+
let resp;
|
|
149
|
+
const call = async (callSignal) => {
|
|
150
|
+
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
151
|
+
if (this.workspaceId !== undefined) {
|
|
152
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
153
|
+
}
|
|
154
|
+
headers.set('User-Agent', this.userAgent);
|
|
155
|
+
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
156
|
+
const respBody = await executeHttpCall({
|
|
157
|
+
request: httpReq,
|
|
158
|
+
httpClient: this.httpClient,
|
|
159
|
+
logger: this.logger,
|
|
160
|
+
});
|
|
161
|
+
resp = parseResponse(respBody, unmarshalShareInfoSchema);
|
|
162
|
+
};
|
|
163
|
+
await executeCall(call, options);
|
|
164
|
+
if (resp === undefined) {
|
|
165
|
+
throw new Error('API call completed without a result.');
|
|
166
|
+
}
|
|
167
|
+
return resp;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Deletes an existing federation policy for an OIDC_FEDERATION recipient.
|
|
171
|
+
* The caller must be the owner of the recipient.
|
|
172
|
+
*/
|
|
173
|
+
async deleteFederationPolicy(req, options) {
|
|
174
|
+
const url = `${this.host}/api/2.0/data-sharing/recipients/${req.recipientName ?? ''}/federation-policies/${req.name ?? ''}`;
|
|
175
|
+
const call = async (callSignal) => {
|
|
176
|
+
const headers = new Headers();
|
|
177
|
+
if (this.workspaceId !== undefined) {
|
|
178
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
179
|
+
}
|
|
180
|
+
headers.set('User-Agent', this.userAgent);
|
|
181
|
+
const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
|
|
182
|
+
await executeHttpCall({
|
|
183
|
+
request: httpReq,
|
|
184
|
+
httpClient: this.httpClient,
|
|
185
|
+
logger: this.logger,
|
|
186
|
+
});
|
|
187
|
+
};
|
|
188
|
+
await executeCall(call, options);
|
|
189
|
+
}
|
|
190
|
+
/** Deletes an authentication provider, if the caller is a metastore admin or is the owner of the provider. */
|
|
191
|
+
async deleteProvider(req, options) {
|
|
192
|
+
const url = `${this.host}/api/2.1/unity-catalog/providers/${req.nameArg ?? ''}`;
|
|
193
|
+
let resp;
|
|
194
|
+
const call = async (callSignal) => {
|
|
195
|
+
const headers = new Headers();
|
|
196
|
+
if (this.workspaceId !== undefined) {
|
|
197
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
198
|
+
}
|
|
199
|
+
headers.set('User-Agent', this.userAgent);
|
|
200
|
+
const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
|
|
201
|
+
const respBody = await executeHttpCall({
|
|
202
|
+
request: httpReq,
|
|
203
|
+
httpClient: this.httpClient,
|
|
204
|
+
logger: this.logger,
|
|
205
|
+
});
|
|
206
|
+
resp = parseResponse(respBody, unmarshalDeleteProviderRequest_ResponseSchema);
|
|
207
|
+
};
|
|
208
|
+
await executeCall(call, options);
|
|
209
|
+
if (resp === undefined) {
|
|
210
|
+
throw new Error('API call completed without a result.');
|
|
211
|
+
}
|
|
212
|
+
return resp;
|
|
213
|
+
}
|
|
214
|
+
/** Deletes the specified recipient from the metastore. The caller must be the owner of the recipient. */
|
|
215
|
+
async deleteRecipient(req, options) {
|
|
216
|
+
const url = `${this.host}/api/2.1/unity-catalog/recipients/${req.name ?? ''}`;
|
|
217
|
+
let resp;
|
|
218
|
+
const call = async (callSignal) => {
|
|
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
|
+
const respBody = await executeHttpCall({
|
|
226
|
+
request: httpReq,
|
|
227
|
+
httpClient: this.httpClient,
|
|
228
|
+
logger: this.logger,
|
|
229
|
+
});
|
|
230
|
+
resp = parseResponse(respBody, unmarshalDeleteRecipientRequest_ResponseSchema);
|
|
231
|
+
};
|
|
232
|
+
await executeCall(call, options);
|
|
233
|
+
if (resp === undefined) {
|
|
234
|
+
throw new Error('API call completed without a result.');
|
|
235
|
+
}
|
|
236
|
+
return resp;
|
|
237
|
+
}
|
|
238
|
+
/** Deletes a data object share from the metastore. The caller must be an owner of the share. */
|
|
239
|
+
async deleteShare(req, options) {
|
|
240
|
+
const url = `${this.host}/api/2.1/unity-catalog/shares/${req.name ?? ''}`;
|
|
241
|
+
let resp;
|
|
242
|
+
const call = async (callSignal) => {
|
|
243
|
+
const headers = new Headers();
|
|
244
|
+
if (this.workspaceId !== undefined) {
|
|
245
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
246
|
+
}
|
|
247
|
+
headers.set('User-Agent', this.userAgent);
|
|
248
|
+
const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
|
|
249
|
+
const respBody = await executeHttpCall({
|
|
250
|
+
request: httpReq,
|
|
251
|
+
httpClient: this.httpClient,
|
|
252
|
+
logger: this.logger,
|
|
253
|
+
});
|
|
254
|
+
resp = parseResponse(respBody, unmarshalDeleteShareRequest_ResponseSchema);
|
|
255
|
+
};
|
|
256
|
+
await executeCall(call, options);
|
|
257
|
+
if (resp === undefined) {
|
|
258
|
+
throw new Error('API call completed without a result.');
|
|
259
|
+
}
|
|
260
|
+
return resp;
|
|
261
|
+
}
|
|
262
|
+
/** Gets an activation URL for a share. */
|
|
263
|
+
async getActivationUrlInfo(req, options) {
|
|
264
|
+
const url = `${this.host}/api/2.1/unity-catalog/public/data_sharing_activation_info/${req.activationUrl ?? ''}`;
|
|
265
|
+
let resp;
|
|
266
|
+
const call = async (callSignal) => {
|
|
267
|
+
const headers = new Headers();
|
|
268
|
+
if (this.workspaceId !== undefined) {
|
|
269
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
270
|
+
}
|
|
271
|
+
headers.set('User-Agent', this.userAgent);
|
|
272
|
+
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
|
|
273
|
+
const respBody = await executeHttpCall({
|
|
274
|
+
request: httpReq,
|
|
275
|
+
httpClient: this.httpClient,
|
|
276
|
+
logger: this.logger,
|
|
277
|
+
});
|
|
278
|
+
resp = parseResponse(respBody, unmarshalGetActivationUrlInfoRequest_ResponseSchema);
|
|
279
|
+
};
|
|
280
|
+
await executeCall(call, options);
|
|
281
|
+
if (resp === undefined) {
|
|
282
|
+
throw new Error('API call completed without a result.');
|
|
283
|
+
}
|
|
284
|
+
return resp;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Reads an existing federation policy for an OIDC_FEDERATION recipient for sharing data from <Databricks> to non-<Databricks> recipients.
|
|
288
|
+
* The caller must have read access to the recipient.
|
|
289
|
+
*/
|
|
290
|
+
async getFederationPolicy(req, options) {
|
|
291
|
+
const url = `${this.host}/api/2.0/data-sharing/recipients/${req.recipientName ?? ''}/federation-policies/${req.name ?? ''}`;
|
|
292
|
+
let resp;
|
|
293
|
+
const call = async (callSignal) => {
|
|
294
|
+
const headers = new Headers();
|
|
295
|
+
if (this.workspaceId !== undefined) {
|
|
296
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
297
|
+
}
|
|
298
|
+
headers.set('User-Agent', this.userAgent);
|
|
299
|
+
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
|
|
300
|
+
const respBody = await executeHttpCall({
|
|
301
|
+
request: httpReq,
|
|
302
|
+
httpClient: this.httpClient,
|
|
303
|
+
logger: this.logger,
|
|
304
|
+
});
|
|
305
|
+
resp = parseResponse(respBody, unmarshalFederationPolicySchema);
|
|
306
|
+
};
|
|
307
|
+
await executeCall(call, options);
|
|
308
|
+
if (resp === undefined) {
|
|
309
|
+
throw new Error('API call completed without a result.');
|
|
310
|
+
}
|
|
311
|
+
return resp;
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Gets a specific authentication provider.
|
|
315
|
+
* The caller must supply the name of the provider, and must either be a metastore admin or the owner of the provider.
|
|
316
|
+
*/
|
|
317
|
+
async getProvider(req, options) {
|
|
318
|
+
const url = `${this.host}/api/2.1/unity-catalog/providers/${req.nameArg ?? ''}`;
|
|
319
|
+
let resp;
|
|
320
|
+
const call = async (callSignal) => {
|
|
321
|
+
const headers = new Headers();
|
|
322
|
+
if (this.workspaceId !== undefined) {
|
|
323
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
324
|
+
}
|
|
325
|
+
headers.set('User-Agent', this.userAgent);
|
|
326
|
+
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
|
|
327
|
+
const respBody = await executeHttpCall({
|
|
328
|
+
request: httpReq,
|
|
329
|
+
httpClient: this.httpClient,
|
|
330
|
+
logger: this.logger,
|
|
331
|
+
});
|
|
332
|
+
resp = parseResponse(respBody, unmarshalProviderInfoSchema);
|
|
333
|
+
};
|
|
334
|
+
await executeCall(call, options);
|
|
335
|
+
if (resp === undefined) {
|
|
336
|
+
throw new Error('API call completed without a result.');
|
|
337
|
+
}
|
|
338
|
+
return resp;
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Gets a share recipient from the metastore. The caller must be one of:
|
|
342
|
+
* * A user with **USE_RECIPIENT** privilege on the metastore
|
|
343
|
+
* * The owner of the share recipient
|
|
344
|
+
* * A metastore admin
|
|
345
|
+
*/
|
|
346
|
+
async getRecipient(req, options) {
|
|
347
|
+
const url = `${this.host}/api/2.1/unity-catalog/recipients/${req.name ?? ''}`;
|
|
348
|
+
let resp;
|
|
349
|
+
const call = async (callSignal) => {
|
|
350
|
+
const headers = new Headers();
|
|
351
|
+
if (this.workspaceId !== undefined) {
|
|
352
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
353
|
+
}
|
|
354
|
+
headers.set('User-Agent', this.userAgent);
|
|
355
|
+
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
|
|
356
|
+
const respBody = await executeHttpCall({
|
|
357
|
+
request: httpReq,
|
|
358
|
+
httpClient: this.httpClient,
|
|
359
|
+
logger: this.logger,
|
|
360
|
+
});
|
|
361
|
+
resp = parseResponse(respBody, unmarshalRecipientInfoSchema);
|
|
362
|
+
};
|
|
363
|
+
await executeCall(call, options);
|
|
364
|
+
if (resp === undefined) {
|
|
365
|
+
throw new Error('API call completed without a result.');
|
|
366
|
+
}
|
|
367
|
+
return resp;
|
|
368
|
+
}
|
|
369
|
+
/** Gets the share permissions for the specified Recipient. The caller must have the **USE_RECIPIENT** privilege on the metastore or be the owner of the Recipient. */
|
|
370
|
+
async getRecipientSharePermissions(req, options) {
|
|
371
|
+
const url = `${this.host}/api/2.1/unity-catalog/recipients/${req.name ?? ''}/share-permissions`;
|
|
372
|
+
const params = new URLSearchParams();
|
|
373
|
+
if (req.maxResults !== undefined) {
|
|
374
|
+
params.append('max_results', String(req.maxResults));
|
|
375
|
+
}
|
|
376
|
+
if (req.pageToken !== undefined) {
|
|
377
|
+
params.append('page_token', req.pageToken);
|
|
378
|
+
}
|
|
379
|
+
const query = params.toString();
|
|
380
|
+
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
381
|
+
let resp;
|
|
382
|
+
const call = async (callSignal) => {
|
|
383
|
+
const headers = new Headers();
|
|
384
|
+
if (this.workspaceId !== undefined) {
|
|
385
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
386
|
+
}
|
|
387
|
+
headers.set('User-Agent', this.userAgent);
|
|
388
|
+
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
389
|
+
const respBody = await executeHttpCall({
|
|
390
|
+
request: httpReq,
|
|
391
|
+
httpClient: this.httpClient,
|
|
392
|
+
logger: this.logger,
|
|
393
|
+
});
|
|
394
|
+
resp = parseResponse(respBody, unmarshalGetRecipientSharePermissionsRequest_ResponseSchema);
|
|
395
|
+
};
|
|
396
|
+
await executeCall(call, options);
|
|
397
|
+
if (resp === undefined) {
|
|
398
|
+
throw new Error('API call completed without a result.');
|
|
399
|
+
}
|
|
400
|
+
return resp;
|
|
401
|
+
}
|
|
402
|
+
/** Gets a data object share from the metastore. The caller must have the USE_SHARE privilege on the metastore or be the owner of the share. */
|
|
403
|
+
async getShare(req, options) {
|
|
404
|
+
const url = `${this.host}/api/2.1/unity-catalog/shares/${req.name ?? ''}`;
|
|
405
|
+
const params = new URLSearchParams();
|
|
406
|
+
if (req.includeSharedData !== undefined) {
|
|
407
|
+
params.append('include_shared_data', String(req.includeSharedData));
|
|
408
|
+
}
|
|
409
|
+
const query = params.toString();
|
|
410
|
+
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
411
|
+
let resp;
|
|
412
|
+
const call = async (callSignal) => {
|
|
413
|
+
const headers = new Headers();
|
|
414
|
+
if (this.workspaceId !== undefined) {
|
|
415
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
416
|
+
}
|
|
417
|
+
headers.set('User-Agent', this.userAgent);
|
|
418
|
+
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
419
|
+
const respBody = await executeHttpCall({
|
|
420
|
+
request: httpReq,
|
|
421
|
+
httpClient: this.httpClient,
|
|
422
|
+
logger: this.logger,
|
|
423
|
+
});
|
|
424
|
+
resp = parseResponse(respBody, unmarshalShareInfoSchema);
|
|
425
|
+
};
|
|
426
|
+
await executeCall(call, options);
|
|
427
|
+
if (resp === undefined) {
|
|
428
|
+
throw new Error('API call completed without a result.');
|
|
429
|
+
}
|
|
430
|
+
return resp;
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* Gets the permissions for a data share from the metastore.
|
|
434
|
+
* The caller must have the USE_SHARE privilege on the metastore or be the owner of the share.
|
|
435
|
+
*/
|
|
436
|
+
async getSharePermissions(req, options) {
|
|
437
|
+
const url = `${this.host}/api/2.1/unity-catalog/shares/${req.name ?? ''}/permissions`;
|
|
438
|
+
const params = new URLSearchParams();
|
|
439
|
+
if (req.maxResults !== undefined) {
|
|
440
|
+
params.append('max_results', String(req.maxResults));
|
|
441
|
+
}
|
|
442
|
+
if (req.pageToken !== undefined) {
|
|
443
|
+
params.append('page_token', req.pageToken);
|
|
444
|
+
}
|
|
445
|
+
const query = params.toString();
|
|
446
|
+
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
447
|
+
let resp;
|
|
448
|
+
const call = async (callSignal) => {
|
|
449
|
+
const headers = new Headers();
|
|
450
|
+
if (this.workspaceId !== undefined) {
|
|
451
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
452
|
+
}
|
|
453
|
+
headers.set('User-Agent', this.userAgent);
|
|
454
|
+
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
455
|
+
const respBody = await executeHttpCall({
|
|
456
|
+
request: httpReq,
|
|
457
|
+
httpClient: this.httpClient,
|
|
458
|
+
logger: this.logger,
|
|
459
|
+
});
|
|
460
|
+
resp = parseResponse(respBody, unmarshalGetSharePermissionsRequest_ResponseSchema);
|
|
461
|
+
};
|
|
462
|
+
await executeCall(call, options);
|
|
463
|
+
if (resp === undefined) {
|
|
464
|
+
throw new Error('API call completed without a result.');
|
|
465
|
+
}
|
|
466
|
+
return resp;
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* Lists federation policies for an OIDC_FEDERATION recipient for sharing data from <Databricks> to non-<Databricks> recipients.
|
|
470
|
+
* The caller must have read access to the recipient.
|
|
471
|
+
*/
|
|
472
|
+
async listFederationPolicies(req, options) {
|
|
473
|
+
const url = `${this.host}/api/2.0/data-sharing/recipients/${req.recipientName ?? ''}/federation-policies`;
|
|
474
|
+
const params = new URLSearchParams();
|
|
475
|
+
if (req.maxResults !== undefined) {
|
|
476
|
+
params.append('max_results', String(req.maxResults));
|
|
477
|
+
}
|
|
478
|
+
if (req.pageToken !== undefined) {
|
|
479
|
+
params.append('page_token', req.pageToken);
|
|
480
|
+
}
|
|
481
|
+
const query = params.toString();
|
|
482
|
+
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
483
|
+
let resp;
|
|
484
|
+
const call = async (callSignal) => {
|
|
485
|
+
const headers = new Headers();
|
|
486
|
+
if (this.workspaceId !== undefined) {
|
|
487
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
488
|
+
}
|
|
489
|
+
headers.set('User-Agent', this.userAgent);
|
|
490
|
+
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
491
|
+
const respBody = await executeHttpCall({
|
|
492
|
+
request: httpReq,
|
|
493
|
+
httpClient: this.httpClient,
|
|
494
|
+
logger: this.logger,
|
|
495
|
+
});
|
|
496
|
+
resp = parseResponse(respBody, unmarshalListFederationPoliciesResponseSchema);
|
|
497
|
+
};
|
|
498
|
+
await executeCall(call, options);
|
|
499
|
+
if (resp === undefined) {
|
|
500
|
+
throw new Error('API call completed without a result.');
|
|
501
|
+
}
|
|
502
|
+
return resp;
|
|
503
|
+
}
|
|
504
|
+
async *listFederationPoliciesIter(req, options) {
|
|
505
|
+
const pageReq = { ...req };
|
|
506
|
+
for (;;) {
|
|
507
|
+
const resp = await this.listFederationPolicies(pageReq, options);
|
|
508
|
+
for (const item of resp.policies ?? []) {
|
|
509
|
+
yield item;
|
|
510
|
+
}
|
|
511
|
+
if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
|
|
512
|
+
return;
|
|
513
|
+
}
|
|
514
|
+
pageReq.pageToken = resp.nextPageToken;
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* Get arrays of assets associated with a specified provider's share.
|
|
519
|
+
* The caller is the recipient of the share.
|
|
520
|
+
*/
|
|
521
|
+
async listProviderShareAssets(req, options) {
|
|
522
|
+
const url = `${this.host}/api/2.1/data-sharing/providers/${req.providerNameArg ?? ''}/shares/${req.shareNameArg ?? ''}`;
|
|
523
|
+
const params = new URLSearchParams();
|
|
524
|
+
if (req.tableMaxResults !== undefined) {
|
|
525
|
+
params.append('table_max_results', String(req.tableMaxResults));
|
|
526
|
+
}
|
|
527
|
+
if (req.functionMaxResults !== undefined) {
|
|
528
|
+
params.append('function_max_results', String(req.functionMaxResults));
|
|
529
|
+
}
|
|
530
|
+
if (req.volumeMaxResults !== undefined) {
|
|
531
|
+
params.append('volume_max_results', String(req.volumeMaxResults));
|
|
532
|
+
}
|
|
533
|
+
if (req.notebookMaxResults !== undefined) {
|
|
534
|
+
params.append('notebook_max_results', String(req.notebookMaxResults));
|
|
535
|
+
}
|
|
536
|
+
const query = params.toString();
|
|
537
|
+
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
538
|
+
let resp;
|
|
539
|
+
const call = async (callSignal) => {
|
|
540
|
+
const headers = new Headers();
|
|
541
|
+
if (this.workspaceId !== undefined) {
|
|
542
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
543
|
+
}
|
|
544
|
+
headers.set('User-Agent', this.userAgent);
|
|
545
|
+
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
546
|
+
const respBody = await executeHttpCall({
|
|
547
|
+
request: httpReq,
|
|
548
|
+
httpClient: this.httpClient,
|
|
549
|
+
logger: this.logger,
|
|
550
|
+
});
|
|
551
|
+
resp = parseResponse(respBody, unmarshalListProviderShareAssetsResponseSchema);
|
|
552
|
+
};
|
|
553
|
+
await executeCall(call, options);
|
|
554
|
+
if (resp === undefined) {
|
|
555
|
+
throw new Error('API call completed without a result.');
|
|
556
|
+
}
|
|
557
|
+
return resp;
|
|
558
|
+
}
|
|
559
|
+
/**
|
|
560
|
+
* Gets an array of a specified provider's shares within the metastore where:
|
|
561
|
+
*
|
|
562
|
+
* * the caller is a metastore admin, or
|
|
563
|
+
* * the caller is the owner.
|
|
564
|
+
*/
|
|
565
|
+
async listProviderShares(req, options) {
|
|
566
|
+
const url = `${this.host}/api/2.1/unity-catalog/providers/${req.providerNameArg ?? ''}/shares`;
|
|
567
|
+
const params = new URLSearchParams();
|
|
568
|
+
if (req.maxResults !== undefined) {
|
|
569
|
+
params.append('max_results', String(req.maxResults));
|
|
570
|
+
}
|
|
571
|
+
if (req.pageToken !== undefined) {
|
|
572
|
+
params.append('page_token', req.pageToken);
|
|
573
|
+
}
|
|
574
|
+
const query = params.toString();
|
|
575
|
+
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
576
|
+
let resp;
|
|
577
|
+
const call = async (callSignal) => {
|
|
578
|
+
const headers = new Headers();
|
|
579
|
+
if (this.workspaceId !== undefined) {
|
|
580
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
581
|
+
}
|
|
582
|
+
headers.set('User-Agent', this.userAgent);
|
|
583
|
+
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
584
|
+
const respBody = await executeHttpCall({
|
|
585
|
+
request: httpReq,
|
|
586
|
+
httpClient: this.httpClient,
|
|
587
|
+
logger: this.logger,
|
|
588
|
+
});
|
|
589
|
+
resp = parseResponse(respBody, unmarshalListProviderSharesRequest_ResponseSchema);
|
|
590
|
+
};
|
|
591
|
+
await executeCall(call, options);
|
|
592
|
+
if (resp === undefined) {
|
|
593
|
+
throw new Error('API call completed without a result.');
|
|
594
|
+
}
|
|
595
|
+
return resp;
|
|
596
|
+
}
|
|
597
|
+
async *listProviderSharesIter(req, options) {
|
|
598
|
+
const pageReq = { ...req };
|
|
599
|
+
for (;;) {
|
|
600
|
+
const resp = await this.listProviderShares(pageReq, options);
|
|
601
|
+
for (const item of resp.shares ?? []) {
|
|
602
|
+
yield item;
|
|
603
|
+
}
|
|
604
|
+
if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
|
|
605
|
+
return;
|
|
606
|
+
}
|
|
607
|
+
pageReq.pageToken = resp.nextPageToken;
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
/**
|
|
611
|
+
* Gets an array of available authentication providers.
|
|
612
|
+
* The caller must either be a metastore admin, have the **USE_PROVIDER** privilege on the providers,
|
|
613
|
+
* or be the owner of the providers. Providers not owned by the caller and for which the caller does
|
|
614
|
+
* not have the **USE_PROVIDER** privilege are not included in the response.
|
|
615
|
+
* There is no guarantee of a specific ordering of the elements in the array.
|
|
616
|
+
*/
|
|
617
|
+
async listProviders(req, options) {
|
|
618
|
+
const url = `${this.host}/api/2.1/unity-catalog/providers`;
|
|
619
|
+
const params = new URLSearchParams();
|
|
620
|
+
if (req.dataProviderGlobalMetastoreId !== undefined) {
|
|
621
|
+
params.append('data_provider_global_metastore_id', req.dataProviderGlobalMetastoreId);
|
|
622
|
+
}
|
|
623
|
+
if (req.maxResults !== undefined) {
|
|
624
|
+
params.append('max_results', String(req.maxResults));
|
|
625
|
+
}
|
|
626
|
+
if (req.pageToken !== undefined) {
|
|
627
|
+
params.append('page_token', req.pageToken);
|
|
628
|
+
}
|
|
629
|
+
const query = params.toString();
|
|
630
|
+
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
631
|
+
let resp;
|
|
632
|
+
const call = async (callSignal) => {
|
|
633
|
+
const headers = new Headers();
|
|
634
|
+
if (this.workspaceId !== undefined) {
|
|
635
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
636
|
+
}
|
|
637
|
+
headers.set('User-Agent', this.userAgent);
|
|
638
|
+
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
639
|
+
const respBody = await executeHttpCall({
|
|
640
|
+
request: httpReq,
|
|
641
|
+
httpClient: this.httpClient,
|
|
642
|
+
logger: this.logger,
|
|
643
|
+
});
|
|
644
|
+
resp = parseResponse(respBody, unmarshalListProvidersRequest_ResponseSchema);
|
|
645
|
+
};
|
|
646
|
+
await executeCall(call, options);
|
|
647
|
+
if (resp === undefined) {
|
|
648
|
+
throw new Error('API call completed without a result.');
|
|
649
|
+
}
|
|
650
|
+
return resp;
|
|
651
|
+
}
|
|
652
|
+
async *listProvidersIter(req, options) {
|
|
653
|
+
const pageReq = { ...req };
|
|
654
|
+
for (;;) {
|
|
655
|
+
const resp = await this.listProviders(pageReq, options);
|
|
656
|
+
for (const item of resp.providers ?? []) {
|
|
657
|
+
yield item;
|
|
658
|
+
}
|
|
659
|
+
if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
|
|
660
|
+
return;
|
|
661
|
+
}
|
|
662
|
+
pageReq.pageToken = resp.nextPageToken;
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
/**
|
|
666
|
+
* Gets an array of all share recipients within the current metastore where:
|
|
667
|
+
*
|
|
668
|
+
* * the caller is a metastore admin, or
|
|
669
|
+
* * the caller is the owner.
|
|
670
|
+
* There is no guarantee of a specific ordering of the elements in the array.
|
|
671
|
+
*/
|
|
672
|
+
async listRecipients(req, options) {
|
|
673
|
+
const url = `${this.host}/api/2.1/unity-catalog/recipients`;
|
|
674
|
+
const params = new URLSearchParams();
|
|
675
|
+
if (req.dataRecipientGlobalMetastoreId !== undefined) {
|
|
676
|
+
params.append('data_recipient_global_metastore_id', req.dataRecipientGlobalMetastoreId);
|
|
677
|
+
}
|
|
678
|
+
if (req.maxResults !== undefined) {
|
|
679
|
+
params.append('max_results', String(req.maxResults));
|
|
680
|
+
}
|
|
681
|
+
if (req.pageToken !== undefined) {
|
|
682
|
+
params.append('page_token', req.pageToken);
|
|
683
|
+
}
|
|
684
|
+
const query = params.toString();
|
|
685
|
+
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
686
|
+
let resp;
|
|
687
|
+
const call = async (callSignal) => {
|
|
688
|
+
const headers = new Headers();
|
|
689
|
+
if (this.workspaceId !== undefined) {
|
|
690
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
691
|
+
}
|
|
692
|
+
headers.set('User-Agent', this.userAgent);
|
|
693
|
+
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
694
|
+
const respBody = await executeHttpCall({
|
|
695
|
+
request: httpReq,
|
|
696
|
+
httpClient: this.httpClient,
|
|
697
|
+
logger: this.logger,
|
|
698
|
+
});
|
|
699
|
+
resp = parseResponse(respBody, unmarshalListRecipientsRequest_ResponseSchema);
|
|
700
|
+
};
|
|
701
|
+
await executeCall(call, options);
|
|
702
|
+
if (resp === undefined) {
|
|
703
|
+
throw new Error('API call completed without a result.');
|
|
704
|
+
}
|
|
705
|
+
return resp;
|
|
706
|
+
}
|
|
707
|
+
async *listRecipientsIter(req, options) {
|
|
708
|
+
const pageReq = { ...req };
|
|
709
|
+
for (;;) {
|
|
710
|
+
const resp = await this.listRecipients(pageReq, options);
|
|
711
|
+
for (const item of resp.recipients ?? []) {
|
|
712
|
+
yield item;
|
|
713
|
+
}
|
|
714
|
+
if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
|
|
715
|
+
return;
|
|
716
|
+
}
|
|
717
|
+
pageReq.pageToken = resp.nextPageToken;
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
/**
|
|
721
|
+
* Gets an array of data object shares from the metastore. If the caller has the USE_SHARE privilege on the metastore, all shares are returned. Otherwise, only shares owned by the caller are returned.
|
|
722
|
+
* There is no guarantee of a specific ordering of the elements in the array.
|
|
723
|
+
*/
|
|
724
|
+
async listShares(req, options) {
|
|
725
|
+
const url = `${this.host}/api/2.1/unity-catalog/shares`;
|
|
726
|
+
const params = new URLSearchParams();
|
|
727
|
+
if (req.maxResults !== undefined) {
|
|
728
|
+
params.append('max_results', String(req.maxResults));
|
|
729
|
+
}
|
|
730
|
+
if (req.pageToken !== undefined) {
|
|
731
|
+
params.append('page_token', req.pageToken);
|
|
732
|
+
}
|
|
733
|
+
const query = params.toString();
|
|
734
|
+
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
735
|
+
let resp;
|
|
736
|
+
const call = async (callSignal) => {
|
|
737
|
+
const headers = new Headers();
|
|
738
|
+
if (this.workspaceId !== undefined) {
|
|
739
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
740
|
+
}
|
|
741
|
+
headers.set('User-Agent', this.userAgent);
|
|
742
|
+
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
743
|
+
const respBody = await executeHttpCall({
|
|
744
|
+
request: httpReq,
|
|
745
|
+
httpClient: this.httpClient,
|
|
746
|
+
logger: this.logger,
|
|
747
|
+
});
|
|
748
|
+
resp = parseResponse(respBody, unmarshalListSharesRequest_ResponseSchema);
|
|
749
|
+
};
|
|
750
|
+
await executeCall(call, options);
|
|
751
|
+
if (resp === undefined) {
|
|
752
|
+
throw new Error('API call completed without a result.');
|
|
753
|
+
}
|
|
754
|
+
return resp;
|
|
755
|
+
}
|
|
756
|
+
async *listSharesIter(req, options) {
|
|
757
|
+
const pageReq = { ...req };
|
|
758
|
+
for (;;) {
|
|
759
|
+
const resp = await this.listShares(pageReq, options);
|
|
760
|
+
for (const item of resp.shares ?? []) {
|
|
761
|
+
yield item;
|
|
762
|
+
}
|
|
763
|
+
if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
|
|
764
|
+
return;
|
|
765
|
+
}
|
|
766
|
+
pageReq.pageToken = resp.nextPageToken;
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
/**
|
|
770
|
+
* Retrieve access token with an activation url.
|
|
771
|
+
* This is a public API without any authentication.
|
|
772
|
+
*/
|
|
773
|
+
async retrieveAccessToken(req, options) {
|
|
774
|
+
const url = `${this.host}/api/2.1/unity-catalog/public/data_sharing_activation/${req.activationUrl ?? ''}`;
|
|
775
|
+
let resp;
|
|
776
|
+
const call = async (callSignal) => {
|
|
777
|
+
const headers = new Headers();
|
|
778
|
+
if (this.workspaceId !== undefined) {
|
|
779
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
780
|
+
}
|
|
781
|
+
headers.set('User-Agent', this.userAgent);
|
|
782
|
+
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
|
|
783
|
+
const respBody = await executeHttpCall({
|
|
784
|
+
request: httpReq,
|
|
785
|
+
httpClient: this.httpClient,
|
|
786
|
+
logger: this.logger,
|
|
787
|
+
});
|
|
788
|
+
resp = parseResponse(respBody, unmarshalRetrieveToken_ResponseSchema);
|
|
789
|
+
};
|
|
790
|
+
await executeCall(call, options);
|
|
791
|
+
if (resp === undefined) {
|
|
792
|
+
throw new Error('API call completed without a result.');
|
|
793
|
+
}
|
|
794
|
+
return resp;
|
|
795
|
+
}
|
|
796
|
+
/**
|
|
797
|
+
* Refreshes the specified recipient's delta sharing authentication token with the provided token info.
|
|
798
|
+
* The caller must be the owner of the recipient.
|
|
799
|
+
*/
|
|
800
|
+
async rotateRecipientToken(req, options) {
|
|
801
|
+
const url = `${this.host}/api/2.1/unity-catalog/recipients/${req.name ?? ''}/rotate-token`;
|
|
802
|
+
const body = marshalRequest(req, marshalRotateRecipientTokenRequestSchema);
|
|
803
|
+
let resp;
|
|
804
|
+
const call = async (callSignal) => {
|
|
805
|
+
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
806
|
+
if (this.workspaceId !== undefined) {
|
|
807
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
808
|
+
}
|
|
809
|
+
headers.set('User-Agent', this.userAgent);
|
|
810
|
+
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
811
|
+
const respBody = await executeHttpCall({
|
|
812
|
+
request: httpReq,
|
|
813
|
+
httpClient: this.httpClient,
|
|
814
|
+
logger: this.logger,
|
|
815
|
+
});
|
|
816
|
+
resp = parseResponse(respBody, unmarshalRecipientInfoSchema);
|
|
817
|
+
};
|
|
818
|
+
await executeCall(call, options);
|
|
819
|
+
if (resp === undefined) {
|
|
820
|
+
throw new Error('API call completed without a result.');
|
|
821
|
+
}
|
|
822
|
+
return resp;
|
|
823
|
+
}
|
|
824
|
+
/**
|
|
825
|
+
* Updates the information for an authentication provider, if the caller is a metastore admin or is the owner of the provider.
|
|
826
|
+
* If the update changes the provider name, the caller must be both a metastore admin and the owner of the provider.
|
|
827
|
+
*/
|
|
828
|
+
async updateProvider(req, options) {
|
|
829
|
+
const url = `${this.host}/api/2.1/unity-catalog/providers/${req.nameArg ?? ''}`;
|
|
830
|
+
const body = marshalRequest(req, marshalUpdateProviderRequestSchema);
|
|
831
|
+
let resp;
|
|
832
|
+
const call = async (callSignal) => {
|
|
833
|
+
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
834
|
+
if (this.workspaceId !== undefined) {
|
|
835
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
836
|
+
}
|
|
837
|
+
headers.set('User-Agent', this.userAgent);
|
|
838
|
+
const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
|
|
839
|
+
const respBody = await executeHttpCall({
|
|
840
|
+
request: httpReq,
|
|
841
|
+
httpClient: this.httpClient,
|
|
842
|
+
logger: this.logger,
|
|
843
|
+
});
|
|
844
|
+
resp = parseResponse(respBody, unmarshalProviderInfoSchema);
|
|
845
|
+
};
|
|
846
|
+
await executeCall(call, options);
|
|
847
|
+
if (resp === undefined) {
|
|
848
|
+
throw new Error('API call completed without a result.');
|
|
849
|
+
}
|
|
850
|
+
return resp;
|
|
851
|
+
}
|
|
852
|
+
/**
|
|
853
|
+
* Updates an existing recipient in the metastore. The caller must be a metastore admin or the owner of the recipient.
|
|
854
|
+
* If the recipient name will be updated, the user must be both a metastore admin and the owner of the recipient.
|
|
855
|
+
*/
|
|
856
|
+
async updateRecipient(req, options) {
|
|
857
|
+
const url = `${this.host}/api/2.1/unity-catalog/recipients/${req.nameArg ?? ''}`;
|
|
858
|
+
const body = marshalRequest(req, marshalUpdateRecipientRequestSchema);
|
|
859
|
+
let resp;
|
|
860
|
+
const call = async (callSignal) => {
|
|
861
|
+
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
862
|
+
if (this.workspaceId !== undefined) {
|
|
863
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
864
|
+
}
|
|
865
|
+
headers.set('User-Agent', this.userAgent);
|
|
866
|
+
const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
|
|
867
|
+
const respBody = await executeHttpCall({
|
|
868
|
+
request: httpReq,
|
|
869
|
+
httpClient: this.httpClient,
|
|
870
|
+
logger: this.logger,
|
|
871
|
+
});
|
|
872
|
+
resp = parseResponse(respBody, unmarshalRecipientInfoSchema);
|
|
873
|
+
};
|
|
874
|
+
await executeCall(call, options);
|
|
875
|
+
if (resp === undefined) {
|
|
876
|
+
throw new Error('API call completed without a result.');
|
|
877
|
+
}
|
|
878
|
+
return resp;
|
|
879
|
+
}
|
|
880
|
+
/**
|
|
881
|
+
* Updates the share with the changes and data objects in the request.
|
|
882
|
+
* The caller must be the owner of the share or a metastore admin.
|
|
883
|
+
*
|
|
884
|
+
* When the caller is a metastore admin, only the __owner__ field can be updated.
|
|
885
|
+
*
|
|
886
|
+
* In the case the share name is changed, **updateShare** requires that the caller is the owner of the share
|
|
887
|
+
* and has the CREATE_SHARE privilege.
|
|
888
|
+
*
|
|
889
|
+
* If there are notebook files in the share, the __storage_root__ field cannot be updated.
|
|
890
|
+
*
|
|
891
|
+
* For each table that is added through this method, the share owner must also have **SELECT** privilege on the table.
|
|
892
|
+
* This privilege must be maintained indefinitely for recipients to be able to access the table.
|
|
893
|
+
* Typically, you should use a group as the share owner.
|
|
894
|
+
*
|
|
895
|
+
* Table removals through **update** do not require additional privileges.
|
|
896
|
+
*/
|
|
897
|
+
async updateShare(req, options) {
|
|
898
|
+
const url = `${this.host}/api/2.1/unity-catalog/shares/${req.nameArg ?? ''}`;
|
|
899
|
+
const body = marshalRequest(req, marshalUpdateShareRequestSchema);
|
|
900
|
+
let resp;
|
|
901
|
+
const call = async (callSignal) => {
|
|
902
|
+
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
903
|
+
if (this.workspaceId !== undefined) {
|
|
904
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
905
|
+
}
|
|
906
|
+
headers.set('User-Agent', this.userAgent);
|
|
907
|
+
const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
|
|
908
|
+
const respBody = await executeHttpCall({
|
|
909
|
+
request: httpReq,
|
|
910
|
+
httpClient: this.httpClient,
|
|
911
|
+
logger: this.logger,
|
|
912
|
+
});
|
|
913
|
+
resp = parseResponse(respBody, unmarshalShareInfoSchema);
|
|
914
|
+
};
|
|
915
|
+
await executeCall(call, options);
|
|
916
|
+
if (resp === undefined) {
|
|
917
|
+
throw new Error('API call completed without a result.');
|
|
918
|
+
}
|
|
919
|
+
return resp;
|
|
920
|
+
}
|
|
921
|
+
/**
|
|
922
|
+
* Updates the permissions for a data share in the metastore.
|
|
923
|
+
* The caller must have both the USE_SHARE and SET_SHARE_PERMISSION privileges on the metastore,
|
|
924
|
+
* or be the owner of the share.
|
|
925
|
+
*
|
|
926
|
+
* For new recipient grants, the user must also be the owner of the recipients.
|
|
927
|
+
* recipient revocations do not require additional privileges.
|
|
928
|
+
*/
|
|
929
|
+
async updateSharePermissions(req, options) {
|
|
930
|
+
const url = `${this.host}/api/2.1/unity-catalog/shares/${req.name ?? ''}/permissions`;
|
|
931
|
+
const body = marshalRequest(req, marshalUpdateSharePermissionsRequestSchema);
|
|
932
|
+
let resp;
|
|
933
|
+
const call = async (callSignal) => {
|
|
934
|
+
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
935
|
+
if (this.workspaceId !== undefined) {
|
|
936
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
937
|
+
}
|
|
938
|
+
headers.set('User-Agent', this.userAgent);
|
|
939
|
+
const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
|
|
940
|
+
const respBody = await executeHttpCall({
|
|
941
|
+
request: httpReq,
|
|
942
|
+
httpClient: this.httpClient,
|
|
943
|
+
logger: this.logger,
|
|
944
|
+
});
|
|
945
|
+
resp = parseResponse(respBody, unmarshalUpdateSharePermissionsRequest_ResponseSchema);
|
|
946
|
+
};
|
|
947
|
+
await executeCall(call, options);
|
|
948
|
+
if (resp === undefined) {
|
|
949
|
+
throw new Error('API call completed without a result.');
|
|
950
|
+
}
|
|
951
|
+
return resp;
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
//# sourceMappingURL=client.js.map
|