@databricks/sdk-postgres 0.1.0-dev.5 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/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 { newHttpClient } from './transport';
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
- host;
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
- if (options.host === undefined) {
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
- this.httpClient = newHttpClient(options);
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
- async createBranch(req, options) {
43
- const url = `${this.host}/api/2.0/postgres/${req.parent ?? ''}/branches`;
40
+ async createBranchBase(req, options) {
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 (this.workspaceId !== undefined) {
58
- headers.set('X-Databricks-Org-Id', this.workspaceId);
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: this.httpClient,
63
+ httpClient,
65
64
  logger: this.logger,
66
65
  });
67
66
  resp = parseResponse(respBody, unmarshalOperationSchema);
@@ -72,13 +71,15 @@ export class PostgresClient {
72
71
  }
73
72
  return resp;
74
73
  }
75
- async createBranchOperation(req, options) {
76
- const op = await this.createBranch(req, options);
74
+ /** Creates a new database branch in the project. */
75
+ async createBranch(req, options) {
76
+ const op = await this.createBranchBase(req, options);
77
77
  return new CreateBranchOperation(op, (req, options) => this.getOperation(req, options));
78
78
  }
79
79
  /** Register a Postgres database in the Unity Catalog. */
80
- async createCatalog(req, options) {
81
- const url = `${this.host}/api/2.0/postgres/catalogs`;
80
+ async createCatalogBase(req, options) {
81
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
82
+ const url = `${host}/api/2.0/postgres/catalogs`;
82
83
  const params = new URLSearchParams();
83
84
  if (req.catalogId !== undefined) {
84
85
  params.append('catalog_id', req.catalogId);
@@ -89,14 +90,14 @@ export class PostgresClient {
89
90
  let resp;
90
91
  const call = async (callSignal) => {
91
92
  const headers = new Headers({ 'Content-Type': 'application/json' });
92
- if (this.workspaceId !== undefined) {
93
- headers.set('X-Databricks-Org-Id', this.workspaceId);
93
+ if (workspaceId !== undefined) {
94
+ headers.set('X-Databricks-Org-Id', workspaceId);
94
95
  }
95
96
  headers.set('User-Agent', this.userAgent);
96
97
  const httpReq = buildHttpRequest('POST', fullUrl, headers, callSignal, body);
97
98
  const respBody = await executeHttpCall({
98
99
  request: httpReq,
99
- httpClient: this.httpClient,
100
+ httpClient,
100
101
  logger: this.logger,
101
102
  });
102
103
  resp = parseResponse(respBody, unmarshalOperationSchema);
@@ -107,8 +108,9 @@ export class PostgresClient {
107
108
  }
108
109
  return resp;
109
110
  }
110
- async createCatalogOperation(req, options) {
111
- const op = await this.createCatalog(req, options);
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
  }
114
116
  /**
@@ -116,8 +118,9 @@ export class PostgresClient {
116
118
  *
117
119
  * Creates a database in the specified branch. A branch can have multiple databases.
118
120
  */
119
- async createDatabase(req, options) {
120
- const url = `${this.host}/api/2.0/postgres/${req.parent ?? ''}/databases`;
121
+ async createDatabaseBase(req, options) {
122
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
123
+ const url = `${host}/api/2.0/postgres/${req.parent ?? ''}/databases`;
121
124
  const params = new URLSearchParams();
122
125
  if (req.databaseId !== undefined) {
123
126
  params.append('database_id', req.databaseId);
@@ -128,14 +131,14 @@ export class PostgresClient {
128
131
  let resp;
129
132
  const call = async (callSignal) => {
130
133
  const headers = new Headers({ 'Content-Type': 'application/json' });
131
- if (this.workspaceId !== undefined) {
132
- headers.set('X-Databricks-Org-Id', this.workspaceId);
134
+ if (workspaceId !== undefined) {
135
+ headers.set('X-Databricks-Org-Id', workspaceId);
133
136
  }
134
137
  headers.set('User-Agent', this.userAgent);
135
138
  const httpReq = buildHttpRequest('POST', fullUrl, headers, callSignal, body);
136
139
  const respBody = await executeHttpCall({
137
140
  request: httpReq,
138
- httpClient: this.httpClient,
141
+ httpClient,
139
142
  logger: this.logger,
140
143
  });
141
144
  resp = parseResponse(respBody, unmarshalOperationSchema);
@@ -146,13 +149,19 @@ export class PostgresClient {
146
149
  }
147
150
  return resp;
148
151
  }
149
- async createDatabaseOperation(req, options) {
150
- const op = await this.createDatabase(req, options);
152
+ /**
153
+ * Create a Database.
154
+ *
155
+ * Creates a database in the specified branch. A branch can have multiple databases.
156
+ */
157
+ async createDatabase(req, options) {
158
+ const op = await this.createDatabaseBase(req, options);
151
159
  return new CreateDatabaseOperation(op, (req, options) => this.getOperation(req, options));
152
160
  }
153
161
  /** Creates a new compute endpoint in the branch. */
154
- async createEndpoint(req, options) {
155
- const url = `${this.host}/api/2.0/postgres/${req.parent ?? ''}/endpoints`;
162
+ async createEndpointBase(req, options) {
163
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
164
+ const url = `${host}/api/2.0/postgres/${req.parent ?? ''}/endpoints`;
156
165
  const params = new URLSearchParams();
157
166
  if (req.endpointId !== undefined) {
158
167
  params.append('endpoint_id', req.endpointId);
@@ -166,14 +175,14 @@ export class PostgresClient {
166
175
  let resp;
167
176
  const call = async (callSignal) => {
168
177
  const headers = new Headers({ 'Content-Type': 'application/json' });
169
- if (this.workspaceId !== undefined) {
170
- headers.set('X-Databricks-Org-Id', this.workspaceId);
178
+ if (workspaceId !== undefined) {
179
+ headers.set('X-Databricks-Org-Id', workspaceId);
171
180
  }
172
181
  headers.set('User-Agent', this.userAgent);
173
182
  const httpReq = buildHttpRequest('POST', fullUrl, headers, callSignal, body);
174
183
  const respBody = await executeHttpCall({
175
184
  request: httpReq,
176
- httpClient: this.httpClient,
185
+ httpClient,
177
186
  logger: this.logger,
178
187
  });
179
188
  resp = parseResponse(respBody, unmarshalOperationSchema);
@@ -184,13 +193,15 @@ export class PostgresClient {
184
193
  }
185
194
  return resp;
186
195
  }
187
- async createEndpointOperation(req, options) {
188
- const op = await this.createEndpoint(req, options);
196
+ /** Creates a new compute endpoint in the branch. */
197
+ async createEndpoint(req, options) {
198
+ const op = await this.createEndpointBase(req, options);
189
199
  return new CreateEndpointOperation(op, (req, options) => this.getOperation(req, options));
190
200
  }
191
201
  /** Creates a new Lakebase Autoscaling Postgres database project, which contains branches and compute endpoints. */
192
- async createProject(req, options) {
193
- const url = `${this.host}/api/2.0/postgres/projects`;
202
+ async createProjectBase(req, options) {
203
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
204
+ const url = `${host}/api/2.0/postgres/projects`;
194
205
  const params = new URLSearchParams();
195
206
  if (req.projectId !== undefined) {
196
207
  params.append('project_id', req.projectId);
@@ -201,14 +212,14 @@ export class PostgresClient {
201
212
  let resp;
202
213
  const call = async (callSignal) => {
203
214
  const headers = new Headers({ 'Content-Type': 'application/json' });
204
- if (this.workspaceId !== undefined) {
205
- headers.set('X-Databricks-Org-Id', this.workspaceId);
215
+ if (workspaceId !== undefined) {
216
+ headers.set('X-Databricks-Org-Id', workspaceId);
206
217
  }
207
218
  headers.set('User-Agent', this.userAgent);
208
219
  const httpReq = buildHttpRequest('POST', fullUrl, headers, callSignal, body);
209
220
  const respBody = await executeHttpCall({
210
221
  request: httpReq,
211
- httpClient: this.httpClient,
222
+ httpClient,
212
223
  logger: this.logger,
213
224
  });
214
225
  resp = parseResponse(respBody, unmarshalOperationSchema);
@@ -219,13 +230,15 @@ export class PostgresClient {
219
230
  }
220
231
  return resp;
221
232
  }
222
- async createProjectOperation(req, options) {
223
- const op = await this.createProject(req, options);
233
+ /** Creates a new Lakebase Autoscaling Postgres database project, which contains branches and compute endpoints. */
234
+ async createProject(req, options) {
235
+ const op = await this.createProjectBase(req, options);
224
236
  return new CreateProjectOperation(op, (req, options) => this.getOperation(req, options));
225
237
  }
226
238
  /** Creates a new Postgres role in the branch. */
227
- async createRole(req, options) {
228
- const url = `${this.host}/api/2.0/postgres/${req.parent ?? ''}/roles`;
239
+ async createRoleBase(req, options) {
240
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
241
+ const url = `${host}/api/2.0/postgres/${req.parent ?? ''}/roles`;
229
242
  const params = new URLSearchParams();
230
243
  if (req.roleId !== undefined) {
231
244
  params.append('role_id', req.roleId);
@@ -236,14 +249,14 @@ export class PostgresClient {
236
249
  let resp;
237
250
  const call = async (callSignal) => {
238
251
  const headers = new Headers({ 'Content-Type': 'application/json' });
239
- if (this.workspaceId !== undefined) {
240
- headers.set('X-Databricks-Org-Id', this.workspaceId);
252
+ if (workspaceId !== undefined) {
253
+ headers.set('X-Databricks-Org-Id', workspaceId);
241
254
  }
242
255
  headers.set('User-Agent', this.userAgent);
243
256
  const httpReq = buildHttpRequest('POST', fullUrl, headers, callSignal, body);
244
257
  const respBody = await executeHttpCall({
245
258
  request: httpReq,
246
- httpClient: this.httpClient,
259
+ httpClient,
247
260
  logger: this.logger,
248
261
  });
249
262
  resp = parseResponse(respBody, unmarshalOperationSchema);
@@ -254,13 +267,15 @@ export class PostgresClient {
254
267
  }
255
268
  return resp;
256
269
  }
257
- async createRoleOperation(req, options) {
258
- const op = await this.createRole(req, options);
270
+ /** Creates a new Postgres role in the branch. */
271
+ async createRole(req, options) {
272
+ const op = await this.createRoleBase(req, options);
259
273
  return new CreateRoleOperation(op, (req, options) => this.getOperation(req, options));
260
274
  }
261
275
  /** Create a Synced Table. */
262
- async createSyncedTable(req, options) {
263
- const url = `${this.host}/api/2.0/postgres/synced_tables`;
276
+ async createSyncedTableBase(req, options) {
277
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
278
+ const url = `${host}/api/2.0/postgres/synced_tables`;
264
279
  const params = new URLSearchParams();
265
280
  if (req.syncedTableId !== undefined) {
266
281
  params.append('synced_table_id', req.syncedTableId);
@@ -271,14 +286,14 @@ export class PostgresClient {
271
286
  let resp;
272
287
  const call = async (callSignal) => {
273
288
  const headers = new Headers({ 'Content-Type': 'application/json' });
274
- if (this.workspaceId !== undefined) {
275
- headers.set('X-Databricks-Org-Id', this.workspaceId);
289
+ if (workspaceId !== undefined) {
290
+ headers.set('X-Databricks-Org-Id', workspaceId);
276
291
  }
277
292
  headers.set('User-Agent', this.userAgent);
278
293
  const httpReq = buildHttpRequest('POST', fullUrl, headers, callSignal, body);
279
294
  const respBody = await executeHttpCall({
280
295
  request: httpReq,
281
- httpClient: this.httpClient,
296
+ httpClient,
282
297
  logger: this.logger,
283
298
  });
284
299
  resp = parseResponse(respBody, unmarshalOperationSchema);
@@ -289,13 +304,15 @@ export class PostgresClient {
289
304
  }
290
305
  return resp;
291
306
  }
292
- async createSyncedTableOperation(req, options) {
293
- const op = await this.createSyncedTable(req, options);
307
+ /** Create a Synced Table. */
308
+ async createSyncedTable(req, options) {
309
+ const op = await this.createSyncedTableBase(req, options);
294
310
  return new CreateSyncedTableOperation(op, (req, options) => this.getOperation(req, options));
295
311
  }
296
312
  /** Deletes the specified database branch. */
297
- async deleteBranch(req, options) {
298
- const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}`;
313
+ async deleteBranchBase(req, options) {
314
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
315
+ const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
299
316
  const params = new URLSearchParams();
300
317
  if (req.purge !== undefined) {
301
318
  params.append('purge', String(req.purge));
@@ -305,14 +322,14 @@ export class PostgresClient {
305
322
  let resp;
306
323
  const call = async (callSignal) => {
307
324
  const headers = new Headers();
308
- if (this.workspaceId !== undefined) {
309
- headers.set('X-Databricks-Org-Id', this.workspaceId);
325
+ if (workspaceId !== undefined) {
326
+ headers.set('X-Databricks-Org-Id', workspaceId);
310
327
  }
311
328
  headers.set('User-Agent', this.userAgent);
312
329
  const httpReq = buildHttpRequest('DELETE', fullUrl, headers, callSignal);
313
330
  const respBody = await executeHttpCall({
314
331
  request: httpReq,
315
- httpClient: this.httpClient,
332
+ httpClient,
316
333
  logger: this.logger,
317
334
  });
318
335
  resp = parseResponse(respBody, unmarshalOperationSchema);
@@ -323,24 +340,26 @@ export class PostgresClient {
323
340
  }
324
341
  return resp;
325
342
  }
326
- async deleteBranchOperation(req, options) {
327
- const op = await this.deleteBranch(req, options);
343
+ /** Deletes the specified database branch. */
344
+ async deleteBranch(req, options) {
345
+ const op = await this.deleteBranchBase(req, options);
328
346
  return new DeleteBranchOperation(op, (req, options) => this.getOperation(req, options));
329
347
  }
330
348
  /** Delete a Database Catalog. */
331
- async deleteCatalog(req, options) {
332
- const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}`;
349
+ async deleteCatalogBase(req, options) {
350
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
351
+ const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
333
352
  let resp;
334
353
  const call = async (callSignal) => {
335
354
  const headers = new Headers();
336
- if (this.workspaceId !== undefined) {
337
- headers.set('X-Databricks-Org-Id', this.workspaceId);
355
+ if (workspaceId !== undefined) {
356
+ headers.set('X-Databricks-Org-Id', workspaceId);
338
357
  }
339
358
  headers.set('User-Agent', this.userAgent);
340
359
  const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
341
360
  const respBody = await executeHttpCall({
342
361
  request: httpReq,
343
- httpClient: this.httpClient,
362
+ httpClient,
344
363
  logger: this.logger,
345
364
  });
346
365
  resp = parseResponse(respBody, unmarshalOperationSchema);
@@ -351,24 +370,26 @@ export class PostgresClient {
351
370
  }
352
371
  return resp;
353
372
  }
354
- async deleteCatalogOperation(req, options) {
355
- const op = await this.deleteCatalog(req, options);
373
+ /** Delete a Database Catalog. */
374
+ async deleteCatalog(req, options) {
375
+ const op = await this.deleteCatalogBase(req, options);
356
376
  return new DeleteCatalogOperation(op, (req, options) => this.getOperation(req, options));
357
377
  }
358
378
  /** Delete a Database. */
359
- async deleteDatabase(req, options) {
360
- const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}`;
379
+ async deleteDatabaseBase(req, options) {
380
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
381
+ const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
361
382
  let resp;
362
383
  const call = async (callSignal) => {
363
384
  const headers = new Headers();
364
- if (this.workspaceId !== undefined) {
365
- headers.set('X-Databricks-Org-Id', this.workspaceId);
385
+ if (workspaceId !== undefined) {
386
+ headers.set('X-Databricks-Org-Id', workspaceId);
366
387
  }
367
388
  headers.set('User-Agent', this.userAgent);
368
389
  const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
369
390
  const respBody = await executeHttpCall({
370
391
  request: httpReq,
371
- httpClient: this.httpClient,
392
+ httpClient,
372
393
  logger: this.logger,
373
394
  });
374
395
  resp = parseResponse(respBody, unmarshalOperationSchema);
@@ -379,24 +400,26 @@ export class PostgresClient {
379
400
  }
380
401
  return resp;
381
402
  }
382
- async deleteDatabaseOperation(req, options) {
383
- const op = await this.deleteDatabase(req, options);
403
+ /** Delete a Database. */
404
+ async deleteDatabase(req, options) {
405
+ const op = await this.deleteDatabaseBase(req, options);
384
406
  return new DeleteDatabaseOperation(op, (req, options) => this.getOperation(req, options));
385
407
  }
386
408
  /** Deletes the specified compute endpoint. */
387
- async deleteEndpoint(req, options) {
388
- const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}`;
409
+ async deleteEndpointBase(req, options) {
410
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
411
+ const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
389
412
  let resp;
390
413
  const call = async (callSignal) => {
391
414
  const headers = new Headers();
392
- if (this.workspaceId !== undefined) {
393
- headers.set('X-Databricks-Org-Id', this.workspaceId);
415
+ if (workspaceId !== undefined) {
416
+ headers.set('X-Databricks-Org-Id', workspaceId);
394
417
  }
395
418
  headers.set('User-Agent', this.userAgent);
396
419
  const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
397
420
  const respBody = await executeHttpCall({
398
421
  request: httpReq,
399
- httpClient: this.httpClient,
422
+ httpClient,
400
423
  logger: this.logger,
401
424
  });
402
425
  resp = parseResponse(respBody, unmarshalOperationSchema);
@@ -407,13 +430,15 @@ export class PostgresClient {
407
430
  }
408
431
  return resp;
409
432
  }
410
- async deleteEndpointOperation(req, options) {
411
- const op = await this.deleteEndpoint(req, options);
433
+ /** Deletes the specified compute endpoint. */
434
+ async deleteEndpoint(req, options) {
435
+ const op = await this.deleteEndpointBase(req, options);
412
436
  return new DeleteEndpointOperation(op, (req, options) => this.getOperation(req, options));
413
437
  }
414
438
  /** Deletes the specified database project. */
415
- async deleteProject(req, options) {
416
- const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}`;
439
+ async deleteProjectBase(req, options) {
440
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
441
+ const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
417
442
  const params = new URLSearchParams();
418
443
  if (req.purge !== undefined) {
419
444
  params.append('purge', String(req.purge));
@@ -423,14 +448,14 @@ export class PostgresClient {
423
448
  let resp;
424
449
  const call = async (callSignal) => {
425
450
  const headers = new Headers();
426
- if (this.workspaceId !== undefined) {
427
- headers.set('X-Databricks-Org-Id', this.workspaceId);
451
+ if (workspaceId !== undefined) {
452
+ headers.set('X-Databricks-Org-Id', workspaceId);
428
453
  }
429
454
  headers.set('User-Agent', this.userAgent);
430
455
  const httpReq = buildHttpRequest('DELETE', fullUrl, headers, callSignal);
431
456
  const respBody = await executeHttpCall({
432
457
  request: httpReq,
433
- httpClient: this.httpClient,
458
+ httpClient,
434
459
  logger: this.logger,
435
460
  });
436
461
  resp = parseResponse(respBody, unmarshalOperationSchema);
@@ -441,13 +466,15 @@ export class PostgresClient {
441
466
  }
442
467
  return resp;
443
468
  }
444
- async deleteProjectOperation(req, options) {
445
- const op = await this.deleteProject(req, options);
469
+ /** Deletes the specified database project. */
470
+ async deleteProject(req, options) {
471
+ const op = await this.deleteProjectBase(req, options);
446
472
  return new DeleteProjectOperation(op, (req, options) => this.getOperation(req, options));
447
473
  }
448
474
  /** Deletes the specified Postgres role. */
449
- async deleteRole(req, options) {
450
- const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}`;
475
+ async deleteRoleBase(req, options) {
476
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
477
+ const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
451
478
  const params = new URLSearchParams();
452
479
  if (req.reassignOwnedTo !== undefined) {
453
480
  params.append('reassign_owned_to', req.reassignOwnedTo);
@@ -457,14 +484,14 @@ export class PostgresClient {
457
484
  let resp;
458
485
  const call = async (callSignal) => {
459
486
  const headers = new Headers();
460
- if (this.workspaceId !== undefined) {
461
- headers.set('X-Databricks-Org-Id', this.workspaceId);
487
+ if (workspaceId !== undefined) {
488
+ headers.set('X-Databricks-Org-Id', workspaceId);
462
489
  }
463
490
  headers.set('User-Agent', this.userAgent);
464
491
  const httpReq = buildHttpRequest('DELETE', fullUrl, headers, callSignal);
465
492
  const respBody = await executeHttpCall({
466
493
  request: httpReq,
467
- httpClient: this.httpClient,
494
+ httpClient,
468
495
  logger: this.logger,
469
496
  });
470
497
  resp = parseResponse(respBody, unmarshalOperationSchema);
@@ -475,24 +502,26 @@ export class PostgresClient {
475
502
  }
476
503
  return resp;
477
504
  }
478
- async deleteRoleOperation(req, options) {
479
- const op = await this.deleteRole(req, options);
505
+ /** Deletes the specified Postgres role. */
506
+ async deleteRole(req, options) {
507
+ const op = await this.deleteRoleBase(req, options);
480
508
  return new DeleteRoleOperation(op, (req, options) => this.getOperation(req, options));
481
509
  }
482
510
  /** Delete a Synced Table. */
483
- async deleteSyncedTable(req, options) {
484
- const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}`;
511
+ async deleteSyncedTableBase(req, options) {
512
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
513
+ const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
485
514
  let resp;
486
515
  const call = async (callSignal) => {
487
516
  const headers = new Headers();
488
- if (this.workspaceId !== undefined) {
489
- headers.set('X-Databricks-Org-Id', this.workspaceId);
517
+ if (workspaceId !== undefined) {
518
+ headers.set('X-Databricks-Org-Id', workspaceId);
490
519
  }
491
520
  headers.set('User-Agent', this.userAgent);
492
521
  const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
493
522
  const respBody = await executeHttpCall({
494
523
  request: httpReq,
495
- httpClient: this.httpClient,
524
+ httpClient,
496
525
  logger: this.logger,
497
526
  });
498
527
  resp = parseResponse(respBody, unmarshalOperationSchema);
@@ -503,25 +532,27 @@ export class PostgresClient {
503
532
  }
504
533
  return resp;
505
534
  }
506
- async deleteSyncedTableOperation(req, options) {
507
- const op = await this.deleteSyncedTable(req, options);
535
+ /** Delete a Synced Table. */
536
+ async deleteSyncedTable(req, options) {
537
+ const op = await this.deleteSyncedTableBase(req, options);
508
538
  return new DeleteSyncedTableOperation(op, (req, options) => this.getOperation(req, options));
509
539
  }
510
540
  /** Generate OAuth credentials for a Postgres database. */
511
541
  async generateDatabaseCredential(req, options) {
512
- const url = `${this.host}/api/2.0/postgres/credentials`;
542
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
543
+ const url = `${host}/api/2.0/postgres/credentials`;
513
544
  const body = marshalRequest(req, marshalGenerateDatabaseCredentialRequestSchema);
514
545
  let resp;
515
546
  const call = async (callSignal) => {
516
547
  const headers = new Headers({ 'Content-Type': 'application/json' });
517
- if (this.workspaceId !== undefined) {
518
- headers.set('X-Databricks-Org-Id', this.workspaceId);
548
+ if (workspaceId !== undefined) {
549
+ headers.set('X-Databricks-Org-Id', workspaceId);
519
550
  }
520
551
  headers.set('User-Agent', this.userAgent);
521
552
  const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
522
553
  const respBody = await executeHttpCall({
523
554
  request: httpReq,
524
- httpClient: this.httpClient,
555
+ httpClient,
525
556
  logger: this.logger,
526
557
  });
527
558
  resp = parseResponse(respBody, unmarshalDatabaseCredentialSchema);
@@ -534,18 +565,19 @@ export class PostgresClient {
534
565
  }
535
566
  /** Retrieves information about the specified database branch. */
536
567
  async getBranch(req, options) {
537
- const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}`;
568
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
569
+ const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
538
570
  let resp;
539
571
  const call = async (callSignal) => {
540
572
  const headers = new Headers();
541
- if (this.workspaceId !== undefined) {
542
- headers.set('X-Databricks-Org-Id', this.workspaceId);
573
+ if (workspaceId !== undefined) {
574
+ headers.set('X-Databricks-Org-Id', workspaceId);
543
575
  }
544
576
  headers.set('User-Agent', this.userAgent);
545
577
  const httpReq = buildHttpRequest('GET', url, headers, callSignal);
546
578
  const respBody = await executeHttpCall({
547
579
  request: httpReq,
548
- httpClient: this.httpClient,
580
+ httpClient,
549
581
  logger: this.logger,
550
582
  });
551
583
  resp = parseResponse(respBody, unmarshalBranchSchema);
@@ -558,18 +590,19 @@ export class PostgresClient {
558
590
  }
559
591
  /** Get a Database Catalog. */
560
592
  async getCatalog(req, options) {
561
- const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}`;
593
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
594
+ const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
562
595
  let resp;
563
596
  const call = async (callSignal) => {
564
597
  const headers = new Headers();
565
- if (this.workspaceId !== undefined) {
566
- headers.set('X-Databricks-Org-Id', this.workspaceId);
598
+ if (workspaceId !== undefined) {
599
+ headers.set('X-Databricks-Org-Id', workspaceId);
567
600
  }
568
601
  headers.set('User-Agent', this.userAgent);
569
602
  const httpReq = buildHttpRequest('GET', url, headers, callSignal);
570
603
  const respBody = await executeHttpCall({
571
604
  request: httpReq,
572
- httpClient: this.httpClient,
605
+ httpClient,
573
606
  logger: this.logger,
574
607
  });
575
608
  resp = parseResponse(respBody, unmarshalCatalogSchema);
@@ -582,18 +615,19 @@ export class PostgresClient {
582
615
  }
583
616
  /** Get a Database. */
584
617
  async getDatabase(req, options) {
585
- const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}`;
618
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
619
+ const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
586
620
  let resp;
587
621
  const call = async (callSignal) => {
588
622
  const headers = new Headers();
589
- if (this.workspaceId !== undefined) {
590
- headers.set('X-Databricks-Org-Id', this.workspaceId);
623
+ if (workspaceId !== undefined) {
624
+ headers.set('X-Databricks-Org-Id', workspaceId);
591
625
  }
592
626
  headers.set('User-Agent', this.userAgent);
593
627
  const httpReq = buildHttpRequest('GET', url, headers, callSignal);
594
628
  const respBody = await executeHttpCall({
595
629
  request: httpReq,
596
- httpClient: this.httpClient,
630
+ httpClient,
597
631
  logger: this.logger,
598
632
  });
599
633
  resp = parseResponse(respBody, unmarshalDatabaseSchema);
@@ -606,18 +640,19 @@ export class PostgresClient {
606
640
  }
607
641
  /** Retrieves information about the specified compute endpoint, including its connection details and operational state. */
608
642
  async getEndpoint(req, options) {
609
- const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}`;
643
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
644
+ const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
610
645
  let resp;
611
646
  const call = async (callSignal) => {
612
647
  const headers = new Headers();
613
- if (this.workspaceId !== undefined) {
614
- headers.set('X-Databricks-Org-Id', this.workspaceId);
648
+ if (workspaceId !== undefined) {
649
+ headers.set('X-Databricks-Org-Id', workspaceId);
615
650
  }
616
651
  headers.set('User-Agent', this.userAgent);
617
652
  const httpReq = buildHttpRequest('GET', url, headers, callSignal);
618
653
  const respBody = await executeHttpCall({
619
654
  request: httpReq,
620
- httpClient: this.httpClient,
655
+ httpClient,
621
656
  logger: this.logger,
622
657
  });
623
658
  resp = parseResponse(respBody, unmarshalEndpointSchema);
@@ -630,18 +665,19 @@ export class PostgresClient {
630
665
  }
631
666
  /** Retrieves the status of a long-running operation. */
632
667
  async getOperation(req, options) {
633
- const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}`;
668
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
669
+ const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
634
670
  let resp;
635
671
  const call = async (callSignal) => {
636
672
  const headers = new Headers();
637
- if (this.workspaceId !== undefined) {
638
- headers.set('X-Databricks-Org-Id', this.workspaceId);
673
+ if (workspaceId !== undefined) {
674
+ headers.set('X-Databricks-Org-Id', workspaceId);
639
675
  }
640
676
  headers.set('User-Agent', this.userAgent);
641
677
  const httpReq = buildHttpRequest('GET', url, headers, callSignal);
642
678
  const respBody = await executeHttpCall({
643
679
  request: httpReq,
644
- httpClient: this.httpClient,
680
+ httpClient,
645
681
  logger: this.logger,
646
682
  });
647
683
  resp = parseResponse(respBody, unmarshalOperationSchema);
@@ -654,18 +690,19 @@ export class PostgresClient {
654
690
  }
655
691
  /** Retrieves information about the specified database project. */
656
692
  async getProject(req, options) {
657
- const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}`;
693
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
694
+ const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
658
695
  let resp;
659
696
  const call = async (callSignal) => {
660
697
  const headers = new Headers();
661
- if (this.workspaceId !== undefined) {
662
- headers.set('X-Databricks-Org-Id', this.workspaceId);
698
+ if (workspaceId !== undefined) {
699
+ headers.set('X-Databricks-Org-Id', workspaceId);
663
700
  }
664
701
  headers.set('User-Agent', this.userAgent);
665
702
  const httpReq = buildHttpRequest('GET', url, headers, callSignal);
666
703
  const respBody = await executeHttpCall({
667
704
  request: httpReq,
668
- httpClient: this.httpClient,
705
+ httpClient,
669
706
  logger: this.logger,
670
707
  });
671
708
  resp = parseResponse(respBody, unmarshalProjectSchema);
@@ -678,18 +715,19 @@ export class PostgresClient {
678
715
  }
679
716
  /** Retrieves information about the specified Postgres role, including its authentication method and permissions. */
680
717
  async getRole(req, options) {
681
- const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}`;
718
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
719
+ const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
682
720
  let resp;
683
721
  const call = async (callSignal) => {
684
722
  const headers = new Headers();
685
- if (this.workspaceId !== undefined) {
686
- headers.set('X-Databricks-Org-Id', this.workspaceId);
723
+ if (workspaceId !== undefined) {
724
+ headers.set('X-Databricks-Org-Id', workspaceId);
687
725
  }
688
726
  headers.set('User-Agent', this.userAgent);
689
727
  const httpReq = buildHttpRequest('GET', url, headers, callSignal);
690
728
  const respBody = await executeHttpCall({
691
729
  request: httpReq,
692
- httpClient: this.httpClient,
730
+ httpClient,
693
731
  logger: this.logger,
694
732
  });
695
733
  resp = parseResponse(respBody, unmarshalRoleSchema);
@@ -702,18 +740,19 @@ export class PostgresClient {
702
740
  }
703
741
  /** Get a Synced Table. */
704
742
  async getSyncedTable(req, options) {
705
- const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}`;
743
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
744
+ const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
706
745
  let resp;
707
746
  const call = async (callSignal) => {
708
747
  const headers = new Headers();
709
- if (this.workspaceId !== undefined) {
710
- headers.set('X-Databricks-Org-Id', this.workspaceId);
748
+ if (workspaceId !== undefined) {
749
+ headers.set('X-Databricks-Org-Id', workspaceId);
711
750
  }
712
751
  headers.set('User-Agent', this.userAgent);
713
752
  const httpReq = buildHttpRequest('GET', url, headers, callSignal);
714
753
  const respBody = await executeHttpCall({
715
754
  request: httpReq,
716
- httpClient: this.httpClient,
755
+ httpClient,
717
756
  logger: this.logger,
718
757
  });
719
758
  resp = parseResponse(respBody, unmarshalSyncedTableSchema);
@@ -726,7 +765,8 @@ export class PostgresClient {
726
765
  }
727
766
  /** Returns a paginated list of database branches in the project. */
728
767
  async listBranches(req, options) {
729
- const url = `${this.host}/api/2.0/postgres/${req.parent ?? ''}/branches`;
768
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
769
+ const url = `${host}/api/2.0/postgres/${req.parent ?? ''}/branches`;
730
770
  const params = new URLSearchParams();
731
771
  if (req.pageToken !== undefined) {
732
772
  params.append('page_token', req.pageToken);
@@ -742,14 +782,14 @@ export class PostgresClient {
742
782
  let resp;
743
783
  const call = async (callSignal) => {
744
784
  const headers = new Headers();
745
- if (this.workspaceId !== undefined) {
746
- headers.set('X-Databricks-Org-Id', this.workspaceId);
785
+ if (workspaceId !== undefined) {
786
+ headers.set('X-Databricks-Org-Id', workspaceId);
747
787
  }
748
788
  headers.set('User-Agent', this.userAgent);
749
789
  const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
750
790
  const respBody = await executeHttpCall({
751
791
  request: httpReq,
752
- httpClient: this.httpClient,
792
+ httpClient,
753
793
  logger: this.logger,
754
794
  });
755
795
  resp = parseResponse(respBody, unmarshalListBranchesResponseSchema);
@@ -775,7 +815,8 @@ export class PostgresClient {
775
815
  }
776
816
  /** List Databases. */
777
817
  async listDatabases(req, options) {
778
- const url = `${this.host}/api/2.0/postgres/${req.parent ?? ''}/databases`;
818
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
819
+ const url = `${host}/api/2.0/postgres/${req.parent ?? ''}/databases`;
779
820
  const params = new URLSearchParams();
780
821
  if (req.pageToken !== undefined) {
781
822
  params.append('page_token', req.pageToken);
@@ -788,14 +829,14 @@ export class PostgresClient {
788
829
  let resp;
789
830
  const call = async (callSignal) => {
790
831
  const headers = new Headers();
791
- if (this.workspaceId !== undefined) {
792
- headers.set('X-Databricks-Org-Id', this.workspaceId);
832
+ if (workspaceId !== undefined) {
833
+ headers.set('X-Databricks-Org-Id', workspaceId);
793
834
  }
794
835
  headers.set('User-Agent', this.userAgent);
795
836
  const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
796
837
  const respBody = await executeHttpCall({
797
838
  request: httpReq,
798
- httpClient: this.httpClient,
839
+ httpClient,
799
840
  logger: this.logger,
800
841
  });
801
842
  resp = parseResponse(respBody, unmarshalListDatabasesResponseSchema);
@@ -821,7 +862,8 @@ export class PostgresClient {
821
862
  }
822
863
  /** Returns a paginated list of compute endpoints in the branch. */
823
864
  async listEndpoints(req, options) {
824
- const url = `${this.host}/api/2.0/postgres/${req.parent ?? ''}/endpoints`;
865
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
866
+ const url = `${host}/api/2.0/postgres/${req.parent ?? ''}/endpoints`;
825
867
  const params = new URLSearchParams();
826
868
  if (req.pageToken !== undefined) {
827
869
  params.append('page_token', req.pageToken);
@@ -834,14 +876,14 @@ export class PostgresClient {
834
876
  let resp;
835
877
  const call = async (callSignal) => {
836
878
  const headers = new Headers();
837
- if (this.workspaceId !== undefined) {
838
- headers.set('X-Databricks-Org-Id', this.workspaceId);
879
+ if (workspaceId !== undefined) {
880
+ headers.set('X-Databricks-Org-Id', workspaceId);
839
881
  }
840
882
  headers.set('User-Agent', this.userAgent);
841
883
  const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
842
884
  const respBody = await executeHttpCall({
843
885
  request: httpReq,
844
- httpClient: this.httpClient,
886
+ httpClient,
845
887
  logger: this.logger,
846
888
  });
847
889
  resp = parseResponse(respBody, unmarshalListEndpointsResponseSchema);
@@ -867,7 +909,8 @@ export class PostgresClient {
867
909
  }
868
910
  /** Returns a paginated list of database projects in the workspace that the user has permission to access. */
869
911
  async listProjects(req, options) {
870
- const url = `${this.host}/api/2.0/postgres/projects`;
912
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
913
+ const url = `${host}/api/2.0/postgres/projects`;
871
914
  const params = new URLSearchParams();
872
915
  if (req.pageToken !== undefined) {
873
916
  params.append('page_token', req.pageToken);
@@ -883,14 +926,14 @@ export class PostgresClient {
883
926
  let resp;
884
927
  const call = async (callSignal) => {
885
928
  const headers = new Headers();
886
- if (this.workspaceId !== undefined) {
887
- headers.set('X-Databricks-Org-Id', this.workspaceId);
929
+ if (workspaceId !== undefined) {
930
+ headers.set('X-Databricks-Org-Id', workspaceId);
888
931
  }
889
932
  headers.set('User-Agent', this.userAgent);
890
933
  const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
891
934
  const respBody = await executeHttpCall({
892
935
  request: httpReq,
893
- httpClient: this.httpClient,
936
+ httpClient,
894
937
  logger: this.logger,
895
938
  });
896
939
  resp = parseResponse(respBody, unmarshalListProjectsResponseSchema);
@@ -916,7 +959,8 @@ export class PostgresClient {
916
959
  }
917
960
  /** Returns a paginated list of Postgres roles in the branch. */
918
961
  async listRoles(req, options) {
919
- const url = `${this.host}/api/2.0/postgres/${req.parent ?? ''}/roles`;
962
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
963
+ const url = `${host}/api/2.0/postgres/${req.parent ?? ''}/roles`;
920
964
  const params = new URLSearchParams();
921
965
  if (req.pageToken !== undefined) {
922
966
  params.append('page_token', req.pageToken);
@@ -929,14 +973,14 @@ export class PostgresClient {
929
973
  let resp;
930
974
  const call = async (callSignal) => {
931
975
  const headers = new Headers();
932
- if (this.workspaceId !== undefined) {
933
- headers.set('X-Databricks-Org-Id', this.workspaceId);
976
+ if (workspaceId !== undefined) {
977
+ headers.set('X-Databricks-Org-Id', workspaceId);
934
978
  }
935
979
  headers.set('User-Agent', this.userAgent);
936
980
  const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
937
981
  const respBody = await executeHttpCall({
938
982
  request: httpReq,
939
- httpClient: this.httpClient,
983
+ httpClient,
940
984
  logger: this.logger,
941
985
  });
942
986
  resp = parseResponse(respBody, unmarshalListRolesResponseSchema);
@@ -961,20 +1005,21 @@ export class PostgresClient {
961
1005
  }
962
1006
  }
963
1007
  /** Undeletes the specified database branch. */
964
- async undeleteBranch(req, options) {
965
- const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}/undelete`;
1008
+ async undeleteBranchBase(req, options) {
1009
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
1010
+ const url = `${host}/api/2.0/postgres/${req.name ?? ''}/undelete`;
966
1011
  const body = marshalRequest(req, marshalUndeleteBranchRequestSchema);
967
1012
  let resp;
968
1013
  const call = async (callSignal) => {
969
1014
  const headers = new Headers({ 'Content-Type': 'application/json' });
970
- if (this.workspaceId !== undefined) {
971
- headers.set('X-Databricks-Org-Id', this.workspaceId);
1015
+ if (workspaceId !== undefined) {
1016
+ headers.set('X-Databricks-Org-Id', workspaceId);
972
1017
  }
973
1018
  headers.set('User-Agent', this.userAgent);
974
1019
  const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
975
1020
  const respBody = await executeHttpCall({
976
1021
  request: httpReq,
977
- httpClient: this.httpClient,
1022
+ httpClient,
978
1023
  logger: this.logger,
979
1024
  });
980
1025
  resp = parseResponse(respBody, unmarshalOperationSchema);
@@ -985,25 +1030,27 @@ export class PostgresClient {
985
1030
  }
986
1031
  return resp;
987
1032
  }
988
- async undeleteBranchOperation(req, options) {
989
- const op = await this.undeleteBranch(req, options);
1033
+ /** Undeletes the specified database branch. */
1034
+ async undeleteBranch(req, options) {
1035
+ const op = await this.undeleteBranchBase(req, options);
990
1036
  return new UndeleteBranchOperation(op, (req, options) => this.getOperation(req, options));
991
1037
  }
992
1038
  /** Undeletes a soft-deleted project. */
993
- async undeleteProject(req, options) {
994
- const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}/undelete`;
1039
+ async undeleteProjectBase(req, options) {
1040
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
1041
+ const url = `${host}/api/2.0/postgres/${req.name ?? ''}/undelete`;
995
1042
  const body = marshalRequest(req, marshalUndeleteProjectRequestSchema);
996
1043
  let resp;
997
1044
  const call = async (callSignal) => {
998
1045
  const headers = new Headers({ 'Content-Type': 'application/json' });
999
- if (this.workspaceId !== undefined) {
1000
- headers.set('X-Databricks-Org-Id', this.workspaceId);
1046
+ if (workspaceId !== undefined) {
1047
+ headers.set('X-Databricks-Org-Id', workspaceId);
1001
1048
  }
1002
1049
  headers.set('User-Agent', this.userAgent);
1003
1050
  const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
1004
1051
  const respBody = await executeHttpCall({
1005
1052
  request: httpReq,
1006
- httpClient: this.httpClient,
1053
+ httpClient,
1007
1054
  logger: this.logger,
1008
1055
  });
1009
1056
  resp = parseResponse(respBody, unmarshalOperationSchema);
@@ -1014,13 +1061,15 @@ export class PostgresClient {
1014
1061
  }
1015
1062
  return resp;
1016
1063
  }
1017
- async undeleteProjectOperation(req, options) {
1018
- const op = await this.undeleteProject(req, options);
1064
+ /** Undeletes a soft-deleted project. */
1065
+ async undeleteProject(req, options) {
1066
+ const op = await this.undeleteProjectBase(req, options);
1019
1067
  return new UndeleteProjectOperation(op, (req, options) => this.getOperation(req, options));
1020
1068
  }
1021
1069
  /** Updates the specified database branch. You can set this branch as the project's default branch, or protect/unprotect it. */
1022
- async updateBranch(req, options) {
1023
- const url = `${this.host}/api/2.0/postgres/${req.branch?.name ?? ''}`;
1070
+ async updateBranchBase(req, options) {
1071
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
1072
+ const url = `${host}/api/2.0/postgres/${req.branch?.name ?? ''}`;
1024
1073
  const params = new URLSearchParams();
1025
1074
  if (req.updateMask !== undefined) {
1026
1075
  params.append('update_mask', req.updateMask.toString());
@@ -1031,14 +1080,14 @@ export class PostgresClient {
1031
1080
  let resp;
1032
1081
  const call = async (callSignal) => {
1033
1082
  const headers = new Headers({ 'Content-Type': 'application/json' });
1034
- if (this.workspaceId !== undefined) {
1035
- headers.set('X-Databricks-Org-Id', this.workspaceId);
1083
+ if (workspaceId !== undefined) {
1084
+ headers.set('X-Databricks-Org-Id', workspaceId);
1036
1085
  }
1037
1086
  headers.set('User-Agent', this.userAgent);
1038
1087
  const httpReq = buildHttpRequest('PATCH', fullUrl, headers, callSignal, body);
1039
1088
  const respBody = await executeHttpCall({
1040
1089
  request: httpReq,
1041
- httpClient: this.httpClient,
1090
+ httpClient,
1042
1091
  logger: this.logger,
1043
1092
  });
1044
1093
  resp = parseResponse(respBody, unmarshalOperationSchema);
@@ -1049,13 +1098,15 @@ export class PostgresClient {
1049
1098
  }
1050
1099
  return resp;
1051
1100
  }
1052
- async updateBranchOperation(req, options) {
1053
- const op = await this.updateBranch(req, options);
1101
+ /** Updates the specified database branch. You can set this branch as the project's default branch, or protect/unprotect it. */
1102
+ async updateBranch(req, options) {
1103
+ const op = await this.updateBranchBase(req, options);
1054
1104
  return new UpdateBranchOperation(op, (req, options) => this.getOperation(req, options));
1055
1105
  }
1056
1106
  /** Update a Database. */
1057
- async updateDatabase(req, options) {
1058
- const url = `${this.host}/api/2.0/postgres/${req.database?.name ?? ''}`;
1107
+ async updateDatabaseBase(req, options) {
1108
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
1109
+ const url = `${host}/api/2.0/postgres/${req.database?.name ?? ''}`;
1059
1110
  const params = new URLSearchParams();
1060
1111
  if (req.updateMask !== undefined) {
1061
1112
  params.append('update_mask', req.updateMask.toString());
@@ -1066,14 +1117,14 @@ export class PostgresClient {
1066
1117
  let resp;
1067
1118
  const call = async (callSignal) => {
1068
1119
  const headers = new Headers({ 'Content-Type': 'application/json' });
1069
- if (this.workspaceId !== undefined) {
1070
- headers.set('X-Databricks-Org-Id', this.workspaceId);
1120
+ if (workspaceId !== undefined) {
1121
+ headers.set('X-Databricks-Org-Id', workspaceId);
1071
1122
  }
1072
1123
  headers.set('User-Agent', this.userAgent);
1073
1124
  const httpReq = buildHttpRequest('PATCH', fullUrl, headers, callSignal, body);
1074
1125
  const respBody = await executeHttpCall({
1075
1126
  request: httpReq,
1076
- httpClient: this.httpClient,
1127
+ httpClient,
1077
1128
  logger: this.logger,
1078
1129
  });
1079
1130
  resp = parseResponse(respBody, unmarshalOperationSchema);
@@ -1084,13 +1135,15 @@ export class PostgresClient {
1084
1135
  }
1085
1136
  return resp;
1086
1137
  }
1087
- async updateDatabaseOperation(req, options) {
1088
- const op = await this.updateDatabase(req, options);
1138
+ /** Update a Database. */
1139
+ async updateDatabase(req, options) {
1140
+ const op = await this.updateDatabaseBase(req, options);
1089
1141
  return new UpdateDatabaseOperation(op, (req, options) => this.getOperation(req, options));
1090
1142
  }
1091
1143
  /** Updates the specified compute endpoint. You can update autoscaling limits, suspend timeout, or enable/disable the compute endpoint. */
1092
- async updateEndpoint(req, options) {
1093
- const url = `${this.host}/api/2.0/postgres/${req.endpoint?.name ?? ''}`;
1144
+ async updateEndpointBase(req, options) {
1145
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
1146
+ const url = `${host}/api/2.0/postgres/${req.endpoint?.name ?? ''}`;
1094
1147
  const params = new URLSearchParams();
1095
1148
  if (req.updateMask !== undefined) {
1096
1149
  params.append('update_mask', req.updateMask.toString());
@@ -1101,14 +1154,14 @@ export class PostgresClient {
1101
1154
  let resp;
1102
1155
  const call = async (callSignal) => {
1103
1156
  const headers = new Headers({ 'Content-Type': 'application/json' });
1104
- if (this.workspaceId !== undefined) {
1105
- headers.set('X-Databricks-Org-Id', this.workspaceId);
1157
+ if (workspaceId !== undefined) {
1158
+ headers.set('X-Databricks-Org-Id', workspaceId);
1106
1159
  }
1107
1160
  headers.set('User-Agent', this.userAgent);
1108
1161
  const httpReq = buildHttpRequest('PATCH', fullUrl, headers, callSignal, body);
1109
1162
  const respBody = await executeHttpCall({
1110
1163
  request: httpReq,
1111
- httpClient: this.httpClient,
1164
+ httpClient,
1112
1165
  logger: this.logger,
1113
1166
  });
1114
1167
  resp = parseResponse(respBody, unmarshalOperationSchema);
@@ -1119,13 +1172,15 @@ export class PostgresClient {
1119
1172
  }
1120
1173
  return resp;
1121
1174
  }
1122
- async updateEndpointOperation(req, options) {
1123
- const op = await this.updateEndpoint(req, options);
1175
+ /** Updates the specified compute endpoint. You can update autoscaling limits, suspend timeout, or enable/disable the compute endpoint. */
1176
+ async updateEndpoint(req, options) {
1177
+ const op = await this.updateEndpointBase(req, options);
1124
1178
  return new UpdateEndpointOperation(op, (req, options) => this.getOperation(req, options));
1125
1179
  }
1126
1180
  /** Updates the specified database project. */
1127
- async updateProject(req, options) {
1128
- const url = `${this.host}/api/2.0/postgres/${req.project?.name ?? ''}`;
1181
+ async updateProjectBase(req, options) {
1182
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
1183
+ const url = `${host}/api/2.0/postgres/${req.project?.name ?? ''}`;
1129
1184
  const params = new URLSearchParams();
1130
1185
  if (req.updateMask !== undefined) {
1131
1186
  params.append('update_mask', req.updateMask.toString());
@@ -1136,14 +1191,14 @@ export class PostgresClient {
1136
1191
  let resp;
1137
1192
  const call = async (callSignal) => {
1138
1193
  const headers = new Headers({ 'Content-Type': 'application/json' });
1139
- if (this.workspaceId !== undefined) {
1140
- headers.set('X-Databricks-Org-Id', this.workspaceId);
1194
+ if (workspaceId !== undefined) {
1195
+ headers.set('X-Databricks-Org-Id', workspaceId);
1141
1196
  }
1142
1197
  headers.set('User-Agent', this.userAgent);
1143
1198
  const httpReq = buildHttpRequest('PATCH', fullUrl, headers, callSignal, body);
1144
1199
  const respBody = await executeHttpCall({
1145
1200
  request: httpReq,
1146
- httpClient: this.httpClient,
1201
+ httpClient,
1147
1202
  logger: this.logger,
1148
1203
  });
1149
1204
  resp = parseResponse(respBody, unmarshalOperationSchema);
@@ -1154,13 +1209,15 @@ export class PostgresClient {
1154
1209
  }
1155
1210
  return resp;
1156
1211
  }
1157
- async updateProjectOperation(req, options) {
1158
- const op = await this.updateProject(req, options);
1212
+ /** Updates the specified database project. */
1213
+ async updateProject(req, options) {
1214
+ const op = await this.updateProjectBase(req, options);
1159
1215
  return new UpdateProjectOperation(op, (req, options) => this.getOperation(req, options));
1160
1216
  }
1161
1217
  /** Update a role for a branch. */
1162
- async updateRole(req, options) {
1163
- const url = `${this.host}/api/2.0/postgres/${req.role?.name ?? ''}`;
1218
+ async updateRoleBase(req, options) {
1219
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
1220
+ const url = `${host}/api/2.0/postgres/${req.role?.name ?? ''}`;
1164
1221
  const params = new URLSearchParams();
1165
1222
  if (req.updateMask !== undefined) {
1166
1223
  params.append('update_mask', req.updateMask.toString());
@@ -1171,14 +1228,14 @@ export class PostgresClient {
1171
1228
  let resp;
1172
1229
  const call = async (callSignal) => {
1173
1230
  const headers = new Headers({ 'Content-Type': 'application/json' });
1174
- if (this.workspaceId !== undefined) {
1175
- headers.set('X-Databricks-Org-Id', this.workspaceId);
1231
+ if (workspaceId !== undefined) {
1232
+ headers.set('X-Databricks-Org-Id', workspaceId);
1176
1233
  }
1177
1234
  headers.set('User-Agent', this.userAgent);
1178
1235
  const httpReq = buildHttpRequest('PATCH', fullUrl, headers, callSignal, body);
1179
1236
  const respBody = await executeHttpCall({
1180
1237
  request: httpReq,
1181
- httpClient: this.httpClient,
1238
+ httpClient,
1182
1239
  logger: this.logger,
1183
1240
  });
1184
1241
  resp = parseResponse(respBody, unmarshalOperationSchema);
@@ -1189,8 +1246,9 @@ export class PostgresClient {
1189
1246
  }
1190
1247
  return resp;
1191
1248
  }
1192
- async updateRoleOperation(req, options) {
1193
- const op = await this.updateRole(req, options);
1249
+ /** Update a role for a branch. */
1250
+ async updateRole(req, options) {
1251
+ const op = await this.updateRoleBase(req, options);
1194
1252
  return new UpdateRoleOperation(op, (req, options) => this.getOperation(req, options));
1195
1253
  }
1196
1254
  }