@databricks/sdk-settings 0.34.0 → 0.35.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/package.js +7 -0
- package/dist/package.js.map +1 -0
- package/dist/v2/client.d.ts +69 -65
- package/dist/v2/client.d.ts.map +1 -1
- package/dist/v2/client.js +279 -346
- package/dist/v2/client.js.map +1 -1
- package/dist/v2/index.d.ts +3 -7
- package/dist/v2/index.js +4 -7
- package/dist/v2/model.d.ts +384 -408
- package/dist/v2/model.d.ts.map +1 -1
- package/dist/v2/model.js +468 -815
- package/dist/v2/model.js.map +1 -1
- package/dist/v2/transport.d.ts +21 -17
- package/dist/v2/transport.d.ts.map +1 -1
- package/dist/v2/transport.js +60 -69
- package/dist/v2/transport.js.map +1 -1
- package/dist/v2/utils.d.ts +18 -14
- package/dist/v2/utils.d.ts.map +1 -1
- package/dist/v2/utils.js +76 -103
- package/dist/v2/utils.js.map +1 -1
- package/package.json +5 -5
- package/dist/v2/index.d.ts.map +0 -1
- package/dist/v2/index.js.map +0 -1
package/dist/v2/client.js
CHANGED
|
@@ -1,349 +1,282 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
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 { marshalSettingSchema, marshalUserPreferenceSchema, unmarshalListAccountSettingsMetadataResponseSchema, unmarshalListAccountUserPreferencesMetadataResponseSchema, unmarshalListWorkspaceSettingsMetadataResponseSchema, unmarshalSettingSchema, unmarshalUserPreferenceSchema } 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/v2/client.ts
|
|
10
10
|
const PACKAGE_SEGMENT = {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
key: "sdk-js-" + name.replace(/^@[^/]+\/sdk-/, ""),
|
|
12
|
+
value: version
|
|
13
13
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
await executeCall(call, options);
|
|
283
|
-
if (resp === undefined) {
|
|
284
|
-
throw new Error('operation completed without a result.');
|
|
285
|
-
}
|
|
286
|
-
return resp;
|
|
287
|
-
}
|
|
288
|
-
/**
|
|
289
|
-
* Update a user preference for a specific user.
|
|
290
|
-
* User preferences are personal settings that allow individual customization without affecting other users.
|
|
291
|
-
* See :method:settingsv2/listaccountuserpreferencesmetadata for list of user preferences available via public APIs.
|
|
292
|
-
*
|
|
293
|
-
* Note: Page refresh is required for changes to take effect in UI.
|
|
294
|
-
*/
|
|
295
|
-
async patchPublicAccountUserPreference(req, options) {
|
|
296
|
-
const { host, accountId, httpClient } = await this.resolveConfig();
|
|
297
|
-
const url = `${host}/api/2.1/accounts/${req.accountId ?? accountId ?? ''}/users/${req.userId ?? ''}/settings/${req.name ?? ''}`;
|
|
298
|
-
const body = marshalRequest(req.setting, marshalUserPreferenceSchema);
|
|
299
|
-
let resp;
|
|
300
|
-
const call = async (callSignal) => {
|
|
301
|
-
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
302
|
-
headers.set('User-Agent', this.userAgent);
|
|
303
|
-
const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
|
|
304
|
-
const respBody = await executeHttpCall({
|
|
305
|
-
request: httpReq,
|
|
306
|
-
httpClient,
|
|
307
|
-
logger: this.logger,
|
|
308
|
-
});
|
|
309
|
-
resp = parseResponse(respBody, unmarshalUserPreferenceSchema);
|
|
310
|
-
};
|
|
311
|
-
await executeCall(call, options);
|
|
312
|
-
if (resp === undefined) {
|
|
313
|
-
throw new Error('operation completed without a result.');
|
|
314
|
-
}
|
|
315
|
-
return resp;
|
|
316
|
-
}
|
|
317
|
-
/**
|
|
318
|
-
* Patch a setting value at workspace level. See :method:settingsv2/listworkspacesettingsmetadata for list of setting available via public APIs at workspace level.
|
|
319
|
-
* 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.
|
|
320
|
-
*
|
|
321
|
-
* Note: Page refresh is required for changes to take effect in UI.
|
|
322
|
-
*/
|
|
323
|
-
async patchPublicWorkspaceSetting(req, options) {
|
|
324
|
-
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
325
|
-
const url = `${host}/api/2.1/settings/${req.name ?? ''}`;
|
|
326
|
-
const body = marshalRequest(req.setting, marshalSettingSchema);
|
|
327
|
-
let resp;
|
|
328
|
-
const call = async (callSignal) => {
|
|
329
|
-
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
330
|
-
if (workspaceId !== undefined) {
|
|
331
|
-
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
332
|
-
}
|
|
333
|
-
headers.set('User-Agent', this.userAgent);
|
|
334
|
-
const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
|
|
335
|
-
const respBody = await executeHttpCall({
|
|
336
|
-
request: httpReq,
|
|
337
|
-
httpClient,
|
|
338
|
-
logger: this.logger,
|
|
339
|
-
});
|
|
340
|
-
resp = parseResponse(respBody, unmarshalSettingSchema);
|
|
341
|
-
};
|
|
342
|
-
await executeCall(call, options);
|
|
343
|
-
if (resp === undefined) {
|
|
344
|
-
throw new Error('operation completed without a result.');
|
|
345
|
-
}
|
|
346
|
-
return resp;
|
|
347
|
-
}
|
|
348
|
-
}
|
|
14
|
+
var SettingsClient = 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
|
+
/** Get a setting value at account level. See :method:settingsv2/listaccountsettingsmetadata for list of setting available via public APIs at account level. */
|
|
35
|
+
async getPublicAccountSetting(req, options) {
|
|
36
|
+
const { host, accountId, httpClient } = await this.resolveConfig();
|
|
37
|
+
const url = `${host}/api/2.1/accounts/${req.accountId ?? accountId ?? ""}/settings/${req.name ?? ""}`;
|
|
38
|
+
let resp;
|
|
39
|
+
const call = async (callSignal) => {
|
|
40
|
+
const headers = new Headers();
|
|
41
|
+
headers.set("User-Agent", this.userAgent);
|
|
42
|
+
resp = parseResponse(await executeHttpCall({
|
|
43
|
+
request: buildHttpRequest("GET", url, headers, callSignal),
|
|
44
|
+
httpClient,
|
|
45
|
+
logger: this.logger
|
|
46
|
+
}), unmarshalSettingSchema);
|
|
47
|
+
};
|
|
48
|
+
await executeCall(call, options);
|
|
49
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
50
|
+
return resp;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Get a user preference for a specific user.
|
|
54
|
+
* User preferences are personal settings that allow individual customization without affecting other users.
|
|
55
|
+
* See :method:settingsv2/listaccountuserpreferencesmetadata for list of user preferences available via public APIs.
|
|
56
|
+
*/
|
|
57
|
+
async getPublicAccountUserPreference(req, options) {
|
|
58
|
+
const { host, accountId, httpClient } = await this.resolveConfig();
|
|
59
|
+
const url = `${host}/api/2.1/accounts/${req.accountId ?? accountId ?? ""}/users/${req.userId ?? ""}/settings/${req.name ?? ""}`;
|
|
60
|
+
let resp;
|
|
61
|
+
const call = async (callSignal) => {
|
|
62
|
+
const headers = new Headers();
|
|
63
|
+
headers.set("User-Agent", this.userAgent);
|
|
64
|
+
resp = parseResponse(await executeHttpCall({
|
|
65
|
+
request: buildHttpRequest("GET", url, headers, callSignal),
|
|
66
|
+
httpClient,
|
|
67
|
+
logger: this.logger
|
|
68
|
+
}), unmarshalUserPreferenceSchema);
|
|
69
|
+
};
|
|
70
|
+
await executeCall(call, options);
|
|
71
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
72
|
+
return resp;
|
|
73
|
+
}
|
|
74
|
+
/** Get a setting value at workspace level. See :method:settingsv2/listworkspacesettingsmetadata for list of setting available via public APIs. */
|
|
75
|
+
async getPublicWorkspaceSetting(req, options) {
|
|
76
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
77
|
+
const url = `${host}/api/2.1/settings/${req.name ?? ""}`;
|
|
78
|
+
let resp;
|
|
79
|
+
const call = async (callSignal) => {
|
|
80
|
+
const headers = new Headers();
|
|
81
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
82
|
+
headers.set("User-Agent", this.userAgent);
|
|
83
|
+
resp = parseResponse(await executeHttpCall({
|
|
84
|
+
request: buildHttpRequest("GET", url, headers, callSignal),
|
|
85
|
+
httpClient,
|
|
86
|
+
logger: this.logger
|
|
87
|
+
}), unmarshalSettingSchema);
|
|
88
|
+
};
|
|
89
|
+
await executeCall(call, options);
|
|
90
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
91
|
+
return resp;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* List valid setting keys and metadata. These settings are available to be referenced via
|
|
95
|
+
* GET :method:settingsv2/getpublicaccountsetting and
|
|
96
|
+
* PATCH :method:settingsv2/patchpublicaccountsetting APIs
|
|
97
|
+
*/
|
|
98
|
+
async listAccountSettingsMetadata(req, options) {
|
|
99
|
+
const { host, accountId, httpClient } = await this.resolveConfig();
|
|
100
|
+
const url = `${host}/api/2.1/accounts/${req.accountId ?? accountId ?? ""}/settings-metadata`;
|
|
101
|
+
const params = new URLSearchParams();
|
|
102
|
+
if (req.pageSize !== void 0) params.append("page_size", String(req.pageSize));
|
|
103
|
+
if (req.pageToken !== void 0) params.append("page_token", req.pageToken);
|
|
104
|
+
const query = params.toString();
|
|
105
|
+
const fullUrl = query !== "" ? `${url}?${query}` : url;
|
|
106
|
+
let resp;
|
|
107
|
+
const call = async (callSignal) => {
|
|
108
|
+
const headers = new Headers();
|
|
109
|
+
headers.set("User-Agent", this.userAgent);
|
|
110
|
+
resp = parseResponse(await executeHttpCall({
|
|
111
|
+
request: buildHttpRequest("GET", fullUrl, headers, callSignal),
|
|
112
|
+
httpClient,
|
|
113
|
+
logger: this.logger
|
|
114
|
+
}), unmarshalListAccountSettingsMetadataResponseSchema);
|
|
115
|
+
};
|
|
116
|
+
await executeCall(call, options);
|
|
117
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
118
|
+
return resp;
|
|
119
|
+
}
|
|
120
|
+
async *listAccountSettingsMetadataIter(req, options) {
|
|
121
|
+
const pageReq = { ...req };
|
|
122
|
+
for (;;) {
|
|
123
|
+
const resp = await this.listAccountSettingsMetadata(pageReq, options);
|
|
124
|
+
for (const item of resp.settingsMetadata ?? []) yield item;
|
|
125
|
+
if (resp.nextPageToken === void 0 || resp.nextPageToken === "") return;
|
|
126
|
+
pageReq.pageToken = resp.nextPageToken;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* List valid user preferences and their metadata for a specific user.
|
|
131
|
+
* User preferences are personal settings that allow individual customization without affecting other users.
|
|
132
|
+
* These settings are available to be referenced via
|
|
133
|
+
* GET :method:settingsv2/getpublicaccountuserpreference and
|
|
134
|
+
* PATCH :method:settingsv2/patchpublicaccountuserpreference APIs
|
|
135
|
+
*/
|
|
136
|
+
async listAccountUserPreferencesMetadata(req, options) {
|
|
137
|
+
const { host, accountId, httpClient } = await this.resolveConfig();
|
|
138
|
+
const url = `${host}/api/2.1/accounts/${req.accountId ?? accountId ?? ""}/users/${req.userId ?? ""}/settings-metadata`;
|
|
139
|
+
const params = new URLSearchParams();
|
|
140
|
+
if (req.pageSize !== void 0) params.append("page_size", String(req.pageSize));
|
|
141
|
+
if (req.pageToken !== void 0) params.append("page_token", req.pageToken);
|
|
142
|
+
const query = params.toString();
|
|
143
|
+
const fullUrl = query !== "" ? `${url}?${query}` : url;
|
|
144
|
+
let resp;
|
|
145
|
+
const call = async (callSignal) => {
|
|
146
|
+
const headers = new Headers();
|
|
147
|
+
headers.set("User-Agent", this.userAgent);
|
|
148
|
+
resp = parseResponse(await executeHttpCall({
|
|
149
|
+
request: buildHttpRequest("GET", fullUrl, headers, callSignal),
|
|
150
|
+
httpClient,
|
|
151
|
+
logger: this.logger
|
|
152
|
+
}), unmarshalListAccountUserPreferencesMetadataResponseSchema);
|
|
153
|
+
};
|
|
154
|
+
await executeCall(call, options);
|
|
155
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
156
|
+
return resp;
|
|
157
|
+
}
|
|
158
|
+
async *listAccountUserPreferencesMetadataIter(req, options) {
|
|
159
|
+
const pageReq = { ...req };
|
|
160
|
+
for (;;) {
|
|
161
|
+
const resp = await this.listAccountUserPreferencesMetadata(pageReq, options);
|
|
162
|
+
for (const item of resp.settingsMetadata ?? []) yield item;
|
|
163
|
+
if (resp.nextPageToken === void 0 || resp.nextPageToken === "") return;
|
|
164
|
+
pageReq.pageToken = resp.nextPageToken;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* List valid setting keys and metadata. These settings are available to be referenced via
|
|
169
|
+
* GET :method:settingsv2/getpublicworkspacesetting and
|
|
170
|
+
* PATCH :method:settingsv2/patchpublicworkspacesetting APIs
|
|
171
|
+
*/
|
|
172
|
+
async listWorkspaceSettingsMetadata(req, options) {
|
|
173
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
174
|
+
const url = `${host}/api/2.1/settings-metadata`;
|
|
175
|
+
const params = new URLSearchParams();
|
|
176
|
+
if (req.pageSize !== void 0) params.append("page_size", String(req.pageSize));
|
|
177
|
+
if (req.pageToken !== void 0) params.append("page_token", req.pageToken);
|
|
178
|
+
const query = params.toString();
|
|
179
|
+
const fullUrl = query !== "" ? `${url}?${query}` : url;
|
|
180
|
+
let resp;
|
|
181
|
+
const call = async (callSignal) => {
|
|
182
|
+
const headers = new Headers();
|
|
183
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
184
|
+
headers.set("User-Agent", this.userAgent);
|
|
185
|
+
resp = parseResponse(await executeHttpCall({
|
|
186
|
+
request: buildHttpRequest("GET", fullUrl, headers, callSignal),
|
|
187
|
+
httpClient,
|
|
188
|
+
logger: this.logger
|
|
189
|
+
}), unmarshalListWorkspaceSettingsMetadataResponseSchema);
|
|
190
|
+
};
|
|
191
|
+
await executeCall(call, options);
|
|
192
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
193
|
+
return resp;
|
|
194
|
+
}
|
|
195
|
+
async *listWorkspaceSettingsMetadataIter(req, options) {
|
|
196
|
+
const pageReq = { ...req };
|
|
197
|
+
for (;;) {
|
|
198
|
+
const resp = await this.listWorkspaceSettingsMetadata(pageReq, options);
|
|
199
|
+
for (const item of resp.settingsMetadata ?? []) yield item;
|
|
200
|
+
if (resp.nextPageToken === void 0 || resp.nextPageToken === "") return;
|
|
201
|
+
pageReq.pageToken = resp.nextPageToken;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Patch a setting value at account level. See :method:settingsv2/listaccountsettingsmetadata for list of setting available via public APIs at account level.
|
|
206
|
+
* 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.
|
|
207
|
+
*
|
|
208
|
+
* Note: Page refresh is required for changes to take effect in UI.
|
|
209
|
+
*/
|
|
210
|
+
async patchPublicAccountSetting(req, options) {
|
|
211
|
+
const { host, accountId, httpClient } = await this.resolveConfig();
|
|
212
|
+
const url = `${host}/api/2.1/accounts/${req.accountId ?? accountId ?? ""}/settings/${req.name ?? ""}`;
|
|
213
|
+
const body = marshalRequest(req.setting, marshalSettingSchema);
|
|
214
|
+
let resp;
|
|
215
|
+
const call = async (callSignal) => {
|
|
216
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
217
|
+
headers.set("User-Agent", this.userAgent);
|
|
218
|
+
resp = parseResponse(await executeHttpCall({
|
|
219
|
+
request: buildHttpRequest("PATCH", url, headers, callSignal, body),
|
|
220
|
+
httpClient,
|
|
221
|
+
logger: this.logger
|
|
222
|
+
}), unmarshalSettingSchema);
|
|
223
|
+
};
|
|
224
|
+
await executeCall(call, options);
|
|
225
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
226
|
+
return resp;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Update a user preference for a specific user.
|
|
230
|
+
* User preferences are personal settings that allow individual customization without affecting other users.
|
|
231
|
+
* See :method:settingsv2/listaccountuserpreferencesmetadata for list of user preferences available via public APIs.
|
|
232
|
+
*
|
|
233
|
+
* Note: Page refresh is required for changes to take effect in UI.
|
|
234
|
+
*/
|
|
235
|
+
async patchPublicAccountUserPreference(req, options) {
|
|
236
|
+
const { host, accountId, httpClient } = await this.resolveConfig();
|
|
237
|
+
const url = `${host}/api/2.1/accounts/${req.accountId ?? accountId ?? ""}/users/${req.userId ?? ""}/settings/${req.name ?? ""}`;
|
|
238
|
+
const body = marshalRequest(req.setting, marshalUserPreferenceSchema);
|
|
239
|
+
let resp;
|
|
240
|
+
const call = async (callSignal) => {
|
|
241
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
242
|
+
headers.set("User-Agent", this.userAgent);
|
|
243
|
+
resp = parseResponse(await executeHttpCall({
|
|
244
|
+
request: buildHttpRequest("PATCH", url, headers, callSignal, body),
|
|
245
|
+
httpClient,
|
|
246
|
+
logger: this.logger
|
|
247
|
+
}), unmarshalUserPreferenceSchema);
|
|
248
|
+
};
|
|
249
|
+
await executeCall(call, options);
|
|
250
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
251
|
+
return resp;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Patch a setting value at workspace level. See :method:settingsv2/listworkspacesettingsmetadata for list of setting available via public APIs at workspace level.
|
|
255
|
+
* 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.
|
|
256
|
+
*
|
|
257
|
+
* Note: Page refresh is required for changes to take effect in UI.
|
|
258
|
+
*/
|
|
259
|
+
async patchPublicWorkspaceSetting(req, options) {
|
|
260
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
261
|
+
const url = `${host}/api/2.1/settings/${req.name ?? ""}`;
|
|
262
|
+
const body = marshalRequest(req.setting, marshalSettingSchema);
|
|
263
|
+
let resp;
|
|
264
|
+
const call = async (callSignal) => {
|
|
265
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
266
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
267
|
+
headers.set("User-Agent", this.userAgent);
|
|
268
|
+
resp = parseResponse(await executeHttpCall({
|
|
269
|
+
request: buildHttpRequest("PATCH", url, headers, callSignal, body),
|
|
270
|
+
httpClient,
|
|
271
|
+
logger: this.logger
|
|
272
|
+
}), unmarshalSettingSchema);
|
|
273
|
+
};
|
|
274
|
+
await executeCall(call, options);
|
|
275
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
276
|
+
return resp;
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
//#endregion
|
|
281
|
+
export { SettingsClient };
|
|
349
282
|
//# sourceMappingURL=client.js.map
|