@databricks/sdk-postgres 0.1.0-dev.5 → 0.1.0-dev.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -0
- package/dist/v1/client.d.ts +3 -3
- package/dist/v1/client.d.ts.map +1 -1
- package/dist/v1/client.js +186 -153
- package/dist/v1/client.js.map +1 -1
- package/dist/v1/index.d.ts +1 -1
- package/dist/v1/index.d.ts.map +1 -1
- package/dist/v1/index.js.map +1 -1
- package/dist/v1/model.d.ts +0 -8
- package/dist/v1/model.d.ts.map +1 -1
- package/dist/v1/model.js.map +1 -1
- package/dist/v1/transport.d.ts +30 -2
- package/dist/v1/transport.d.ts.map +1 -1
- package/dist/v1/transport.js +33 -16
- package/dist/v1/transport.js.map +1 -1
- package/package.json +9 -4
package/dist/v1/client.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { VERSION as AUTH_VERSION } from '@databricks/sdk-auth';
|
|
3
3
|
import { createDefault } from '@databricks/sdk-core/clientinfo';
|
|
4
4
|
import { NoOpLogger } from '@databricks/sdk-core/logger';
|
|
5
|
-
import {
|
|
5
|
+
import { resolveClientConfig } from './transport';
|
|
6
6
|
import { buildHttpRequest, executeCall, executeHttpCall, marshalRequest, parseResponse, executeWait, StillRunningError, } from './utils';
|
|
7
7
|
import pkgJson from '../../package.json' with { type: 'json' };
|
|
8
8
|
import { z } from 'zod';
|
|
@@ -13,34 +13,33 @@ const PACKAGE_SEGMENT = {
|
|
|
13
13
|
value: pkgJson.version,
|
|
14
14
|
};
|
|
15
15
|
export class PostgresClient {
|
|
16
|
-
|
|
17
|
-
// Workspace ID used to route workspace-level calls on unified hosts (SPOG).
|
|
18
|
-
// When set, workspace-level methods send X-Databricks-Org-Id on every
|
|
19
|
-
// request.
|
|
20
|
-
workspaceId;
|
|
21
|
-
httpClient;
|
|
16
|
+
options;
|
|
22
17
|
logger;
|
|
23
18
|
// User-Agent header value. Composed once at construction from
|
|
24
19
|
// createDefault() merged with this package's identity and the active
|
|
25
20
|
// credential's name.
|
|
26
21
|
userAgent;
|
|
22
|
+
// Memoized configuration. The profile is resolved once, lazily, on the first
|
|
23
|
+
// request, then reused; host, workspaceId/accountId, and credentials are
|
|
24
|
+
// filled from it when not set explicitly on the options.
|
|
25
|
+
config;
|
|
27
26
|
constructor(options) {
|
|
28
|
-
|
|
29
|
-
throw new Error('Host is required.');
|
|
30
|
-
}
|
|
31
|
-
this.host = options.host.replace(/\/$/, '');
|
|
32
|
-
this.workspaceId = options.workspaceId;
|
|
27
|
+
this.options = options;
|
|
33
28
|
this.logger = options.logger ?? new NoOpLogger();
|
|
34
29
|
const info = createDefault()
|
|
35
30
|
.with(PACKAGE_SEGMENT)
|
|
36
31
|
.with({ key: 'sdk-js-auth', value: AUTH_VERSION })
|
|
37
32
|
.with({ key: 'auth', value: options.credentials?.name() ?? 'default' });
|
|
38
33
|
this.userAgent = info.toString();
|
|
39
|
-
|
|
34
|
+
}
|
|
35
|
+
resolveConfig() {
|
|
36
|
+
this.config ??= resolveClientConfig(this.options);
|
|
37
|
+
return this.config;
|
|
40
38
|
}
|
|
41
39
|
/** Creates a new database branch in the project. */
|
|
42
40
|
async createBranch(req, options) {
|
|
43
|
-
const
|
|
41
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
42
|
+
const url = `${host}/api/2.0/postgres/${req.parent ?? ''}/branches`;
|
|
44
43
|
const params = new URLSearchParams();
|
|
45
44
|
if (req.branchId !== undefined) {
|
|
46
45
|
params.append('branch_id', req.branchId);
|
|
@@ -54,14 +53,14 @@ export class PostgresClient {
|
|
|
54
53
|
let resp;
|
|
55
54
|
const call = async (callSignal) => {
|
|
56
55
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
57
|
-
if (
|
|
58
|
-
headers.set('X-Databricks-Org-Id',
|
|
56
|
+
if (workspaceId !== undefined) {
|
|
57
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
59
58
|
}
|
|
60
59
|
headers.set('User-Agent', this.userAgent);
|
|
61
60
|
const httpReq = buildHttpRequest('POST', fullUrl, headers, callSignal, body);
|
|
62
61
|
const respBody = await executeHttpCall({
|
|
63
62
|
request: httpReq,
|
|
64
|
-
httpClient
|
|
63
|
+
httpClient,
|
|
65
64
|
logger: this.logger,
|
|
66
65
|
});
|
|
67
66
|
resp = parseResponse(respBody, unmarshalOperationSchema);
|
|
@@ -78,7 +77,8 @@ export class PostgresClient {
|
|
|
78
77
|
}
|
|
79
78
|
/** Register a Postgres database in the Unity Catalog. */
|
|
80
79
|
async createCatalog(req, options) {
|
|
81
|
-
const
|
|
80
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
81
|
+
const url = `${host}/api/2.0/postgres/catalogs`;
|
|
82
82
|
const params = new URLSearchParams();
|
|
83
83
|
if (req.catalogId !== undefined) {
|
|
84
84
|
params.append('catalog_id', req.catalogId);
|
|
@@ -89,14 +89,14 @@ export class PostgresClient {
|
|
|
89
89
|
let resp;
|
|
90
90
|
const call = async (callSignal) => {
|
|
91
91
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
92
|
-
if (
|
|
93
|
-
headers.set('X-Databricks-Org-Id',
|
|
92
|
+
if (workspaceId !== undefined) {
|
|
93
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
94
94
|
}
|
|
95
95
|
headers.set('User-Agent', this.userAgent);
|
|
96
96
|
const httpReq = buildHttpRequest('POST', fullUrl, headers, callSignal, body);
|
|
97
97
|
const respBody = await executeHttpCall({
|
|
98
98
|
request: httpReq,
|
|
99
|
-
httpClient
|
|
99
|
+
httpClient,
|
|
100
100
|
logger: this.logger,
|
|
101
101
|
});
|
|
102
102
|
resp = parseResponse(respBody, unmarshalOperationSchema);
|
|
@@ -117,7 +117,8 @@ export class PostgresClient {
|
|
|
117
117
|
* Creates a database in the specified branch. A branch can have multiple databases.
|
|
118
118
|
*/
|
|
119
119
|
async createDatabase(req, options) {
|
|
120
|
-
const
|
|
120
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
121
|
+
const url = `${host}/api/2.0/postgres/${req.parent ?? ''}/databases`;
|
|
121
122
|
const params = new URLSearchParams();
|
|
122
123
|
if (req.databaseId !== undefined) {
|
|
123
124
|
params.append('database_id', req.databaseId);
|
|
@@ -128,14 +129,14 @@ export class PostgresClient {
|
|
|
128
129
|
let resp;
|
|
129
130
|
const call = async (callSignal) => {
|
|
130
131
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
131
|
-
if (
|
|
132
|
-
headers.set('X-Databricks-Org-Id',
|
|
132
|
+
if (workspaceId !== undefined) {
|
|
133
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
133
134
|
}
|
|
134
135
|
headers.set('User-Agent', this.userAgent);
|
|
135
136
|
const httpReq = buildHttpRequest('POST', fullUrl, headers, callSignal, body);
|
|
136
137
|
const respBody = await executeHttpCall({
|
|
137
138
|
request: httpReq,
|
|
138
|
-
httpClient
|
|
139
|
+
httpClient,
|
|
139
140
|
logger: this.logger,
|
|
140
141
|
});
|
|
141
142
|
resp = parseResponse(respBody, unmarshalOperationSchema);
|
|
@@ -152,7 +153,8 @@ export class PostgresClient {
|
|
|
152
153
|
}
|
|
153
154
|
/** Creates a new compute endpoint in the branch. */
|
|
154
155
|
async createEndpoint(req, options) {
|
|
155
|
-
const
|
|
156
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
157
|
+
const url = `${host}/api/2.0/postgres/${req.parent ?? ''}/endpoints`;
|
|
156
158
|
const params = new URLSearchParams();
|
|
157
159
|
if (req.endpointId !== undefined) {
|
|
158
160
|
params.append('endpoint_id', req.endpointId);
|
|
@@ -166,14 +168,14 @@ export class PostgresClient {
|
|
|
166
168
|
let resp;
|
|
167
169
|
const call = async (callSignal) => {
|
|
168
170
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
169
|
-
if (
|
|
170
|
-
headers.set('X-Databricks-Org-Id',
|
|
171
|
+
if (workspaceId !== undefined) {
|
|
172
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
171
173
|
}
|
|
172
174
|
headers.set('User-Agent', this.userAgent);
|
|
173
175
|
const httpReq = buildHttpRequest('POST', fullUrl, headers, callSignal, body);
|
|
174
176
|
const respBody = await executeHttpCall({
|
|
175
177
|
request: httpReq,
|
|
176
|
-
httpClient
|
|
178
|
+
httpClient,
|
|
177
179
|
logger: this.logger,
|
|
178
180
|
});
|
|
179
181
|
resp = parseResponse(respBody, unmarshalOperationSchema);
|
|
@@ -190,7 +192,8 @@ export class PostgresClient {
|
|
|
190
192
|
}
|
|
191
193
|
/** Creates a new Lakebase Autoscaling Postgres database project, which contains branches and compute endpoints. */
|
|
192
194
|
async createProject(req, options) {
|
|
193
|
-
const
|
|
195
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
196
|
+
const url = `${host}/api/2.0/postgres/projects`;
|
|
194
197
|
const params = new URLSearchParams();
|
|
195
198
|
if (req.projectId !== undefined) {
|
|
196
199
|
params.append('project_id', req.projectId);
|
|
@@ -201,14 +204,14 @@ export class PostgresClient {
|
|
|
201
204
|
let resp;
|
|
202
205
|
const call = async (callSignal) => {
|
|
203
206
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
204
|
-
if (
|
|
205
|
-
headers.set('X-Databricks-Org-Id',
|
|
207
|
+
if (workspaceId !== undefined) {
|
|
208
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
206
209
|
}
|
|
207
210
|
headers.set('User-Agent', this.userAgent);
|
|
208
211
|
const httpReq = buildHttpRequest('POST', fullUrl, headers, callSignal, body);
|
|
209
212
|
const respBody = await executeHttpCall({
|
|
210
213
|
request: httpReq,
|
|
211
|
-
httpClient
|
|
214
|
+
httpClient,
|
|
212
215
|
logger: this.logger,
|
|
213
216
|
});
|
|
214
217
|
resp = parseResponse(respBody, unmarshalOperationSchema);
|
|
@@ -225,7 +228,8 @@ export class PostgresClient {
|
|
|
225
228
|
}
|
|
226
229
|
/** Creates a new Postgres role in the branch. */
|
|
227
230
|
async createRole(req, options) {
|
|
228
|
-
const
|
|
231
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
232
|
+
const url = `${host}/api/2.0/postgres/${req.parent ?? ''}/roles`;
|
|
229
233
|
const params = new URLSearchParams();
|
|
230
234
|
if (req.roleId !== undefined) {
|
|
231
235
|
params.append('role_id', req.roleId);
|
|
@@ -236,14 +240,14 @@ export class PostgresClient {
|
|
|
236
240
|
let resp;
|
|
237
241
|
const call = async (callSignal) => {
|
|
238
242
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
239
|
-
if (
|
|
240
|
-
headers.set('X-Databricks-Org-Id',
|
|
243
|
+
if (workspaceId !== undefined) {
|
|
244
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
241
245
|
}
|
|
242
246
|
headers.set('User-Agent', this.userAgent);
|
|
243
247
|
const httpReq = buildHttpRequest('POST', fullUrl, headers, callSignal, body);
|
|
244
248
|
const respBody = await executeHttpCall({
|
|
245
249
|
request: httpReq,
|
|
246
|
-
httpClient
|
|
250
|
+
httpClient,
|
|
247
251
|
logger: this.logger,
|
|
248
252
|
});
|
|
249
253
|
resp = parseResponse(respBody, unmarshalOperationSchema);
|
|
@@ -260,7 +264,8 @@ export class PostgresClient {
|
|
|
260
264
|
}
|
|
261
265
|
/** Create a Synced Table. */
|
|
262
266
|
async createSyncedTable(req, options) {
|
|
263
|
-
const
|
|
267
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
268
|
+
const url = `${host}/api/2.0/postgres/synced_tables`;
|
|
264
269
|
const params = new URLSearchParams();
|
|
265
270
|
if (req.syncedTableId !== undefined) {
|
|
266
271
|
params.append('synced_table_id', req.syncedTableId);
|
|
@@ -271,14 +276,14 @@ export class PostgresClient {
|
|
|
271
276
|
let resp;
|
|
272
277
|
const call = async (callSignal) => {
|
|
273
278
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
274
|
-
if (
|
|
275
|
-
headers.set('X-Databricks-Org-Id',
|
|
279
|
+
if (workspaceId !== undefined) {
|
|
280
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
276
281
|
}
|
|
277
282
|
headers.set('User-Agent', this.userAgent);
|
|
278
283
|
const httpReq = buildHttpRequest('POST', fullUrl, headers, callSignal, body);
|
|
279
284
|
const respBody = await executeHttpCall({
|
|
280
285
|
request: httpReq,
|
|
281
|
-
httpClient
|
|
286
|
+
httpClient,
|
|
282
287
|
logger: this.logger,
|
|
283
288
|
});
|
|
284
289
|
resp = parseResponse(respBody, unmarshalOperationSchema);
|
|
@@ -295,7 +300,8 @@ export class PostgresClient {
|
|
|
295
300
|
}
|
|
296
301
|
/** Deletes the specified database branch. */
|
|
297
302
|
async deleteBranch(req, options) {
|
|
298
|
-
const
|
|
303
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
304
|
+
const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
|
|
299
305
|
const params = new URLSearchParams();
|
|
300
306
|
if (req.purge !== undefined) {
|
|
301
307
|
params.append('purge', String(req.purge));
|
|
@@ -305,14 +311,14 @@ export class PostgresClient {
|
|
|
305
311
|
let resp;
|
|
306
312
|
const call = async (callSignal) => {
|
|
307
313
|
const headers = new Headers();
|
|
308
|
-
if (
|
|
309
|
-
headers.set('X-Databricks-Org-Id',
|
|
314
|
+
if (workspaceId !== undefined) {
|
|
315
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
310
316
|
}
|
|
311
317
|
headers.set('User-Agent', this.userAgent);
|
|
312
318
|
const httpReq = buildHttpRequest('DELETE', fullUrl, headers, callSignal);
|
|
313
319
|
const respBody = await executeHttpCall({
|
|
314
320
|
request: httpReq,
|
|
315
|
-
httpClient
|
|
321
|
+
httpClient,
|
|
316
322
|
logger: this.logger,
|
|
317
323
|
});
|
|
318
324
|
resp = parseResponse(respBody, unmarshalOperationSchema);
|
|
@@ -329,18 +335,19 @@ export class PostgresClient {
|
|
|
329
335
|
}
|
|
330
336
|
/** Delete a Database Catalog. */
|
|
331
337
|
async deleteCatalog(req, options) {
|
|
332
|
-
const
|
|
338
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
339
|
+
const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
|
|
333
340
|
let resp;
|
|
334
341
|
const call = async (callSignal) => {
|
|
335
342
|
const headers = new Headers();
|
|
336
|
-
if (
|
|
337
|
-
headers.set('X-Databricks-Org-Id',
|
|
343
|
+
if (workspaceId !== undefined) {
|
|
344
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
338
345
|
}
|
|
339
346
|
headers.set('User-Agent', this.userAgent);
|
|
340
347
|
const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
|
|
341
348
|
const respBody = await executeHttpCall({
|
|
342
349
|
request: httpReq,
|
|
343
|
-
httpClient
|
|
350
|
+
httpClient,
|
|
344
351
|
logger: this.logger,
|
|
345
352
|
});
|
|
346
353
|
resp = parseResponse(respBody, unmarshalOperationSchema);
|
|
@@ -357,18 +364,19 @@ export class PostgresClient {
|
|
|
357
364
|
}
|
|
358
365
|
/** Delete a Database. */
|
|
359
366
|
async deleteDatabase(req, options) {
|
|
360
|
-
const
|
|
367
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
368
|
+
const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
|
|
361
369
|
let resp;
|
|
362
370
|
const call = async (callSignal) => {
|
|
363
371
|
const headers = new Headers();
|
|
364
|
-
if (
|
|
365
|
-
headers.set('X-Databricks-Org-Id',
|
|
372
|
+
if (workspaceId !== undefined) {
|
|
373
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
366
374
|
}
|
|
367
375
|
headers.set('User-Agent', this.userAgent);
|
|
368
376
|
const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
|
|
369
377
|
const respBody = await executeHttpCall({
|
|
370
378
|
request: httpReq,
|
|
371
|
-
httpClient
|
|
379
|
+
httpClient,
|
|
372
380
|
logger: this.logger,
|
|
373
381
|
});
|
|
374
382
|
resp = parseResponse(respBody, unmarshalOperationSchema);
|
|
@@ -385,18 +393,19 @@ export class PostgresClient {
|
|
|
385
393
|
}
|
|
386
394
|
/** Deletes the specified compute endpoint. */
|
|
387
395
|
async deleteEndpoint(req, options) {
|
|
388
|
-
const
|
|
396
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
397
|
+
const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
|
|
389
398
|
let resp;
|
|
390
399
|
const call = async (callSignal) => {
|
|
391
400
|
const headers = new Headers();
|
|
392
|
-
if (
|
|
393
|
-
headers.set('X-Databricks-Org-Id',
|
|
401
|
+
if (workspaceId !== undefined) {
|
|
402
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
394
403
|
}
|
|
395
404
|
headers.set('User-Agent', this.userAgent);
|
|
396
405
|
const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
|
|
397
406
|
const respBody = await executeHttpCall({
|
|
398
407
|
request: httpReq,
|
|
399
|
-
httpClient
|
|
408
|
+
httpClient,
|
|
400
409
|
logger: this.logger,
|
|
401
410
|
});
|
|
402
411
|
resp = parseResponse(respBody, unmarshalOperationSchema);
|
|
@@ -413,7 +422,8 @@ export class PostgresClient {
|
|
|
413
422
|
}
|
|
414
423
|
/** Deletes the specified database project. */
|
|
415
424
|
async deleteProject(req, options) {
|
|
416
|
-
const
|
|
425
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
426
|
+
const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
|
|
417
427
|
const params = new URLSearchParams();
|
|
418
428
|
if (req.purge !== undefined) {
|
|
419
429
|
params.append('purge', String(req.purge));
|
|
@@ -423,14 +433,14 @@ export class PostgresClient {
|
|
|
423
433
|
let resp;
|
|
424
434
|
const call = async (callSignal) => {
|
|
425
435
|
const headers = new Headers();
|
|
426
|
-
if (
|
|
427
|
-
headers.set('X-Databricks-Org-Id',
|
|
436
|
+
if (workspaceId !== undefined) {
|
|
437
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
428
438
|
}
|
|
429
439
|
headers.set('User-Agent', this.userAgent);
|
|
430
440
|
const httpReq = buildHttpRequest('DELETE', fullUrl, headers, callSignal);
|
|
431
441
|
const respBody = await executeHttpCall({
|
|
432
442
|
request: httpReq,
|
|
433
|
-
httpClient
|
|
443
|
+
httpClient,
|
|
434
444
|
logger: this.logger,
|
|
435
445
|
});
|
|
436
446
|
resp = parseResponse(respBody, unmarshalOperationSchema);
|
|
@@ -447,7 +457,8 @@ export class PostgresClient {
|
|
|
447
457
|
}
|
|
448
458
|
/** Deletes the specified Postgres role. */
|
|
449
459
|
async deleteRole(req, options) {
|
|
450
|
-
const
|
|
460
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
461
|
+
const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
|
|
451
462
|
const params = new URLSearchParams();
|
|
452
463
|
if (req.reassignOwnedTo !== undefined) {
|
|
453
464
|
params.append('reassign_owned_to', req.reassignOwnedTo);
|
|
@@ -457,14 +468,14 @@ export class PostgresClient {
|
|
|
457
468
|
let resp;
|
|
458
469
|
const call = async (callSignal) => {
|
|
459
470
|
const headers = new Headers();
|
|
460
|
-
if (
|
|
461
|
-
headers.set('X-Databricks-Org-Id',
|
|
471
|
+
if (workspaceId !== undefined) {
|
|
472
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
462
473
|
}
|
|
463
474
|
headers.set('User-Agent', this.userAgent);
|
|
464
475
|
const httpReq = buildHttpRequest('DELETE', fullUrl, headers, callSignal);
|
|
465
476
|
const respBody = await executeHttpCall({
|
|
466
477
|
request: httpReq,
|
|
467
|
-
httpClient
|
|
478
|
+
httpClient,
|
|
468
479
|
logger: this.logger,
|
|
469
480
|
});
|
|
470
481
|
resp = parseResponse(respBody, unmarshalOperationSchema);
|
|
@@ -481,18 +492,19 @@ export class PostgresClient {
|
|
|
481
492
|
}
|
|
482
493
|
/** Delete a Synced Table. */
|
|
483
494
|
async deleteSyncedTable(req, options) {
|
|
484
|
-
const
|
|
495
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
496
|
+
const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
|
|
485
497
|
let resp;
|
|
486
498
|
const call = async (callSignal) => {
|
|
487
499
|
const headers = new Headers();
|
|
488
|
-
if (
|
|
489
|
-
headers.set('X-Databricks-Org-Id',
|
|
500
|
+
if (workspaceId !== undefined) {
|
|
501
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
490
502
|
}
|
|
491
503
|
headers.set('User-Agent', this.userAgent);
|
|
492
504
|
const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
|
|
493
505
|
const respBody = await executeHttpCall({
|
|
494
506
|
request: httpReq,
|
|
495
|
-
httpClient
|
|
507
|
+
httpClient,
|
|
496
508
|
logger: this.logger,
|
|
497
509
|
});
|
|
498
510
|
resp = parseResponse(respBody, unmarshalOperationSchema);
|
|
@@ -509,19 +521,20 @@ export class PostgresClient {
|
|
|
509
521
|
}
|
|
510
522
|
/** Generate OAuth credentials for a Postgres database. */
|
|
511
523
|
async generateDatabaseCredential(req, options) {
|
|
512
|
-
const
|
|
524
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
525
|
+
const url = `${host}/api/2.0/postgres/credentials`;
|
|
513
526
|
const body = marshalRequest(req, marshalGenerateDatabaseCredentialRequestSchema);
|
|
514
527
|
let resp;
|
|
515
528
|
const call = async (callSignal) => {
|
|
516
529
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
517
|
-
if (
|
|
518
|
-
headers.set('X-Databricks-Org-Id',
|
|
530
|
+
if (workspaceId !== undefined) {
|
|
531
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
519
532
|
}
|
|
520
533
|
headers.set('User-Agent', this.userAgent);
|
|
521
534
|
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
522
535
|
const respBody = await executeHttpCall({
|
|
523
536
|
request: httpReq,
|
|
524
|
-
httpClient
|
|
537
|
+
httpClient,
|
|
525
538
|
logger: this.logger,
|
|
526
539
|
});
|
|
527
540
|
resp = parseResponse(respBody, unmarshalDatabaseCredentialSchema);
|
|
@@ -534,18 +547,19 @@ export class PostgresClient {
|
|
|
534
547
|
}
|
|
535
548
|
/** Retrieves information about the specified database branch. */
|
|
536
549
|
async getBranch(req, options) {
|
|
537
|
-
const
|
|
550
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
551
|
+
const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
|
|
538
552
|
let resp;
|
|
539
553
|
const call = async (callSignal) => {
|
|
540
554
|
const headers = new Headers();
|
|
541
|
-
if (
|
|
542
|
-
headers.set('X-Databricks-Org-Id',
|
|
555
|
+
if (workspaceId !== undefined) {
|
|
556
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
543
557
|
}
|
|
544
558
|
headers.set('User-Agent', this.userAgent);
|
|
545
559
|
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
|
|
546
560
|
const respBody = await executeHttpCall({
|
|
547
561
|
request: httpReq,
|
|
548
|
-
httpClient
|
|
562
|
+
httpClient,
|
|
549
563
|
logger: this.logger,
|
|
550
564
|
});
|
|
551
565
|
resp = parseResponse(respBody, unmarshalBranchSchema);
|
|
@@ -558,18 +572,19 @@ export class PostgresClient {
|
|
|
558
572
|
}
|
|
559
573
|
/** Get a Database Catalog. */
|
|
560
574
|
async getCatalog(req, options) {
|
|
561
|
-
const
|
|
575
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
576
|
+
const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
|
|
562
577
|
let resp;
|
|
563
578
|
const call = async (callSignal) => {
|
|
564
579
|
const headers = new Headers();
|
|
565
|
-
if (
|
|
566
|
-
headers.set('X-Databricks-Org-Id',
|
|
580
|
+
if (workspaceId !== undefined) {
|
|
581
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
567
582
|
}
|
|
568
583
|
headers.set('User-Agent', this.userAgent);
|
|
569
584
|
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
|
|
570
585
|
const respBody = await executeHttpCall({
|
|
571
586
|
request: httpReq,
|
|
572
|
-
httpClient
|
|
587
|
+
httpClient,
|
|
573
588
|
logger: this.logger,
|
|
574
589
|
});
|
|
575
590
|
resp = parseResponse(respBody, unmarshalCatalogSchema);
|
|
@@ -582,18 +597,19 @@ export class PostgresClient {
|
|
|
582
597
|
}
|
|
583
598
|
/** Get a Database. */
|
|
584
599
|
async getDatabase(req, options) {
|
|
585
|
-
const
|
|
600
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
601
|
+
const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
|
|
586
602
|
let resp;
|
|
587
603
|
const call = async (callSignal) => {
|
|
588
604
|
const headers = new Headers();
|
|
589
|
-
if (
|
|
590
|
-
headers.set('X-Databricks-Org-Id',
|
|
605
|
+
if (workspaceId !== undefined) {
|
|
606
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
591
607
|
}
|
|
592
608
|
headers.set('User-Agent', this.userAgent);
|
|
593
609
|
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
|
|
594
610
|
const respBody = await executeHttpCall({
|
|
595
611
|
request: httpReq,
|
|
596
|
-
httpClient
|
|
612
|
+
httpClient,
|
|
597
613
|
logger: this.logger,
|
|
598
614
|
});
|
|
599
615
|
resp = parseResponse(respBody, unmarshalDatabaseSchema);
|
|
@@ -606,18 +622,19 @@ export class PostgresClient {
|
|
|
606
622
|
}
|
|
607
623
|
/** Retrieves information about the specified compute endpoint, including its connection details and operational state. */
|
|
608
624
|
async getEndpoint(req, options) {
|
|
609
|
-
const
|
|
625
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
626
|
+
const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
|
|
610
627
|
let resp;
|
|
611
628
|
const call = async (callSignal) => {
|
|
612
629
|
const headers = new Headers();
|
|
613
|
-
if (
|
|
614
|
-
headers.set('X-Databricks-Org-Id',
|
|
630
|
+
if (workspaceId !== undefined) {
|
|
631
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
615
632
|
}
|
|
616
633
|
headers.set('User-Agent', this.userAgent);
|
|
617
634
|
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
|
|
618
635
|
const respBody = await executeHttpCall({
|
|
619
636
|
request: httpReq,
|
|
620
|
-
httpClient
|
|
637
|
+
httpClient,
|
|
621
638
|
logger: this.logger,
|
|
622
639
|
});
|
|
623
640
|
resp = parseResponse(respBody, unmarshalEndpointSchema);
|
|
@@ -630,18 +647,19 @@ export class PostgresClient {
|
|
|
630
647
|
}
|
|
631
648
|
/** Retrieves the status of a long-running operation. */
|
|
632
649
|
async getOperation(req, options) {
|
|
633
|
-
const
|
|
650
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
651
|
+
const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
|
|
634
652
|
let resp;
|
|
635
653
|
const call = async (callSignal) => {
|
|
636
654
|
const headers = new Headers();
|
|
637
|
-
if (
|
|
638
|
-
headers.set('X-Databricks-Org-Id',
|
|
655
|
+
if (workspaceId !== undefined) {
|
|
656
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
639
657
|
}
|
|
640
658
|
headers.set('User-Agent', this.userAgent);
|
|
641
659
|
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
|
|
642
660
|
const respBody = await executeHttpCall({
|
|
643
661
|
request: httpReq,
|
|
644
|
-
httpClient
|
|
662
|
+
httpClient,
|
|
645
663
|
logger: this.logger,
|
|
646
664
|
});
|
|
647
665
|
resp = parseResponse(respBody, unmarshalOperationSchema);
|
|
@@ -654,18 +672,19 @@ export class PostgresClient {
|
|
|
654
672
|
}
|
|
655
673
|
/** Retrieves information about the specified database project. */
|
|
656
674
|
async getProject(req, options) {
|
|
657
|
-
const
|
|
675
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
676
|
+
const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
|
|
658
677
|
let resp;
|
|
659
678
|
const call = async (callSignal) => {
|
|
660
679
|
const headers = new Headers();
|
|
661
|
-
if (
|
|
662
|
-
headers.set('X-Databricks-Org-Id',
|
|
680
|
+
if (workspaceId !== undefined) {
|
|
681
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
663
682
|
}
|
|
664
683
|
headers.set('User-Agent', this.userAgent);
|
|
665
684
|
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
|
|
666
685
|
const respBody = await executeHttpCall({
|
|
667
686
|
request: httpReq,
|
|
668
|
-
httpClient
|
|
687
|
+
httpClient,
|
|
669
688
|
logger: this.logger,
|
|
670
689
|
});
|
|
671
690
|
resp = parseResponse(respBody, unmarshalProjectSchema);
|
|
@@ -678,18 +697,19 @@ export class PostgresClient {
|
|
|
678
697
|
}
|
|
679
698
|
/** Retrieves information about the specified Postgres role, including its authentication method and permissions. */
|
|
680
699
|
async getRole(req, options) {
|
|
681
|
-
const
|
|
700
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
701
|
+
const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
|
|
682
702
|
let resp;
|
|
683
703
|
const call = async (callSignal) => {
|
|
684
704
|
const headers = new Headers();
|
|
685
|
-
if (
|
|
686
|
-
headers.set('X-Databricks-Org-Id',
|
|
705
|
+
if (workspaceId !== undefined) {
|
|
706
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
687
707
|
}
|
|
688
708
|
headers.set('User-Agent', this.userAgent);
|
|
689
709
|
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
|
|
690
710
|
const respBody = await executeHttpCall({
|
|
691
711
|
request: httpReq,
|
|
692
|
-
httpClient
|
|
712
|
+
httpClient,
|
|
693
713
|
logger: this.logger,
|
|
694
714
|
});
|
|
695
715
|
resp = parseResponse(respBody, unmarshalRoleSchema);
|
|
@@ -702,18 +722,19 @@ export class PostgresClient {
|
|
|
702
722
|
}
|
|
703
723
|
/** Get a Synced Table. */
|
|
704
724
|
async getSyncedTable(req, options) {
|
|
705
|
-
const
|
|
725
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
726
|
+
const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
|
|
706
727
|
let resp;
|
|
707
728
|
const call = async (callSignal) => {
|
|
708
729
|
const headers = new Headers();
|
|
709
|
-
if (
|
|
710
|
-
headers.set('X-Databricks-Org-Id',
|
|
730
|
+
if (workspaceId !== undefined) {
|
|
731
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
711
732
|
}
|
|
712
733
|
headers.set('User-Agent', this.userAgent);
|
|
713
734
|
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
|
|
714
735
|
const respBody = await executeHttpCall({
|
|
715
736
|
request: httpReq,
|
|
716
|
-
httpClient
|
|
737
|
+
httpClient,
|
|
717
738
|
logger: this.logger,
|
|
718
739
|
});
|
|
719
740
|
resp = parseResponse(respBody, unmarshalSyncedTableSchema);
|
|
@@ -726,7 +747,8 @@ export class PostgresClient {
|
|
|
726
747
|
}
|
|
727
748
|
/** Returns a paginated list of database branches in the project. */
|
|
728
749
|
async listBranches(req, options) {
|
|
729
|
-
const
|
|
750
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
751
|
+
const url = `${host}/api/2.0/postgres/${req.parent ?? ''}/branches`;
|
|
730
752
|
const params = new URLSearchParams();
|
|
731
753
|
if (req.pageToken !== undefined) {
|
|
732
754
|
params.append('page_token', req.pageToken);
|
|
@@ -742,14 +764,14 @@ export class PostgresClient {
|
|
|
742
764
|
let resp;
|
|
743
765
|
const call = async (callSignal) => {
|
|
744
766
|
const headers = new Headers();
|
|
745
|
-
if (
|
|
746
|
-
headers.set('X-Databricks-Org-Id',
|
|
767
|
+
if (workspaceId !== undefined) {
|
|
768
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
747
769
|
}
|
|
748
770
|
headers.set('User-Agent', this.userAgent);
|
|
749
771
|
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
750
772
|
const respBody = await executeHttpCall({
|
|
751
773
|
request: httpReq,
|
|
752
|
-
httpClient
|
|
774
|
+
httpClient,
|
|
753
775
|
logger: this.logger,
|
|
754
776
|
});
|
|
755
777
|
resp = parseResponse(respBody, unmarshalListBranchesResponseSchema);
|
|
@@ -775,7 +797,8 @@ export class PostgresClient {
|
|
|
775
797
|
}
|
|
776
798
|
/** List Databases. */
|
|
777
799
|
async listDatabases(req, options) {
|
|
778
|
-
const
|
|
800
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
801
|
+
const url = `${host}/api/2.0/postgres/${req.parent ?? ''}/databases`;
|
|
779
802
|
const params = new URLSearchParams();
|
|
780
803
|
if (req.pageToken !== undefined) {
|
|
781
804
|
params.append('page_token', req.pageToken);
|
|
@@ -788,14 +811,14 @@ export class PostgresClient {
|
|
|
788
811
|
let resp;
|
|
789
812
|
const call = async (callSignal) => {
|
|
790
813
|
const headers = new Headers();
|
|
791
|
-
if (
|
|
792
|
-
headers.set('X-Databricks-Org-Id',
|
|
814
|
+
if (workspaceId !== undefined) {
|
|
815
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
793
816
|
}
|
|
794
817
|
headers.set('User-Agent', this.userAgent);
|
|
795
818
|
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
796
819
|
const respBody = await executeHttpCall({
|
|
797
820
|
request: httpReq,
|
|
798
|
-
httpClient
|
|
821
|
+
httpClient,
|
|
799
822
|
logger: this.logger,
|
|
800
823
|
});
|
|
801
824
|
resp = parseResponse(respBody, unmarshalListDatabasesResponseSchema);
|
|
@@ -821,7 +844,8 @@ export class PostgresClient {
|
|
|
821
844
|
}
|
|
822
845
|
/** Returns a paginated list of compute endpoints in the branch. */
|
|
823
846
|
async listEndpoints(req, options) {
|
|
824
|
-
const
|
|
847
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
848
|
+
const url = `${host}/api/2.0/postgres/${req.parent ?? ''}/endpoints`;
|
|
825
849
|
const params = new URLSearchParams();
|
|
826
850
|
if (req.pageToken !== undefined) {
|
|
827
851
|
params.append('page_token', req.pageToken);
|
|
@@ -834,14 +858,14 @@ export class PostgresClient {
|
|
|
834
858
|
let resp;
|
|
835
859
|
const call = async (callSignal) => {
|
|
836
860
|
const headers = new Headers();
|
|
837
|
-
if (
|
|
838
|
-
headers.set('X-Databricks-Org-Id',
|
|
861
|
+
if (workspaceId !== undefined) {
|
|
862
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
839
863
|
}
|
|
840
864
|
headers.set('User-Agent', this.userAgent);
|
|
841
865
|
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
842
866
|
const respBody = await executeHttpCall({
|
|
843
867
|
request: httpReq,
|
|
844
|
-
httpClient
|
|
868
|
+
httpClient,
|
|
845
869
|
logger: this.logger,
|
|
846
870
|
});
|
|
847
871
|
resp = parseResponse(respBody, unmarshalListEndpointsResponseSchema);
|
|
@@ -867,7 +891,8 @@ export class PostgresClient {
|
|
|
867
891
|
}
|
|
868
892
|
/** Returns a paginated list of database projects in the workspace that the user has permission to access. */
|
|
869
893
|
async listProjects(req, options) {
|
|
870
|
-
const
|
|
894
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
895
|
+
const url = `${host}/api/2.0/postgres/projects`;
|
|
871
896
|
const params = new URLSearchParams();
|
|
872
897
|
if (req.pageToken !== undefined) {
|
|
873
898
|
params.append('page_token', req.pageToken);
|
|
@@ -883,14 +908,14 @@ export class PostgresClient {
|
|
|
883
908
|
let resp;
|
|
884
909
|
const call = async (callSignal) => {
|
|
885
910
|
const headers = new Headers();
|
|
886
|
-
if (
|
|
887
|
-
headers.set('X-Databricks-Org-Id',
|
|
911
|
+
if (workspaceId !== undefined) {
|
|
912
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
888
913
|
}
|
|
889
914
|
headers.set('User-Agent', this.userAgent);
|
|
890
915
|
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
891
916
|
const respBody = await executeHttpCall({
|
|
892
917
|
request: httpReq,
|
|
893
|
-
httpClient
|
|
918
|
+
httpClient,
|
|
894
919
|
logger: this.logger,
|
|
895
920
|
});
|
|
896
921
|
resp = parseResponse(respBody, unmarshalListProjectsResponseSchema);
|
|
@@ -916,7 +941,8 @@ export class PostgresClient {
|
|
|
916
941
|
}
|
|
917
942
|
/** Returns a paginated list of Postgres roles in the branch. */
|
|
918
943
|
async listRoles(req, options) {
|
|
919
|
-
const
|
|
944
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
945
|
+
const url = `${host}/api/2.0/postgres/${req.parent ?? ''}/roles`;
|
|
920
946
|
const params = new URLSearchParams();
|
|
921
947
|
if (req.pageToken !== undefined) {
|
|
922
948
|
params.append('page_token', req.pageToken);
|
|
@@ -929,14 +955,14 @@ export class PostgresClient {
|
|
|
929
955
|
let resp;
|
|
930
956
|
const call = async (callSignal) => {
|
|
931
957
|
const headers = new Headers();
|
|
932
|
-
if (
|
|
933
|
-
headers.set('X-Databricks-Org-Id',
|
|
958
|
+
if (workspaceId !== undefined) {
|
|
959
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
934
960
|
}
|
|
935
961
|
headers.set('User-Agent', this.userAgent);
|
|
936
962
|
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
937
963
|
const respBody = await executeHttpCall({
|
|
938
964
|
request: httpReq,
|
|
939
|
-
httpClient
|
|
965
|
+
httpClient,
|
|
940
966
|
logger: this.logger,
|
|
941
967
|
});
|
|
942
968
|
resp = parseResponse(respBody, unmarshalListRolesResponseSchema);
|
|
@@ -962,19 +988,20 @@ export class PostgresClient {
|
|
|
962
988
|
}
|
|
963
989
|
/** Undeletes the specified database branch. */
|
|
964
990
|
async undeleteBranch(req, options) {
|
|
965
|
-
const
|
|
991
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
992
|
+
const url = `${host}/api/2.0/postgres/${req.name ?? ''}/undelete`;
|
|
966
993
|
const body = marshalRequest(req, marshalUndeleteBranchRequestSchema);
|
|
967
994
|
let resp;
|
|
968
995
|
const call = async (callSignal) => {
|
|
969
996
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
970
|
-
if (
|
|
971
|
-
headers.set('X-Databricks-Org-Id',
|
|
997
|
+
if (workspaceId !== undefined) {
|
|
998
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
972
999
|
}
|
|
973
1000
|
headers.set('User-Agent', this.userAgent);
|
|
974
1001
|
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
975
1002
|
const respBody = await executeHttpCall({
|
|
976
1003
|
request: httpReq,
|
|
977
|
-
httpClient
|
|
1004
|
+
httpClient,
|
|
978
1005
|
logger: this.logger,
|
|
979
1006
|
});
|
|
980
1007
|
resp = parseResponse(respBody, unmarshalOperationSchema);
|
|
@@ -991,19 +1018,20 @@ export class PostgresClient {
|
|
|
991
1018
|
}
|
|
992
1019
|
/** Undeletes a soft-deleted project. */
|
|
993
1020
|
async undeleteProject(req, options) {
|
|
994
|
-
const
|
|
1021
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
1022
|
+
const url = `${host}/api/2.0/postgres/${req.name ?? ''}/undelete`;
|
|
995
1023
|
const body = marshalRequest(req, marshalUndeleteProjectRequestSchema);
|
|
996
1024
|
let resp;
|
|
997
1025
|
const call = async (callSignal) => {
|
|
998
1026
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
999
|
-
if (
|
|
1000
|
-
headers.set('X-Databricks-Org-Id',
|
|
1027
|
+
if (workspaceId !== undefined) {
|
|
1028
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
1001
1029
|
}
|
|
1002
1030
|
headers.set('User-Agent', this.userAgent);
|
|
1003
1031
|
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
1004
1032
|
const respBody = await executeHttpCall({
|
|
1005
1033
|
request: httpReq,
|
|
1006
|
-
httpClient
|
|
1034
|
+
httpClient,
|
|
1007
1035
|
logger: this.logger,
|
|
1008
1036
|
});
|
|
1009
1037
|
resp = parseResponse(respBody, unmarshalOperationSchema);
|
|
@@ -1020,7 +1048,8 @@ export class PostgresClient {
|
|
|
1020
1048
|
}
|
|
1021
1049
|
/** Updates the specified database branch. You can set this branch as the project's default branch, or protect/unprotect it. */
|
|
1022
1050
|
async updateBranch(req, options) {
|
|
1023
|
-
const
|
|
1051
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
1052
|
+
const url = `${host}/api/2.0/postgres/${req.branch?.name ?? ''}`;
|
|
1024
1053
|
const params = new URLSearchParams();
|
|
1025
1054
|
if (req.updateMask !== undefined) {
|
|
1026
1055
|
params.append('update_mask', req.updateMask.toString());
|
|
@@ -1031,14 +1060,14 @@ export class PostgresClient {
|
|
|
1031
1060
|
let resp;
|
|
1032
1061
|
const call = async (callSignal) => {
|
|
1033
1062
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
1034
|
-
if (
|
|
1035
|
-
headers.set('X-Databricks-Org-Id',
|
|
1063
|
+
if (workspaceId !== undefined) {
|
|
1064
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
1036
1065
|
}
|
|
1037
1066
|
headers.set('User-Agent', this.userAgent);
|
|
1038
1067
|
const httpReq = buildHttpRequest('PATCH', fullUrl, headers, callSignal, body);
|
|
1039
1068
|
const respBody = await executeHttpCall({
|
|
1040
1069
|
request: httpReq,
|
|
1041
|
-
httpClient
|
|
1070
|
+
httpClient,
|
|
1042
1071
|
logger: this.logger,
|
|
1043
1072
|
});
|
|
1044
1073
|
resp = parseResponse(respBody, unmarshalOperationSchema);
|
|
@@ -1055,7 +1084,8 @@ export class PostgresClient {
|
|
|
1055
1084
|
}
|
|
1056
1085
|
/** Update a Database. */
|
|
1057
1086
|
async updateDatabase(req, options) {
|
|
1058
|
-
const
|
|
1087
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
1088
|
+
const url = `${host}/api/2.0/postgres/${req.database?.name ?? ''}`;
|
|
1059
1089
|
const params = new URLSearchParams();
|
|
1060
1090
|
if (req.updateMask !== undefined) {
|
|
1061
1091
|
params.append('update_mask', req.updateMask.toString());
|
|
@@ -1066,14 +1096,14 @@ export class PostgresClient {
|
|
|
1066
1096
|
let resp;
|
|
1067
1097
|
const call = async (callSignal) => {
|
|
1068
1098
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
1069
|
-
if (
|
|
1070
|
-
headers.set('X-Databricks-Org-Id',
|
|
1099
|
+
if (workspaceId !== undefined) {
|
|
1100
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
1071
1101
|
}
|
|
1072
1102
|
headers.set('User-Agent', this.userAgent);
|
|
1073
1103
|
const httpReq = buildHttpRequest('PATCH', fullUrl, headers, callSignal, body);
|
|
1074
1104
|
const respBody = await executeHttpCall({
|
|
1075
1105
|
request: httpReq,
|
|
1076
|
-
httpClient
|
|
1106
|
+
httpClient,
|
|
1077
1107
|
logger: this.logger,
|
|
1078
1108
|
});
|
|
1079
1109
|
resp = parseResponse(respBody, unmarshalOperationSchema);
|
|
@@ -1090,7 +1120,8 @@ export class PostgresClient {
|
|
|
1090
1120
|
}
|
|
1091
1121
|
/** Updates the specified compute endpoint. You can update autoscaling limits, suspend timeout, or enable/disable the compute endpoint. */
|
|
1092
1122
|
async updateEndpoint(req, options) {
|
|
1093
|
-
const
|
|
1123
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
1124
|
+
const url = `${host}/api/2.0/postgres/${req.endpoint?.name ?? ''}`;
|
|
1094
1125
|
const params = new URLSearchParams();
|
|
1095
1126
|
if (req.updateMask !== undefined) {
|
|
1096
1127
|
params.append('update_mask', req.updateMask.toString());
|
|
@@ -1101,14 +1132,14 @@ export class PostgresClient {
|
|
|
1101
1132
|
let resp;
|
|
1102
1133
|
const call = async (callSignal) => {
|
|
1103
1134
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
1104
|
-
if (
|
|
1105
|
-
headers.set('X-Databricks-Org-Id',
|
|
1135
|
+
if (workspaceId !== undefined) {
|
|
1136
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
1106
1137
|
}
|
|
1107
1138
|
headers.set('User-Agent', this.userAgent);
|
|
1108
1139
|
const httpReq = buildHttpRequest('PATCH', fullUrl, headers, callSignal, body);
|
|
1109
1140
|
const respBody = await executeHttpCall({
|
|
1110
1141
|
request: httpReq,
|
|
1111
|
-
httpClient
|
|
1142
|
+
httpClient,
|
|
1112
1143
|
logger: this.logger,
|
|
1113
1144
|
});
|
|
1114
1145
|
resp = parseResponse(respBody, unmarshalOperationSchema);
|
|
@@ -1125,7 +1156,8 @@ export class PostgresClient {
|
|
|
1125
1156
|
}
|
|
1126
1157
|
/** Updates the specified database project. */
|
|
1127
1158
|
async updateProject(req, options) {
|
|
1128
|
-
const
|
|
1159
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
1160
|
+
const url = `${host}/api/2.0/postgres/${req.project?.name ?? ''}`;
|
|
1129
1161
|
const params = new URLSearchParams();
|
|
1130
1162
|
if (req.updateMask !== undefined) {
|
|
1131
1163
|
params.append('update_mask', req.updateMask.toString());
|
|
@@ -1136,14 +1168,14 @@ export class PostgresClient {
|
|
|
1136
1168
|
let resp;
|
|
1137
1169
|
const call = async (callSignal) => {
|
|
1138
1170
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
1139
|
-
if (
|
|
1140
|
-
headers.set('X-Databricks-Org-Id',
|
|
1171
|
+
if (workspaceId !== undefined) {
|
|
1172
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
1141
1173
|
}
|
|
1142
1174
|
headers.set('User-Agent', this.userAgent);
|
|
1143
1175
|
const httpReq = buildHttpRequest('PATCH', fullUrl, headers, callSignal, body);
|
|
1144
1176
|
const respBody = await executeHttpCall({
|
|
1145
1177
|
request: httpReq,
|
|
1146
|
-
httpClient
|
|
1178
|
+
httpClient,
|
|
1147
1179
|
logger: this.logger,
|
|
1148
1180
|
});
|
|
1149
1181
|
resp = parseResponse(respBody, unmarshalOperationSchema);
|
|
@@ -1160,7 +1192,8 @@ export class PostgresClient {
|
|
|
1160
1192
|
}
|
|
1161
1193
|
/** Update a role for a branch. */
|
|
1162
1194
|
async updateRole(req, options) {
|
|
1163
|
-
const
|
|
1195
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
1196
|
+
const url = `${host}/api/2.0/postgres/${req.role?.name ?? ''}`;
|
|
1164
1197
|
const params = new URLSearchParams();
|
|
1165
1198
|
if (req.updateMask !== undefined) {
|
|
1166
1199
|
params.append('update_mask', req.updateMask.toString());
|
|
@@ -1171,14 +1204,14 @@ export class PostgresClient {
|
|
|
1171
1204
|
let resp;
|
|
1172
1205
|
const call = async (callSignal) => {
|
|
1173
1206
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
1174
|
-
if (
|
|
1175
|
-
headers.set('X-Databricks-Org-Id',
|
|
1207
|
+
if (workspaceId !== undefined) {
|
|
1208
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
1176
1209
|
}
|
|
1177
1210
|
headers.set('User-Agent', this.userAgent);
|
|
1178
1211
|
const httpReq = buildHttpRequest('PATCH', fullUrl, headers, callSignal, body);
|
|
1179
1212
|
const respBody = await executeHttpCall({
|
|
1180
1213
|
request: httpReq,
|
|
1181
|
-
httpClient
|
|
1214
|
+
httpClient,
|
|
1182
1215
|
logger: this.logger,
|
|
1183
1216
|
});
|
|
1184
1217
|
resp = parseResponse(respBody, unmarshalOperationSchema);
|