@databricks/sdk-postgres 0.1.0-dev.6 → 0.3.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/README.md +3 -8
- package/dist/v1/client.d.ts +133 -43
- package/dist/v1/client.d.ts.map +1 -1
- package/dist/v1/client.js +436 -99
- package/dist/v1/client.js.map +1 -1
- package/dist/v1/index.d.ts +7 -4
- package/dist/v1/index.d.ts.map +1 -1
- package/dist/v1/index.js +6 -3
- package/dist/v1/index.js.map +1 -1
- package/dist/v1/model.d.ts +171 -0
- package/dist/v1/model.d.ts.map +1 -1
- package/dist/v1/model.js +262 -0
- package/dist/v1/model.js.map +1 -1
- package/package.json +4 -4
package/dist/v1/client.js
CHANGED
|
@@ -6,7 +6,7 @@ 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';
|
|
9
|
-
import { marshalBranchSchema, marshalCatalogSchema, marshalDatabaseSchema, marshalEndpointSchema, marshalGenerateDatabaseCredentialRequestSchema, marshalProjectSchema, marshalRoleSchema, marshalSyncedTableSchema, marshalUndeleteBranchRequestSchema, marshalUndeleteProjectRequestSchema, unmarshalBranchOperationMetadataSchema, unmarshalBranchSchema, unmarshalCatalogOperationMetadataSchema, unmarshalCatalogSchema, unmarshalDatabaseCredentialSchema, unmarshalDatabaseOperationMetadataSchema, unmarshalDatabaseSchema, unmarshalEndpointOperationMetadataSchema, unmarshalEndpointSchema, unmarshalListBranchesResponseSchema, unmarshalListDatabasesResponseSchema, unmarshalListEndpointsResponseSchema, unmarshalListProjectsResponseSchema, unmarshalListRolesResponseSchema, unmarshalOperationSchema, unmarshalProjectOperationMetadataSchema, unmarshalProjectSchema, unmarshalRoleOperationMetadataSchema, unmarshalRoleSchema, unmarshalSyncedTableOperationMetadataSchema, unmarshalSyncedTableSchema, } from './model';
|
|
9
|
+
import { marshalBranchSchema, marshalCatalogSchema, marshalDataApiSchema, marshalDatabaseSchema, marshalEndpointSchema, marshalGenerateDatabaseCredentialRequestSchema, marshalProjectSchema, marshalRoleSchema, marshalSyncedTableSchema, marshalUndeleteBranchRequestSchema, marshalUndeleteProjectRequestSchema, unmarshalBranchOperationMetadataSchema, unmarshalBranchSchema, unmarshalCatalogOperationMetadataSchema, unmarshalCatalogSchema, unmarshalDataApiOperationMetadataSchema, unmarshalDataApiSchema, unmarshalDatabaseCredentialSchema, unmarshalDatabaseOperationMetadataSchema, unmarshalDatabaseSchema, unmarshalEndpointOperationMetadataSchema, unmarshalEndpointSchema, unmarshalListBranchesResponseSchema, unmarshalListDatabasesResponseSchema, unmarshalListEndpointsResponseSchema, unmarshalListProjectsResponseSchema, unmarshalListRolesResponseSchema, unmarshalOperationSchema, unmarshalProjectOperationMetadataSchema, unmarshalProjectSchema, unmarshalRoleOperationMetadataSchema, unmarshalRoleSchema, unmarshalSyncedTableOperationMetadataSchema, unmarshalSyncedTableSchema, } from './model';
|
|
10
10
|
// Package identity segment for this client to be used in the User-Agent header.
|
|
11
11
|
const PACKAGE_SEGMENT = {
|
|
12
12
|
key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''),
|
|
@@ -37,7 +37,7 @@ export class PostgresClient {
|
|
|
37
37
|
return this.config;
|
|
38
38
|
}
|
|
39
39
|
/** Creates a new database branch in the project. */
|
|
40
|
-
async
|
|
40
|
+
async createBranchBase(req, options) {
|
|
41
41
|
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
42
42
|
const url = `${host}/api/2.0/postgres/${req.parent ?? ''}/branches`;
|
|
43
43
|
const params = new URLSearchParams();
|
|
@@ -54,7 +54,7 @@ export class PostgresClient {
|
|
|
54
54
|
const call = async (callSignal) => {
|
|
55
55
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
56
56
|
if (workspaceId !== undefined) {
|
|
57
|
-
headers.set('X-Databricks-
|
|
57
|
+
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
58
58
|
}
|
|
59
59
|
headers.set('User-Agent', this.userAgent);
|
|
60
60
|
const httpReq = buildHttpRequest('POST', fullUrl, headers, callSignal, body);
|
|
@@ -71,12 +71,13 @@ export class PostgresClient {
|
|
|
71
71
|
}
|
|
72
72
|
return resp;
|
|
73
73
|
}
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
/** Creates a new database branch in the project. */
|
|
75
|
+
async createBranch(req, options) {
|
|
76
|
+
const op = await this.createBranchBase(req, options);
|
|
76
77
|
return new CreateBranchOperation(op, (req, options) => this.getOperation(req, options));
|
|
77
78
|
}
|
|
78
79
|
/** Register a Postgres database in the Unity Catalog. */
|
|
79
|
-
async
|
|
80
|
+
async createCatalogBase(req, options) {
|
|
80
81
|
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
81
82
|
const url = `${host}/api/2.0/postgres/catalogs`;
|
|
82
83
|
const params = new URLSearchParams();
|
|
@@ -90,7 +91,7 @@ export class PostgresClient {
|
|
|
90
91
|
const call = async (callSignal) => {
|
|
91
92
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
92
93
|
if (workspaceId !== undefined) {
|
|
93
|
-
headers.set('X-Databricks-
|
|
94
|
+
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
94
95
|
}
|
|
95
96
|
headers.set('User-Agent', this.userAgent);
|
|
96
97
|
const httpReq = buildHttpRequest('POST', fullUrl, headers, callSignal, body);
|
|
@@ -107,16 +108,48 @@ export class PostgresClient {
|
|
|
107
108
|
}
|
|
108
109
|
return resp;
|
|
109
110
|
}
|
|
110
|
-
|
|
111
|
-
|
|
111
|
+
/** Register a Postgres database in the Unity Catalog. */
|
|
112
|
+
async createCatalog(req, options) {
|
|
113
|
+
const op = await this.createCatalogBase(req, options);
|
|
112
114
|
return new CreateCatalogOperation(op, (req, options) => this.getOperation(req, options));
|
|
113
115
|
}
|
|
116
|
+
/** Enable Data API for a database. */
|
|
117
|
+
async createDataApiBase(req, options) {
|
|
118
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
119
|
+
const url = `${host}/api/2.0/postgres/${req.parent ?? ''}/data-api`;
|
|
120
|
+
const body = marshalRequest(req.dataApi, marshalDataApiSchema);
|
|
121
|
+
let resp;
|
|
122
|
+
const call = async (callSignal) => {
|
|
123
|
+
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
124
|
+
if (workspaceId !== undefined) {
|
|
125
|
+
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
126
|
+
}
|
|
127
|
+
headers.set('User-Agent', this.userAgent);
|
|
128
|
+
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
129
|
+
const respBody = await executeHttpCall({
|
|
130
|
+
request: httpReq,
|
|
131
|
+
httpClient,
|
|
132
|
+
logger: this.logger,
|
|
133
|
+
});
|
|
134
|
+
resp = parseResponse(respBody, unmarshalOperationSchema);
|
|
135
|
+
};
|
|
136
|
+
await executeCall(call, options);
|
|
137
|
+
if (resp === undefined) {
|
|
138
|
+
throw new Error('operation completed without a result.');
|
|
139
|
+
}
|
|
140
|
+
return resp;
|
|
141
|
+
}
|
|
142
|
+
/** Enable Data API for a database. */
|
|
143
|
+
async createDataApi(req, options) {
|
|
144
|
+
const op = await this.createDataApiBase(req, options);
|
|
145
|
+
return new CreateDataApiOperation(op, (req, options) => this.getOperation(req, options));
|
|
146
|
+
}
|
|
114
147
|
/**
|
|
115
148
|
* Create a Database.
|
|
116
149
|
*
|
|
117
150
|
* Creates a database in the specified branch. A branch can have multiple databases.
|
|
118
151
|
*/
|
|
119
|
-
async
|
|
152
|
+
async createDatabaseBase(req, options) {
|
|
120
153
|
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
121
154
|
const url = `${host}/api/2.0/postgres/${req.parent ?? ''}/databases`;
|
|
122
155
|
const params = new URLSearchParams();
|
|
@@ -130,7 +163,7 @@ export class PostgresClient {
|
|
|
130
163
|
const call = async (callSignal) => {
|
|
131
164
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
132
165
|
if (workspaceId !== undefined) {
|
|
133
|
-
headers.set('X-Databricks-
|
|
166
|
+
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
134
167
|
}
|
|
135
168
|
headers.set('User-Agent', this.userAgent);
|
|
136
169
|
const httpReq = buildHttpRequest('POST', fullUrl, headers, callSignal, body);
|
|
@@ -147,12 +180,17 @@ export class PostgresClient {
|
|
|
147
180
|
}
|
|
148
181
|
return resp;
|
|
149
182
|
}
|
|
150
|
-
|
|
151
|
-
|
|
183
|
+
/**
|
|
184
|
+
* Create a Database.
|
|
185
|
+
*
|
|
186
|
+
* Creates a database in the specified branch. A branch can have multiple databases.
|
|
187
|
+
*/
|
|
188
|
+
async createDatabase(req, options) {
|
|
189
|
+
const op = await this.createDatabaseBase(req, options);
|
|
152
190
|
return new CreateDatabaseOperation(op, (req, options) => this.getOperation(req, options));
|
|
153
191
|
}
|
|
154
192
|
/** Creates a new compute endpoint in the branch. */
|
|
155
|
-
async
|
|
193
|
+
async createEndpointBase(req, options) {
|
|
156
194
|
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
157
195
|
const url = `${host}/api/2.0/postgres/${req.parent ?? ''}/endpoints`;
|
|
158
196
|
const params = new URLSearchParams();
|
|
@@ -169,7 +207,7 @@ export class PostgresClient {
|
|
|
169
207
|
const call = async (callSignal) => {
|
|
170
208
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
171
209
|
if (workspaceId !== undefined) {
|
|
172
|
-
headers.set('X-Databricks-
|
|
210
|
+
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
173
211
|
}
|
|
174
212
|
headers.set('User-Agent', this.userAgent);
|
|
175
213
|
const httpReq = buildHttpRequest('POST', fullUrl, headers, callSignal, body);
|
|
@@ -186,12 +224,13 @@ export class PostgresClient {
|
|
|
186
224
|
}
|
|
187
225
|
return resp;
|
|
188
226
|
}
|
|
189
|
-
|
|
190
|
-
|
|
227
|
+
/** Creates a new compute endpoint in the branch. */
|
|
228
|
+
async createEndpoint(req, options) {
|
|
229
|
+
const op = await this.createEndpointBase(req, options);
|
|
191
230
|
return new CreateEndpointOperation(op, (req, options) => this.getOperation(req, options));
|
|
192
231
|
}
|
|
193
232
|
/** Creates a new Lakebase Autoscaling Postgres database project, which contains branches and compute endpoints. */
|
|
194
|
-
async
|
|
233
|
+
async createProjectBase(req, options) {
|
|
195
234
|
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
196
235
|
const url = `${host}/api/2.0/postgres/projects`;
|
|
197
236
|
const params = new URLSearchParams();
|
|
@@ -205,7 +244,7 @@ export class PostgresClient {
|
|
|
205
244
|
const call = async (callSignal) => {
|
|
206
245
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
207
246
|
if (workspaceId !== undefined) {
|
|
208
|
-
headers.set('X-Databricks-
|
|
247
|
+
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
209
248
|
}
|
|
210
249
|
headers.set('User-Agent', this.userAgent);
|
|
211
250
|
const httpReq = buildHttpRequest('POST', fullUrl, headers, callSignal, body);
|
|
@@ -222,12 +261,13 @@ export class PostgresClient {
|
|
|
222
261
|
}
|
|
223
262
|
return resp;
|
|
224
263
|
}
|
|
225
|
-
|
|
226
|
-
|
|
264
|
+
/** Creates a new Lakebase Autoscaling Postgres database project, which contains branches and compute endpoints. */
|
|
265
|
+
async createProject(req, options) {
|
|
266
|
+
const op = await this.createProjectBase(req, options);
|
|
227
267
|
return new CreateProjectOperation(op, (req, options) => this.getOperation(req, options));
|
|
228
268
|
}
|
|
229
269
|
/** Creates a new Postgres role in the branch. */
|
|
230
|
-
async
|
|
270
|
+
async createRoleBase(req, options) {
|
|
231
271
|
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
232
272
|
const url = `${host}/api/2.0/postgres/${req.parent ?? ''}/roles`;
|
|
233
273
|
const params = new URLSearchParams();
|
|
@@ -241,7 +281,7 @@ export class PostgresClient {
|
|
|
241
281
|
const call = async (callSignal) => {
|
|
242
282
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
243
283
|
if (workspaceId !== undefined) {
|
|
244
|
-
headers.set('X-Databricks-
|
|
284
|
+
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
245
285
|
}
|
|
246
286
|
headers.set('User-Agent', this.userAgent);
|
|
247
287
|
const httpReq = buildHttpRequest('POST', fullUrl, headers, callSignal, body);
|
|
@@ -258,12 +298,13 @@ export class PostgresClient {
|
|
|
258
298
|
}
|
|
259
299
|
return resp;
|
|
260
300
|
}
|
|
261
|
-
|
|
262
|
-
|
|
301
|
+
/** Creates a new Postgres role in the branch. */
|
|
302
|
+
async createRole(req, options) {
|
|
303
|
+
const op = await this.createRoleBase(req, options);
|
|
263
304
|
return new CreateRoleOperation(op, (req, options) => this.getOperation(req, options));
|
|
264
305
|
}
|
|
265
306
|
/** Create a Synced Table. */
|
|
266
|
-
async
|
|
307
|
+
async createSyncedTableBase(req, options) {
|
|
267
308
|
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
268
309
|
const url = `${host}/api/2.0/postgres/synced_tables`;
|
|
269
310
|
const params = new URLSearchParams();
|
|
@@ -277,7 +318,7 @@ export class PostgresClient {
|
|
|
277
318
|
const call = async (callSignal) => {
|
|
278
319
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
279
320
|
if (workspaceId !== undefined) {
|
|
280
|
-
headers.set('X-Databricks-
|
|
321
|
+
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
281
322
|
}
|
|
282
323
|
headers.set('User-Agent', this.userAgent);
|
|
283
324
|
const httpReq = buildHttpRequest('POST', fullUrl, headers, callSignal, body);
|
|
@@ -294,12 +335,13 @@ export class PostgresClient {
|
|
|
294
335
|
}
|
|
295
336
|
return resp;
|
|
296
337
|
}
|
|
297
|
-
|
|
298
|
-
|
|
338
|
+
/** Create a Synced Table. */
|
|
339
|
+
async createSyncedTable(req, options) {
|
|
340
|
+
const op = await this.createSyncedTableBase(req, options);
|
|
299
341
|
return new CreateSyncedTableOperation(op, (req, options) => this.getOperation(req, options));
|
|
300
342
|
}
|
|
301
343
|
/** Deletes the specified database branch. */
|
|
302
|
-
async
|
|
344
|
+
async deleteBranchBase(req, options) {
|
|
303
345
|
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
304
346
|
const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
|
|
305
347
|
const params = new URLSearchParams();
|
|
@@ -312,7 +354,7 @@ export class PostgresClient {
|
|
|
312
354
|
const call = async (callSignal) => {
|
|
313
355
|
const headers = new Headers();
|
|
314
356
|
if (workspaceId !== undefined) {
|
|
315
|
-
headers.set('X-Databricks-
|
|
357
|
+
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
316
358
|
}
|
|
317
359
|
headers.set('User-Agent', this.userAgent);
|
|
318
360
|
const httpReq = buildHttpRequest('DELETE', fullUrl, headers, callSignal);
|
|
@@ -329,19 +371,20 @@ export class PostgresClient {
|
|
|
329
371
|
}
|
|
330
372
|
return resp;
|
|
331
373
|
}
|
|
332
|
-
|
|
333
|
-
|
|
374
|
+
/** Deletes the specified database branch. */
|
|
375
|
+
async deleteBranch(req, options) {
|
|
376
|
+
const op = await this.deleteBranchBase(req, options);
|
|
334
377
|
return new DeleteBranchOperation(op, (req, options) => this.getOperation(req, options));
|
|
335
378
|
}
|
|
336
379
|
/** Delete a Database Catalog. */
|
|
337
|
-
async
|
|
380
|
+
async deleteCatalogBase(req, options) {
|
|
338
381
|
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
339
382
|
const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
|
|
340
383
|
let resp;
|
|
341
384
|
const call = async (callSignal) => {
|
|
342
385
|
const headers = new Headers();
|
|
343
386
|
if (workspaceId !== undefined) {
|
|
344
|
-
headers.set('X-Databricks-
|
|
387
|
+
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
345
388
|
}
|
|
346
389
|
headers.set('User-Agent', this.userAgent);
|
|
347
390
|
const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
|
|
@@ -358,19 +401,50 @@ export class PostgresClient {
|
|
|
358
401
|
}
|
|
359
402
|
return resp;
|
|
360
403
|
}
|
|
361
|
-
|
|
362
|
-
|
|
404
|
+
/** Delete a Database Catalog. */
|
|
405
|
+
async deleteCatalog(req, options) {
|
|
406
|
+
const op = await this.deleteCatalogBase(req, options);
|
|
363
407
|
return new DeleteCatalogOperation(op, (req, options) => this.getOperation(req, options));
|
|
364
408
|
}
|
|
409
|
+
/** Disable Data API for a database. */
|
|
410
|
+
async deleteDataApiBase(req, options) {
|
|
411
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
412
|
+
const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
|
|
413
|
+
let resp;
|
|
414
|
+
const call = async (callSignal) => {
|
|
415
|
+
const headers = new Headers();
|
|
416
|
+
if (workspaceId !== undefined) {
|
|
417
|
+
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
418
|
+
}
|
|
419
|
+
headers.set('User-Agent', this.userAgent);
|
|
420
|
+
const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
|
|
421
|
+
const respBody = await executeHttpCall({
|
|
422
|
+
request: httpReq,
|
|
423
|
+
httpClient,
|
|
424
|
+
logger: this.logger,
|
|
425
|
+
});
|
|
426
|
+
resp = parseResponse(respBody, unmarshalOperationSchema);
|
|
427
|
+
};
|
|
428
|
+
await executeCall(call, options);
|
|
429
|
+
if (resp === undefined) {
|
|
430
|
+
throw new Error('operation completed without a result.');
|
|
431
|
+
}
|
|
432
|
+
return resp;
|
|
433
|
+
}
|
|
434
|
+
/** Disable Data API for a database. */
|
|
435
|
+
async deleteDataApi(req, options) {
|
|
436
|
+
const op = await this.deleteDataApiBase(req, options);
|
|
437
|
+
return new DeleteDataApiOperation(op, (req, options) => this.getOperation(req, options));
|
|
438
|
+
}
|
|
365
439
|
/** Delete a Database. */
|
|
366
|
-
async
|
|
440
|
+
async deleteDatabaseBase(req, options) {
|
|
367
441
|
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
368
442
|
const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
|
|
369
443
|
let resp;
|
|
370
444
|
const call = async (callSignal) => {
|
|
371
445
|
const headers = new Headers();
|
|
372
446
|
if (workspaceId !== undefined) {
|
|
373
|
-
headers.set('X-Databricks-
|
|
447
|
+
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
374
448
|
}
|
|
375
449
|
headers.set('User-Agent', this.userAgent);
|
|
376
450
|
const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
|
|
@@ -387,19 +461,20 @@ export class PostgresClient {
|
|
|
387
461
|
}
|
|
388
462
|
return resp;
|
|
389
463
|
}
|
|
390
|
-
|
|
391
|
-
|
|
464
|
+
/** Delete a Database. */
|
|
465
|
+
async deleteDatabase(req, options) {
|
|
466
|
+
const op = await this.deleteDatabaseBase(req, options);
|
|
392
467
|
return new DeleteDatabaseOperation(op, (req, options) => this.getOperation(req, options));
|
|
393
468
|
}
|
|
394
469
|
/** Deletes the specified compute endpoint. */
|
|
395
|
-
async
|
|
470
|
+
async deleteEndpointBase(req, options) {
|
|
396
471
|
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
397
472
|
const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
|
|
398
473
|
let resp;
|
|
399
474
|
const call = async (callSignal) => {
|
|
400
475
|
const headers = new Headers();
|
|
401
476
|
if (workspaceId !== undefined) {
|
|
402
|
-
headers.set('X-Databricks-
|
|
477
|
+
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
403
478
|
}
|
|
404
479
|
headers.set('User-Agent', this.userAgent);
|
|
405
480
|
const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
|
|
@@ -416,12 +491,13 @@ export class PostgresClient {
|
|
|
416
491
|
}
|
|
417
492
|
return resp;
|
|
418
493
|
}
|
|
419
|
-
|
|
420
|
-
|
|
494
|
+
/** Deletes the specified compute endpoint. */
|
|
495
|
+
async deleteEndpoint(req, options) {
|
|
496
|
+
const op = await this.deleteEndpointBase(req, options);
|
|
421
497
|
return new DeleteEndpointOperation(op, (req, options) => this.getOperation(req, options));
|
|
422
498
|
}
|
|
423
499
|
/** Deletes the specified database project. */
|
|
424
|
-
async
|
|
500
|
+
async deleteProjectBase(req, options) {
|
|
425
501
|
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
426
502
|
const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
|
|
427
503
|
const params = new URLSearchParams();
|
|
@@ -434,7 +510,7 @@ export class PostgresClient {
|
|
|
434
510
|
const call = async (callSignal) => {
|
|
435
511
|
const headers = new Headers();
|
|
436
512
|
if (workspaceId !== undefined) {
|
|
437
|
-
headers.set('X-Databricks-
|
|
513
|
+
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
438
514
|
}
|
|
439
515
|
headers.set('User-Agent', this.userAgent);
|
|
440
516
|
const httpReq = buildHttpRequest('DELETE', fullUrl, headers, callSignal);
|
|
@@ -451,12 +527,13 @@ export class PostgresClient {
|
|
|
451
527
|
}
|
|
452
528
|
return resp;
|
|
453
529
|
}
|
|
454
|
-
|
|
455
|
-
|
|
530
|
+
/** Deletes the specified database project. */
|
|
531
|
+
async deleteProject(req, options) {
|
|
532
|
+
const op = await this.deleteProjectBase(req, options);
|
|
456
533
|
return new DeleteProjectOperation(op, (req, options) => this.getOperation(req, options));
|
|
457
534
|
}
|
|
458
535
|
/** Deletes the specified Postgres role. */
|
|
459
|
-
async
|
|
536
|
+
async deleteRoleBase(req, options) {
|
|
460
537
|
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
461
538
|
const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
|
|
462
539
|
const params = new URLSearchParams();
|
|
@@ -469,7 +546,7 @@ export class PostgresClient {
|
|
|
469
546
|
const call = async (callSignal) => {
|
|
470
547
|
const headers = new Headers();
|
|
471
548
|
if (workspaceId !== undefined) {
|
|
472
|
-
headers.set('X-Databricks-
|
|
549
|
+
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
473
550
|
}
|
|
474
551
|
headers.set('User-Agent', this.userAgent);
|
|
475
552
|
const httpReq = buildHttpRequest('DELETE', fullUrl, headers, callSignal);
|
|
@@ -486,19 +563,20 @@ export class PostgresClient {
|
|
|
486
563
|
}
|
|
487
564
|
return resp;
|
|
488
565
|
}
|
|
489
|
-
|
|
490
|
-
|
|
566
|
+
/** Deletes the specified Postgres role. */
|
|
567
|
+
async deleteRole(req, options) {
|
|
568
|
+
const op = await this.deleteRoleBase(req, options);
|
|
491
569
|
return new DeleteRoleOperation(op, (req, options) => this.getOperation(req, options));
|
|
492
570
|
}
|
|
493
571
|
/** Delete a Synced Table. */
|
|
494
|
-
async
|
|
572
|
+
async deleteSyncedTableBase(req, options) {
|
|
495
573
|
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
496
574
|
const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
|
|
497
575
|
let resp;
|
|
498
576
|
const call = async (callSignal) => {
|
|
499
577
|
const headers = new Headers();
|
|
500
578
|
if (workspaceId !== undefined) {
|
|
501
|
-
headers.set('X-Databricks-
|
|
579
|
+
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
502
580
|
}
|
|
503
581
|
headers.set('User-Agent', this.userAgent);
|
|
504
582
|
const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
|
|
@@ -515,8 +593,9 @@ export class PostgresClient {
|
|
|
515
593
|
}
|
|
516
594
|
return resp;
|
|
517
595
|
}
|
|
518
|
-
|
|
519
|
-
|
|
596
|
+
/** Delete a Synced Table. */
|
|
597
|
+
async deleteSyncedTable(req, options) {
|
|
598
|
+
const op = await this.deleteSyncedTableBase(req, options);
|
|
520
599
|
return new DeleteSyncedTableOperation(op, (req, options) => this.getOperation(req, options));
|
|
521
600
|
}
|
|
522
601
|
/** Generate OAuth credentials for a Postgres database. */
|
|
@@ -528,7 +607,7 @@ export class PostgresClient {
|
|
|
528
607
|
const call = async (callSignal) => {
|
|
529
608
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
530
609
|
if (workspaceId !== undefined) {
|
|
531
|
-
headers.set('X-Databricks-
|
|
610
|
+
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
532
611
|
}
|
|
533
612
|
headers.set('User-Agent', this.userAgent);
|
|
534
613
|
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
@@ -553,7 +632,7 @@ export class PostgresClient {
|
|
|
553
632
|
const call = async (callSignal) => {
|
|
554
633
|
const headers = new Headers();
|
|
555
634
|
if (workspaceId !== undefined) {
|
|
556
|
-
headers.set('X-Databricks-
|
|
635
|
+
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
557
636
|
}
|
|
558
637
|
headers.set('User-Agent', this.userAgent);
|
|
559
638
|
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
|
|
@@ -578,7 +657,7 @@ export class PostgresClient {
|
|
|
578
657
|
const call = async (callSignal) => {
|
|
579
658
|
const headers = new Headers();
|
|
580
659
|
if (workspaceId !== undefined) {
|
|
581
|
-
headers.set('X-Databricks-
|
|
660
|
+
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
582
661
|
}
|
|
583
662
|
headers.set('User-Agent', this.userAgent);
|
|
584
663
|
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
|
|
@@ -595,6 +674,31 @@ export class PostgresClient {
|
|
|
595
674
|
}
|
|
596
675
|
return resp;
|
|
597
676
|
}
|
|
677
|
+
/** Get Data API configuration for a database. */
|
|
678
|
+
async getDataApi(req, options) {
|
|
679
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
680
|
+
const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
|
|
681
|
+
let resp;
|
|
682
|
+
const call = async (callSignal) => {
|
|
683
|
+
const headers = new Headers();
|
|
684
|
+
if (workspaceId !== undefined) {
|
|
685
|
+
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
686
|
+
}
|
|
687
|
+
headers.set('User-Agent', this.userAgent);
|
|
688
|
+
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
|
|
689
|
+
const respBody = await executeHttpCall({
|
|
690
|
+
request: httpReq,
|
|
691
|
+
httpClient,
|
|
692
|
+
logger: this.logger,
|
|
693
|
+
});
|
|
694
|
+
resp = parseResponse(respBody, unmarshalDataApiSchema);
|
|
695
|
+
};
|
|
696
|
+
await executeCall(call, options);
|
|
697
|
+
if (resp === undefined) {
|
|
698
|
+
throw new Error('operation completed without a result.');
|
|
699
|
+
}
|
|
700
|
+
return resp;
|
|
701
|
+
}
|
|
598
702
|
/** Get a Database. */
|
|
599
703
|
async getDatabase(req, options) {
|
|
600
704
|
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
@@ -603,7 +707,7 @@ export class PostgresClient {
|
|
|
603
707
|
const call = async (callSignal) => {
|
|
604
708
|
const headers = new Headers();
|
|
605
709
|
if (workspaceId !== undefined) {
|
|
606
|
-
headers.set('X-Databricks-
|
|
710
|
+
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
607
711
|
}
|
|
608
712
|
headers.set('User-Agent', this.userAgent);
|
|
609
713
|
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
|
|
@@ -628,7 +732,7 @@ export class PostgresClient {
|
|
|
628
732
|
const call = async (callSignal) => {
|
|
629
733
|
const headers = new Headers();
|
|
630
734
|
if (workspaceId !== undefined) {
|
|
631
|
-
headers.set('X-Databricks-
|
|
735
|
+
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
632
736
|
}
|
|
633
737
|
headers.set('User-Agent', this.userAgent);
|
|
634
738
|
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
|
|
@@ -653,7 +757,7 @@ export class PostgresClient {
|
|
|
653
757
|
const call = async (callSignal) => {
|
|
654
758
|
const headers = new Headers();
|
|
655
759
|
if (workspaceId !== undefined) {
|
|
656
|
-
headers.set('X-Databricks-
|
|
760
|
+
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
657
761
|
}
|
|
658
762
|
headers.set('User-Agent', this.userAgent);
|
|
659
763
|
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
|
|
@@ -678,7 +782,7 @@ export class PostgresClient {
|
|
|
678
782
|
const call = async (callSignal) => {
|
|
679
783
|
const headers = new Headers();
|
|
680
784
|
if (workspaceId !== undefined) {
|
|
681
|
-
headers.set('X-Databricks-
|
|
785
|
+
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
682
786
|
}
|
|
683
787
|
headers.set('User-Agent', this.userAgent);
|
|
684
788
|
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
|
|
@@ -703,7 +807,7 @@ export class PostgresClient {
|
|
|
703
807
|
const call = async (callSignal) => {
|
|
704
808
|
const headers = new Headers();
|
|
705
809
|
if (workspaceId !== undefined) {
|
|
706
|
-
headers.set('X-Databricks-
|
|
810
|
+
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
707
811
|
}
|
|
708
812
|
headers.set('User-Agent', this.userAgent);
|
|
709
813
|
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
|
|
@@ -728,7 +832,7 @@ export class PostgresClient {
|
|
|
728
832
|
const call = async (callSignal) => {
|
|
729
833
|
const headers = new Headers();
|
|
730
834
|
if (workspaceId !== undefined) {
|
|
731
|
-
headers.set('X-Databricks-
|
|
835
|
+
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
732
836
|
}
|
|
733
837
|
headers.set('User-Agent', this.userAgent);
|
|
734
838
|
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
|
|
@@ -765,7 +869,7 @@ export class PostgresClient {
|
|
|
765
869
|
const call = async (callSignal) => {
|
|
766
870
|
const headers = new Headers();
|
|
767
871
|
if (workspaceId !== undefined) {
|
|
768
|
-
headers.set('X-Databricks-
|
|
872
|
+
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
769
873
|
}
|
|
770
874
|
headers.set('User-Agent', this.userAgent);
|
|
771
875
|
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
@@ -812,7 +916,7 @@ export class PostgresClient {
|
|
|
812
916
|
const call = async (callSignal) => {
|
|
813
917
|
const headers = new Headers();
|
|
814
918
|
if (workspaceId !== undefined) {
|
|
815
|
-
headers.set('X-Databricks-
|
|
919
|
+
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
816
920
|
}
|
|
817
921
|
headers.set('User-Agent', this.userAgent);
|
|
818
922
|
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
@@ -859,7 +963,7 @@ export class PostgresClient {
|
|
|
859
963
|
const call = async (callSignal) => {
|
|
860
964
|
const headers = new Headers();
|
|
861
965
|
if (workspaceId !== undefined) {
|
|
862
|
-
headers.set('X-Databricks-
|
|
966
|
+
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
863
967
|
}
|
|
864
968
|
headers.set('User-Agent', this.userAgent);
|
|
865
969
|
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
@@ -909,7 +1013,7 @@ export class PostgresClient {
|
|
|
909
1013
|
const call = async (callSignal) => {
|
|
910
1014
|
const headers = new Headers();
|
|
911
1015
|
if (workspaceId !== undefined) {
|
|
912
|
-
headers.set('X-Databricks-
|
|
1016
|
+
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
913
1017
|
}
|
|
914
1018
|
headers.set('User-Agent', this.userAgent);
|
|
915
1019
|
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
@@ -956,7 +1060,7 @@ export class PostgresClient {
|
|
|
956
1060
|
const call = async (callSignal) => {
|
|
957
1061
|
const headers = new Headers();
|
|
958
1062
|
if (workspaceId !== undefined) {
|
|
959
|
-
headers.set('X-Databricks-
|
|
1063
|
+
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
960
1064
|
}
|
|
961
1065
|
headers.set('User-Agent', this.userAgent);
|
|
962
1066
|
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
@@ -987,7 +1091,7 @@ export class PostgresClient {
|
|
|
987
1091
|
}
|
|
988
1092
|
}
|
|
989
1093
|
/** Undeletes the specified database branch. */
|
|
990
|
-
async
|
|
1094
|
+
async undeleteBranchBase(req, options) {
|
|
991
1095
|
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
992
1096
|
const url = `${host}/api/2.0/postgres/${req.name ?? ''}/undelete`;
|
|
993
1097
|
const body = marshalRequest(req, marshalUndeleteBranchRequestSchema);
|
|
@@ -995,7 +1099,7 @@ export class PostgresClient {
|
|
|
995
1099
|
const call = async (callSignal) => {
|
|
996
1100
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
997
1101
|
if (workspaceId !== undefined) {
|
|
998
|
-
headers.set('X-Databricks-
|
|
1102
|
+
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
999
1103
|
}
|
|
1000
1104
|
headers.set('User-Agent', this.userAgent);
|
|
1001
1105
|
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
@@ -1012,12 +1116,13 @@ export class PostgresClient {
|
|
|
1012
1116
|
}
|
|
1013
1117
|
return resp;
|
|
1014
1118
|
}
|
|
1015
|
-
|
|
1016
|
-
|
|
1119
|
+
/** Undeletes the specified database branch. */
|
|
1120
|
+
async undeleteBranch(req, options) {
|
|
1121
|
+
const op = await this.undeleteBranchBase(req, options);
|
|
1017
1122
|
return new UndeleteBranchOperation(op, (req, options) => this.getOperation(req, options));
|
|
1018
1123
|
}
|
|
1019
1124
|
/** Undeletes a soft-deleted project. */
|
|
1020
|
-
async
|
|
1125
|
+
async undeleteProjectBase(req, options) {
|
|
1021
1126
|
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
1022
1127
|
const url = `${host}/api/2.0/postgres/${req.name ?? ''}/undelete`;
|
|
1023
1128
|
const body = marshalRequest(req, marshalUndeleteProjectRequestSchema);
|
|
@@ -1025,7 +1130,7 @@ export class PostgresClient {
|
|
|
1025
1130
|
const call = async (callSignal) => {
|
|
1026
1131
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
1027
1132
|
if (workspaceId !== undefined) {
|
|
1028
|
-
headers.set('X-Databricks-
|
|
1133
|
+
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
1029
1134
|
}
|
|
1030
1135
|
headers.set('User-Agent', this.userAgent);
|
|
1031
1136
|
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
@@ -1042,12 +1147,13 @@ export class PostgresClient {
|
|
|
1042
1147
|
}
|
|
1043
1148
|
return resp;
|
|
1044
1149
|
}
|
|
1045
|
-
|
|
1046
|
-
|
|
1150
|
+
/** Undeletes a soft-deleted project. */
|
|
1151
|
+
async undeleteProject(req, options) {
|
|
1152
|
+
const op = await this.undeleteProjectBase(req, options);
|
|
1047
1153
|
return new UndeleteProjectOperation(op, (req, options) => this.getOperation(req, options));
|
|
1048
1154
|
}
|
|
1049
1155
|
/** Updates the specified database branch. You can set this branch as the project's default branch, or protect/unprotect it. */
|
|
1050
|
-
async
|
|
1156
|
+
async updateBranchBase(req, options) {
|
|
1051
1157
|
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
1052
1158
|
const url = `${host}/api/2.0/postgres/${req.branch?.name ?? ''}`;
|
|
1053
1159
|
const params = new URLSearchParams();
|
|
@@ -1061,7 +1167,7 @@ export class PostgresClient {
|
|
|
1061
1167
|
const call = async (callSignal) => {
|
|
1062
1168
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
1063
1169
|
if (workspaceId !== undefined) {
|
|
1064
|
-
headers.set('X-Databricks-
|
|
1170
|
+
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
1065
1171
|
}
|
|
1066
1172
|
headers.set('User-Agent', this.userAgent);
|
|
1067
1173
|
const httpReq = buildHttpRequest('PATCH', fullUrl, headers, callSignal, body);
|
|
@@ -1078,12 +1184,50 @@ export class PostgresClient {
|
|
|
1078
1184
|
}
|
|
1079
1185
|
return resp;
|
|
1080
1186
|
}
|
|
1081
|
-
|
|
1082
|
-
|
|
1187
|
+
/** Updates the specified database branch. You can set this branch as the project's default branch, or protect/unprotect it. */
|
|
1188
|
+
async updateBranch(req, options) {
|
|
1189
|
+
const op = await this.updateBranchBase(req, options);
|
|
1083
1190
|
return new UpdateBranchOperation(op, (req, options) => this.getOperation(req, options));
|
|
1084
1191
|
}
|
|
1192
|
+
/** Update Data API configuration for a database. */
|
|
1193
|
+
async updateDataApiBase(req, options) {
|
|
1194
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
1195
|
+
const url = `${host}/api/2.0/postgres/${req.dataApi?.name ?? ''}`;
|
|
1196
|
+
const params = new URLSearchParams();
|
|
1197
|
+
if (req.updateMask !== undefined) {
|
|
1198
|
+
params.append('update_mask', req.updateMask.toString());
|
|
1199
|
+
}
|
|
1200
|
+
const query = params.toString();
|
|
1201
|
+
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
1202
|
+
const body = marshalRequest(req.dataApi, marshalDataApiSchema);
|
|
1203
|
+
let resp;
|
|
1204
|
+
const call = async (callSignal) => {
|
|
1205
|
+
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
1206
|
+
if (workspaceId !== undefined) {
|
|
1207
|
+
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
1208
|
+
}
|
|
1209
|
+
headers.set('User-Agent', this.userAgent);
|
|
1210
|
+
const httpReq = buildHttpRequest('PATCH', fullUrl, headers, callSignal, body);
|
|
1211
|
+
const respBody = await executeHttpCall({
|
|
1212
|
+
request: httpReq,
|
|
1213
|
+
httpClient,
|
|
1214
|
+
logger: this.logger,
|
|
1215
|
+
});
|
|
1216
|
+
resp = parseResponse(respBody, unmarshalOperationSchema);
|
|
1217
|
+
};
|
|
1218
|
+
await executeCall(call, options);
|
|
1219
|
+
if (resp === undefined) {
|
|
1220
|
+
throw new Error('operation completed without a result.');
|
|
1221
|
+
}
|
|
1222
|
+
return resp;
|
|
1223
|
+
}
|
|
1224
|
+
/** Update Data API configuration for a database. */
|
|
1225
|
+
async updateDataApi(req, options) {
|
|
1226
|
+
const op = await this.updateDataApiBase(req, options);
|
|
1227
|
+
return new UpdateDataApiOperation(op, (req, options) => this.getOperation(req, options));
|
|
1228
|
+
}
|
|
1085
1229
|
/** Update a Database. */
|
|
1086
|
-
async
|
|
1230
|
+
async updateDatabaseBase(req, options) {
|
|
1087
1231
|
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
1088
1232
|
const url = `${host}/api/2.0/postgres/${req.database?.name ?? ''}`;
|
|
1089
1233
|
const params = new URLSearchParams();
|
|
@@ -1097,7 +1241,7 @@ export class PostgresClient {
|
|
|
1097
1241
|
const call = async (callSignal) => {
|
|
1098
1242
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
1099
1243
|
if (workspaceId !== undefined) {
|
|
1100
|
-
headers.set('X-Databricks-
|
|
1244
|
+
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
1101
1245
|
}
|
|
1102
1246
|
headers.set('User-Agent', this.userAgent);
|
|
1103
1247
|
const httpReq = buildHttpRequest('PATCH', fullUrl, headers, callSignal, body);
|
|
@@ -1114,12 +1258,13 @@ export class PostgresClient {
|
|
|
1114
1258
|
}
|
|
1115
1259
|
return resp;
|
|
1116
1260
|
}
|
|
1117
|
-
|
|
1118
|
-
|
|
1261
|
+
/** Update a Database. */
|
|
1262
|
+
async updateDatabase(req, options) {
|
|
1263
|
+
const op = await this.updateDatabaseBase(req, options);
|
|
1119
1264
|
return new UpdateDatabaseOperation(op, (req, options) => this.getOperation(req, options));
|
|
1120
1265
|
}
|
|
1121
1266
|
/** Updates the specified compute endpoint. You can update autoscaling limits, suspend timeout, or enable/disable the compute endpoint. */
|
|
1122
|
-
async
|
|
1267
|
+
async updateEndpointBase(req, options) {
|
|
1123
1268
|
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
1124
1269
|
const url = `${host}/api/2.0/postgres/${req.endpoint?.name ?? ''}`;
|
|
1125
1270
|
const params = new URLSearchParams();
|
|
@@ -1133,7 +1278,7 @@ export class PostgresClient {
|
|
|
1133
1278
|
const call = async (callSignal) => {
|
|
1134
1279
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
1135
1280
|
if (workspaceId !== undefined) {
|
|
1136
|
-
headers.set('X-Databricks-
|
|
1281
|
+
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
1137
1282
|
}
|
|
1138
1283
|
headers.set('User-Agent', this.userAgent);
|
|
1139
1284
|
const httpReq = buildHttpRequest('PATCH', fullUrl, headers, callSignal, body);
|
|
@@ -1150,12 +1295,13 @@ export class PostgresClient {
|
|
|
1150
1295
|
}
|
|
1151
1296
|
return resp;
|
|
1152
1297
|
}
|
|
1153
|
-
|
|
1154
|
-
|
|
1298
|
+
/** Updates the specified compute endpoint. You can update autoscaling limits, suspend timeout, or enable/disable the compute endpoint. */
|
|
1299
|
+
async updateEndpoint(req, options) {
|
|
1300
|
+
const op = await this.updateEndpointBase(req, options);
|
|
1155
1301
|
return new UpdateEndpointOperation(op, (req, options) => this.getOperation(req, options));
|
|
1156
1302
|
}
|
|
1157
1303
|
/** Updates the specified database project. */
|
|
1158
|
-
async
|
|
1304
|
+
async updateProjectBase(req, options) {
|
|
1159
1305
|
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
1160
1306
|
const url = `${host}/api/2.0/postgres/${req.project?.name ?? ''}`;
|
|
1161
1307
|
const params = new URLSearchParams();
|
|
@@ -1169,7 +1315,7 @@ export class PostgresClient {
|
|
|
1169
1315
|
const call = async (callSignal) => {
|
|
1170
1316
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
1171
1317
|
if (workspaceId !== undefined) {
|
|
1172
|
-
headers.set('X-Databricks-
|
|
1318
|
+
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
1173
1319
|
}
|
|
1174
1320
|
headers.set('User-Agent', this.userAgent);
|
|
1175
1321
|
const httpReq = buildHttpRequest('PATCH', fullUrl, headers, callSignal, body);
|
|
@@ -1186,12 +1332,13 @@ export class PostgresClient {
|
|
|
1186
1332
|
}
|
|
1187
1333
|
return resp;
|
|
1188
1334
|
}
|
|
1189
|
-
|
|
1190
|
-
|
|
1335
|
+
/** Updates the specified database project. */
|
|
1336
|
+
async updateProject(req, options) {
|
|
1337
|
+
const op = await this.updateProjectBase(req, options);
|
|
1191
1338
|
return new UpdateProjectOperation(op, (req, options) => this.getOperation(req, options));
|
|
1192
1339
|
}
|
|
1193
1340
|
/** Update a role for a branch. */
|
|
1194
|
-
async
|
|
1341
|
+
async updateRoleBase(req, options) {
|
|
1195
1342
|
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
1196
1343
|
const url = `${host}/api/2.0/postgres/${req.role?.name ?? ''}`;
|
|
1197
1344
|
const params = new URLSearchParams();
|
|
@@ -1205,7 +1352,7 @@ export class PostgresClient {
|
|
|
1205
1352
|
const call = async (callSignal) => {
|
|
1206
1353
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
1207
1354
|
if (workspaceId !== undefined) {
|
|
1208
|
-
headers.set('X-Databricks-
|
|
1355
|
+
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
1209
1356
|
}
|
|
1210
1357
|
headers.set('User-Agent', this.userAgent);
|
|
1211
1358
|
const httpReq = buildHttpRequest('PATCH', fullUrl, headers, callSignal, body);
|
|
@@ -1222,8 +1369,9 @@ export class PostgresClient {
|
|
|
1222
1369
|
}
|
|
1223
1370
|
return resp;
|
|
1224
1371
|
}
|
|
1225
|
-
|
|
1226
|
-
|
|
1372
|
+
/** Update a role for a branch. */
|
|
1373
|
+
async updateRole(req, options) {
|
|
1374
|
+
const op = await this.updateRoleBase(req, options);
|
|
1227
1375
|
return new UpdateRoleOperation(op, (req, options) => this.getOperation(req, options));
|
|
1228
1376
|
}
|
|
1229
1377
|
}
|
|
@@ -1359,6 +1507,72 @@ export class CreateCatalogOperation {
|
|
|
1359
1507
|
return op.done;
|
|
1360
1508
|
}
|
|
1361
1509
|
}
|
|
1510
|
+
export class CreateDataApiOperation {
|
|
1511
|
+
operation;
|
|
1512
|
+
getOperation;
|
|
1513
|
+
constructor(operation, getOperation) {
|
|
1514
|
+
this.operation = operation;
|
|
1515
|
+
this.getOperation = getOperation;
|
|
1516
|
+
}
|
|
1517
|
+
/** Returns the server-assigned name of the long-running operation. */
|
|
1518
|
+
name() {
|
|
1519
|
+
return Promise.resolve(this.operation.name);
|
|
1520
|
+
}
|
|
1521
|
+
/** Returns metadata associated with the long-running operation. */
|
|
1522
|
+
metadata() {
|
|
1523
|
+
if (this.operation.metadata === undefined) {
|
|
1524
|
+
return Promise.resolve(undefined);
|
|
1525
|
+
}
|
|
1526
|
+
return Promise.resolve(z
|
|
1527
|
+
.lazy(() => unmarshalDataApiOperationMetadataSchema)
|
|
1528
|
+
.parse(this.operation.metadata));
|
|
1529
|
+
}
|
|
1530
|
+
/**
|
|
1531
|
+
* Polls the operation until it completes.
|
|
1532
|
+
*
|
|
1533
|
+
* Throws if the operation failed.
|
|
1534
|
+
*/
|
|
1535
|
+
async wait(options) {
|
|
1536
|
+
let result;
|
|
1537
|
+
const call = async (callSignal) => {
|
|
1538
|
+
const op = await this.getOperation({
|
|
1539
|
+
name: this.operation.name,
|
|
1540
|
+
}, callSignal !== undefined ? { signal: callSignal } : undefined);
|
|
1541
|
+
this.operation = op;
|
|
1542
|
+
if (op.done === undefined) {
|
|
1543
|
+
throw new Error('operation is missing the done field');
|
|
1544
|
+
}
|
|
1545
|
+
if (!op.done) {
|
|
1546
|
+
throw new StillRunningError();
|
|
1547
|
+
}
|
|
1548
|
+
if (op.result?.$case === 'error') {
|
|
1549
|
+
const err = op.result.error;
|
|
1550
|
+
const msg = err.message !== undefined && err.message !== ''
|
|
1551
|
+
? err.message
|
|
1552
|
+
: 'unknown error';
|
|
1553
|
+
const errorMsg = err.errorCode !== undefined ? `[${err.errorCode}] ${msg}` : msg;
|
|
1554
|
+
throw new Error(`operation failed: ${errorMsg}`, {
|
|
1555
|
+
cause: err,
|
|
1556
|
+
});
|
|
1557
|
+
}
|
|
1558
|
+
if (op.result?.$case !== 'response') {
|
|
1559
|
+
throw new Error('operation completed without a response');
|
|
1560
|
+
}
|
|
1561
|
+
result = z.lazy(() => unmarshalDataApiSchema).parse(op.result.response);
|
|
1562
|
+
};
|
|
1563
|
+
await executeWait(call, options);
|
|
1564
|
+
if (result === undefined) {
|
|
1565
|
+
throw new Error('operation completed without a result.');
|
|
1566
|
+
}
|
|
1567
|
+
return result;
|
|
1568
|
+
}
|
|
1569
|
+
/** Checks whether the operation has completed */
|
|
1570
|
+
async done(options) {
|
|
1571
|
+
const op = await this.getOperation({ name: this.operation.name }, options);
|
|
1572
|
+
this.operation = op;
|
|
1573
|
+
return op.done;
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1362
1576
|
export class CreateDatabaseOperation {
|
|
1363
1577
|
operation;
|
|
1364
1578
|
getOperation;
|
|
@@ -1805,6 +2019,63 @@ export class DeleteCatalogOperation {
|
|
|
1805
2019
|
return op.done;
|
|
1806
2020
|
}
|
|
1807
2021
|
}
|
|
2022
|
+
export class DeleteDataApiOperation {
|
|
2023
|
+
operation;
|
|
2024
|
+
getOperation;
|
|
2025
|
+
constructor(operation, getOperation) {
|
|
2026
|
+
this.operation = operation;
|
|
2027
|
+
this.getOperation = getOperation;
|
|
2028
|
+
}
|
|
2029
|
+
/** Returns the server-assigned name of the long-running operation. */
|
|
2030
|
+
name() {
|
|
2031
|
+
return Promise.resolve(this.operation.name);
|
|
2032
|
+
}
|
|
2033
|
+
/** Returns metadata associated with the long-running operation. */
|
|
2034
|
+
metadata() {
|
|
2035
|
+
if (this.operation.metadata === undefined) {
|
|
2036
|
+
return Promise.resolve(undefined);
|
|
2037
|
+
}
|
|
2038
|
+
return Promise.resolve(z
|
|
2039
|
+
.lazy(() => unmarshalDataApiOperationMetadataSchema)
|
|
2040
|
+
.parse(this.operation.metadata));
|
|
2041
|
+
}
|
|
2042
|
+
/**
|
|
2043
|
+
* Polls the operation until it completes.
|
|
2044
|
+
*
|
|
2045
|
+
* Throws if the operation failed.
|
|
2046
|
+
*/
|
|
2047
|
+
async wait(options) {
|
|
2048
|
+
const call = async (callSignal) => {
|
|
2049
|
+
const op = await this.getOperation({
|
|
2050
|
+
name: this.operation.name,
|
|
2051
|
+
}, callSignal !== undefined ? { signal: callSignal } : undefined);
|
|
2052
|
+
this.operation = op;
|
|
2053
|
+
if (op.done === undefined) {
|
|
2054
|
+
throw new Error('operation is missing the done field');
|
|
2055
|
+
}
|
|
2056
|
+
if (!op.done) {
|
|
2057
|
+
throw new StillRunningError();
|
|
2058
|
+
}
|
|
2059
|
+
if (op.result?.$case === 'error') {
|
|
2060
|
+
const err = op.result.error;
|
|
2061
|
+
const msg = err.message !== undefined && err.message !== ''
|
|
2062
|
+
? err.message
|
|
2063
|
+
: 'unknown error';
|
|
2064
|
+
const errorMsg = err.errorCode !== undefined ? `[${err.errorCode}] ${msg}` : msg;
|
|
2065
|
+
throw new Error(`operation failed: ${errorMsg}`, {
|
|
2066
|
+
cause: err,
|
|
2067
|
+
});
|
|
2068
|
+
}
|
|
2069
|
+
};
|
|
2070
|
+
await executeWait(call, options);
|
|
2071
|
+
}
|
|
2072
|
+
/** Checks whether the operation has completed */
|
|
2073
|
+
async done(options) {
|
|
2074
|
+
const op = await this.getOperation({ name: this.operation.name }, options);
|
|
2075
|
+
this.operation = op;
|
|
2076
|
+
return op.done;
|
|
2077
|
+
}
|
|
2078
|
+
}
|
|
1808
2079
|
export class DeleteDatabaseOperation {
|
|
1809
2080
|
operation;
|
|
1810
2081
|
getOperation;
|
|
@@ -2270,6 +2541,72 @@ export class UpdateBranchOperation {
|
|
|
2270
2541
|
return op.done;
|
|
2271
2542
|
}
|
|
2272
2543
|
}
|
|
2544
|
+
export class UpdateDataApiOperation {
|
|
2545
|
+
operation;
|
|
2546
|
+
getOperation;
|
|
2547
|
+
constructor(operation, getOperation) {
|
|
2548
|
+
this.operation = operation;
|
|
2549
|
+
this.getOperation = getOperation;
|
|
2550
|
+
}
|
|
2551
|
+
/** Returns the server-assigned name of the long-running operation. */
|
|
2552
|
+
name() {
|
|
2553
|
+
return Promise.resolve(this.operation.name);
|
|
2554
|
+
}
|
|
2555
|
+
/** Returns metadata associated with the long-running operation. */
|
|
2556
|
+
metadata() {
|
|
2557
|
+
if (this.operation.metadata === undefined) {
|
|
2558
|
+
return Promise.resolve(undefined);
|
|
2559
|
+
}
|
|
2560
|
+
return Promise.resolve(z
|
|
2561
|
+
.lazy(() => unmarshalDataApiOperationMetadataSchema)
|
|
2562
|
+
.parse(this.operation.metadata));
|
|
2563
|
+
}
|
|
2564
|
+
/**
|
|
2565
|
+
* Polls the operation until it completes.
|
|
2566
|
+
*
|
|
2567
|
+
* Throws if the operation failed.
|
|
2568
|
+
*/
|
|
2569
|
+
async wait(options) {
|
|
2570
|
+
let result;
|
|
2571
|
+
const call = async (callSignal) => {
|
|
2572
|
+
const op = await this.getOperation({
|
|
2573
|
+
name: this.operation.name,
|
|
2574
|
+
}, callSignal !== undefined ? { signal: callSignal } : undefined);
|
|
2575
|
+
this.operation = op;
|
|
2576
|
+
if (op.done === undefined) {
|
|
2577
|
+
throw new Error('operation is missing the done field');
|
|
2578
|
+
}
|
|
2579
|
+
if (!op.done) {
|
|
2580
|
+
throw new StillRunningError();
|
|
2581
|
+
}
|
|
2582
|
+
if (op.result?.$case === 'error') {
|
|
2583
|
+
const err = op.result.error;
|
|
2584
|
+
const msg = err.message !== undefined && err.message !== ''
|
|
2585
|
+
? err.message
|
|
2586
|
+
: 'unknown error';
|
|
2587
|
+
const errorMsg = err.errorCode !== undefined ? `[${err.errorCode}] ${msg}` : msg;
|
|
2588
|
+
throw new Error(`operation failed: ${errorMsg}`, {
|
|
2589
|
+
cause: err,
|
|
2590
|
+
});
|
|
2591
|
+
}
|
|
2592
|
+
if (op.result?.$case !== 'response') {
|
|
2593
|
+
throw new Error('operation completed without a response');
|
|
2594
|
+
}
|
|
2595
|
+
result = z.lazy(() => unmarshalDataApiSchema).parse(op.result.response);
|
|
2596
|
+
};
|
|
2597
|
+
await executeWait(call, options);
|
|
2598
|
+
if (result === undefined) {
|
|
2599
|
+
throw new Error('operation completed without a result.');
|
|
2600
|
+
}
|
|
2601
|
+
return result;
|
|
2602
|
+
}
|
|
2603
|
+
/** Checks whether the operation has completed */
|
|
2604
|
+
async done(options) {
|
|
2605
|
+
const op = await this.getOperation({ name: this.operation.name }, options);
|
|
2606
|
+
this.operation = op;
|
|
2607
|
+
return op.done;
|
|
2608
|
+
}
|
|
2609
|
+
}
|
|
2273
2610
|
export class UpdateDatabaseOperation {
|
|
2274
2611
|
operation;
|
|
2275
2612
|
getOperation;
|