@databricks/sdk-scim 0.1.0-dev.4 → 0.2.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/README.md +23 -0
- package/dist/v1/client.d.ts +3 -4
- package/dist/v1/client.d.ts.map +1 -1
- package/dist/v1/client.js +180 -145
- package/dist/v1/client.js.map +1 -1
- package/dist/v1/transport.d.ts +30 -2
- package/dist/v1/transport.d.ts.map +1 -1
- package/dist/v1/transport.js +33 -16
- package/dist/v1/transport.js.map +1 -1
- package/package.json +9 -4
package/dist/v1/client.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { VERSION as AUTH_VERSION } from '@databricks/sdk-auth';
|
|
3
3
|
import { createDefault } from '@databricks/sdk-core/clientinfo';
|
|
4
4
|
import { NoOpLogger } from '@databricks/sdk-core/logger';
|
|
5
|
-
import {
|
|
5
|
+
import { resolveClientConfig } from './transport';
|
|
6
6
|
import { buildHttpRequest, executeCall, executeHttpCall, marshalRequest, parseResponse, } from './utils';
|
|
7
7
|
import pkgJson from '../../package.json' with { type: 'json' };
|
|
8
8
|
import { marshalCreateAccountGroupRequestSchema, marshalCreateAccountServicePrincipalRequestSchema, marshalCreateAccountUserRequestSchema, marshalCreateGroupRequestSchema, marshalCreateServicePrincipalRequestSchema, marshalCreateUserRequestSchema, marshalPasswordPermissionsRequestSchema, marshalPatchAccountGroupRequestSchema, marshalPatchAccountServicePrincipalRequestSchema, marshalPatchAccountUserRequestSchema, marshalPatchGroupRequestSchema, marshalPatchServicePrincipalRequestSchema, marshalPatchUserRequestSchema, marshalUpdateAccountGroupRequestSchema, marshalUpdateAccountServicePrincipalRequestSchema, marshalUpdateAccountUserRequestSchema, marshalUpdateGroupRequestSchema, marshalUpdateServicePrincipalRequestSchema, marshalUpdateUserRequestSchema, unmarshalAccountGroupSchema, unmarshalAccountServicePrincipalSchema, unmarshalAccountUserSchema, unmarshalGetPasswordPermissionLevelsResponseSchema, unmarshalGroupSchema, unmarshalListAccountGroupsResponseSchema, unmarshalListAccountServicePrincipalsResponseSchema, unmarshalListAccountUsersResponseSchema, unmarshalListGroupsResponseSchema, unmarshalListServicePrincipalResponseSchema, unmarshalListUsersResponseSchema, unmarshalPasswordPermissionsSchema, unmarshalServicePrincipalSchema, unmarshalUserSchema, } from './model';
|
|
@@ -12,38 +12,33 @@ const PACKAGE_SEGMENT = {
|
|
|
12
12
|
value: pkgJson.version,
|
|
13
13
|
};
|
|
14
14
|
export class ScimClient {
|
|
15
|
-
|
|
16
|
-
// Fallback for endpoints whose path contains {account_id}. If the request
|
|
17
|
-
// already carries an accountId, that value wins.
|
|
18
|
-
accountId;
|
|
19
|
-
// Workspace ID used to route workspace-level calls on unified hosts (SPOG).
|
|
20
|
-
// When set, workspace-level methods send X-Databricks-Org-Id on every
|
|
21
|
-
// request.
|
|
22
|
-
workspaceId;
|
|
23
|
-
httpClient;
|
|
15
|
+
options;
|
|
24
16
|
logger;
|
|
25
17
|
// User-Agent header value. Composed once at construction from
|
|
26
18
|
// createDefault() merged with this package's identity and the active
|
|
27
19
|
// credential's name.
|
|
28
20
|
userAgent;
|
|
21
|
+
// Memoized configuration. The profile is resolved once, lazily, on the first
|
|
22
|
+
// request, then reused; host, workspaceId/accountId, and credentials are
|
|
23
|
+
// filled from it when not set explicitly on the options.
|
|
24
|
+
config;
|
|
29
25
|
constructor(options) {
|
|
30
|
-
|
|
31
|
-
throw new Error('Host is required.');
|
|
32
|
-
}
|
|
33
|
-
this.host = options.host.replace(/\/$/, '');
|
|
34
|
-
this.accountId = options.accountId;
|
|
35
|
-
this.workspaceId = options.workspaceId;
|
|
26
|
+
this.options = options;
|
|
36
27
|
this.logger = options.logger ?? new NoOpLogger();
|
|
37
28
|
const info = createDefault()
|
|
38
29
|
.with(PACKAGE_SEGMENT)
|
|
39
30
|
.with({ key: 'sdk-js-auth', value: AUTH_VERSION })
|
|
40
31
|
.with({ key: 'auth', value: options.credentials?.name() ?? 'default' });
|
|
41
32
|
this.userAgent = info.toString();
|
|
42
|
-
|
|
33
|
+
}
|
|
34
|
+
resolveConfig() {
|
|
35
|
+
this.config ??= resolveClientConfig(this.options);
|
|
36
|
+
return this.config;
|
|
43
37
|
}
|
|
44
38
|
/** Creates a group in the <Databricks> account with a unique name, using the supplied group details. */
|
|
45
39
|
async createAccountGroup(req, options) {
|
|
46
|
-
const
|
|
40
|
+
const { host, accountId, httpClient } = await this.resolveConfig();
|
|
41
|
+
const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ''}/scim/v2/Groups`;
|
|
47
42
|
const body = marshalRequest(req, marshalCreateAccountGroupRequestSchema);
|
|
48
43
|
let resp;
|
|
49
44
|
const call = async (callSignal) => {
|
|
@@ -52,7 +47,7 @@ export class ScimClient {
|
|
|
52
47
|
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
53
48
|
const respBody = await executeHttpCall({
|
|
54
49
|
request: httpReq,
|
|
55
|
-
httpClient
|
|
50
|
+
httpClient,
|
|
56
51
|
logger: this.logger,
|
|
57
52
|
});
|
|
58
53
|
resp = parseResponse(respBody, unmarshalAccountGroupSchema);
|
|
@@ -65,14 +60,15 @@ export class ScimClient {
|
|
|
65
60
|
}
|
|
66
61
|
/** Deletes a group from the <Databricks> account. */
|
|
67
62
|
async deleteAccountGroup(req, options) {
|
|
68
|
-
const
|
|
63
|
+
const { host, accountId, httpClient } = await this.resolveConfig();
|
|
64
|
+
const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ''}/scim/v2/Groups/${req.id ?? ''}`;
|
|
69
65
|
const call = async (callSignal) => {
|
|
70
66
|
const headers = new Headers();
|
|
71
67
|
headers.set('User-Agent', this.userAgent);
|
|
72
68
|
const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
|
|
73
69
|
await executeHttpCall({
|
|
74
70
|
request: httpReq,
|
|
75
|
-
httpClient
|
|
71
|
+
httpClient,
|
|
76
72
|
logger: this.logger,
|
|
77
73
|
});
|
|
78
74
|
};
|
|
@@ -80,7 +76,8 @@ export class ScimClient {
|
|
|
80
76
|
}
|
|
81
77
|
/** Gets the information for a specific group in the <Databricks> account. */
|
|
82
78
|
async getAccountGroup(req, options) {
|
|
83
|
-
const
|
|
79
|
+
const { host, accountId, httpClient } = await this.resolveConfig();
|
|
80
|
+
const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ''}/scim/v2/Groups/${req.id ?? ''}`;
|
|
84
81
|
let resp;
|
|
85
82
|
const call = async (callSignal) => {
|
|
86
83
|
const headers = new Headers();
|
|
@@ -88,7 +85,7 @@ export class ScimClient {
|
|
|
88
85
|
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
|
|
89
86
|
const respBody = await executeHttpCall({
|
|
90
87
|
request: httpReq,
|
|
91
|
-
httpClient
|
|
88
|
+
httpClient,
|
|
92
89
|
logger: this.logger,
|
|
93
90
|
});
|
|
94
91
|
resp = parseResponse(respBody, unmarshalAccountGroupSchema);
|
|
@@ -106,7 +103,8 @@ export class ScimClient {
|
|
|
106
103
|
* will not be impacted and will continue receiving member data as before.
|
|
107
104
|
*/
|
|
108
105
|
async listAccountGroups(req, options) {
|
|
109
|
-
const
|
|
106
|
+
const { host, accountId, httpClient } = await this.resolveConfig();
|
|
107
|
+
const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ''}/scim/v2/Groups`;
|
|
110
108
|
const params = new URLSearchParams();
|
|
111
109
|
if (req.filter !== undefined) {
|
|
112
110
|
params.append('filter', req.filter);
|
|
@@ -138,7 +136,7 @@ export class ScimClient {
|
|
|
138
136
|
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
139
137
|
const respBody = await executeHttpCall({
|
|
140
138
|
request: httpReq,
|
|
141
|
-
httpClient
|
|
139
|
+
httpClient,
|
|
142
140
|
logger: this.logger,
|
|
143
141
|
});
|
|
144
142
|
resp = parseResponse(respBody, unmarshalListAccountGroupsResponseSchema);
|
|
@@ -165,7 +163,8 @@ export class ScimClient {
|
|
|
165
163
|
}
|
|
166
164
|
/** Partially updates the details of a group. */
|
|
167
165
|
async patchAccountGroup(req, options) {
|
|
168
|
-
const
|
|
166
|
+
const { host, accountId, httpClient } = await this.resolveConfig();
|
|
167
|
+
const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ''}/scim/v2/Groups/${req.id ?? ''}`;
|
|
169
168
|
const body = marshalRequest(req, marshalPatchAccountGroupRequestSchema);
|
|
170
169
|
const call = async (callSignal) => {
|
|
171
170
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
@@ -173,7 +172,7 @@ export class ScimClient {
|
|
|
173
172
|
const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
|
|
174
173
|
await executeHttpCall({
|
|
175
174
|
request: httpReq,
|
|
176
|
-
httpClient
|
|
175
|
+
httpClient,
|
|
177
176
|
logger: this.logger,
|
|
178
177
|
});
|
|
179
178
|
};
|
|
@@ -181,7 +180,8 @@ export class ScimClient {
|
|
|
181
180
|
}
|
|
182
181
|
/** Updates the details of a group by replacing the entire group entity. */
|
|
183
182
|
async updateAccountGroup(req, options) {
|
|
184
|
-
const
|
|
183
|
+
const { host, accountId, httpClient } = await this.resolveConfig();
|
|
184
|
+
const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ''}/scim/v2/Groups/${req.id ?? ''}`;
|
|
185
185
|
const body = marshalRequest(req, marshalUpdateAccountGroupRequestSchema);
|
|
186
186
|
const call = async (callSignal) => {
|
|
187
187
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
@@ -189,7 +189,7 @@ export class ScimClient {
|
|
|
189
189
|
const httpReq = buildHttpRequest('PUT', url, headers, callSignal, body);
|
|
190
190
|
await executeHttpCall({
|
|
191
191
|
request: httpReq,
|
|
192
|
-
httpClient
|
|
192
|
+
httpClient,
|
|
193
193
|
logger: this.logger,
|
|
194
194
|
});
|
|
195
195
|
};
|
|
@@ -197,7 +197,8 @@ export class ScimClient {
|
|
|
197
197
|
}
|
|
198
198
|
/** Creates a new service principal in the <Databricks> account. */
|
|
199
199
|
async createAccountServicePrincipal(req, options) {
|
|
200
|
-
const
|
|
200
|
+
const { host, accountId, httpClient } = await this.resolveConfig();
|
|
201
|
+
const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ''}/scim/v2/ServicePrincipals`;
|
|
201
202
|
const body = marshalRequest(req, marshalCreateAccountServicePrincipalRequestSchema);
|
|
202
203
|
let resp;
|
|
203
204
|
const call = async (callSignal) => {
|
|
@@ -206,7 +207,7 @@ export class ScimClient {
|
|
|
206
207
|
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
207
208
|
const respBody = await executeHttpCall({
|
|
208
209
|
request: httpReq,
|
|
209
|
-
httpClient
|
|
210
|
+
httpClient,
|
|
210
211
|
logger: this.logger,
|
|
211
212
|
});
|
|
212
213
|
resp = parseResponse(respBody, unmarshalAccountServicePrincipalSchema);
|
|
@@ -219,14 +220,15 @@ export class ScimClient {
|
|
|
219
220
|
}
|
|
220
221
|
/** Delete a single service principal in the <Databricks> account. */
|
|
221
222
|
async deleteAccountServicePrincipal(req, options) {
|
|
222
|
-
const
|
|
223
|
+
const { host, accountId, httpClient } = await this.resolveConfig();
|
|
224
|
+
const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ''}/scim/v2/ServicePrincipals/${req.id ?? ''}`;
|
|
223
225
|
const call = async (callSignal) => {
|
|
224
226
|
const headers = new Headers();
|
|
225
227
|
headers.set('User-Agent', this.userAgent);
|
|
226
228
|
const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
|
|
227
229
|
await executeHttpCall({
|
|
228
230
|
request: httpReq,
|
|
229
|
-
httpClient
|
|
231
|
+
httpClient,
|
|
230
232
|
logger: this.logger,
|
|
231
233
|
});
|
|
232
234
|
};
|
|
@@ -234,7 +236,8 @@ export class ScimClient {
|
|
|
234
236
|
}
|
|
235
237
|
/** Gets the details for a single service principal define in the <Databricks> account. */
|
|
236
238
|
async getAccountServicePrincipal(req, options) {
|
|
237
|
-
const
|
|
239
|
+
const { host, accountId, httpClient } = await this.resolveConfig();
|
|
240
|
+
const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ''}/scim/v2/ServicePrincipals/${req.id ?? ''}`;
|
|
238
241
|
let resp;
|
|
239
242
|
const call = async (callSignal) => {
|
|
240
243
|
const headers = new Headers();
|
|
@@ -242,7 +245,7 @@ export class ScimClient {
|
|
|
242
245
|
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
|
|
243
246
|
const respBody = await executeHttpCall({
|
|
244
247
|
request: httpReq,
|
|
245
|
-
httpClient
|
|
248
|
+
httpClient,
|
|
246
249
|
logger: this.logger,
|
|
247
250
|
});
|
|
248
251
|
resp = parseResponse(respBody, unmarshalAccountServicePrincipalSchema);
|
|
@@ -255,7 +258,8 @@ export class ScimClient {
|
|
|
255
258
|
}
|
|
256
259
|
/** Gets the set of service principals associated with a <Databricks> account. */
|
|
257
260
|
async listAccountServicePrincipals(req, options) {
|
|
258
|
-
const
|
|
261
|
+
const { host, accountId, httpClient } = await this.resolveConfig();
|
|
262
|
+
const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ''}/scim/v2/ServicePrincipals`;
|
|
259
263
|
const params = new URLSearchParams();
|
|
260
264
|
if (req.attributes !== undefined) {
|
|
261
265
|
params.append('attributes', req.attributes);
|
|
@@ -287,7 +291,7 @@ export class ScimClient {
|
|
|
287
291
|
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
288
292
|
const respBody = await executeHttpCall({
|
|
289
293
|
request: httpReq,
|
|
290
|
-
httpClient
|
|
294
|
+
httpClient,
|
|
291
295
|
logger: this.logger,
|
|
292
296
|
});
|
|
293
297
|
resp = parseResponse(respBody, unmarshalListAccountServicePrincipalsResponseSchema);
|
|
@@ -314,7 +318,8 @@ export class ScimClient {
|
|
|
314
318
|
}
|
|
315
319
|
/** Partially updates the details of a single service principal in the <Databricks> account. */
|
|
316
320
|
async patchAccountServicePrincipal(req, options) {
|
|
317
|
-
const
|
|
321
|
+
const { host, accountId, httpClient } = await this.resolveConfig();
|
|
322
|
+
const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ''}/scim/v2/ServicePrincipals/${req.id ?? ''}`;
|
|
318
323
|
const body = marshalRequest(req, marshalPatchAccountServicePrincipalRequestSchema);
|
|
319
324
|
const call = async (callSignal) => {
|
|
320
325
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
@@ -322,7 +327,7 @@ export class ScimClient {
|
|
|
322
327
|
const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
|
|
323
328
|
await executeHttpCall({
|
|
324
329
|
request: httpReq,
|
|
325
|
-
httpClient
|
|
330
|
+
httpClient,
|
|
326
331
|
logger: this.logger,
|
|
327
332
|
});
|
|
328
333
|
};
|
|
@@ -334,7 +339,8 @@ export class ScimClient {
|
|
|
334
339
|
* This action replaces the existing service principal with the same name.
|
|
335
340
|
*/
|
|
336
341
|
async updateAccountServicePrincipal(req, options) {
|
|
337
|
-
const
|
|
342
|
+
const { host, accountId, httpClient } = await this.resolveConfig();
|
|
343
|
+
const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ''}/scim/v2/ServicePrincipals/${req.id ?? ''}`;
|
|
338
344
|
const body = marshalRequest(req, marshalUpdateAccountServicePrincipalRequestSchema);
|
|
339
345
|
const call = async (callSignal) => {
|
|
340
346
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
@@ -342,7 +348,7 @@ export class ScimClient {
|
|
|
342
348
|
const httpReq = buildHttpRequest('PUT', url, headers, callSignal, body);
|
|
343
349
|
await executeHttpCall({
|
|
344
350
|
request: httpReq,
|
|
345
|
-
httpClient
|
|
351
|
+
httpClient,
|
|
346
352
|
logger: this.logger,
|
|
347
353
|
});
|
|
348
354
|
};
|
|
@@ -350,7 +356,8 @@ export class ScimClient {
|
|
|
350
356
|
}
|
|
351
357
|
/** Creates a new user in the <Databricks> account. This new user will also be added to the <Databricks> account. */
|
|
352
358
|
async createAccountUser(req, options) {
|
|
353
|
-
const
|
|
359
|
+
const { host, accountId, httpClient } = await this.resolveConfig();
|
|
360
|
+
const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ''}/scim/v2/Users`;
|
|
354
361
|
const body = marshalRequest(req, marshalCreateAccountUserRequestSchema);
|
|
355
362
|
let resp;
|
|
356
363
|
const call = async (callSignal) => {
|
|
@@ -359,7 +366,7 @@ export class ScimClient {
|
|
|
359
366
|
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
360
367
|
const respBody = await executeHttpCall({
|
|
361
368
|
request: httpReq,
|
|
362
|
-
httpClient
|
|
369
|
+
httpClient,
|
|
363
370
|
logger: this.logger,
|
|
364
371
|
});
|
|
365
372
|
resp = parseResponse(respBody, unmarshalAccountUserSchema);
|
|
@@ -372,14 +379,15 @@ export class ScimClient {
|
|
|
372
379
|
}
|
|
373
380
|
/** Deletes a user. Deleting a user from a <Databricks> account also removes objects associated with the user. */
|
|
374
381
|
async deleteAccountUser(req, options) {
|
|
375
|
-
const
|
|
382
|
+
const { host, accountId, httpClient } = await this.resolveConfig();
|
|
383
|
+
const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ''}/scim/v2/Users/${req.id ?? ''}`;
|
|
376
384
|
const call = async (callSignal) => {
|
|
377
385
|
const headers = new Headers();
|
|
378
386
|
headers.set('User-Agent', this.userAgent);
|
|
379
387
|
const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
|
|
380
388
|
await executeHttpCall({
|
|
381
389
|
request: httpReq,
|
|
382
|
-
httpClient
|
|
390
|
+
httpClient,
|
|
383
391
|
logger: this.logger,
|
|
384
392
|
});
|
|
385
393
|
};
|
|
@@ -387,7 +395,8 @@ export class ScimClient {
|
|
|
387
395
|
}
|
|
388
396
|
/** Gets information for a specific user in <Databricks> account. */
|
|
389
397
|
async getAccountUser(req, options) {
|
|
390
|
-
const
|
|
398
|
+
const { host, accountId, httpClient } = await this.resolveConfig();
|
|
399
|
+
const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ''}/scim/v2/Users/${req.id ?? ''}`;
|
|
391
400
|
const params = new URLSearchParams();
|
|
392
401
|
if (req.attributes !== undefined) {
|
|
393
402
|
params.append('attributes', req.attributes);
|
|
@@ -419,7 +428,7 @@ export class ScimClient {
|
|
|
419
428
|
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
420
429
|
const respBody = await executeHttpCall({
|
|
421
430
|
request: httpReq,
|
|
422
|
-
httpClient
|
|
431
|
+
httpClient,
|
|
423
432
|
logger: this.logger,
|
|
424
433
|
});
|
|
425
434
|
resp = parseResponse(respBody, unmarshalAccountUserSchema);
|
|
@@ -432,7 +441,8 @@ export class ScimClient {
|
|
|
432
441
|
}
|
|
433
442
|
/** Gets details for all the users associated with a <Databricks> account. */
|
|
434
443
|
async listAccountUsers(req, options) {
|
|
435
|
-
const
|
|
444
|
+
const { host, accountId, httpClient } = await this.resolveConfig();
|
|
445
|
+
const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ''}/scim/v2/Users`;
|
|
436
446
|
const params = new URLSearchParams();
|
|
437
447
|
if (req.attributes !== undefined) {
|
|
438
448
|
params.append('attributes', req.attributes);
|
|
@@ -464,7 +474,7 @@ export class ScimClient {
|
|
|
464
474
|
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
465
475
|
const respBody = await executeHttpCall({
|
|
466
476
|
request: httpReq,
|
|
467
|
-
httpClient
|
|
477
|
+
httpClient,
|
|
468
478
|
logger: this.logger,
|
|
469
479
|
});
|
|
470
480
|
resp = parseResponse(respBody, unmarshalListAccountUsersResponseSchema);
|
|
@@ -491,7 +501,8 @@ export class ScimClient {
|
|
|
491
501
|
}
|
|
492
502
|
/** Partially updates a user resource by applying the supplied operations on specific user attributes. */
|
|
493
503
|
async patchAccountUser(req, options) {
|
|
494
|
-
const
|
|
504
|
+
const { host, accountId, httpClient } = await this.resolveConfig();
|
|
505
|
+
const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ''}/scim/v2/Users/${req.id ?? ''}`;
|
|
495
506
|
const body = marshalRequest(req, marshalPatchAccountUserRequestSchema);
|
|
496
507
|
const call = async (callSignal) => {
|
|
497
508
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
@@ -499,7 +510,7 @@ export class ScimClient {
|
|
|
499
510
|
const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
|
|
500
511
|
await executeHttpCall({
|
|
501
512
|
request: httpReq,
|
|
502
|
-
httpClient
|
|
513
|
+
httpClient,
|
|
503
514
|
logger: this.logger,
|
|
504
515
|
});
|
|
505
516
|
};
|
|
@@ -507,7 +518,8 @@ export class ScimClient {
|
|
|
507
518
|
}
|
|
508
519
|
/** Replaces a user's information with the data supplied in request. */
|
|
509
520
|
async updateAccountUser(req, options) {
|
|
510
|
-
const
|
|
521
|
+
const { host, accountId, httpClient } = await this.resolveConfig();
|
|
522
|
+
const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ''}/scim/v2/Users/${req.id ?? ''}`;
|
|
511
523
|
const body = marshalRequest(req, marshalUpdateAccountUserRequestSchema);
|
|
512
524
|
const call = async (callSignal) => {
|
|
513
525
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
@@ -515,7 +527,7 @@ export class ScimClient {
|
|
|
515
527
|
const httpReq = buildHttpRequest('PUT', url, headers, callSignal, body);
|
|
516
528
|
await executeHttpCall({
|
|
517
529
|
request: httpReq,
|
|
518
|
-
httpClient
|
|
530
|
+
httpClient,
|
|
519
531
|
logger: this.logger,
|
|
520
532
|
});
|
|
521
533
|
};
|
|
@@ -523,7 +535,8 @@ export class ScimClient {
|
|
|
523
535
|
}
|
|
524
536
|
/** Get details about the current method caller's identity. */
|
|
525
537
|
async me(req, options) {
|
|
526
|
-
const
|
|
538
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
539
|
+
const url = `${host}/api/2.0/preview/scim/v2/Me`;
|
|
527
540
|
const params = new URLSearchParams();
|
|
528
541
|
if (req.attributes !== undefined) {
|
|
529
542
|
params.append('attributes', req.attributes);
|
|
@@ -536,14 +549,14 @@ export class ScimClient {
|
|
|
536
549
|
let resp;
|
|
537
550
|
const call = async (callSignal) => {
|
|
538
551
|
const headers = new Headers();
|
|
539
|
-
if (
|
|
540
|
-
headers.set('X-Databricks-Org-Id',
|
|
552
|
+
if (workspaceId !== undefined) {
|
|
553
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
541
554
|
}
|
|
542
555
|
headers.set('User-Agent', this.userAgent);
|
|
543
556
|
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
544
557
|
const respBody = await executeHttpCall({
|
|
545
558
|
request: httpReq,
|
|
546
|
-
httpClient
|
|
559
|
+
httpClient,
|
|
547
560
|
logger: this.logger,
|
|
548
561
|
});
|
|
549
562
|
resp = parseResponse(respBody, unmarshalUserSchema);
|
|
@@ -556,19 +569,20 @@ export class ScimClient {
|
|
|
556
569
|
}
|
|
557
570
|
/** Creates a group in the <Databricks> workspace with a unique name, using the supplied group details. */
|
|
558
571
|
async createGroup(req, options) {
|
|
559
|
-
const
|
|
572
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
573
|
+
const url = `${host}/api/2.0/preview/scim/v2/Groups`;
|
|
560
574
|
const body = marshalRequest(req, marshalCreateGroupRequestSchema);
|
|
561
575
|
let resp;
|
|
562
576
|
const call = async (callSignal) => {
|
|
563
577
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
564
|
-
if (
|
|
565
|
-
headers.set('X-Databricks-Org-Id',
|
|
578
|
+
if (workspaceId !== undefined) {
|
|
579
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
566
580
|
}
|
|
567
581
|
headers.set('User-Agent', this.userAgent);
|
|
568
582
|
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
569
583
|
const respBody = await executeHttpCall({
|
|
570
584
|
request: httpReq,
|
|
571
|
-
httpClient
|
|
585
|
+
httpClient,
|
|
572
586
|
logger: this.logger,
|
|
573
587
|
});
|
|
574
588
|
resp = parseResponse(respBody, unmarshalGroupSchema);
|
|
@@ -581,17 +595,18 @@ export class ScimClient {
|
|
|
581
595
|
}
|
|
582
596
|
/** Deletes a group from the <Databricks> workspace. */
|
|
583
597
|
async deleteGroup(req, options) {
|
|
584
|
-
const
|
|
598
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
599
|
+
const url = `${host}/api/2.0/preview/scim/v2/Groups/${req.id ?? ''}`;
|
|
585
600
|
const call = async (callSignal) => {
|
|
586
601
|
const headers = new Headers();
|
|
587
|
-
if (
|
|
588
|
-
headers.set('X-Databricks-Org-Id',
|
|
602
|
+
if (workspaceId !== undefined) {
|
|
603
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
589
604
|
}
|
|
590
605
|
headers.set('User-Agent', this.userAgent);
|
|
591
606
|
const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
|
|
592
607
|
await executeHttpCall({
|
|
593
608
|
request: httpReq,
|
|
594
|
-
httpClient
|
|
609
|
+
httpClient,
|
|
595
610
|
logger: this.logger,
|
|
596
611
|
});
|
|
597
612
|
};
|
|
@@ -599,18 +614,19 @@ export class ScimClient {
|
|
|
599
614
|
}
|
|
600
615
|
/** Gets the information for a specific group in the <Databricks> workspace. */
|
|
601
616
|
async getGroup(req, options) {
|
|
602
|
-
const
|
|
617
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
618
|
+
const url = `${host}/api/2.0/preview/scim/v2/Groups/${req.id ?? ''}`;
|
|
603
619
|
let resp;
|
|
604
620
|
const call = async (callSignal) => {
|
|
605
621
|
const headers = new Headers();
|
|
606
|
-
if (
|
|
607
|
-
headers.set('X-Databricks-Org-Id',
|
|
622
|
+
if (workspaceId !== undefined) {
|
|
623
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
608
624
|
}
|
|
609
625
|
headers.set('User-Agent', this.userAgent);
|
|
610
626
|
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
|
|
611
627
|
const respBody = await executeHttpCall({
|
|
612
628
|
request: httpReq,
|
|
613
|
-
httpClient
|
|
629
|
+
httpClient,
|
|
614
630
|
logger: this.logger,
|
|
615
631
|
});
|
|
616
632
|
resp = parseResponse(respBody, unmarshalGroupSchema);
|
|
@@ -623,7 +639,8 @@ export class ScimClient {
|
|
|
623
639
|
}
|
|
624
640
|
/** Gets all details of the groups associated with the <Databricks> workspace. */
|
|
625
641
|
async listGroups(req, options) {
|
|
626
|
-
const
|
|
642
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
643
|
+
const url = `${host}/api/2.0/preview/scim/v2/Groups`;
|
|
627
644
|
const params = new URLSearchParams();
|
|
628
645
|
if (req.filter !== undefined) {
|
|
629
646
|
params.append('filter', req.filter);
|
|
@@ -651,14 +668,14 @@ export class ScimClient {
|
|
|
651
668
|
let resp;
|
|
652
669
|
const call = async (callSignal) => {
|
|
653
670
|
const headers = new Headers();
|
|
654
|
-
if (
|
|
655
|
-
headers.set('X-Databricks-Org-Id',
|
|
671
|
+
if (workspaceId !== undefined) {
|
|
672
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
656
673
|
}
|
|
657
674
|
headers.set('User-Agent', this.userAgent);
|
|
658
675
|
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
659
676
|
const respBody = await executeHttpCall({
|
|
660
677
|
request: httpReq,
|
|
661
|
-
httpClient
|
|
678
|
+
httpClient,
|
|
662
679
|
logger: this.logger,
|
|
663
680
|
});
|
|
664
681
|
resp = parseResponse(respBody, unmarshalListGroupsResponseSchema);
|
|
@@ -685,18 +702,19 @@ export class ScimClient {
|
|
|
685
702
|
}
|
|
686
703
|
/** Partially updates the details of a group. */
|
|
687
704
|
async patchGroup(req, options) {
|
|
688
|
-
const
|
|
705
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
706
|
+
const url = `${host}/api/2.0/preview/scim/v2/Groups/${req.id ?? ''}`;
|
|
689
707
|
const body = marshalRequest(req, marshalPatchGroupRequestSchema);
|
|
690
708
|
const call = async (callSignal) => {
|
|
691
709
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
692
|
-
if (
|
|
693
|
-
headers.set('X-Databricks-Org-Id',
|
|
710
|
+
if (workspaceId !== undefined) {
|
|
711
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
694
712
|
}
|
|
695
713
|
headers.set('User-Agent', this.userAgent);
|
|
696
714
|
const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
|
|
697
715
|
await executeHttpCall({
|
|
698
716
|
request: httpReq,
|
|
699
|
-
httpClient
|
|
717
|
+
httpClient,
|
|
700
718
|
logger: this.logger,
|
|
701
719
|
});
|
|
702
720
|
};
|
|
@@ -704,18 +722,19 @@ export class ScimClient {
|
|
|
704
722
|
}
|
|
705
723
|
/** Updates the details of a group by replacing the entire group entity. */
|
|
706
724
|
async updateGroup(req, options) {
|
|
707
|
-
const
|
|
725
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
726
|
+
const url = `${host}/api/2.0/preview/scim/v2/Groups/${req.id ?? ''}`;
|
|
708
727
|
const body = marshalRequest(req, marshalUpdateGroupRequestSchema);
|
|
709
728
|
const call = async (callSignal) => {
|
|
710
729
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
711
|
-
if (
|
|
712
|
-
headers.set('X-Databricks-Org-Id',
|
|
730
|
+
if (workspaceId !== undefined) {
|
|
731
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
713
732
|
}
|
|
714
733
|
headers.set('User-Agent', this.userAgent);
|
|
715
734
|
const httpReq = buildHttpRequest('PUT', url, headers, callSignal, body);
|
|
716
735
|
await executeHttpCall({
|
|
717
736
|
request: httpReq,
|
|
718
|
-
httpClient
|
|
737
|
+
httpClient,
|
|
719
738
|
logger: this.logger,
|
|
720
739
|
});
|
|
721
740
|
};
|
|
@@ -723,19 +742,20 @@ export class ScimClient {
|
|
|
723
742
|
}
|
|
724
743
|
/** Creates a new service principal in the <Databricks> workspace. */
|
|
725
744
|
async createServicePrincipal(req, options) {
|
|
726
|
-
const
|
|
745
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
746
|
+
const url = `${host}/api/2.0/preview/scim/v2/ServicePrincipals`;
|
|
727
747
|
const body = marshalRequest(req, marshalCreateServicePrincipalRequestSchema);
|
|
728
748
|
let resp;
|
|
729
749
|
const call = async (callSignal) => {
|
|
730
750
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
731
|
-
if (
|
|
732
|
-
headers.set('X-Databricks-Org-Id',
|
|
751
|
+
if (workspaceId !== undefined) {
|
|
752
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
733
753
|
}
|
|
734
754
|
headers.set('User-Agent', this.userAgent);
|
|
735
755
|
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
736
756
|
const respBody = await executeHttpCall({
|
|
737
757
|
request: httpReq,
|
|
738
|
-
httpClient
|
|
758
|
+
httpClient,
|
|
739
759
|
logger: this.logger,
|
|
740
760
|
});
|
|
741
761
|
resp = parseResponse(respBody, unmarshalServicePrincipalSchema);
|
|
@@ -748,17 +768,18 @@ export class ScimClient {
|
|
|
748
768
|
}
|
|
749
769
|
/** Delete a single service principal in the <Databricks> workspace. */
|
|
750
770
|
async deleteServicePrincipal(req, options) {
|
|
751
|
-
const
|
|
771
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
772
|
+
const url = `${host}/api/2.0/preview/scim/v2/ServicePrincipals/${req.id ?? ''}`;
|
|
752
773
|
const call = async (callSignal) => {
|
|
753
774
|
const headers = new Headers();
|
|
754
|
-
if (
|
|
755
|
-
headers.set('X-Databricks-Org-Id',
|
|
775
|
+
if (workspaceId !== undefined) {
|
|
776
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
756
777
|
}
|
|
757
778
|
headers.set('User-Agent', this.userAgent);
|
|
758
779
|
const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
|
|
759
780
|
await executeHttpCall({
|
|
760
781
|
request: httpReq,
|
|
761
|
-
httpClient
|
|
782
|
+
httpClient,
|
|
762
783
|
logger: this.logger,
|
|
763
784
|
});
|
|
764
785
|
};
|
|
@@ -766,18 +787,19 @@ export class ScimClient {
|
|
|
766
787
|
}
|
|
767
788
|
/** Gets the details for a single service principal define in the <Databricks> workspace. */
|
|
768
789
|
async getServicePrincipal(req, options) {
|
|
769
|
-
const
|
|
790
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
791
|
+
const url = `${host}/api/2.0/preview/scim/v2/ServicePrincipals/${req.id ?? ''}`;
|
|
770
792
|
let resp;
|
|
771
793
|
const call = async (callSignal) => {
|
|
772
794
|
const headers = new Headers();
|
|
773
|
-
if (
|
|
774
|
-
headers.set('X-Databricks-Org-Id',
|
|
795
|
+
if (workspaceId !== undefined) {
|
|
796
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
775
797
|
}
|
|
776
798
|
headers.set('User-Agent', this.userAgent);
|
|
777
799
|
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
|
|
778
800
|
const respBody = await executeHttpCall({
|
|
779
801
|
request: httpReq,
|
|
780
|
-
httpClient
|
|
802
|
+
httpClient,
|
|
781
803
|
logger: this.logger,
|
|
782
804
|
});
|
|
783
805
|
resp = parseResponse(respBody, unmarshalServicePrincipalSchema);
|
|
@@ -790,7 +812,8 @@ export class ScimClient {
|
|
|
790
812
|
}
|
|
791
813
|
/** Gets the set of service principals associated with a <Databricks> workspace. */
|
|
792
814
|
async listServicePrincipals(req, options) {
|
|
793
|
-
const
|
|
815
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
816
|
+
const url = `${host}/api/2.0/preview/scim/v2/ServicePrincipals`;
|
|
794
817
|
const params = new URLSearchParams();
|
|
795
818
|
if (req.attributes !== undefined) {
|
|
796
819
|
params.append('attributes', req.attributes);
|
|
@@ -818,14 +841,14 @@ export class ScimClient {
|
|
|
818
841
|
let resp;
|
|
819
842
|
const call = async (callSignal) => {
|
|
820
843
|
const headers = new Headers();
|
|
821
|
-
if (
|
|
822
|
-
headers.set('X-Databricks-Org-Id',
|
|
844
|
+
if (workspaceId !== undefined) {
|
|
845
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
823
846
|
}
|
|
824
847
|
headers.set('User-Agent', this.userAgent);
|
|
825
848
|
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
826
849
|
const respBody = await executeHttpCall({
|
|
827
850
|
request: httpReq,
|
|
828
|
-
httpClient
|
|
851
|
+
httpClient,
|
|
829
852
|
logger: this.logger,
|
|
830
853
|
});
|
|
831
854
|
resp = parseResponse(respBody, unmarshalListServicePrincipalResponseSchema);
|
|
@@ -852,18 +875,19 @@ export class ScimClient {
|
|
|
852
875
|
}
|
|
853
876
|
/** Partially updates the details of a single service principal in the <Databricks> workspace. */
|
|
854
877
|
async patchServicePrincipal(req, options) {
|
|
855
|
-
const
|
|
878
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
879
|
+
const url = `${host}/api/2.0/preview/scim/v2/ServicePrincipals/${req.id ?? ''}`;
|
|
856
880
|
const body = marshalRequest(req, marshalPatchServicePrincipalRequestSchema);
|
|
857
881
|
const call = async (callSignal) => {
|
|
858
882
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
859
|
-
if (
|
|
860
|
-
headers.set('X-Databricks-Org-Id',
|
|
883
|
+
if (workspaceId !== undefined) {
|
|
884
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
861
885
|
}
|
|
862
886
|
headers.set('User-Agent', this.userAgent);
|
|
863
887
|
const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
|
|
864
888
|
await executeHttpCall({
|
|
865
889
|
request: httpReq,
|
|
866
|
-
httpClient
|
|
890
|
+
httpClient,
|
|
867
891
|
logger: this.logger,
|
|
868
892
|
});
|
|
869
893
|
};
|
|
@@ -875,18 +899,19 @@ export class ScimClient {
|
|
|
875
899
|
* This action replaces the existing service principal with the same name.
|
|
876
900
|
*/
|
|
877
901
|
async updateServicePrincipal(req, options) {
|
|
878
|
-
const
|
|
902
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
903
|
+
const url = `${host}/api/2.0/preview/scim/v2/ServicePrincipals/${req.id ?? ''}`;
|
|
879
904
|
const body = marshalRequest(req, marshalUpdateServicePrincipalRequestSchema);
|
|
880
905
|
const call = async (callSignal) => {
|
|
881
906
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
882
|
-
if (
|
|
883
|
-
headers.set('X-Databricks-Org-Id',
|
|
907
|
+
if (workspaceId !== undefined) {
|
|
908
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
884
909
|
}
|
|
885
910
|
headers.set('User-Agent', this.userAgent);
|
|
886
911
|
const httpReq = buildHttpRequest('PUT', url, headers, callSignal, body);
|
|
887
912
|
await executeHttpCall({
|
|
888
913
|
request: httpReq,
|
|
889
|
-
httpClient
|
|
914
|
+
httpClient,
|
|
890
915
|
logger: this.logger,
|
|
891
916
|
});
|
|
892
917
|
};
|
|
@@ -894,19 +919,20 @@ export class ScimClient {
|
|
|
894
919
|
}
|
|
895
920
|
/** Creates a new user in the <Databricks> workspace. This new user will also be added to the <Databricks> account. */
|
|
896
921
|
async createUser(req, options) {
|
|
897
|
-
const
|
|
922
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
923
|
+
const url = `${host}/api/2.0/preview/scim/v2/Users`;
|
|
898
924
|
const body = marshalRequest(req, marshalCreateUserRequestSchema);
|
|
899
925
|
let resp;
|
|
900
926
|
const call = async (callSignal) => {
|
|
901
927
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
902
|
-
if (
|
|
903
|
-
headers.set('X-Databricks-Org-Id',
|
|
928
|
+
if (workspaceId !== undefined) {
|
|
929
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
904
930
|
}
|
|
905
931
|
headers.set('User-Agent', this.userAgent);
|
|
906
932
|
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
907
933
|
const respBody = await executeHttpCall({
|
|
908
934
|
request: httpReq,
|
|
909
|
-
httpClient
|
|
935
|
+
httpClient,
|
|
910
936
|
logger: this.logger,
|
|
911
937
|
});
|
|
912
938
|
resp = parseResponse(respBody, unmarshalUserSchema);
|
|
@@ -919,17 +945,18 @@ export class ScimClient {
|
|
|
919
945
|
}
|
|
920
946
|
/** Deletes a user. Deleting a user from a <Databricks> workspace also removes objects associated with the user. */
|
|
921
947
|
async deleteUser(req, options) {
|
|
922
|
-
const
|
|
948
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
949
|
+
const url = `${host}/api/2.0/preview/scim/v2/Users/${req.id ?? ''}`;
|
|
923
950
|
const call = async (callSignal) => {
|
|
924
951
|
const headers = new Headers();
|
|
925
|
-
if (
|
|
926
|
-
headers.set('X-Databricks-Org-Id',
|
|
952
|
+
if (workspaceId !== undefined) {
|
|
953
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
927
954
|
}
|
|
928
955
|
headers.set('User-Agent', this.userAgent);
|
|
929
956
|
const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
|
|
930
957
|
await executeHttpCall({
|
|
931
958
|
request: httpReq,
|
|
932
|
-
httpClient
|
|
959
|
+
httpClient,
|
|
933
960
|
logger: this.logger,
|
|
934
961
|
});
|
|
935
962
|
};
|
|
@@ -937,18 +964,19 @@ export class ScimClient {
|
|
|
937
964
|
}
|
|
938
965
|
/** Gets the permission levels that a user can have on an object. */
|
|
939
966
|
async getPermissionLevels(_req, options) {
|
|
940
|
-
const
|
|
967
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
968
|
+
const url = `${host}/api/2.0/permissions/authorization/passwords/permissionLevels`;
|
|
941
969
|
let resp;
|
|
942
970
|
const call = async (callSignal) => {
|
|
943
971
|
const headers = new Headers();
|
|
944
|
-
if (
|
|
945
|
-
headers.set('X-Databricks-Org-Id',
|
|
972
|
+
if (workspaceId !== undefined) {
|
|
973
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
946
974
|
}
|
|
947
975
|
headers.set('User-Agent', this.userAgent);
|
|
948
976
|
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
|
|
949
977
|
const respBody = await executeHttpCall({
|
|
950
978
|
request: httpReq,
|
|
951
|
-
httpClient
|
|
979
|
+
httpClient,
|
|
952
980
|
logger: this.logger,
|
|
953
981
|
});
|
|
954
982
|
resp = parseResponse(respBody, unmarshalGetPasswordPermissionLevelsResponseSchema);
|
|
@@ -961,18 +989,19 @@ export class ScimClient {
|
|
|
961
989
|
}
|
|
962
990
|
/** Gets the permissions of all passwords. Passwords can inherit permissions from their root object. */
|
|
963
991
|
async getPermissions(_req, options) {
|
|
964
|
-
const
|
|
992
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
993
|
+
const url = `${host}/api/2.0/permissions/authorization/passwords`;
|
|
965
994
|
let resp;
|
|
966
995
|
const call = async (callSignal) => {
|
|
967
996
|
const headers = new Headers();
|
|
968
|
-
if (
|
|
969
|
-
headers.set('X-Databricks-Org-Id',
|
|
997
|
+
if (workspaceId !== undefined) {
|
|
998
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
970
999
|
}
|
|
971
1000
|
headers.set('User-Agent', this.userAgent);
|
|
972
1001
|
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
|
|
973
1002
|
const respBody = await executeHttpCall({
|
|
974
1003
|
request: httpReq,
|
|
975
|
-
httpClient
|
|
1004
|
+
httpClient,
|
|
976
1005
|
logger: this.logger,
|
|
977
1006
|
});
|
|
978
1007
|
resp = parseResponse(respBody, unmarshalPasswordPermissionsSchema);
|
|
@@ -985,7 +1014,8 @@ export class ScimClient {
|
|
|
985
1014
|
}
|
|
986
1015
|
/** Gets information for a specific user in <Databricks> workspace. */
|
|
987
1016
|
async getUser(req, options) {
|
|
988
|
-
const
|
|
1017
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
1018
|
+
const url = `${host}/api/2.0/preview/scim/v2/Users/${req.id ?? ''}`;
|
|
989
1019
|
const params = new URLSearchParams();
|
|
990
1020
|
if (req.attributes !== undefined) {
|
|
991
1021
|
params.append('attributes', req.attributes);
|
|
@@ -1013,14 +1043,14 @@ export class ScimClient {
|
|
|
1013
1043
|
let resp;
|
|
1014
1044
|
const call = async (callSignal) => {
|
|
1015
1045
|
const headers = new Headers();
|
|
1016
|
-
if (
|
|
1017
|
-
headers.set('X-Databricks-Org-Id',
|
|
1046
|
+
if (workspaceId !== undefined) {
|
|
1047
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
1018
1048
|
}
|
|
1019
1049
|
headers.set('User-Agent', this.userAgent);
|
|
1020
1050
|
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
1021
1051
|
const respBody = await executeHttpCall({
|
|
1022
1052
|
request: httpReq,
|
|
1023
|
-
httpClient
|
|
1053
|
+
httpClient,
|
|
1024
1054
|
logger: this.logger,
|
|
1025
1055
|
});
|
|
1026
1056
|
resp = parseResponse(respBody, unmarshalUserSchema);
|
|
@@ -1033,7 +1063,8 @@ export class ScimClient {
|
|
|
1033
1063
|
}
|
|
1034
1064
|
/** Gets details for all the users associated with a <Databricks> workspace. */
|
|
1035
1065
|
async listUsers(req, options) {
|
|
1036
|
-
const
|
|
1066
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
1067
|
+
const url = `${host}/api/2.0/preview/scim/v2/Users`;
|
|
1037
1068
|
const params = new URLSearchParams();
|
|
1038
1069
|
if (req.attributes !== undefined) {
|
|
1039
1070
|
params.append('attributes', req.attributes);
|
|
@@ -1061,14 +1092,14 @@ export class ScimClient {
|
|
|
1061
1092
|
let resp;
|
|
1062
1093
|
const call = async (callSignal) => {
|
|
1063
1094
|
const headers = new Headers();
|
|
1064
|
-
if (
|
|
1065
|
-
headers.set('X-Databricks-Org-Id',
|
|
1095
|
+
if (workspaceId !== undefined) {
|
|
1096
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
1066
1097
|
}
|
|
1067
1098
|
headers.set('User-Agent', this.userAgent);
|
|
1068
1099
|
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
1069
1100
|
const respBody = await executeHttpCall({
|
|
1070
1101
|
request: httpReq,
|
|
1071
|
-
httpClient
|
|
1102
|
+
httpClient,
|
|
1072
1103
|
logger: this.logger,
|
|
1073
1104
|
});
|
|
1074
1105
|
resp = parseResponse(respBody, unmarshalListUsersResponseSchema);
|
|
@@ -1095,18 +1126,19 @@ export class ScimClient {
|
|
|
1095
1126
|
}
|
|
1096
1127
|
/** Partially updates a user resource by applying the supplied operations on specific user attributes. */
|
|
1097
1128
|
async patchUser(req, options) {
|
|
1098
|
-
const
|
|
1129
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
1130
|
+
const url = `${host}/api/2.0/preview/scim/v2/Users/${req.id ?? ''}`;
|
|
1099
1131
|
const body = marshalRequest(req, marshalPatchUserRequestSchema);
|
|
1100
1132
|
const call = async (callSignal) => {
|
|
1101
1133
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
1102
|
-
if (
|
|
1103
|
-
headers.set('X-Databricks-Org-Id',
|
|
1134
|
+
if (workspaceId !== undefined) {
|
|
1135
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
1104
1136
|
}
|
|
1105
1137
|
headers.set('User-Agent', this.userAgent);
|
|
1106
1138
|
const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
|
|
1107
1139
|
await executeHttpCall({
|
|
1108
1140
|
request: httpReq,
|
|
1109
|
-
httpClient
|
|
1141
|
+
httpClient,
|
|
1110
1142
|
logger: this.logger,
|
|
1111
1143
|
});
|
|
1112
1144
|
};
|
|
@@ -1114,19 +1146,20 @@ export class ScimClient {
|
|
|
1114
1146
|
}
|
|
1115
1147
|
/** Sets permissions on an object, replacing existing permissions if they exist. Deletes all direct permissions if none are specified. Objects can inherit permissions from their root object. */
|
|
1116
1148
|
async setPermissions(req, options) {
|
|
1117
|
-
const
|
|
1149
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
1150
|
+
const url = `${host}/api/2.0/permissions/authorization/passwords`;
|
|
1118
1151
|
const body = marshalRequest(req, marshalPasswordPermissionsRequestSchema);
|
|
1119
1152
|
let resp;
|
|
1120
1153
|
const call = async (callSignal) => {
|
|
1121
1154
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
1122
|
-
if (
|
|
1123
|
-
headers.set('X-Databricks-Org-Id',
|
|
1155
|
+
if (workspaceId !== undefined) {
|
|
1156
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
1124
1157
|
}
|
|
1125
1158
|
headers.set('User-Agent', this.userAgent);
|
|
1126
1159
|
const httpReq = buildHttpRequest('PUT', url, headers, callSignal, body);
|
|
1127
1160
|
const respBody = await executeHttpCall({
|
|
1128
1161
|
request: httpReq,
|
|
1129
|
-
httpClient
|
|
1162
|
+
httpClient,
|
|
1130
1163
|
logger: this.logger,
|
|
1131
1164
|
});
|
|
1132
1165
|
resp = parseResponse(respBody, unmarshalPasswordPermissionsSchema);
|
|
@@ -1139,19 +1172,20 @@ export class ScimClient {
|
|
|
1139
1172
|
}
|
|
1140
1173
|
/** Updates the permissions on all passwords. Passwords can inherit permissions from their root object. */
|
|
1141
1174
|
async updatePermissions(req, options) {
|
|
1142
|
-
const
|
|
1175
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
1176
|
+
const url = `${host}/api/2.0/permissions/authorization/passwords`;
|
|
1143
1177
|
const body = marshalRequest(req, marshalPasswordPermissionsRequestSchema);
|
|
1144
1178
|
let resp;
|
|
1145
1179
|
const call = async (callSignal) => {
|
|
1146
1180
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
1147
|
-
if (
|
|
1148
|
-
headers.set('X-Databricks-Org-Id',
|
|
1181
|
+
if (workspaceId !== undefined) {
|
|
1182
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
1149
1183
|
}
|
|
1150
1184
|
headers.set('User-Agent', this.userAgent);
|
|
1151
1185
|
const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
|
|
1152
1186
|
const respBody = await executeHttpCall({
|
|
1153
1187
|
request: httpReq,
|
|
1154
|
-
httpClient
|
|
1188
|
+
httpClient,
|
|
1155
1189
|
logger: this.logger,
|
|
1156
1190
|
});
|
|
1157
1191
|
resp = parseResponse(respBody, unmarshalPasswordPermissionsSchema);
|
|
@@ -1164,18 +1198,19 @@ export class ScimClient {
|
|
|
1164
1198
|
}
|
|
1165
1199
|
/** Replaces a user's information with the data supplied in request. */
|
|
1166
1200
|
async updateUser(req, options) {
|
|
1167
|
-
const
|
|
1201
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
1202
|
+
const url = `${host}/api/2.0/preview/scim/v2/Users/${req.id ?? ''}`;
|
|
1168
1203
|
const body = marshalRequest(req, marshalUpdateUserRequestSchema);
|
|
1169
1204
|
const call = async (callSignal) => {
|
|
1170
1205
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
1171
|
-
if (
|
|
1172
|
-
headers.set('X-Databricks-Org-Id',
|
|
1206
|
+
if (workspaceId !== undefined) {
|
|
1207
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
1173
1208
|
}
|
|
1174
1209
|
headers.set('User-Agent', this.userAgent);
|
|
1175
1210
|
const httpReq = buildHttpRequest('PUT', url, headers, callSignal, body);
|
|
1176
1211
|
await executeHttpCall({
|
|
1177
1212
|
request: httpReq,
|
|
1178
|
-
httpClient
|
|
1213
|
+
httpClient,
|
|
1179
1214
|
logger: this.logger,
|
|
1180
1215
|
});
|
|
1181
1216
|
};
|