@databricks/sdk-settings 0.0.0-dev → 0.1.0-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +203 -0
- package/dist/v2/client.d.ts +68 -0
- package/dist/v2/client.d.ts.map +1 -0
- package/dist/v2/client.js +346 -0
- package/dist/v2/client.js.map +1 -0
- package/dist/v2/index.d.ts +4 -0
- package/dist/v2/index.d.ts.map +1 -0
- package/dist/v2/index.js +4 -0
- package/dist/v2/index.js.map +1 -0
- package/dist/v2/model.d.ts +442 -0
- package/dist/v2/model.d.ts.map +1 -0
- package/dist/v2/model.js +790 -0
- package/dist/v2/model.js.map +1 -0
- package/dist/v2/transport.d.ts +5 -0
- package/dist/v2/transport.d.ts.map +1 -0
- package/dist/v2/transport.js +57 -0
- package/dist/v2/transport.js.map +1 -0
- package/dist/v2/utils.d.ts +22 -0
- package/dist/v2/utils.d.ts.map +1 -0
- package/dist/v2/utils.js +113 -0
- package/dist/v2/utils.js.map +1 -0
- package/package.json +38 -4
- package/src/v2/client.ts +445 -0
- package/src/v2/index.ts +44 -0
- package/src/v2/model.ts +1300 -0
- package/src/v2/transport.ts +73 -0
- package/src/v2/utils.ts +156 -0
- package/README.md +0 -1
- package/index.js +0 -1
package/src/v2/client.ts
ADDED
|
@@ -0,0 +1,445 @@
|
|
|
1
|
+
// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
import {VERSION as AUTH_VERSION} from '@databricks/sdk-auth';
|
|
4
|
+
import type {Call} from '@databricks/sdk-core/api';
|
|
5
|
+
import {createDefault} from '@databricks/sdk-core/clientinfo';
|
|
6
|
+
import type {Logger} from '@databricks/sdk-core/logger';
|
|
7
|
+
import {NoOpLogger} from '@databricks/sdk-core/logger';
|
|
8
|
+
import type {CallOptions} from '@databricks/sdk-options/call';
|
|
9
|
+
import type {ClientOptions} from '@databricks/sdk-options/client';
|
|
10
|
+
import type {HttpClient} from '@databricks/sdk-core/http';
|
|
11
|
+
import {newHttpClient} from './transport';
|
|
12
|
+
import {
|
|
13
|
+
buildHttpRequest,
|
|
14
|
+
executeCall,
|
|
15
|
+
executeHttpCall,
|
|
16
|
+
marshalRequest,
|
|
17
|
+
parseResponse,
|
|
18
|
+
} from './utils';
|
|
19
|
+
import pkgJson from '../../package.json' with {type: 'json'};
|
|
20
|
+
import type {
|
|
21
|
+
GetPublicAccountSettingRequest,
|
|
22
|
+
GetPublicAccountUserPreferenceRequest,
|
|
23
|
+
GetPublicWorkspaceSettingRequest,
|
|
24
|
+
ListAccountSettingsMetadataRequest,
|
|
25
|
+
ListAccountSettingsMetadataResponse,
|
|
26
|
+
ListAccountUserPreferencesMetadataRequest,
|
|
27
|
+
ListAccountUserPreferencesMetadataResponse,
|
|
28
|
+
ListWorkspaceSettingsMetadataRequest,
|
|
29
|
+
ListWorkspaceSettingsMetadataResponse,
|
|
30
|
+
PatchPublicAccountSettingRequest,
|
|
31
|
+
PatchPublicAccountUserPreferenceRequest,
|
|
32
|
+
PatchPublicWorkspaceSettingRequest,
|
|
33
|
+
Setting,
|
|
34
|
+
SettingsMetadata,
|
|
35
|
+
UserPreference,
|
|
36
|
+
} from './model';
|
|
37
|
+
import {
|
|
38
|
+
marshalSettingSchema,
|
|
39
|
+
marshalUserPreferenceSchema,
|
|
40
|
+
unmarshalListAccountSettingsMetadataResponseSchema,
|
|
41
|
+
unmarshalListAccountUserPreferencesMetadataResponseSchema,
|
|
42
|
+
unmarshalListWorkspaceSettingsMetadataResponseSchema,
|
|
43
|
+
unmarshalSettingSchema,
|
|
44
|
+
unmarshalUserPreferenceSchema,
|
|
45
|
+
} from './model';
|
|
46
|
+
|
|
47
|
+
// Package identity segment for this client to be used in the User-Agent header.
|
|
48
|
+
const PACKAGE_SEGMENT = {
|
|
49
|
+
key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''),
|
|
50
|
+
value: pkgJson.version,
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export class SettingsClient {
|
|
54
|
+
private readonly host: string;
|
|
55
|
+
// Fallback for endpoints whose path contains {account_id}. If the request
|
|
56
|
+
// already carries an accountId, that value wins.
|
|
57
|
+
private readonly accountId: string | undefined;
|
|
58
|
+
// Workspace ID used to route workspace-level calls on unified hosts (SPOG).
|
|
59
|
+
// When set, workspace-level methods send X-Databricks-Org-Id on every
|
|
60
|
+
// request.
|
|
61
|
+
private readonly workspaceId: string | undefined;
|
|
62
|
+
private readonly httpClient: HttpClient;
|
|
63
|
+
private readonly logger: Logger;
|
|
64
|
+
// User-Agent header value. Composed once at construction from
|
|
65
|
+
// createDefault() merged with this package's identity and the active
|
|
66
|
+
// credential's name.
|
|
67
|
+
private readonly userAgent: string;
|
|
68
|
+
|
|
69
|
+
constructor(options: ClientOptions) {
|
|
70
|
+
if (options.host === undefined) {
|
|
71
|
+
throw new Error('Host is required.');
|
|
72
|
+
}
|
|
73
|
+
this.host = options.host.replace(/\/$/, '');
|
|
74
|
+
this.accountId = options.accountId;
|
|
75
|
+
this.workspaceId = options.workspaceId;
|
|
76
|
+
this.logger = options.logger ?? new NoOpLogger();
|
|
77
|
+
const info = createDefault()
|
|
78
|
+
.with(PACKAGE_SEGMENT)
|
|
79
|
+
.with({key: 'sdk-js-auth', value: AUTH_VERSION})
|
|
80
|
+
.with({key: 'auth', value: options.credentials?.name() ?? 'default'});
|
|
81
|
+
this.userAgent = info.toString();
|
|
82
|
+
this.httpClient = newHttpClient(options);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** Get a setting value at account level. See :method:settingsv2/listaccountsettingsmetadata for list of setting available via public APIs at account level. */
|
|
86
|
+
async getPublicAccountSetting(
|
|
87
|
+
req: GetPublicAccountSettingRequest,
|
|
88
|
+
options?: CallOptions
|
|
89
|
+
): Promise<Setting> {
|
|
90
|
+
const url = `${this.host}/api/2.1/accounts/${req.accountId ?? this.accountId ?? ''}/settings/${req.name ?? ''}`;
|
|
91
|
+
let resp: Setting | undefined;
|
|
92
|
+
const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
93
|
+
const headers = new Headers();
|
|
94
|
+
headers.set('User-Agent', this.userAgent);
|
|
95
|
+
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
|
|
96
|
+
const respBody = await executeHttpCall({
|
|
97
|
+
request: httpReq,
|
|
98
|
+
httpClient: this.httpClient,
|
|
99
|
+
logger: this.logger,
|
|
100
|
+
});
|
|
101
|
+
resp = parseResponse(respBody, unmarshalSettingSchema);
|
|
102
|
+
};
|
|
103
|
+
await executeCall(call, options);
|
|
104
|
+
if (resp === undefined) {
|
|
105
|
+
throw new Error('API call completed without a result.');
|
|
106
|
+
}
|
|
107
|
+
return resp;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Get a user preference for a specific user.
|
|
112
|
+
* User preferences are personal settings that allow individual customization without affecting other users.
|
|
113
|
+
* See :method:settingsv2/listaccountuserpreferencesmetadata for list of user preferences available via public APIs.
|
|
114
|
+
*/
|
|
115
|
+
async getPublicAccountUserPreference(
|
|
116
|
+
req: GetPublicAccountUserPreferenceRequest,
|
|
117
|
+
options?: CallOptions
|
|
118
|
+
): Promise<UserPreference> {
|
|
119
|
+
const url = `${this.host}/api/2.1/accounts/${req.accountId ?? this.accountId ?? ''}/users/${req.userId ?? ''}/settings/${req.name ?? ''}`;
|
|
120
|
+
let resp: UserPreference | undefined;
|
|
121
|
+
const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
122
|
+
const headers = new Headers();
|
|
123
|
+
headers.set('User-Agent', this.userAgent);
|
|
124
|
+
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
|
|
125
|
+
const respBody = await executeHttpCall({
|
|
126
|
+
request: httpReq,
|
|
127
|
+
httpClient: this.httpClient,
|
|
128
|
+
logger: this.logger,
|
|
129
|
+
});
|
|
130
|
+
resp = parseResponse(respBody, unmarshalUserPreferenceSchema);
|
|
131
|
+
};
|
|
132
|
+
await executeCall(call, options);
|
|
133
|
+
if (resp === undefined) {
|
|
134
|
+
throw new Error('API call completed without a result.');
|
|
135
|
+
}
|
|
136
|
+
return resp;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/** Get a setting value at workspace level. See :method:settingsv2/listworkspacesettingsmetadata for list of setting available via public APIs. */
|
|
140
|
+
async getPublicWorkspaceSetting(
|
|
141
|
+
req: GetPublicWorkspaceSettingRequest,
|
|
142
|
+
options?: CallOptions
|
|
143
|
+
): Promise<Setting> {
|
|
144
|
+
const url = `${this.host}/api/2.1/settings/${req.name ?? ''}`;
|
|
145
|
+
let resp: Setting | undefined;
|
|
146
|
+
const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
147
|
+
const headers = new Headers();
|
|
148
|
+
if (this.workspaceId !== undefined) {
|
|
149
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
150
|
+
}
|
|
151
|
+
headers.set('User-Agent', this.userAgent);
|
|
152
|
+
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
|
|
153
|
+
const respBody = await executeHttpCall({
|
|
154
|
+
request: httpReq,
|
|
155
|
+
httpClient: this.httpClient,
|
|
156
|
+
logger: this.logger,
|
|
157
|
+
});
|
|
158
|
+
resp = parseResponse(respBody, unmarshalSettingSchema);
|
|
159
|
+
};
|
|
160
|
+
await executeCall(call, options);
|
|
161
|
+
if (resp === undefined) {
|
|
162
|
+
throw new Error('API call completed without a result.');
|
|
163
|
+
}
|
|
164
|
+
return resp;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* List valid setting keys and metadata. These settings are available to be referenced via
|
|
169
|
+
* GET :method:settingsv2/getpublicaccountsetting and
|
|
170
|
+
* PATCH :method:settingsv2/patchpublicaccountsetting APIs
|
|
171
|
+
*/
|
|
172
|
+
async listAccountSettingsMetadata(
|
|
173
|
+
req: ListAccountSettingsMetadataRequest,
|
|
174
|
+
options?: CallOptions
|
|
175
|
+
): Promise<ListAccountSettingsMetadataResponse> {
|
|
176
|
+
const url = `${this.host}/api/2.1/accounts/${req.accountId ?? this.accountId ?? ''}/settings-metadata`;
|
|
177
|
+
const params = new URLSearchParams();
|
|
178
|
+
if (req.pageSize !== undefined) {
|
|
179
|
+
params.append('page_size', String(req.pageSize));
|
|
180
|
+
}
|
|
181
|
+
if (req.pageToken !== undefined) {
|
|
182
|
+
params.append('page_token', req.pageToken);
|
|
183
|
+
}
|
|
184
|
+
const query = params.toString();
|
|
185
|
+
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
186
|
+
let resp: ListAccountSettingsMetadataResponse | undefined;
|
|
187
|
+
const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
188
|
+
const headers = new Headers();
|
|
189
|
+
headers.set('User-Agent', this.userAgent);
|
|
190
|
+
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
191
|
+
const respBody = await executeHttpCall({
|
|
192
|
+
request: httpReq,
|
|
193
|
+
httpClient: this.httpClient,
|
|
194
|
+
logger: this.logger,
|
|
195
|
+
});
|
|
196
|
+
resp = parseResponse(
|
|
197
|
+
respBody,
|
|
198
|
+
unmarshalListAccountSettingsMetadataResponseSchema
|
|
199
|
+
);
|
|
200
|
+
};
|
|
201
|
+
await executeCall(call, options);
|
|
202
|
+
if (resp === undefined) {
|
|
203
|
+
throw new Error('API call completed without a result.');
|
|
204
|
+
}
|
|
205
|
+
return resp;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
async *listAccountSettingsMetadataIter(
|
|
209
|
+
req: ListAccountSettingsMetadataRequest,
|
|
210
|
+
options?: CallOptions
|
|
211
|
+
): AsyncGenerator<SettingsMetadata> {
|
|
212
|
+
const pageReq: ListAccountSettingsMetadataRequest = {...req};
|
|
213
|
+
for (;;) {
|
|
214
|
+
const resp = await this.listAccountSettingsMetadata(pageReq, options);
|
|
215
|
+
for (const item of resp.settingsMetadata ?? []) {
|
|
216
|
+
yield item;
|
|
217
|
+
}
|
|
218
|
+
if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
pageReq.pageToken = resp.nextPageToken;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* List valid user preferences and their metadata for a specific user.
|
|
227
|
+
* User preferences are personal settings that allow individual customization without affecting other users.
|
|
228
|
+
* These settings are available to be referenced via
|
|
229
|
+
* GET :method:settingsv2/getpublicaccountuserpreference and
|
|
230
|
+
* PATCH :method:settingsv2/patchpublicaccountuserpreference APIs
|
|
231
|
+
*/
|
|
232
|
+
async listAccountUserPreferencesMetadata(
|
|
233
|
+
req: ListAccountUserPreferencesMetadataRequest,
|
|
234
|
+
options?: CallOptions
|
|
235
|
+
): Promise<ListAccountUserPreferencesMetadataResponse> {
|
|
236
|
+
const url = `${this.host}/api/2.1/accounts/${req.accountId ?? this.accountId ?? ''}/users/${req.userId ?? ''}/settings-metadata`;
|
|
237
|
+
const params = new URLSearchParams();
|
|
238
|
+
if (req.pageSize !== undefined) {
|
|
239
|
+
params.append('page_size', String(req.pageSize));
|
|
240
|
+
}
|
|
241
|
+
if (req.pageToken !== undefined) {
|
|
242
|
+
params.append('page_token', req.pageToken);
|
|
243
|
+
}
|
|
244
|
+
const query = params.toString();
|
|
245
|
+
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
246
|
+
let resp: ListAccountUserPreferencesMetadataResponse | undefined;
|
|
247
|
+
const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
248
|
+
const headers = new Headers();
|
|
249
|
+
headers.set('User-Agent', this.userAgent);
|
|
250
|
+
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
251
|
+
const respBody = await executeHttpCall({
|
|
252
|
+
request: httpReq,
|
|
253
|
+
httpClient: this.httpClient,
|
|
254
|
+
logger: this.logger,
|
|
255
|
+
});
|
|
256
|
+
resp = parseResponse(
|
|
257
|
+
respBody,
|
|
258
|
+
unmarshalListAccountUserPreferencesMetadataResponseSchema
|
|
259
|
+
);
|
|
260
|
+
};
|
|
261
|
+
await executeCall(call, options);
|
|
262
|
+
if (resp === undefined) {
|
|
263
|
+
throw new Error('API call completed without a result.');
|
|
264
|
+
}
|
|
265
|
+
return resp;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
async *listAccountUserPreferencesMetadataIter(
|
|
269
|
+
req: ListAccountUserPreferencesMetadataRequest,
|
|
270
|
+
options?: CallOptions
|
|
271
|
+
): AsyncGenerator<SettingsMetadata> {
|
|
272
|
+
const pageReq: ListAccountUserPreferencesMetadataRequest = {...req};
|
|
273
|
+
for (;;) {
|
|
274
|
+
const resp = await this.listAccountUserPreferencesMetadata(
|
|
275
|
+
pageReq,
|
|
276
|
+
options
|
|
277
|
+
);
|
|
278
|
+
for (const item of resp.settingsMetadata ?? []) {
|
|
279
|
+
yield item;
|
|
280
|
+
}
|
|
281
|
+
if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
pageReq.pageToken = resp.nextPageToken;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* List valid setting keys and metadata. These settings are available to be referenced via
|
|
290
|
+
* GET :method:settingsv2/getpublicworkspacesetting and
|
|
291
|
+
* PATCH :method:settingsv2/patchpublicworkspacesetting APIs
|
|
292
|
+
*/
|
|
293
|
+
async listWorkspaceSettingsMetadata(
|
|
294
|
+
req: ListWorkspaceSettingsMetadataRequest,
|
|
295
|
+
options?: CallOptions
|
|
296
|
+
): Promise<ListWorkspaceSettingsMetadataResponse> {
|
|
297
|
+
const url = `${this.host}/api/2.1/settings-metadata`;
|
|
298
|
+
const params = new URLSearchParams();
|
|
299
|
+
if (req.pageSize !== undefined) {
|
|
300
|
+
params.append('page_size', String(req.pageSize));
|
|
301
|
+
}
|
|
302
|
+
if (req.pageToken !== undefined) {
|
|
303
|
+
params.append('page_token', req.pageToken);
|
|
304
|
+
}
|
|
305
|
+
const query = params.toString();
|
|
306
|
+
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
307
|
+
let resp: ListWorkspaceSettingsMetadataResponse | undefined;
|
|
308
|
+
const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
309
|
+
const headers = new Headers();
|
|
310
|
+
if (this.workspaceId !== undefined) {
|
|
311
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
312
|
+
}
|
|
313
|
+
headers.set('User-Agent', this.userAgent);
|
|
314
|
+
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
315
|
+
const respBody = await executeHttpCall({
|
|
316
|
+
request: httpReq,
|
|
317
|
+
httpClient: this.httpClient,
|
|
318
|
+
logger: this.logger,
|
|
319
|
+
});
|
|
320
|
+
resp = parseResponse(
|
|
321
|
+
respBody,
|
|
322
|
+
unmarshalListWorkspaceSettingsMetadataResponseSchema
|
|
323
|
+
);
|
|
324
|
+
};
|
|
325
|
+
await executeCall(call, options);
|
|
326
|
+
if (resp === undefined) {
|
|
327
|
+
throw new Error('API call completed without a result.');
|
|
328
|
+
}
|
|
329
|
+
return resp;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
async *listWorkspaceSettingsMetadataIter(
|
|
333
|
+
req: ListWorkspaceSettingsMetadataRequest,
|
|
334
|
+
options?: CallOptions
|
|
335
|
+
): AsyncGenerator<SettingsMetadata> {
|
|
336
|
+
const pageReq: ListWorkspaceSettingsMetadataRequest = {...req};
|
|
337
|
+
for (;;) {
|
|
338
|
+
const resp = await this.listWorkspaceSettingsMetadata(pageReq, options);
|
|
339
|
+
for (const item of resp.settingsMetadata ?? []) {
|
|
340
|
+
yield item;
|
|
341
|
+
}
|
|
342
|
+
if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
pageReq.pageToken = resp.nextPageToken;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Patch a setting value at account level. See :method:settingsv2/listaccountsettingsmetadata for list of setting available via public APIs at account level.
|
|
351
|
+
* To determine the correct field to include in a patch request, refer to the type field of the setting returned in the :method:settingsv2/listaccountsettingsmetadata response.
|
|
352
|
+
*
|
|
353
|
+
* Note: Page refresh is required for changes to take effect in UI.
|
|
354
|
+
*/
|
|
355
|
+
async patchPublicAccountSetting(
|
|
356
|
+
req: PatchPublicAccountSettingRequest,
|
|
357
|
+
options?: CallOptions
|
|
358
|
+
): Promise<Setting> {
|
|
359
|
+
const url = `${this.host}/api/2.1/accounts/${req.accountId ?? this.accountId ?? ''}/settings/${req.name ?? ''}`;
|
|
360
|
+
const body = marshalRequest(req.setting, marshalSettingSchema);
|
|
361
|
+
let resp: Setting | undefined;
|
|
362
|
+
const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
363
|
+
const headers = new Headers({'Content-Type': 'application/json'});
|
|
364
|
+
headers.set('User-Agent', this.userAgent);
|
|
365
|
+
const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
|
|
366
|
+
const respBody = await executeHttpCall({
|
|
367
|
+
request: httpReq,
|
|
368
|
+
httpClient: this.httpClient,
|
|
369
|
+
logger: this.logger,
|
|
370
|
+
});
|
|
371
|
+
resp = parseResponse(respBody, unmarshalSettingSchema);
|
|
372
|
+
};
|
|
373
|
+
await executeCall(call, options);
|
|
374
|
+
if (resp === undefined) {
|
|
375
|
+
throw new Error('API call completed without a result.');
|
|
376
|
+
}
|
|
377
|
+
return resp;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Update a user preference for a specific user.
|
|
382
|
+
* User preferences are personal settings that allow individual customization without affecting other users.
|
|
383
|
+
* See :method:settingsv2/listaccountuserpreferencesmetadata for list of user preferences available via public APIs.
|
|
384
|
+
*
|
|
385
|
+
* Note: Page refresh is required for changes to take effect in UI.
|
|
386
|
+
*/
|
|
387
|
+
async patchPublicAccountUserPreference(
|
|
388
|
+
req: PatchPublicAccountUserPreferenceRequest,
|
|
389
|
+
options?: CallOptions
|
|
390
|
+
): Promise<UserPreference> {
|
|
391
|
+
const url = `${this.host}/api/2.1/accounts/${req.accountId ?? this.accountId ?? ''}/users/${req.userId ?? ''}/settings/${req.name ?? ''}`;
|
|
392
|
+
const body = marshalRequest(req.setting, marshalUserPreferenceSchema);
|
|
393
|
+
let resp: UserPreference | undefined;
|
|
394
|
+
const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
395
|
+
const headers = new Headers({'Content-Type': 'application/json'});
|
|
396
|
+
headers.set('User-Agent', this.userAgent);
|
|
397
|
+
const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
|
|
398
|
+
const respBody = await executeHttpCall({
|
|
399
|
+
request: httpReq,
|
|
400
|
+
httpClient: this.httpClient,
|
|
401
|
+
logger: this.logger,
|
|
402
|
+
});
|
|
403
|
+
resp = parseResponse(respBody, unmarshalUserPreferenceSchema);
|
|
404
|
+
};
|
|
405
|
+
await executeCall(call, options);
|
|
406
|
+
if (resp === undefined) {
|
|
407
|
+
throw new Error('API call completed without a result.');
|
|
408
|
+
}
|
|
409
|
+
return resp;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* Patch a setting value at workspace level. See :method:settingsv2/listworkspacesettingsmetadata for list of setting available via public APIs at workspace level.
|
|
414
|
+
* To determine the correct field to include in a patch request, refer to the type field of the setting returned in the :method:settingsv2/listworkspacesettingsmetadata response.
|
|
415
|
+
*
|
|
416
|
+
* Note: Page refresh is required for changes to take effect in UI.
|
|
417
|
+
*/
|
|
418
|
+
async patchPublicWorkspaceSetting(
|
|
419
|
+
req: PatchPublicWorkspaceSettingRequest,
|
|
420
|
+
options?: CallOptions
|
|
421
|
+
): Promise<Setting> {
|
|
422
|
+
const url = `${this.host}/api/2.1/settings/${req.name ?? ''}`;
|
|
423
|
+
const body = marshalRequest(req.setting, marshalSettingSchema);
|
|
424
|
+
let resp: Setting | undefined;
|
|
425
|
+
const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
426
|
+
const headers = new Headers({'Content-Type': 'application/json'});
|
|
427
|
+
if (this.workspaceId !== undefined) {
|
|
428
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
429
|
+
}
|
|
430
|
+
headers.set('User-Agent', this.userAgent);
|
|
431
|
+
const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
|
|
432
|
+
const respBody = await executeHttpCall({
|
|
433
|
+
request: httpReq,
|
|
434
|
+
httpClient: this.httpClient,
|
|
435
|
+
logger: this.logger,
|
|
436
|
+
});
|
|
437
|
+
resp = parseResponse(respBody, unmarshalSettingSchema);
|
|
438
|
+
};
|
|
439
|
+
await executeCall(call, options);
|
|
440
|
+
if (resp === undefined) {
|
|
441
|
+
throw new Error('API call completed without a result.');
|
|
442
|
+
}
|
|
443
|
+
return resp;
|
|
444
|
+
}
|
|
445
|
+
}
|
package/src/v2/index.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
export {SettingsClient} from './client';
|
|
4
|
+
|
|
5
|
+
export {
|
|
6
|
+
PreviewPhase,
|
|
7
|
+
AibiDashboardEmbeddingAccessPolicy_AccessPolicyType,
|
|
8
|
+
ClusterAutoRestartMessage_MaintenanceWindow_DayOfWeek,
|
|
9
|
+
ClusterAutoRestartMessage_MaintenanceWindow_WeekDayFrequency,
|
|
10
|
+
PersonalComputeMessage_PersonalComputeMessageEnum,
|
|
11
|
+
RestrictWorkspaceAdminsMessage_Status,
|
|
12
|
+
} from './model';
|
|
13
|
+
|
|
14
|
+
export type {
|
|
15
|
+
AibiDashboardEmbeddingAccessPolicy,
|
|
16
|
+
AibiDashboardEmbeddingApprovedDomains,
|
|
17
|
+
AllowedAppsUserApiScopesMessage,
|
|
18
|
+
BooleanMessage,
|
|
19
|
+
ClusterAutoRestartMessage,
|
|
20
|
+
ClusterAutoRestartMessage_EnablementDetails,
|
|
21
|
+
ClusterAutoRestartMessage_MaintenanceWindow,
|
|
22
|
+
ClusterAutoRestartMessage_MaintenanceWindow_WeekDayBasedSchedule,
|
|
23
|
+
ClusterAutoRestartMessage_MaintenanceWindow_WindowStartTime,
|
|
24
|
+
GetPublicAccountSettingRequest,
|
|
25
|
+
GetPublicAccountUserPreferenceRequest,
|
|
26
|
+
GetPublicWorkspaceSettingRequest,
|
|
27
|
+
IntegerMessage,
|
|
28
|
+
ListAccountSettingsMetadataRequest,
|
|
29
|
+
ListAccountSettingsMetadataResponse,
|
|
30
|
+
ListAccountUserPreferencesMetadataRequest,
|
|
31
|
+
ListAccountUserPreferencesMetadataResponse,
|
|
32
|
+
ListWorkspaceSettingsMetadataRequest,
|
|
33
|
+
ListWorkspaceSettingsMetadataResponse,
|
|
34
|
+
OperationalEmailCustomRecipientMessage,
|
|
35
|
+
PatchPublicAccountSettingRequest,
|
|
36
|
+
PatchPublicAccountUserPreferenceRequest,
|
|
37
|
+
PatchPublicWorkspaceSettingRequest,
|
|
38
|
+
PersonalComputeMessage,
|
|
39
|
+
RestrictWorkspaceAdminsMessage,
|
|
40
|
+
Setting,
|
|
41
|
+
SettingsMetadata,
|
|
42
|
+
StringMessage,
|
|
43
|
+
UserPreference,
|
|
44
|
+
} from './model';
|