@databricks/sdk-scim 0.34.0 → 0.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/v1/client.js CHANGED
@@ -1,1232 +1,935 @@
1
- // Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
2
- import { VERSION as AUTH_VERSION } from '@databricks/sdk-auth';
3
- import { createDefault } from '@databricks/sdk-core/clientinfo';
4
- import { NoOpLogger } from '@databricks/sdk-core/logger';
5
- import { resolveClientConfig } from './transport';
6
- import { buildHttpRequest, executeCall, executeHttpCall, marshalRequest, parseResponse, } from './utils';
7
- import pkgJson from '../../package.json' with { type: 'json' };
8
- import { 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';
9
- // Package identity segment for this client to be used in the User-Agent header.
1
+ import { resolveClientConfig } from "./transport.js";
2
+ import { buildHttpRequest, executeCall, executeHttpCall, marshalRequest, parseResponse } from "./utils.js";
3
+ import { name, version } from "../package.js";
4
+ import { 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.js";
5
+ import { VERSION } from "@databricks/sdk-auth";
6
+ import { createDefault } from "@databricks/sdk-core/clientinfo";
7
+ import { NoOpLogger } from "@databricks/sdk-core/logger";
8
+
9
+ //#region src/v1/client.ts
10
10
  const PACKAGE_SEGMENT = {
11
- key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''),
12
- value: pkgJson.version,
11
+ key: "sdk-js-" + name.replace(/^@[^/]+\/sdk-/, ""),
12
+ value: version
13
13
  };
14
- export class ScimClient {
15
- options;
16
- logger;
17
- // User-Agent header value. Composed once at construction from
18
- // createDefault() merged with this package's identity and the active
19
- // credential's name.
20
- userAgent;
21
- // Memoized configuration. The profile is resolved once, lazily, on the first
22
- // request, then reused; host, workspaceId/accountId, and credentials are
23
- // filled from it when not set explicitly on the options.
24
- config;
25
- constructor(options) {
26
- this.options = options;
27
- this.logger = options.logger ?? new NoOpLogger();
28
- const info = createDefault()
29
- .with(PACKAGE_SEGMENT)
30
- .with({ key: 'sdk-js-auth', value: AUTH_VERSION })
31
- .with({ key: 'auth', value: options.credentials?.name() ?? 'default' });
32
- this.userAgent = info.toString();
33
- }
34
- resolveConfig() {
35
- this.config ??= resolveClientConfig(this.options);
36
- return this.config;
37
- }
38
- /** Creates a group in the <Databricks> account with a unique name, using the supplied group details. */
39
- async createAccountGroup(req, options) {
40
- const { host, accountId, httpClient } = await this.resolveConfig();
41
- const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ''}/scim/v2/Groups`;
42
- const body = marshalRequest(req, marshalCreateAccountGroupRequestSchema);
43
- let resp;
44
- const call = async (callSignal) => {
45
- const headers = new Headers({ 'Content-Type': 'application/json' });
46
- headers.set('User-Agent', this.userAgent);
47
- const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
48
- const respBody = await executeHttpCall({
49
- request: httpReq,
50
- httpClient,
51
- logger: this.logger,
52
- });
53
- resp = parseResponse(respBody, unmarshalAccountGroupSchema);
54
- };
55
- await executeCall(call, options);
56
- if (resp === undefined) {
57
- throw new Error('operation completed without a result.');
58
- }
59
- return resp;
60
- }
61
- /** Deletes a group from the <Databricks> account. */
62
- async deleteAccountGroup(req, options) {
63
- const { host, accountId, httpClient } = await this.resolveConfig();
64
- const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ''}/scim/v2/Groups/${req.id ?? ''}`;
65
- const call = async (callSignal) => {
66
- const headers = new Headers();
67
- headers.set('User-Agent', this.userAgent);
68
- const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
69
- await executeHttpCall({
70
- request: httpReq,
71
- httpClient,
72
- logger: this.logger,
73
- });
74
- };
75
- await executeCall(call, options);
76
- }
77
- /** Gets the information for a specific group in the <Databricks> account. */
78
- async getAccountGroup(req, options) {
79
- const { host, accountId, httpClient } = await this.resolveConfig();
80
- const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ''}/scim/v2/Groups/${req.id ?? ''}`;
81
- let resp;
82
- const call = async (callSignal) => {
83
- const headers = new Headers();
84
- headers.set('User-Agent', this.userAgent);
85
- const httpReq = buildHttpRequest('GET', url, headers, callSignal);
86
- const respBody = await executeHttpCall({
87
- request: httpReq,
88
- httpClient,
89
- logger: this.logger,
90
- });
91
- resp = parseResponse(respBody, unmarshalAccountGroupSchema);
92
- };
93
- await executeCall(call, options);
94
- if (resp === undefined) {
95
- throw new Error('operation completed without a result.');
96
- }
97
- return resp;
98
- }
99
- /**
100
- * Gets all details of the groups associated with the <Databricks> account. As of 08/22/2025,
101
- * this endpoint will no longer return members. Instead, members should be retrieved by
102
- * iterating through `Get group details`. Existing accounts that rely on this attribute
103
- * will not be impacted and will continue receiving member data as before.
104
- */
105
- async listAccountGroups(req, options) {
106
- const { host, accountId, httpClient } = await this.resolveConfig();
107
- const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ''}/scim/v2/Groups`;
108
- const params = new URLSearchParams();
109
- if (req.filter !== undefined) {
110
- params.append('filter', req.filter);
111
- }
112
- if (req.attributes !== undefined) {
113
- params.append('attributes', req.attributes);
114
- }
115
- if (req.excludedAttributes !== undefined) {
116
- params.append('excludedAttributes', req.excludedAttributes);
117
- }
118
- if (req.startIndex !== undefined) {
119
- params.append('startIndex', String(req.startIndex));
120
- }
121
- if (req.count !== undefined) {
122
- params.append('count', String(req.count));
123
- }
124
- if (req.sortBy !== undefined) {
125
- params.append('sortBy', req.sortBy);
126
- }
127
- if (req.sortOrder !== undefined) {
128
- params.append('sortOrder', req.sortOrder);
129
- }
130
- const query = params.toString();
131
- const fullUrl = query !== '' ? `${url}?${query}` : url;
132
- let resp;
133
- const call = async (callSignal) => {
134
- const headers = new Headers();
135
- headers.set('User-Agent', this.userAgent);
136
- const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
137
- const respBody = await executeHttpCall({
138
- request: httpReq,
139
- httpClient,
140
- logger: this.logger,
141
- });
142
- resp = parseResponse(respBody, unmarshalListAccountGroupsResponseSchema);
143
- };
144
- await executeCall(call, options);
145
- if (resp === undefined) {
146
- throw new Error('operation completed without a result.');
147
- }
148
- return resp;
149
- }
150
- async *listAccountGroupsIter(req, options) {
151
- const pageReq = { ...req };
152
- for (;;) {
153
- const resp = await this.listAccountGroups(pageReq, options);
154
- const items = resp.resources ?? [];
155
- for (const item of items) {
156
- yield item;
157
- }
158
- if (items.length === 0) {
159
- return;
160
- }
161
- pageReq.startIndex = (resp.startIndex ?? 0n) + BigInt(items.length);
162
- }
163
- }
164
- /** Partially updates the details of a group. */
165
- async patchAccountGroup(req, options) {
166
- const { host, accountId, httpClient } = await this.resolveConfig();
167
- const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ''}/scim/v2/Groups/${req.id ?? ''}`;
168
- const body = marshalRequest(req, marshalPatchAccountGroupRequestSchema);
169
- const call = async (callSignal) => {
170
- const headers = new Headers({ 'Content-Type': 'application/json' });
171
- headers.set('User-Agent', this.userAgent);
172
- const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
173
- await executeHttpCall({
174
- request: httpReq,
175
- httpClient,
176
- logger: this.logger,
177
- });
178
- };
179
- await executeCall(call, options);
180
- }
181
- /** Updates the details of a group by replacing the entire group entity. */
182
- async updateAccountGroup(req, options) {
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
- const body = marshalRequest(req, marshalUpdateAccountGroupRequestSchema);
186
- const call = async (callSignal) => {
187
- const headers = new Headers({ 'Content-Type': 'application/json' });
188
- headers.set('User-Agent', this.userAgent);
189
- const httpReq = buildHttpRequest('PUT', url, headers, callSignal, body);
190
- await executeHttpCall({
191
- request: httpReq,
192
- httpClient,
193
- logger: this.logger,
194
- });
195
- };
196
- await executeCall(call, options);
197
- }
198
- /** Creates a new service principal in the <Databricks> account. */
199
- async createAccountServicePrincipal(req, options) {
200
- const { host, accountId, httpClient } = await this.resolveConfig();
201
- const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ''}/scim/v2/ServicePrincipals`;
202
- const body = marshalRequest(req, marshalCreateAccountServicePrincipalRequestSchema);
203
- let resp;
204
- const call = async (callSignal) => {
205
- const headers = new Headers({ 'Content-Type': 'application/json' });
206
- headers.set('User-Agent', this.userAgent);
207
- const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
208
- const respBody = await executeHttpCall({
209
- request: httpReq,
210
- httpClient,
211
- logger: this.logger,
212
- });
213
- resp = parseResponse(respBody, unmarshalAccountServicePrincipalSchema);
214
- };
215
- await executeCall(call, options);
216
- if (resp === undefined) {
217
- throw new Error('operation completed without a result.');
218
- }
219
- return resp;
220
- }
221
- /** Delete a single service principal in the <Databricks> account. */
222
- async deleteAccountServicePrincipal(req, options) {
223
- const { host, accountId, httpClient } = await this.resolveConfig();
224
- const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ''}/scim/v2/ServicePrincipals/${req.id ?? ''}`;
225
- const call = async (callSignal) => {
226
- const headers = new Headers();
227
- headers.set('User-Agent', this.userAgent);
228
- const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
229
- await executeHttpCall({
230
- request: httpReq,
231
- httpClient,
232
- logger: this.logger,
233
- });
234
- };
235
- await executeCall(call, options);
236
- }
237
- /** Gets the details for a single service principal define in the <Databricks> account. */
238
- async getAccountServicePrincipal(req, options) {
239
- const { host, accountId, httpClient } = await this.resolveConfig();
240
- const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ''}/scim/v2/ServicePrincipals/${req.id ?? ''}`;
241
- let resp;
242
- const call = async (callSignal) => {
243
- const headers = new Headers();
244
- headers.set('User-Agent', this.userAgent);
245
- const httpReq = buildHttpRequest('GET', url, headers, callSignal);
246
- const respBody = await executeHttpCall({
247
- request: httpReq,
248
- httpClient,
249
- logger: this.logger,
250
- });
251
- resp = parseResponse(respBody, unmarshalAccountServicePrincipalSchema);
252
- };
253
- await executeCall(call, options);
254
- if (resp === undefined) {
255
- throw new Error('operation completed without a result.');
256
- }
257
- return resp;
258
- }
259
- /** Gets the set of service principals associated with a <Databricks> account. */
260
- async listAccountServicePrincipals(req, options) {
261
- const { host, accountId, httpClient } = await this.resolveConfig();
262
- const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ''}/scim/v2/ServicePrincipals`;
263
- const params = new URLSearchParams();
264
- if (req.attributes !== undefined) {
265
- params.append('attributes', req.attributes);
266
- }
267
- if (req.count !== undefined) {
268
- params.append('count', String(req.count));
269
- }
270
- if (req.excludedAttributes !== undefined) {
271
- params.append('excludedAttributes', req.excludedAttributes);
272
- }
273
- if (req.filter !== undefined) {
274
- params.append('filter', req.filter);
275
- }
276
- if (req.sortBy !== undefined) {
277
- params.append('sortBy', req.sortBy);
278
- }
279
- if (req.sortOrder !== undefined) {
280
- params.append('sortOrder', req.sortOrder);
281
- }
282
- if (req.startIndex !== undefined) {
283
- params.append('startIndex', String(req.startIndex));
284
- }
285
- const query = params.toString();
286
- const fullUrl = query !== '' ? `${url}?${query}` : url;
287
- let resp;
288
- const call = async (callSignal) => {
289
- const headers = new Headers();
290
- headers.set('User-Agent', this.userAgent);
291
- const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
292
- const respBody = await executeHttpCall({
293
- request: httpReq,
294
- httpClient,
295
- logger: this.logger,
296
- });
297
- resp = parseResponse(respBody, unmarshalListAccountServicePrincipalsResponseSchema);
298
- };
299
- await executeCall(call, options);
300
- if (resp === undefined) {
301
- throw new Error('operation completed without a result.');
302
- }
303
- return resp;
304
- }
305
- async *listAccountServicePrincipalsIter(req, options) {
306
- const pageReq = { ...req };
307
- for (;;) {
308
- const resp = await this.listAccountServicePrincipals(pageReq, options);
309
- const items = resp.resources ?? [];
310
- for (const item of items) {
311
- yield item;
312
- }
313
- if (items.length === 0) {
314
- return;
315
- }
316
- pageReq.startIndex = (resp.startIndex ?? 0n) + BigInt(items.length);
317
- }
318
- }
319
- /** Partially updates the details of a single service principal in the <Databricks> account. */
320
- async patchAccountServicePrincipal(req, options) {
321
- const { host, accountId, httpClient } = await this.resolveConfig();
322
- const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ''}/scim/v2/ServicePrincipals/${req.id ?? ''}`;
323
- const body = marshalRequest(req, marshalPatchAccountServicePrincipalRequestSchema);
324
- const call = async (callSignal) => {
325
- const headers = new Headers({ 'Content-Type': 'application/json' });
326
- headers.set('User-Agent', this.userAgent);
327
- const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
328
- await executeHttpCall({
329
- request: httpReq,
330
- httpClient,
331
- logger: this.logger,
332
- });
333
- };
334
- await executeCall(call, options);
335
- }
336
- /**
337
- * Updates the details of a single service principal.
338
- *
339
- * This action replaces the existing service principal with the same name.
340
- */
341
- async updateAccountServicePrincipal(req, options) {
342
- const { host, accountId, httpClient } = await this.resolveConfig();
343
- const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ''}/scim/v2/ServicePrincipals/${req.id ?? ''}`;
344
- const body = marshalRequest(req, marshalUpdateAccountServicePrincipalRequestSchema);
345
- const call = async (callSignal) => {
346
- const headers = new Headers({ 'Content-Type': 'application/json' });
347
- headers.set('User-Agent', this.userAgent);
348
- const httpReq = buildHttpRequest('PUT', url, headers, callSignal, body);
349
- await executeHttpCall({
350
- request: httpReq,
351
- httpClient,
352
- logger: this.logger,
353
- });
354
- };
355
- await executeCall(call, options);
356
- }
357
- /** Creates a new user in the <Databricks> account. This new user will also be added to the <Databricks> account. */
358
- async createAccountUser(req, options) {
359
- const { host, accountId, httpClient } = await this.resolveConfig();
360
- const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ''}/scim/v2/Users`;
361
- const body = marshalRequest(req, marshalCreateAccountUserRequestSchema);
362
- let resp;
363
- const call = async (callSignal) => {
364
- const headers = new Headers({ 'Content-Type': 'application/json' });
365
- headers.set('User-Agent', this.userAgent);
366
- const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
367
- const respBody = await executeHttpCall({
368
- request: httpReq,
369
- httpClient,
370
- logger: this.logger,
371
- });
372
- resp = parseResponse(respBody, unmarshalAccountUserSchema);
373
- };
374
- await executeCall(call, options);
375
- if (resp === undefined) {
376
- throw new Error('operation completed without a result.');
377
- }
378
- return resp;
379
- }
380
- /** Deletes a user. Deleting a user from a <Databricks> account also removes objects associated with the user. */
381
- async deleteAccountUser(req, options) {
382
- const { host, accountId, httpClient } = await this.resolveConfig();
383
- const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ''}/scim/v2/Users/${req.id ?? ''}`;
384
- const call = async (callSignal) => {
385
- const headers = new Headers();
386
- headers.set('User-Agent', this.userAgent);
387
- const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
388
- await executeHttpCall({
389
- request: httpReq,
390
- httpClient,
391
- logger: this.logger,
392
- });
393
- };
394
- await executeCall(call, options);
395
- }
396
- /** Gets information for a specific user in <Databricks> account. */
397
- async getAccountUser(req, options) {
398
- const { host, accountId, httpClient } = await this.resolveConfig();
399
- const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ''}/scim/v2/Users/${req.id ?? ''}`;
400
- const params = new URLSearchParams();
401
- if (req.attributes !== undefined) {
402
- params.append('attributes', req.attributes);
403
- }
404
- if (req.count !== undefined) {
405
- params.append('count', String(req.count));
406
- }
407
- if (req.excludedAttributes !== undefined) {
408
- params.append('excludedAttributes', req.excludedAttributes);
409
- }
410
- if (req.filter !== undefined) {
411
- params.append('filter', req.filter);
412
- }
413
- if (req.sortBy !== undefined) {
414
- params.append('sortBy', req.sortBy);
415
- }
416
- if (req.sortOrder !== undefined) {
417
- params.append('sortOrder', req.sortOrder);
418
- }
419
- if (req.startIndex !== undefined) {
420
- params.append('startIndex', String(req.startIndex));
421
- }
422
- const query = params.toString();
423
- const fullUrl = query !== '' ? `${url}?${query}` : url;
424
- let resp;
425
- const call = async (callSignal) => {
426
- const headers = new Headers();
427
- headers.set('User-Agent', this.userAgent);
428
- const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
429
- const respBody = await executeHttpCall({
430
- request: httpReq,
431
- httpClient,
432
- logger: this.logger,
433
- });
434
- resp = parseResponse(respBody, unmarshalAccountUserSchema);
435
- };
436
- await executeCall(call, options);
437
- if (resp === undefined) {
438
- throw new Error('operation completed without a result.');
439
- }
440
- return resp;
441
- }
442
- /** Gets details for all the users associated with a <Databricks> account. */
443
- async listAccountUsers(req, options) {
444
- const { host, accountId, httpClient } = await this.resolveConfig();
445
- const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ''}/scim/v2/Users`;
446
- const params = new URLSearchParams();
447
- if (req.attributes !== undefined) {
448
- params.append('attributes', req.attributes);
449
- }
450
- if (req.count !== undefined) {
451
- params.append('count', String(req.count));
452
- }
453
- if (req.excludedAttributes !== undefined) {
454
- params.append('excludedAttributes', req.excludedAttributes);
455
- }
456
- if (req.filter !== undefined) {
457
- params.append('filter', req.filter);
458
- }
459
- if (req.sortBy !== undefined) {
460
- params.append('sortBy', req.sortBy);
461
- }
462
- if (req.sortOrder !== undefined) {
463
- params.append('sortOrder', req.sortOrder);
464
- }
465
- if (req.startIndex !== undefined) {
466
- params.append('startIndex', String(req.startIndex));
467
- }
468
- const query = params.toString();
469
- const fullUrl = query !== '' ? `${url}?${query}` : url;
470
- let resp;
471
- const call = async (callSignal) => {
472
- const headers = new Headers();
473
- headers.set('User-Agent', this.userAgent);
474
- const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
475
- const respBody = await executeHttpCall({
476
- request: httpReq,
477
- httpClient,
478
- logger: this.logger,
479
- });
480
- resp = parseResponse(respBody, unmarshalListAccountUsersResponseSchema);
481
- };
482
- await executeCall(call, options);
483
- if (resp === undefined) {
484
- throw new Error('operation completed without a result.');
485
- }
486
- return resp;
487
- }
488
- async *listAccountUsersIter(req, options) {
489
- const pageReq = { ...req };
490
- for (;;) {
491
- const resp = await this.listAccountUsers(pageReq, options);
492
- const items = resp.resources ?? [];
493
- for (const item of items) {
494
- yield item;
495
- }
496
- if (items.length === 0) {
497
- return;
498
- }
499
- pageReq.startIndex = (resp.startIndex ?? 0n) + BigInt(items.length);
500
- }
501
- }
502
- /**
503
- * Partially updates a user resource by applying the supplied operations on specific user attributes.
504
- * The `userName` and `emails` attributes cannot be updated through this API; any supplied changes to them are ignored (no-op).
505
- */
506
- async patchAccountUser(req, options) {
507
- const { host, accountId, httpClient } = await this.resolveConfig();
508
- const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ''}/scim/v2/Users/${req.id ?? ''}`;
509
- const body = marshalRequest(req, marshalPatchAccountUserRequestSchema);
510
- const call = async (callSignal) => {
511
- const headers = new Headers({ 'Content-Type': 'application/json' });
512
- headers.set('User-Agent', this.userAgent);
513
- const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
514
- await executeHttpCall({
515
- request: httpReq,
516
- httpClient,
517
- logger: this.logger,
518
- });
519
- };
520
- await executeCall(call, options);
521
- }
522
- /**
523
- * Replaces a user's information with the data supplied in request.
524
- * The `userName` and `emails` attributes cannot be updated through this API; any supplied changes to them are ignored (no-op).
525
- */
526
- async updateAccountUser(req, options) {
527
- const { host, accountId, httpClient } = await this.resolveConfig();
528
- const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ''}/scim/v2/Users/${req.id ?? ''}`;
529
- const body = marshalRequest(req, marshalUpdateAccountUserRequestSchema);
530
- const call = async (callSignal) => {
531
- const headers = new Headers({ 'Content-Type': 'application/json' });
532
- headers.set('User-Agent', this.userAgent);
533
- const httpReq = buildHttpRequest('PUT', url, headers, callSignal, body);
534
- await executeHttpCall({
535
- request: httpReq,
536
- httpClient,
537
- logger: this.logger,
538
- });
539
- };
540
- await executeCall(call, options);
541
- }
542
- /** Get details about the current method caller's identity. */
543
- async me(req, options) {
544
- const { host, workspaceId, httpClient } = await this.resolveConfig();
545
- const url = `${host}/api/2.0/preview/scim/v2/Me`;
546
- const params = new URLSearchParams();
547
- if (req.attributes !== undefined) {
548
- params.append('attributes', req.attributes);
549
- }
550
- if (req.excludedAttributes !== undefined) {
551
- params.append('excludedAttributes', req.excludedAttributes);
552
- }
553
- const query = params.toString();
554
- const fullUrl = query !== '' ? `${url}?${query}` : url;
555
- let resp;
556
- const call = async (callSignal) => {
557
- const headers = new Headers();
558
- if (workspaceId !== undefined) {
559
- headers.set('X-Databricks-Workspace-Id', workspaceId);
560
- }
561
- headers.set('User-Agent', this.userAgent);
562
- const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
563
- const respBody = await executeHttpCall({
564
- request: httpReq,
565
- httpClient,
566
- logger: this.logger,
567
- });
568
- resp = parseResponse(respBody, unmarshalUserSchema);
569
- };
570
- await executeCall(call, options);
571
- if (resp === undefined) {
572
- throw new Error('operation completed without a result.');
573
- }
574
- return resp;
575
- }
576
- /** Creates a group in the <Databricks> workspace with a unique name, using the supplied group details. */
577
- async createGroup(req, options) {
578
- const { host, workspaceId, httpClient } = await this.resolveConfig();
579
- const url = `${host}/api/2.0/preview/scim/v2/Groups`;
580
- const body = marshalRequest(req, marshalCreateGroupRequestSchema);
581
- let resp;
582
- const call = async (callSignal) => {
583
- const headers = new Headers({ 'Content-Type': 'application/json' });
584
- if (workspaceId !== undefined) {
585
- headers.set('X-Databricks-Workspace-Id', workspaceId);
586
- }
587
- headers.set('User-Agent', this.userAgent);
588
- const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
589
- const respBody = await executeHttpCall({
590
- request: httpReq,
591
- httpClient,
592
- logger: this.logger,
593
- });
594
- resp = parseResponse(respBody, unmarshalGroupSchema);
595
- };
596
- await executeCall(call, options);
597
- if (resp === undefined) {
598
- throw new Error('operation completed without a result.');
599
- }
600
- return resp;
601
- }
602
- /** Deletes a group from the <Databricks> workspace. */
603
- async deleteGroup(req, options) {
604
- const { host, workspaceId, httpClient } = await this.resolveConfig();
605
- const url = `${host}/api/2.0/preview/scim/v2/Groups/${req.id ?? ''}`;
606
- const call = async (callSignal) => {
607
- const headers = new Headers();
608
- if (workspaceId !== undefined) {
609
- headers.set('X-Databricks-Workspace-Id', workspaceId);
610
- }
611
- headers.set('User-Agent', this.userAgent);
612
- const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
613
- await executeHttpCall({
614
- request: httpReq,
615
- httpClient,
616
- logger: this.logger,
617
- });
618
- };
619
- await executeCall(call, options);
620
- }
621
- /** Gets the information for a specific group in the <Databricks> workspace. */
622
- async getGroup(req, options) {
623
- const { host, workspaceId, httpClient } = await this.resolveConfig();
624
- const url = `${host}/api/2.0/preview/scim/v2/Groups/${req.id ?? ''}`;
625
- let resp;
626
- const call = async (callSignal) => {
627
- const headers = new Headers();
628
- if (workspaceId !== undefined) {
629
- headers.set('X-Databricks-Workspace-Id', workspaceId);
630
- }
631
- headers.set('User-Agent', this.userAgent);
632
- const httpReq = buildHttpRequest('GET', url, headers, callSignal);
633
- const respBody = await executeHttpCall({
634
- request: httpReq,
635
- httpClient,
636
- logger: this.logger,
637
- });
638
- resp = parseResponse(respBody, unmarshalGroupSchema);
639
- };
640
- await executeCall(call, options);
641
- if (resp === undefined) {
642
- throw new Error('operation completed without a result.');
643
- }
644
- return resp;
645
- }
646
- /** Gets all details of the groups associated with the <Databricks> workspace. */
647
- async listGroups(req, options) {
648
- const { host, workspaceId, httpClient } = await this.resolveConfig();
649
- const url = `${host}/api/2.0/preview/scim/v2/Groups`;
650
- const params = new URLSearchParams();
651
- if (req.filter !== undefined) {
652
- params.append('filter', req.filter);
653
- }
654
- if (req.attributes !== undefined) {
655
- params.append('attributes', req.attributes);
656
- }
657
- if (req.excludedAttributes !== undefined) {
658
- params.append('excludedAttributes', req.excludedAttributes);
659
- }
660
- if (req.startIndex !== undefined) {
661
- params.append('startIndex', String(req.startIndex));
662
- }
663
- if (req.count !== undefined) {
664
- params.append('count', String(req.count));
665
- }
666
- if (req.sortBy !== undefined) {
667
- params.append('sortBy', req.sortBy);
668
- }
669
- if (req.sortOrder !== undefined) {
670
- params.append('sortOrder', req.sortOrder);
671
- }
672
- const query = params.toString();
673
- const fullUrl = query !== '' ? `${url}?${query}` : url;
674
- let resp;
675
- const call = async (callSignal) => {
676
- const headers = new Headers();
677
- if (workspaceId !== undefined) {
678
- headers.set('X-Databricks-Workspace-Id', workspaceId);
679
- }
680
- headers.set('User-Agent', this.userAgent);
681
- const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
682
- const respBody = await executeHttpCall({
683
- request: httpReq,
684
- httpClient,
685
- logger: this.logger,
686
- });
687
- resp = parseResponse(respBody, unmarshalListGroupsResponseSchema);
688
- };
689
- await executeCall(call, options);
690
- if (resp === undefined) {
691
- throw new Error('operation completed without a result.');
692
- }
693
- return resp;
694
- }
695
- async *listGroupsIter(req, options) {
696
- const pageReq = { ...req };
697
- for (;;) {
698
- const resp = await this.listGroups(pageReq, options);
699
- const items = resp.resources ?? [];
700
- for (const item of items) {
701
- yield item;
702
- }
703
- if (items.length === 0) {
704
- return;
705
- }
706
- pageReq.startIndex = (resp.startIndex ?? 0n) + BigInt(items.length);
707
- }
708
- }
709
- /** Partially updates the details of a group. */
710
- async patchGroup(req, options) {
711
- const { host, workspaceId, httpClient } = await this.resolveConfig();
712
- const url = `${host}/api/2.0/preview/scim/v2/Groups/${req.id ?? ''}`;
713
- const body = marshalRequest(req, marshalPatchGroupRequestSchema);
714
- const call = async (callSignal) => {
715
- const headers = new Headers({ 'Content-Type': 'application/json' });
716
- if (workspaceId !== undefined) {
717
- headers.set('X-Databricks-Workspace-Id', workspaceId);
718
- }
719
- headers.set('User-Agent', this.userAgent);
720
- const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
721
- await executeHttpCall({
722
- request: httpReq,
723
- httpClient,
724
- logger: this.logger,
725
- });
726
- };
727
- await executeCall(call, options);
728
- }
729
- /** Updates the details of a group by replacing the entire group entity. */
730
- async updateGroup(req, options) {
731
- const { host, workspaceId, httpClient } = await this.resolveConfig();
732
- const url = `${host}/api/2.0/preview/scim/v2/Groups/${req.id ?? ''}`;
733
- const body = marshalRequest(req, marshalUpdateGroupRequestSchema);
734
- const call = async (callSignal) => {
735
- const headers = new Headers({ 'Content-Type': 'application/json' });
736
- if (workspaceId !== undefined) {
737
- headers.set('X-Databricks-Workspace-Id', workspaceId);
738
- }
739
- headers.set('User-Agent', this.userAgent);
740
- const httpReq = buildHttpRequest('PUT', url, headers, callSignal, body);
741
- await executeHttpCall({
742
- request: httpReq,
743
- httpClient,
744
- logger: this.logger,
745
- });
746
- };
747
- await executeCall(call, options);
748
- }
749
- /** Creates a new service principal in the <Databricks> workspace. */
750
- async createServicePrincipal(req, options) {
751
- const { host, workspaceId, httpClient } = await this.resolveConfig();
752
- const url = `${host}/api/2.0/preview/scim/v2/ServicePrincipals`;
753
- const body = marshalRequest(req, marshalCreateServicePrincipalRequestSchema);
754
- let resp;
755
- const call = async (callSignal) => {
756
- const headers = new Headers({ 'Content-Type': 'application/json' });
757
- if (workspaceId !== undefined) {
758
- headers.set('X-Databricks-Workspace-Id', workspaceId);
759
- }
760
- headers.set('User-Agent', this.userAgent);
761
- const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
762
- const respBody = await executeHttpCall({
763
- request: httpReq,
764
- httpClient,
765
- logger: this.logger,
766
- });
767
- resp = parseResponse(respBody, unmarshalServicePrincipalSchema);
768
- };
769
- await executeCall(call, options);
770
- if (resp === undefined) {
771
- throw new Error('operation completed without a result.');
772
- }
773
- return resp;
774
- }
775
- /** Delete a single service principal in the <Databricks> workspace. */
776
- async deleteServicePrincipal(req, options) {
777
- const { host, workspaceId, httpClient } = await this.resolveConfig();
778
- const url = `${host}/api/2.0/preview/scim/v2/ServicePrincipals/${req.id ?? ''}`;
779
- const call = async (callSignal) => {
780
- const headers = new Headers();
781
- if (workspaceId !== undefined) {
782
- headers.set('X-Databricks-Workspace-Id', workspaceId);
783
- }
784
- headers.set('User-Agent', this.userAgent);
785
- const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
786
- await executeHttpCall({
787
- request: httpReq,
788
- httpClient,
789
- logger: this.logger,
790
- });
791
- };
792
- await executeCall(call, options);
793
- }
794
- /** Gets the details for a single service principal define in the <Databricks> workspace. */
795
- async getServicePrincipal(req, options) {
796
- const { host, workspaceId, httpClient } = await this.resolveConfig();
797
- const url = `${host}/api/2.0/preview/scim/v2/ServicePrincipals/${req.id ?? ''}`;
798
- let resp;
799
- const call = async (callSignal) => {
800
- const headers = new Headers();
801
- if (workspaceId !== undefined) {
802
- headers.set('X-Databricks-Workspace-Id', workspaceId);
803
- }
804
- headers.set('User-Agent', this.userAgent);
805
- const httpReq = buildHttpRequest('GET', url, headers, callSignal);
806
- const respBody = await executeHttpCall({
807
- request: httpReq,
808
- httpClient,
809
- logger: this.logger,
810
- });
811
- resp = parseResponse(respBody, unmarshalServicePrincipalSchema);
812
- };
813
- await executeCall(call, options);
814
- if (resp === undefined) {
815
- throw new Error('operation completed without a result.');
816
- }
817
- return resp;
818
- }
819
- /** Gets the set of service principals associated with a <Databricks> workspace. */
820
- async listServicePrincipals(req, options) {
821
- const { host, workspaceId, httpClient } = await this.resolveConfig();
822
- const url = `${host}/api/2.0/preview/scim/v2/ServicePrincipals`;
823
- const params = new URLSearchParams();
824
- if (req.attributes !== undefined) {
825
- params.append('attributes', req.attributes);
826
- }
827
- if (req.count !== undefined) {
828
- params.append('count', String(req.count));
829
- }
830
- if (req.excludedAttributes !== undefined) {
831
- params.append('excludedAttributes', req.excludedAttributes);
832
- }
833
- if (req.filter !== undefined) {
834
- params.append('filter', req.filter);
835
- }
836
- if (req.sortBy !== undefined) {
837
- params.append('sortBy', req.sortBy);
838
- }
839
- if (req.sortOrder !== undefined) {
840
- params.append('sortOrder', req.sortOrder);
841
- }
842
- if (req.startIndex !== undefined) {
843
- params.append('startIndex', String(req.startIndex));
844
- }
845
- const query = params.toString();
846
- const fullUrl = query !== '' ? `${url}?${query}` : url;
847
- let resp;
848
- const call = async (callSignal) => {
849
- const headers = new Headers();
850
- if (workspaceId !== undefined) {
851
- headers.set('X-Databricks-Workspace-Id', workspaceId);
852
- }
853
- headers.set('User-Agent', this.userAgent);
854
- const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
855
- const respBody = await executeHttpCall({
856
- request: httpReq,
857
- httpClient,
858
- logger: this.logger,
859
- });
860
- resp = parseResponse(respBody, unmarshalListServicePrincipalResponseSchema);
861
- };
862
- await executeCall(call, options);
863
- if (resp === undefined) {
864
- throw new Error('operation completed without a result.');
865
- }
866
- return resp;
867
- }
868
- async *listServicePrincipalsIter(req, options) {
869
- const pageReq = { ...req };
870
- for (;;) {
871
- const resp = await this.listServicePrincipals(pageReq, options);
872
- const items = resp.resources ?? [];
873
- for (const item of items) {
874
- yield item;
875
- }
876
- if (items.length === 0) {
877
- return;
878
- }
879
- pageReq.startIndex = (resp.startIndex ?? 0n) + BigInt(items.length);
880
- }
881
- }
882
- /** Partially updates the details of a single service principal in the <Databricks> workspace. */
883
- async patchServicePrincipal(req, options) {
884
- const { host, workspaceId, httpClient } = await this.resolveConfig();
885
- const url = `${host}/api/2.0/preview/scim/v2/ServicePrincipals/${req.id ?? ''}`;
886
- const body = marshalRequest(req, marshalPatchServicePrincipalRequestSchema);
887
- const call = async (callSignal) => {
888
- const headers = new Headers({ 'Content-Type': 'application/json' });
889
- if (workspaceId !== undefined) {
890
- headers.set('X-Databricks-Workspace-Id', workspaceId);
891
- }
892
- headers.set('User-Agent', this.userAgent);
893
- const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
894
- await executeHttpCall({
895
- request: httpReq,
896
- httpClient,
897
- logger: this.logger,
898
- });
899
- };
900
- await executeCall(call, options);
901
- }
902
- /**
903
- * Updates the details of a single service principal.
904
- *
905
- * This action replaces the existing service principal with the same name.
906
- */
907
- async updateServicePrincipal(req, options) {
908
- const { host, workspaceId, httpClient } = await this.resolveConfig();
909
- const url = `${host}/api/2.0/preview/scim/v2/ServicePrincipals/${req.id ?? ''}`;
910
- const body = marshalRequest(req, marshalUpdateServicePrincipalRequestSchema);
911
- const call = async (callSignal) => {
912
- const headers = new Headers({ 'Content-Type': 'application/json' });
913
- if (workspaceId !== undefined) {
914
- headers.set('X-Databricks-Workspace-Id', workspaceId);
915
- }
916
- headers.set('User-Agent', this.userAgent);
917
- const httpReq = buildHttpRequest('PUT', url, headers, callSignal, body);
918
- await executeHttpCall({
919
- request: httpReq,
920
- httpClient,
921
- logger: this.logger,
922
- });
923
- };
924
- await executeCall(call, options);
925
- }
926
- /** Creates a new user in the <Databricks> workspace. This new user will also be added to the <Databricks> account. */
927
- async createUser(req, options) {
928
- const { host, workspaceId, httpClient } = await this.resolveConfig();
929
- const url = `${host}/api/2.0/preview/scim/v2/Users`;
930
- const body = marshalRequest(req, marshalCreateUserRequestSchema);
931
- let resp;
932
- const call = async (callSignal) => {
933
- const headers = new Headers({ 'Content-Type': 'application/json' });
934
- if (workspaceId !== undefined) {
935
- headers.set('X-Databricks-Workspace-Id', workspaceId);
936
- }
937
- headers.set('User-Agent', this.userAgent);
938
- const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
939
- const respBody = await executeHttpCall({
940
- request: httpReq,
941
- httpClient,
942
- logger: this.logger,
943
- });
944
- resp = parseResponse(respBody, unmarshalUserSchema);
945
- };
946
- await executeCall(call, options);
947
- if (resp === undefined) {
948
- throw new Error('operation completed without a result.');
949
- }
950
- return resp;
951
- }
952
- /** Deletes a user. Deleting a user from a <Databricks> workspace also removes objects associated with the user. */
953
- async deleteUser(req, options) {
954
- const { host, workspaceId, httpClient } = await this.resolveConfig();
955
- const url = `${host}/api/2.0/preview/scim/v2/Users/${req.id ?? ''}`;
956
- const call = async (callSignal) => {
957
- const headers = new Headers();
958
- if (workspaceId !== undefined) {
959
- headers.set('X-Databricks-Workspace-Id', workspaceId);
960
- }
961
- headers.set('User-Agent', this.userAgent);
962
- const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
963
- await executeHttpCall({
964
- request: httpReq,
965
- httpClient,
966
- logger: this.logger,
967
- });
968
- };
969
- await executeCall(call, options);
970
- }
971
- /** Gets the permission levels that a user can have on an object. */
972
- async getPermissionLevels(_req, options) {
973
- const { host, workspaceId, httpClient } = await this.resolveConfig();
974
- const url = `${host}/api/2.0/permissions/authorization/passwords/permissionLevels`;
975
- let resp;
976
- const call = async (callSignal) => {
977
- const headers = new Headers();
978
- if (workspaceId !== undefined) {
979
- headers.set('X-Databricks-Workspace-Id', workspaceId);
980
- }
981
- headers.set('User-Agent', this.userAgent);
982
- const httpReq = buildHttpRequest('GET', url, headers, callSignal);
983
- const respBody = await executeHttpCall({
984
- request: httpReq,
985
- httpClient,
986
- logger: this.logger,
987
- });
988
- resp = parseResponse(respBody, unmarshalGetPasswordPermissionLevelsResponseSchema);
989
- };
990
- await executeCall(call, options);
991
- if (resp === undefined) {
992
- throw new Error('operation completed without a result.');
993
- }
994
- return resp;
995
- }
996
- /** Gets the permissions of all passwords. Passwords can inherit permissions from their root object. */
997
- async getPermissions(_req, options) {
998
- const { host, workspaceId, httpClient } = await this.resolveConfig();
999
- const url = `${host}/api/2.0/permissions/authorization/passwords`;
1000
- let resp;
1001
- const call = async (callSignal) => {
1002
- const headers = new Headers();
1003
- if (workspaceId !== undefined) {
1004
- headers.set('X-Databricks-Workspace-Id', workspaceId);
1005
- }
1006
- headers.set('User-Agent', this.userAgent);
1007
- const httpReq = buildHttpRequest('GET', url, headers, callSignal);
1008
- const respBody = await executeHttpCall({
1009
- request: httpReq,
1010
- httpClient,
1011
- logger: this.logger,
1012
- });
1013
- resp = parseResponse(respBody, unmarshalPasswordPermissionsSchema);
1014
- };
1015
- await executeCall(call, options);
1016
- if (resp === undefined) {
1017
- throw new Error('operation completed without a result.');
1018
- }
1019
- return resp;
1020
- }
1021
- /** Gets information for a specific user in <Databricks> workspace. */
1022
- async getUser(req, options) {
1023
- const { host, workspaceId, httpClient } = await this.resolveConfig();
1024
- const url = `${host}/api/2.0/preview/scim/v2/Users/${req.id ?? ''}`;
1025
- const params = new URLSearchParams();
1026
- if (req.attributes !== undefined) {
1027
- params.append('attributes', req.attributes);
1028
- }
1029
- if (req.count !== undefined) {
1030
- params.append('count', String(req.count));
1031
- }
1032
- if (req.excludedAttributes !== undefined) {
1033
- params.append('excludedAttributes', req.excludedAttributes);
1034
- }
1035
- if (req.filter !== undefined) {
1036
- params.append('filter', req.filter);
1037
- }
1038
- if (req.sortBy !== undefined) {
1039
- params.append('sortBy', req.sortBy);
1040
- }
1041
- if (req.sortOrder !== undefined) {
1042
- params.append('sortOrder', req.sortOrder);
1043
- }
1044
- if (req.startIndex !== undefined) {
1045
- params.append('startIndex', String(req.startIndex));
1046
- }
1047
- const query = params.toString();
1048
- const fullUrl = query !== '' ? `${url}?${query}` : url;
1049
- let resp;
1050
- const call = async (callSignal) => {
1051
- const headers = new Headers();
1052
- if (workspaceId !== undefined) {
1053
- headers.set('X-Databricks-Workspace-Id', workspaceId);
1054
- }
1055
- headers.set('User-Agent', this.userAgent);
1056
- const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
1057
- const respBody = await executeHttpCall({
1058
- request: httpReq,
1059
- httpClient,
1060
- logger: this.logger,
1061
- });
1062
- resp = parseResponse(respBody, unmarshalUserSchema);
1063
- };
1064
- await executeCall(call, options);
1065
- if (resp === undefined) {
1066
- throw new Error('operation completed without a result.');
1067
- }
1068
- return resp;
1069
- }
1070
- /** Gets details for all the users associated with a <Databricks> workspace. */
1071
- async listUsers(req, options) {
1072
- const { host, workspaceId, httpClient } = await this.resolveConfig();
1073
- const url = `${host}/api/2.0/preview/scim/v2/Users`;
1074
- const params = new URLSearchParams();
1075
- if (req.attributes !== undefined) {
1076
- params.append('attributes', req.attributes);
1077
- }
1078
- if (req.count !== undefined) {
1079
- params.append('count', String(req.count));
1080
- }
1081
- if (req.excludedAttributes !== undefined) {
1082
- params.append('excludedAttributes', req.excludedAttributes);
1083
- }
1084
- if (req.filter !== undefined) {
1085
- params.append('filter', req.filter);
1086
- }
1087
- if (req.sortBy !== undefined) {
1088
- params.append('sortBy', req.sortBy);
1089
- }
1090
- if (req.sortOrder !== undefined) {
1091
- params.append('sortOrder', req.sortOrder);
1092
- }
1093
- if (req.startIndex !== undefined) {
1094
- params.append('startIndex', String(req.startIndex));
1095
- }
1096
- const query = params.toString();
1097
- const fullUrl = query !== '' ? `${url}?${query}` : url;
1098
- let resp;
1099
- const call = async (callSignal) => {
1100
- const headers = new Headers();
1101
- if (workspaceId !== undefined) {
1102
- headers.set('X-Databricks-Workspace-Id', workspaceId);
1103
- }
1104
- headers.set('User-Agent', this.userAgent);
1105
- const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
1106
- const respBody = await executeHttpCall({
1107
- request: httpReq,
1108
- httpClient,
1109
- logger: this.logger,
1110
- });
1111
- resp = parseResponse(respBody, unmarshalListUsersResponseSchema);
1112
- };
1113
- await executeCall(call, options);
1114
- if (resp === undefined) {
1115
- throw new Error('operation completed without a result.');
1116
- }
1117
- return resp;
1118
- }
1119
- async *listUsersIter(req, options) {
1120
- const pageReq = { ...req };
1121
- for (;;) {
1122
- const resp = await this.listUsers(pageReq, options);
1123
- const items = resp.resources ?? [];
1124
- for (const item of items) {
1125
- yield item;
1126
- }
1127
- if (items.length === 0) {
1128
- return;
1129
- }
1130
- pageReq.startIndex = (resp.startIndex ?? 0n) + BigInt(items.length);
1131
- }
1132
- }
1133
- /**
1134
- * Partially updates a user resource by applying the supplied operations on specific user attributes.
1135
- * The `userName` and `emails` attributes cannot be updated through this API; any supplied changes to them are ignored (no-op).
1136
- */
1137
- async patchUser(req, options) {
1138
- const { host, workspaceId, httpClient } = await this.resolveConfig();
1139
- const url = `${host}/api/2.0/preview/scim/v2/Users/${req.id ?? ''}`;
1140
- const body = marshalRequest(req, marshalPatchUserRequestSchema);
1141
- const call = async (callSignal) => {
1142
- const headers = new Headers({ 'Content-Type': 'application/json' });
1143
- if (workspaceId !== undefined) {
1144
- headers.set('X-Databricks-Workspace-Id', workspaceId);
1145
- }
1146
- headers.set('User-Agent', this.userAgent);
1147
- const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
1148
- await executeHttpCall({
1149
- request: httpReq,
1150
- httpClient,
1151
- logger: this.logger,
1152
- });
1153
- };
1154
- await executeCall(call, options);
1155
- }
1156
- /** 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. */
1157
- async setPermissions(req, options) {
1158
- const { host, workspaceId, httpClient } = await this.resolveConfig();
1159
- const url = `${host}/api/2.0/permissions/authorization/passwords`;
1160
- const body = marshalRequest(req, marshalPasswordPermissionsRequestSchema);
1161
- let resp;
1162
- const call = async (callSignal) => {
1163
- const headers = new Headers({ 'Content-Type': 'application/json' });
1164
- if (workspaceId !== undefined) {
1165
- headers.set('X-Databricks-Workspace-Id', workspaceId);
1166
- }
1167
- headers.set('User-Agent', this.userAgent);
1168
- const httpReq = buildHttpRequest('PUT', url, headers, callSignal, body);
1169
- const respBody = await executeHttpCall({
1170
- request: httpReq,
1171
- httpClient,
1172
- logger: this.logger,
1173
- });
1174
- resp = parseResponse(respBody, unmarshalPasswordPermissionsSchema);
1175
- };
1176
- await executeCall(call, options);
1177
- if (resp === undefined) {
1178
- throw new Error('operation completed without a result.');
1179
- }
1180
- return resp;
1181
- }
1182
- /** Updates the permissions on all passwords. Passwords can inherit permissions from their root object. */
1183
- async updatePermissions(req, options) {
1184
- const { host, workspaceId, httpClient } = await this.resolveConfig();
1185
- const url = `${host}/api/2.0/permissions/authorization/passwords`;
1186
- const body = marshalRequest(req, marshalPasswordPermissionsRequestSchema);
1187
- let resp;
1188
- const call = async (callSignal) => {
1189
- const headers = new Headers({ 'Content-Type': 'application/json' });
1190
- if (workspaceId !== undefined) {
1191
- headers.set('X-Databricks-Workspace-Id', workspaceId);
1192
- }
1193
- headers.set('User-Agent', this.userAgent);
1194
- const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
1195
- const respBody = await executeHttpCall({
1196
- request: httpReq,
1197
- httpClient,
1198
- logger: this.logger,
1199
- });
1200
- resp = parseResponse(respBody, unmarshalPasswordPermissionsSchema);
1201
- };
1202
- await executeCall(call, options);
1203
- if (resp === undefined) {
1204
- throw new Error('operation completed without a result.');
1205
- }
1206
- return resp;
1207
- }
1208
- /**
1209
- * Replaces a user's information with the data supplied in request.
1210
- * The `userName` and `emails` attributes cannot be updated through this API; any supplied changes to them are ignored (no-op).
1211
- */
1212
- async updateUser(req, options) {
1213
- const { host, workspaceId, httpClient } = await this.resolveConfig();
1214
- const url = `${host}/api/2.0/preview/scim/v2/Users/${req.id ?? ''}`;
1215
- const body = marshalRequest(req, marshalUpdateUserRequestSchema);
1216
- const call = async (callSignal) => {
1217
- const headers = new Headers({ 'Content-Type': 'application/json' });
1218
- if (workspaceId !== undefined) {
1219
- headers.set('X-Databricks-Workspace-Id', workspaceId);
1220
- }
1221
- headers.set('User-Agent', this.userAgent);
1222
- const httpReq = buildHttpRequest('PUT', url, headers, callSignal, body);
1223
- await executeHttpCall({
1224
- request: httpReq,
1225
- httpClient,
1226
- logger: this.logger,
1227
- });
1228
- };
1229
- await executeCall(call, options);
1230
- }
1231
- }
14
+ var ScimClient = class {
15
+ options;
16
+ logger;
17
+ userAgent;
18
+ config;
19
+ constructor(options) {
20
+ this.options = options;
21
+ this.logger = options.logger ?? new NoOpLogger();
22
+ this.userAgent = createDefault().with(PACKAGE_SEGMENT).with({
23
+ key: "sdk-js-auth",
24
+ value: VERSION
25
+ }).with({
26
+ key: "auth",
27
+ value: options.credentials?.name() ?? "default"
28
+ }).toString();
29
+ }
30
+ resolveConfig() {
31
+ this.config ??= resolveClientConfig(this.options);
32
+ return this.config;
33
+ }
34
+ /** Creates a group in the <Databricks> account with a unique name, using the supplied group details. */
35
+ async createAccountGroup(req, options) {
36
+ const { host, accountId, httpClient } = await this.resolveConfig();
37
+ const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ""}/scim/v2/Groups`;
38
+ const body = marshalRequest(req, marshalCreateAccountGroupRequestSchema);
39
+ let resp;
40
+ const call = async (callSignal) => {
41
+ const headers = new Headers({ "Content-Type": "application/json" });
42
+ headers.set("User-Agent", this.userAgent);
43
+ resp = parseResponse(await executeHttpCall({
44
+ request: buildHttpRequest("POST", url, headers, callSignal, body),
45
+ httpClient,
46
+ logger: this.logger
47
+ }), unmarshalAccountGroupSchema);
48
+ };
49
+ await executeCall(call, options);
50
+ if (resp === void 0) throw new Error("operation completed without a result.");
51
+ return resp;
52
+ }
53
+ /** Deletes a group from the <Databricks> account. */
54
+ async deleteAccountGroup(req, options) {
55
+ const { host, accountId, httpClient } = await this.resolveConfig();
56
+ const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ""}/scim/v2/Groups/${req.id ?? ""}`;
57
+ const call = async (callSignal) => {
58
+ const headers = new Headers();
59
+ headers.set("User-Agent", this.userAgent);
60
+ await executeHttpCall({
61
+ request: buildHttpRequest("DELETE", url, headers, callSignal),
62
+ httpClient,
63
+ logger: this.logger
64
+ });
65
+ };
66
+ await executeCall(call, options);
67
+ }
68
+ /** Gets the information for a specific group in the <Databricks> account. */
69
+ async getAccountGroup(req, options) {
70
+ const { host, accountId, httpClient } = await this.resolveConfig();
71
+ const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ""}/scim/v2/Groups/${req.id ?? ""}`;
72
+ let resp;
73
+ const call = async (callSignal) => {
74
+ const headers = new Headers();
75
+ headers.set("User-Agent", this.userAgent);
76
+ resp = parseResponse(await executeHttpCall({
77
+ request: buildHttpRequest("GET", url, headers, callSignal),
78
+ httpClient,
79
+ logger: this.logger
80
+ }), unmarshalAccountGroupSchema);
81
+ };
82
+ await executeCall(call, options);
83
+ if (resp === void 0) throw new Error("operation completed without a result.");
84
+ return resp;
85
+ }
86
+ /**
87
+ * Gets all details of the groups associated with the <Databricks> account. As of 08/22/2025,
88
+ * this endpoint will no longer return members. Instead, members should be retrieved by
89
+ * iterating through `Get group details`. Existing accounts that rely on this attribute
90
+ * will not be impacted and will continue receiving member data as before.
91
+ */
92
+ async listAccountGroups(req, options) {
93
+ const { host, accountId, httpClient } = await this.resolveConfig();
94
+ const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ""}/scim/v2/Groups`;
95
+ const params = new URLSearchParams();
96
+ if (req.filter !== void 0) params.append("filter", req.filter);
97
+ if (req.attributes !== void 0) params.append("attributes", req.attributes);
98
+ if (req.excludedAttributes !== void 0) params.append("excludedAttributes", req.excludedAttributes);
99
+ if (req.startIndex !== void 0) params.append("startIndex", String(req.startIndex));
100
+ if (req.count !== void 0) params.append("count", String(req.count));
101
+ if (req.sortBy !== void 0) params.append("sortBy", req.sortBy);
102
+ if (req.sortOrder !== void 0) params.append("sortOrder", req.sortOrder);
103
+ const query = params.toString();
104
+ const fullUrl = query !== "" ? `${url}?${query}` : url;
105
+ let resp;
106
+ const call = async (callSignal) => {
107
+ const headers = new Headers();
108
+ headers.set("User-Agent", this.userAgent);
109
+ resp = parseResponse(await executeHttpCall({
110
+ request: buildHttpRequest("GET", fullUrl, headers, callSignal),
111
+ httpClient,
112
+ logger: this.logger
113
+ }), unmarshalListAccountGroupsResponseSchema);
114
+ };
115
+ await executeCall(call, options);
116
+ if (resp === void 0) throw new Error("operation completed without a result.");
117
+ return resp;
118
+ }
119
+ async *listAccountGroupsIter(req, options) {
120
+ const pageReq = { ...req };
121
+ for (;;) {
122
+ const resp = await this.listAccountGroups(pageReq, options);
123
+ const items = resp.resources ?? [];
124
+ for (const item of items) yield item;
125
+ if (items.length === 0) return;
126
+ pageReq.startIndex = (resp.startIndex ?? 0n) + BigInt(items.length);
127
+ }
128
+ }
129
+ /** Partially updates the details of a group. */
130
+ async patchAccountGroup(req, options) {
131
+ const { host, accountId, httpClient } = await this.resolveConfig();
132
+ const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ""}/scim/v2/Groups/${req.id ?? ""}`;
133
+ const body = marshalRequest(req, marshalPatchAccountGroupRequestSchema);
134
+ const call = async (callSignal) => {
135
+ const headers = new Headers({ "Content-Type": "application/json" });
136
+ headers.set("User-Agent", this.userAgent);
137
+ await executeHttpCall({
138
+ request: buildHttpRequest("PATCH", url, headers, callSignal, body),
139
+ httpClient,
140
+ logger: this.logger
141
+ });
142
+ };
143
+ await executeCall(call, options);
144
+ }
145
+ /** Updates the details of a group by replacing the entire group entity. */
146
+ async updateAccountGroup(req, options) {
147
+ const { host, accountId, httpClient } = await this.resolveConfig();
148
+ const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ""}/scim/v2/Groups/${req.id ?? ""}`;
149
+ const body = marshalRequest(req, marshalUpdateAccountGroupRequestSchema);
150
+ const call = async (callSignal) => {
151
+ const headers = new Headers({ "Content-Type": "application/json" });
152
+ headers.set("User-Agent", this.userAgent);
153
+ await executeHttpCall({
154
+ request: buildHttpRequest("PUT", url, headers, callSignal, body),
155
+ httpClient,
156
+ logger: this.logger
157
+ });
158
+ };
159
+ await executeCall(call, options);
160
+ }
161
+ /** Creates a new service principal in the <Databricks> account. */
162
+ async createAccountServicePrincipal(req, options) {
163
+ const { host, accountId, httpClient } = await this.resolveConfig();
164
+ const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ""}/scim/v2/ServicePrincipals`;
165
+ const body = marshalRequest(req, marshalCreateAccountServicePrincipalRequestSchema);
166
+ let resp;
167
+ const call = async (callSignal) => {
168
+ const headers = new Headers({ "Content-Type": "application/json" });
169
+ headers.set("User-Agent", this.userAgent);
170
+ resp = parseResponse(await executeHttpCall({
171
+ request: buildHttpRequest("POST", url, headers, callSignal, body),
172
+ httpClient,
173
+ logger: this.logger
174
+ }), unmarshalAccountServicePrincipalSchema);
175
+ };
176
+ await executeCall(call, options);
177
+ if (resp === void 0) throw new Error("operation completed without a result.");
178
+ return resp;
179
+ }
180
+ /** Delete a single service principal in the <Databricks> account. */
181
+ async deleteAccountServicePrincipal(req, options) {
182
+ const { host, accountId, httpClient } = await this.resolveConfig();
183
+ const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ""}/scim/v2/ServicePrincipals/${req.id ?? ""}`;
184
+ const call = async (callSignal) => {
185
+ const headers = new Headers();
186
+ headers.set("User-Agent", this.userAgent);
187
+ await executeHttpCall({
188
+ request: buildHttpRequest("DELETE", url, headers, callSignal),
189
+ httpClient,
190
+ logger: this.logger
191
+ });
192
+ };
193
+ await executeCall(call, options);
194
+ }
195
+ /** Gets the details for a single service principal define in the <Databricks> account. */
196
+ async getAccountServicePrincipal(req, options) {
197
+ const { host, accountId, httpClient } = await this.resolveConfig();
198
+ const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ""}/scim/v2/ServicePrincipals/${req.id ?? ""}`;
199
+ let resp;
200
+ const call = async (callSignal) => {
201
+ const headers = new Headers();
202
+ headers.set("User-Agent", this.userAgent);
203
+ resp = parseResponse(await executeHttpCall({
204
+ request: buildHttpRequest("GET", url, headers, callSignal),
205
+ httpClient,
206
+ logger: this.logger
207
+ }), unmarshalAccountServicePrincipalSchema);
208
+ };
209
+ await executeCall(call, options);
210
+ if (resp === void 0) throw new Error("operation completed without a result.");
211
+ return resp;
212
+ }
213
+ /** Gets the set of service principals associated with a <Databricks> account. */
214
+ async listAccountServicePrincipals(req, options) {
215
+ const { host, accountId, httpClient } = await this.resolveConfig();
216
+ const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ""}/scim/v2/ServicePrincipals`;
217
+ const params = new URLSearchParams();
218
+ if (req.attributes !== void 0) params.append("attributes", req.attributes);
219
+ if (req.count !== void 0) params.append("count", String(req.count));
220
+ if (req.excludedAttributes !== void 0) params.append("excludedAttributes", req.excludedAttributes);
221
+ if (req.filter !== void 0) params.append("filter", req.filter);
222
+ if (req.sortBy !== void 0) params.append("sortBy", req.sortBy);
223
+ if (req.sortOrder !== void 0) params.append("sortOrder", req.sortOrder);
224
+ if (req.startIndex !== void 0) params.append("startIndex", String(req.startIndex));
225
+ const query = params.toString();
226
+ const fullUrl = query !== "" ? `${url}?${query}` : url;
227
+ let resp;
228
+ const call = async (callSignal) => {
229
+ const headers = new Headers();
230
+ headers.set("User-Agent", this.userAgent);
231
+ resp = parseResponse(await executeHttpCall({
232
+ request: buildHttpRequest("GET", fullUrl, headers, callSignal),
233
+ httpClient,
234
+ logger: this.logger
235
+ }), unmarshalListAccountServicePrincipalsResponseSchema);
236
+ };
237
+ await executeCall(call, options);
238
+ if (resp === void 0) throw new Error("operation completed without a result.");
239
+ return resp;
240
+ }
241
+ async *listAccountServicePrincipalsIter(req, options) {
242
+ const pageReq = { ...req };
243
+ for (;;) {
244
+ const resp = await this.listAccountServicePrincipals(pageReq, options);
245
+ const items = resp.resources ?? [];
246
+ for (const item of items) yield item;
247
+ if (items.length === 0) return;
248
+ pageReq.startIndex = (resp.startIndex ?? 0n) + BigInt(items.length);
249
+ }
250
+ }
251
+ /** Partially updates the details of a single service principal in the <Databricks> account. */
252
+ async patchAccountServicePrincipal(req, options) {
253
+ const { host, accountId, httpClient } = await this.resolveConfig();
254
+ const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ""}/scim/v2/ServicePrincipals/${req.id ?? ""}`;
255
+ const body = marshalRequest(req, marshalPatchAccountServicePrincipalRequestSchema);
256
+ const call = async (callSignal) => {
257
+ const headers = new Headers({ "Content-Type": "application/json" });
258
+ headers.set("User-Agent", this.userAgent);
259
+ await executeHttpCall({
260
+ request: buildHttpRequest("PATCH", url, headers, callSignal, body),
261
+ httpClient,
262
+ logger: this.logger
263
+ });
264
+ };
265
+ await executeCall(call, options);
266
+ }
267
+ /**
268
+ * Updates the details of a single service principal.
269
+ *
270
+ * This action replaces the existing service principal with the same name.
271
+ */
272
+ async updateAccountServicePrincipal(req, options) {
273
+ const { host, accountId, httpClient } = await this.resolveConfig();
274
+ const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ""}/scim/v2/ServicePrincipals/${req.id ?? ""}`;
275
+ const body = marshalRequest(req, marshalUpdateAccountServicePrincipalRequestSchema);
276
+ const call = async (callSignal) => {
277
+ const headers = new Headers({ "Content-Type": "application/json" });
278
+ headers.set("User-Agent", this.userAgent);
279
+ await executeHttpCall({
280
+ request: buildHttpRequest("PUT", url, headers, callSignal, body),
281
+ httpClient,
282
+ logger: this.logger
283
+ });
284
+ };
285
+ await executeCall(call, options);
286
+ }
287
+ /** Creates a new user in the <Databricks> account. This new user will also be added to the <Databricks> account. */
288
+ async createAccountUser(req, options) {
289
+ const { host, accountId, httpClient } = await this.resolveConfig();
290
+ const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ""}/scim/v2/Users`;
291
+ const body = marshalRequest(req, marshalCreateAccountUserRequestSchema);
292
+ let resp;
293
+ const call = async (callSignal) => {
294
+ const headers = new Headers({ "Content-Type": "application/json" });
295
+ headers.set("User-Agent", this.userAgent);
296
+ resp = parseResponse(await executeHttpCall({
297
+ request: buildHttpRequest("POST", url, headers, callSignal, body),
298
+ httpClient,
299
+ logger: this.logger
300
+ }), unmarshalAccountUserSchema);
301
+ };
302
+ await executeCall(call, options);
303
+ if (resp === void 0) throw new Error("operation completed without a result.");
304
+ return resp;
305
+ }
306
+ /** Deletes a user. Deleting a user from a <Databricks> account also removes objects associated with the user. */
307
+ async deleteAccountUser(req, options) {
308
+ const { host, accountId, httpClient } = await this.resolveConfig();
309
+ const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ""}/scim/v2/Users/${req.id ?? ""}`;
310
+ const call = async (callSignal) => {
311
+ const headers = new Headers();
312
+ headers.set("User-Agent", this.userAgent);
313
+ await executeHttpCall({
314
+ request: buildHttpRequest("DELETE", url, headers, callSignal),
315
+ httpClient,
316
+ logger: this.logger
317
+ });
318
+ };
319
+ await executeCall(call, options);
320
+ }
321
+ /** Gets information for a specific user in <Databricks> account. */
322
+ async getAccountUser(req, options) {
323
+ const { host, accountId, httpClient } = await this.resolveConfig();
324
+ const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ""}/scim/v2/Users/${req.id ?? ""}`;
325
+ const params = new URLSearchParams();
326
+ if (req.attributes !== void 0) params.append("attributes", req.attributes);
327
+ if (req.count !== void 0) params.append("count", String(req.count));
328
+ if (req.excludedAttributes !== void 0) params.append("excludedAttributes", req.excludedAttributes);
329
+ if (req.filter !== void 0) params.append("filter", req.filter);
330
+ if (req.sortBy !== void 0) params.append("sortBy", req.sortBy);
331
+ if (req.sortOrder !== void 0) params.append("sortOrder", req.sortOrder);
332
+ if (req.startIndex !== void 0) params.append("startIndex", String(req.startIndex));
333
+ const query = params.toString();
334
+ const fullUrl = query !== "" ? `${url}?${query}` : url;
335
+ let resp;
336
+ const call = async (callSignal) => {
337
+ const headers = new Headers();
338
+ headers.set("User-Agent", this.userAgent);
339
+ resp = parseResponse(await executeHttpCall({
340
+ request: buildHttpRequest("GET", fullUrl, headers, callSignal),
341
+ httpClient,
342
+ logger: this.logger
343
+ }), unmarshalAccountUserSchema);
344
+ };
345
+ await executeCall(call, options);
346
+ if (resp === void 0) throw new Error("operation completed without a result.");
347
+ return resp;
348
+ }
349
+ /** Gets details for all the users associated with a <Databricks> account. */
350
+ async listAccountUsers(req, options) {
351
+ const { host, accountId, httpClient } = await this.resolveConfig();
352
+ const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ""}/scim/v2/Users`;
353
+ const params = new URLSearchParams();
354
+ if (req.attributes !== void 0) params.append("attributes", req.attributes);
355
+ if (req.count !== void 0) params.append("count", String(req.count));
356
+ if (req.excludedAttributes !== void 0) params.append("excludedAttributes", req.excludedAttributes);
357
+ if (req.filter !== void 0) params.append("filter", req.filter);
358
+ if (req.sortBy !== void 0) params.append("sortBy", req.sortBy);
359
+ if (req.sortOrder !== void 0) params.append("sortOrder", req.sortOrder);
360
+ if (req.startIndex !== void 0) params.append("startIndex", String(req.startIndex));
361
+ const query = params.toString();
362
+ const fullUrl = query !== "" ? `${url}?${query}` : url;
363
+ let resp;
364
+ const call = async (callSignal) => {
365
+ const headers = new Headers();
366
+ headers.set("User-Agent", this.userAgent);
367
+ resp = parseResponse(await executeHttpCall({
368
+ request: buildHttpRequest("GET", fullUrl, headers, callSignal),
369
+ httpClient,
370
+ logger: this.logger
371
+ }), unmarshalListAccountUsersResponseSchema);
372
+ };
373
+ await executeCall(call, options);
374
+ if (resp === void 0) throw new Error("operation completed without a result.");
375
+ return resp;
376
+ }
377
+ async *listAccountUsersIter(req, options) {
378
+ const pageReq = { ...req };
379
+ for (;;) {
380
+ const resp = await this.listAccountUsers(pageReq, options);
381
+ const items = resp.resources ?? [];
382
+ for (const item of items) yield item;
383
+ if (items.length === 0) return;
384
+ pageReq.startIndex = (resp.startIndex ?? 0n) + BigInt(items.length);
385
+ }
386
+ }
387
+ /**
388
+ * Partially updates a user resource by applying the supplied operations on specific user attributes.
389
+ * The `userName` and `emails` attributes cannot be updated through this API; any supplied changes to them are ignored (no-op).
390
+ */
391
+ async patchAccountUser(req, options) {
392
+ const { host, accountId, httpClient } = await this.resolveConfig();
393
+ const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ""}/scim/v2/Users/${req.id ?? ""}`;
394
+ const body = marshalRequest(req, marshalPatchAccountUserRequestSchema);
395
+ const call = async (callSignal) => {
396
+ const headers = new Headers({ "Content-Type": "application/json" });
397
+ headers.set("User-Agent", this.userAgent);
398
+ await executeHttpCall({
399
+ request: buildHttpRequest("PATCH", url, headers, callSignal, body),
400
+ httpClient,
401
+ logger: this.logger
402
+ });
403
+ };
404
+ await executeCall(call, options);
405
+ }
406
+ /**
407
+ * Replaces a user's information with the data supplied in request.
408
+ * The `userName` and `emails` attributes cannot be updated through this API; any supplied changes to them are ignored (no-op).
409
+ */
410
+ async updateAccountUser(req, options) {
411
+ const { host, accountId, httpClient } = await this.resolveConfig();
412
+ const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ""}/scim/v2/Users/${req.id ?? ""}`;
413
+ const body = marshalRequest(req, marshalUpdateAccountUserRequestSchema);
414
+ const call = async (callSignal) => {
415
+ const headers = new Headers({ "Content-Type": "application/json" });
416
+ headers.set("User-Agent", this.userAgent);
417
+ await executeHttpCall({
418
+ request: buildHttpRequest("PUT", url, headers, callSignal, body),
419
+ httpClient,
420
+ logger: this.logger
421
+ });
422
+ };
423
+ await executeCall(call, options);
424
+ }
425
+ /** Get details about the current method caller's identity. */
426
+ async me(req, options) {
427
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
428
+ const url = `${host}/api/2.0/preview/scim/v2/Me`;
429
+ const params = new URLSearchParams();
430
+ if (req.attributes !== void 0) params.append("attributes", req.attributes);
431
+ if (req.excludedAttributes !== void 0) params.append("excludedAttributes", req.excludedAttributes);
432
+ const query = params.toString();
433
+ const fullUrl = query !== "" ? `${url}?${query}` : url;
434
+ let resp;
435
+ const call = async (callSignal) => {
436
+ const headers = new Headers();
437
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
438
+ headers.set("User-Agent", this.userAgent);
439
+ resp = parseResponse(await executeHttpCall({
440
+ request: buildHttpRequest("GET", fullUrl, headers, callSignal),
441
+ httpClient,
442
+ logger: this.logger
443
+ }), unmarshalUserSchema);
444
+ };
445
+ await executeCall(call, options);
446
+ if (resp === void 0) throw new Error("operation completed without a result.");
447
+ return resp;
448
+ }
449
+ /** Creates a group in the <Databricks> workspace with a unique name, using the supplied group details. */
450
+ async createGroup(req, options) {
451
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
452
+ const url = `${host}/api/2.0/preview/scim/v2/Groups`;
453
+ const body = marshalRequest(req, marshalCreateGroupRequestSchema);
454
+ let resp;
455
+ const call = async (callSignal) => {
456
+ const headers = new Headers({ "Content-Type": "application/json" });
457
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
458
+ headers.set("User-Agent", this.userAgent);
459
+ resp = parseResponse(await executeHttpCall({
460
+ request: buildHttpRequest("POST", url, headers, callSignal, body),
461
+ httpClient,
462
+ logger: this.logger
463
+ }), unmarshalGroupSchema);
464
+ };
465
+ await executeCall(call, options);
466
+ if (resp === void 0) throw new Error("operation completed without a result.");
467
+ return resp;
468
+ }
469
+ /** Deletes a group from the <Databricks> workspace. */
470
+ async deleteGroup(req, options) {
471
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
472
+ const url = `${host}/api/2.0/preview/scim/v2/Groups/${req.id ?? ""}`;
473
+ const call = async (callSignal) => {
474
+ const headers = new Headers();
475
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
476
+ headers.set("User-Agent", this.userAgent);
477
+ await executeHttpCall({
478
+ request: buildHttpRequest("DELETE", url, headers, callSignal),
479
+ httpClient,
480
+ logger: this.logger
481
+ });
482
+ };
483
+ await executeCall(call, options);
484
+ }
485
+ /** Gets the information for a specific group in the <Databricks> workspace. */
486
+ async getGroup(req, options) {
487
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
488
+ const url = `${host}/api/2.0/preview/scim/v2/Groups/${req.id ?? ""}`;
489
+ let resp;
490
+ const call = async (callSignal) => {
491
+ const headers = new Headers();
492
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
493
+ headers.set("User-Agent", this.userAgent);
494
+ resp = parseResponse(await executeHttpCall({
495
+ request: buildHttpRequest("GET", url, headers, callSignal),
496
+ httpClient,
497
+ logger: this.logger
498
+ }), unmarshalGroupSchema);
499
+ };
500
+ await executeCall(call, options);
501
+ if (resp === void 0) throw new Error("operation completed without a result.");
502
+ return resp;
503
+ }
504
+ /** Gets all details of the groups associated with the <Databricks> workspace. */
505
+ async listGroups(req, options) {
506
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
507
+ const url = `${host}/api/2.0/preview/scim/v2/Groups`;
508
+ const params = new URLSearchParams();
509
+ if (req.filter !== void 0) params.append("filter", req.filter);
510
+ if (req.attributes !== void 0) params.append("attributes", req.attributes);
511
+ if (req.excludedAttributes !== void 0) params.append("excludedAttributes", req.excludedAttributes);
512
+ if (req.startIndex !== void 0) params.append("startIndex", String(req.startIndex));
513
+ if (req.count !== void 0) params.append("count", String(req.count));
514
+ if (req.sortBy !== void 0) params.append("sortBy", req.sortBy);
515
+ if (req.sortOrder !== void 0) params.append("sortOrder", req.sortOrder);
516
+ const query = params.toString();
517
+ const fullUrl = query !== "" ? `${url}?${query}` : url;
518
+ let resp;
519
+ const call = async (callSignal) => {
520
+ const headers = new Headers();
521
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
522
+ headers.set("User-Agent", this.userAgent);
523
+ resp = parseResponse(await executeHttpCall({
524
+ request: buildHttpRequest("GET", fullUrl, headers, callSignal),
525
+ httpClient,
526
+ logger: this.logger
527
+ }), unmarshalListGroupsResponseSchema);
528
+ };
529
+ await executeCall(call, options);
530
+ if (resp === void 0) throw new Error("operation completed without a result.");
531
+ return resp;
532
+ }
533
+ async *listGroupsIter(req, options) {
534
+ const pageReq = { ...req };
535
+ for (;;) {
536
+ const resp = await this.listGroups(pageReq, options);
537
+ const items = resp.resources ?? [];
538
+ for (const item of items) yield item;
539
+ if (items.length === 0) return;
540
+ pageReq.startIndex = (resp.startIndex ?? 0n) + BigInt(items.length);
541
+ }
542
+ }
543
+ /** Partially updates the details of a group. */
544
+ async patchGroup(req, options) {
545
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
546
+ const url = `${host}/api/2.0/preview/scim/v2/Groups/${req.id ?? ""}`;
547
+ const body = marshalRequest(req, marshalPatchGroupRequestSchema);
548
+ const call = async (callSignal) => {
549
+ const headers = new Headers({ "Content-Type": "application/json" });
550
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
551
+ headers.set("User-Agent", this.userAgent);
552
+ await executeHttpCall({
553
+ request: buildHttpRequest("PATCH", url, headers, callSignal, body),
554
+ httpClient,
555
+ logger: this.logger
556
+ });
557
+ };
558
+ await executeCall(call, options);
559
+ }
560
+ /** Updates the details of a group by replacing the entire group entity. */
561
+ async updateGroup(req, options) {
562
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
563
+ const url = `${host}/api/2.0/preview/scim/v2/Groups/${req.id ?? ""}`;
564
+ const body = marshalRequest(req, marshalUpdateGroupRequestSchema);
565
+ const call = async (callSignal) => {
566
+ const headers = new Headers({ "Content-Type": "application/json" });
567
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
568
+ headers.set("User-Agent", this.userAgent);
569
+ await executeHttpCall({
570
+ request: buildHttpRequest("PUT", url, headers, callSignal, body),
571
+ httpClient,
572
+ logger: this.logger
573
+ });
574
+ };
575
+ await executeCall(call, options);
576
+ }
577
+ /** Creates a new service principal in the <Databricks> workspace. */
578
+ async createServicePrincipal(req, options) {
579
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
580
+ const url = `${host}/api/2.0/preview/scim/v2/ServicePrincipals`;
581
+ const body = marshalRequest(req, marshalCreateServicePrincipalRequestSchema);
582
+ let resp;
583
+ const call = async (callSignal) => {
584
+ const headers = new Headers({ "Content-Type": "application/json" });
585
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
586
+ headers.set("User-Agent", this.userAgent);
587
+ resp = parseResponse(await executeHttpCall({
588
+ request: buildHttpRequest("POST", url, headers, callSignal, body),
589
+ httpClient,
590
+ logger: this.logger
591
+ }), unmarshalServicePrincipalSchema);
592
+ };
593
+ await executeCall(call, options);
594
+ if (resp === void 0) throw new Error("operation completed without a result.");
595
+ return resp;
596
+ }
597
+ /** Delete a single service principal in the <Databricks> workspace. */
598
+ async deleteServicePrincipal(req, options) {
599
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
600
+ const url = `${host}/api/2.0/preview/scim/v2/ServicePrincipals/${req.id ?? ""}`;
601
+ const call = async (callSignal) => {
602
+ const headers = new Headers();
603
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
604
+ headers.set("User-Agent", this.userAgent);
605
+ await executeHttpCall({
606
+ request: buildHttpRequest("DELETE", url, headers, callSignal),
607
+ httpClient,
608
+ logger: this.logger
609
+ });
610
+ };
611
+ await executeCall(call, options);
612
+ }
613
+ /** Gets the details for a single service principal define in the <Databricks> workspace. */
614
+ async getServicePrincipal(req, options) {
615
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
616
+ const url = `${host}/api/2.0/preview/scim/v2/ServicePrincipals/${req.id ?? ""}`;
617
+ let resp;
618
+ const call = async (callSignal) => {
619
+ const headers = new Headers();
620
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
621
+ headers.set("User-Agent", this.userAgent);
622
+ resp = parseResponse(await executeHttpCall({
623
+ request: buildHttpRequest("GET", url, headers, callSignal),
624
+ httpClient,
625
+ logger: this.logger
626
+ }), unmarshalServicePrincipalSchema);
627
+ };
628
+ await executeCall(call, options);
629
+ if (resp === void 0) throw new Error("operation completed without a result.");
630
+ return resp;
631
+ }
632
+ /** Gets the set of service principals associated with a <Databricks> workspace. */
633
+ async listServicePrincipals(req, options) {
634
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
635
+ const url = `${host}/api/2.0/preview/scim/v2/ServicePrincipals`;
636
+ const params = new URLSearchParams();
637
+ if (req.attributes !== void 0) params.append("attributes", req.attributes);
638
+ if (req.count !== void 0) params.append("count", String(req.count));
639
+ if (req.excludedAttributes !== void 0) params.append("excludedAttributes", req.excludedAttributes);
640
+ if (req.filter !== void 0) params.append("filter", req.filter);
641
+ if (req.sortBy !== void 0) params.append("sortBy", req.sortBy);
642
+ if (req.sortOrder !== void 0) params.append("sortOrder", req.sortOrder);
643
+ if (req.startIndex !== void 0) params.append("startIndex", String(req.startIndex));
644
+ const query = params.toString();
645
+ const fullUrl = query !== "" ? `${url}?${query}` : url;
646
+ let resp;
647
+ const call = async (callSignal) => {
648
+ const headers = new Headers();
649
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
650
+ headers.set("User-Agent", this.userAgent);
651
+ resp = parseResponse(await executeHttpCall({
652
+ request: buildHttpRequest("GET", fullUrl, headers, callSignal),
653
+ httpClient,
654
+ logger: this.logger
655
+ }), unmarshalListServicePrincipalResponseSchema);
656
+ };
657
+ await executeCall(call, options);
658
+ if (resp === void 0) throw new Error("operation completed without a result.");
659
+ return resp;
660
+ }
661
+ async *listServicePrincipalsIter(req, options) {
662
+ const pageReq = { ...req };
663
+ for (;;) {
664
+ const resp = await this.listServicePrincipals(pageReq, options);
665
+ const items = resp.resources ?? [];
666
+ for (const item of items) yield item;
667
+ if (items.length === 0) return;
668
+ pageReq.startIndex = (resp.startIndex ?? 0n) + BigInt(items.length);
669
+ }
670
+ }
671
+ /** Partially updates the details of a single service principal in the <Databricks> workspace. */
672
+ async patchServicePrincipal(req, options) {
673
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
674
+ const url = `${host}/api/2.0/preview/scim/v2/ServicePrincipals/${req.id ?? ""}`;
675
+ const body = marshalRequest(req, marshalPatchServicePrincipalRequestSchema);
676
+ const call = async (callSignal) => {
677
+ const headers = new Headers({ "Content-Type": "application/json" });
678
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
679
+ headers.set("User-Agent", this.userAgent);
680
+ await executeHttpCall({
681
+ request: buildHttpRequest("PATCH", url, headers, callSignal, body),
682
+ httpClient,
683
+ logger: this.logger
684
+ });
685
+ };
686
+ await executeCall(call, options);
687
+ }
688
+ /**
689
+ * Updates the details of a single service principal.
690
+ *
691
+ * This action replaces the existing service principal with the same name.
692
+ */
693
+ async updateServicePrincipal(req, options) {
694
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
695
+ const url = `${host}/api/2.0/preview/scim/v2/ServicePrincipals/${req.id ?? ""}`;
696
+ const body = marshalRequest(req, marshalUpdateServicePrincipalRequestSchema);
697
+ const call = async (callSignal) => {
698
+ const headers = new Headers({ "Content-Type": "application/json" });
699
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
700
+ headers.set("User-Agent", this.userAgent);
701
+ await executeHttpCall({
702
+ request: buildHttpRequest("PUT", url, headers, callSignal, body),
703
+ httpClient,
704
+ logger: this.logger
705
+ });
706
+ };
707
+ await executeCall(call, options);
708
+ }
709
+ /** Creates a new user in the <Databricks> workspace. This new user will also be added to the <Databricks> account. */
710
+ async createUser(req, options) {
711
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
712
+ const url = `${host}/api/2.0/preview/scim/v2/Users`;
713
+ const body = marshalRequest(req, marshalCreateUserRequestSchema);
714
+ let resp;
715
+ const call = async (callSignal) => {
716
+ const headers = new Headers({ "Content-Type": "application/json" });
717
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
718
+ headers.set("User-Agent", this.userAgent);
719
+ resp = parseResponse(await executeHttpCall({
720
+ request: buildHttpRequest("POST", url, headers, callSignal, body),
721
+ httpClient,
722
+ logger: this.logger
723
+ }), unmarshalUserSchema);
724
+ };
725
+ await executeCall(call, options);
726
+ if (resp === void 0) throw new Error("operation completed without a result.");
727
+ return resp;
728
+ }
729
+ /** Deletes a user. Deleting a user from a <Databricks> workspace also removes objects associated with the user. */
730
+ async deleteUser(req, options) {
731
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
732
+ const url = `${host}/api/2.0/preview/scim/v2/Users/${req.id ?? ""}`;
733
+ const call = async (callSignal) => {
734
+ const headers = new Headers();
735
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
736
+ headers.set("User-Agent", this.userAgent);
737
+ await executeHttpCall({
738
+ request: buildHttpRequest("DELETE", url, headers, callSignal),
739
+ httpClient,
740
+ logger: this.logger
741
+ });
742
+ };
743
+ await executeCall(call, options);
744
+ }
745
+ /** Gets the permission levels that a user can have on an object. */
746
+ async getPermissionLevels(_req, options) {
747
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
748
+ const url = `${host}/api/2.0/permissions/authorization/passwords/permissionLevels`;
749
+ let resp;
750
+ const call = async (callSignal) => {
751
+ const headers = new Headers();
752
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
753
+ headers.set("User-Agent", this.userAgent);
754
+ resp = parseResponse(await executeHttpCall({
755
+ request: buildHttpRequest("GET", url, headers, callSignal),
756
+ httpClient,
757
+ logger: this.logger
758
+ }), unmarshalGetPasswordPermissionLevelsResponseSchema);
759
+ };
760
+ await executeCall(call, options);
761
+ if (resp === void 0) throw new Error("operation completed without a result.");
762
+ return resp;
763
+ }
764
+ /** Gets the permissions of all passwords. Passwords can inherit permissions from their root object. */
765
+ async getPermissions(_req, options) {
766
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
767
+ const url = `${host}/api/2.0/permissions/authorization/passwords`;
768
+ let resp;
769
+ const call = async (callSignal) => {
770
+ const headers = new Headers();
771
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
772
+ headers.set("User-Agent", this.userAgent);
773
+ resp = parseResponse(await executeHttpCall({
774
+ request: buildHttpRequest("GET", url, headers, callSignal),
775
+ httpClient,
776
+ logger: this.logger
777
+ }), unmarshalPasswordPermissionsSchema);
778
+ };
779
+ await executeCall(call, options);
780
+ if (resp === void 0) throw new Error("operation completed without a result.");
781
+ return resp;
782
+ }
783
+ /** Gets information for a specific user in <Databricks> workspace. */
784
+ async getUser(req, options) {
785
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
786
+ const url = `${host}/api/2.0/preview/scim/v2/Users/${req.id ?? ""}`;
787
+ const params = new URLSearchParams();
788
+ if (req.attributes !== void 0) params.append("attributes", req.attributes);
789
+ if (req.count !== void 0) params.append("count", String(req.count));
790
+ if (req.excludedAttributes !== void 0) params.append("excludedAttributes", req.excludedAttributes);
791
+ if (req.filter !== void 0) params.append("filter", req.filter);
792
+ if (req.sortBy !== void 0) params.append("sortBy", req.sortBy);
793
+ if (req.sortOrder !== void 0) params.append("sortOrder", req.sortOrder);
794
+ if (req.startIndex !== void 0) params.append("startIndex", String(req.startIndex));
795
+ const query = params.toString();
796
+ const fullUrl = query !== "" ? `${url}?${query}` : url;
797
+ let resp;
798
+ const call = async (callSignal) => {
799
+ const headers = new Headers();
800
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
801
+ headers.set("User-Agent", this.userAgent);
802
+ resp = parseResponse(await executeHttpCall({
803
+ request: buildHttpRequest("GET", fullUrl, headers, callSignal),
804
+ httpClient,
805
+ logger: this.logger
806
+ }), unmarshalUserSchema);
807
+ };
808
+ await executeCall(call, options);
809
+ if (resp === void 0) throw new Error("operation completed without a result.");
810
+ return resp;
811
+ }
812
+ /** Gets details for all the users associated with a <Databricks> workspace. */
813
+ async listUsers(req, options) {
814
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
815
+ const url = `${host}/api/2.0/preview/scim/v2/Users`;
816
+ const params = new URLSearchParams();
817
+ if (req.attributes !== void 0) params.append("attributes", req.attributes);
818
+ if (req.count !== void 0) params.append("count", String(req.count));
819
+ if (req.excludedAttributes !== void 0) params.append("excludedAttributes", req.excludedAttributes);
820
+ if (req.filter !== void 0) params.append("filter", req.filter);
821
+ if (req.sortBy !== void 0) params.append("sortBy", req.sortBy);
822
+ if (req.sortOrder !== void 0) params.append("sortOrder", req.sortOrder);
823
+ if (req.startIndex !== void 0) params.append("startIndex", String(req.startIndex));
824
+ const query = params.toString();
825
+ const fullUrl = query !== "" ? `${url}?${query}` : url;
826
+ let resp;
827
+ const call = async (callSignal) => {
828
+ const headers = new Headers();
829
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
830
+ headers.set("User-Agent", this.userAgent);
831
+ resp = parseResponse(await executeHttpCall({
832
+ request: buildHttpRequest("GET", fullUrl, headers, callSignal),
833
+ httpClient,
834
+ logger: this.logger
835
+ }), unmarshalListUsersResponseSchema);
836
+ };
837
+ await executeCall(call, options);
838
+ if (resp === void 0) throw new Error("operation completed without a result.");
839
+ return resp;
840
+ }
841
+ async *listUsersIter(req, options) {
842
+ const pageReq = { ...req };
843
+ for (;;) {
844
+ const resp = await this.listUsers(pageReq, options);
845
+ const items = resp.resources ?? [];
846
+ for (const item of items) yield item;
847
+ if (items.length === 0) return;
848
+ pageReq.startIndex = (resp.startIndex ?? 0n) + BigInt(items.length);
849
+ }
850
+ }
851
+ /**
852
+ * Partially updates a user resource by applying the supplied operations on specific user attributes.
853
+ * The `userName` and `emails` attributes cannot be updated through this API; any supplied changes to them are ignored (no-op).
854
+ */
855
+ async patchUser(req, options) {
856
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
857
+ const url = `${host}/api/2.0/preview/scim/v2/Users/${req.id ?? ""}`;
858
+ const body = marshalRequest(req, marshalPatchUserRequestSchema);
859
+ const call = async (callSignal) => {
860
+ const headers = new Headers({ "Content-Type": "application/json" });
861
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
862
+ headers.set("User-Agent", this.userAgent);
863
+ await executeHttpCall({
864
+ request: buildHttpRequest("PATCH", url, headers, callSignal, body),
865
+ httpClient,
866
+ logger: this.logger
867
+ });
868
+ };
869
+ await executeCall(call, options);
870
+ }
871
+ /** 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. */
872
+ async setPermissions(req, options) {
873
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
874
+ const url = `${host}/api/2.0/permissions/authorization/passwords`;
875
+ const body = marshalRequest(req, marshalPasswordPermissionsRequestSchema);
876
+ let resp;
877
+ const call = async (callSignal) => {
878
+ const headers = new Headers({ "Content-Type": "application/json" });
879
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
880
+ headers.set("User-Agent", this.userAgent);
881
+ resp = parseResponse(await executeHttpCall({
882
+ request: buildHttpRequest("PUT", url, headers, callSignal, body),
883
+ httpClient,
884
+ logger: this.logger
885
+ }), unmarshalPasswordPermissionsSchema);
886
+ };
887
+ await executeCall(call, options);
888
+ if (resp === void 0) throw new Error("operation completed without a result.");
889
+ return resp;
890
+ }
891
+ /** Updates the permissions on all passwords. Passwords can inherit permissions from their root object. */
892
+ async updatePermissions(req, options) {
893
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
894
+ const url = `${host}/api/2.0/permissions/authorization/passwords`;
895
+ const body = marshalRequest(req, marshalPasswordPermissionsRequestSchema);
896
+ let resp;
897
+ const call = async (callSignal) => {
898
+ const headers = new Headers({ "Content-Type": "application/json" });
899
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
900
+ headers.set("User-Agent", this.userAgent);
901
+ resp = parseResponse(await executeHttpCall({
902
+ request: buildHttpRequest("PATCH", url, headers, callSignal, body),
903
+ httpClient,
904
+ logger: this.logger
905
+ }), unmarshalPasswordPermissionsSchema);
906
+ };
907
+ await executeCall(call, options);
908
+ if (resp === void 0) throw new Error("operation completed without a result.");
909
+ return resp;
910
+ }
911
+ /**
912
+ * Replaces a user's information with the data supplied in request.
913
+ * The `userName` and `emails` attributes cannot be updated through this API; any supplied changes to them are ignored (no-op).
914
+ */
915
+ async updateUser(req, options) {
916
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
917
+ const url = `${host}/api/2.0/preview/scim/v2/Users/${req.id ?? ""}`;
918
+ const body = marshalRequest(req, marshalUpdateUserRequestSchema);
919
+ const call = async (callSignal) => {
920
+ const headers = new Headers({ "Content-Type": "application/json" });
921
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
922
+ headers.set("User-Agent", this.userAgent);
923
+ await executeHttpCall({
924
+ request: buildHttpRequest("PUT", url, headers, callSignal, body),
925
+ httpClient,
926
+ logger: this.logger
927
+ });
928
+ };
929
+ await executeCall(call, options);
930
+ }
931
+ };
932
+
933
+ //#endregion
934
+ export { ScimClient };
1232
935
  //# sourceMappingURL=client.js.map