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