@databricks/sdk-postgres 0.1.0-dev.4 → 0.1.0-dev.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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
40
  async createBranch(req, options) {
43
- const url = `${this.host}/api/2.0/postgres/${req.parent ?? ''}/branches`;
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);
@@ -74,11 +73,12 @@ export class PostgresClient {
74
73
  }
75
74
  async createBranchOperation(req, options) {
76
75
  const op = await this.createBranch(req, options);
77
- return new CreateBranchOperation(this, op);
76
+ return new CreateBranchOperation(op, (req, options) => this.getOperation(req, options));
78
77
  }
79
78
  /** Register a Postgres database in the Unity Catalog. */
80
79
  async createCatalog(req, options) {
81
- const url = `${this.host}/api/2.0/postgres/catalogs`;
80
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
81
+ const url = `${host}/api/2.0/postgres/catalogs`;
82
82
  const params = new URLSearchParams();
83
83
  if (req.catalogId !== undefined) {
84
84
  params.append('catalog_id', req.catalogId);
@@ -89,14 +89,14 @@ export class PostgresClient {
89
89
  let resp;
90
90
  const call = async (callSignal) => {
91
91
  const headers = new Headers({ 'Content-Type': 'application/json' });
92
- if (this.workspaceId !== undefined) {
93
- headers.set('X-Databricks-Org-Id', this.workspaceId);
92
+ if (workspaceId !== undefined) {
93
+ headers.set('X-Databricks-Org-Id', workspaceId);
94
94
  }
95
95
  headers.set('User-Agent', this.userAgent);
96
96
  const httpReq = buildHttpRequest('POST', fullUrl, headers, callSignal, body);
97
97
  const respBody = await executeHttpCall({
98
98
  request: httpReq,
99
- httpClient: this.httpClient,
99
+ httpClient,
100
100
  logger: this.logger,
101
101
  });
102
102
  resp = parseResponse(respBody, unmarshalOperationSchema);
@@ -109,7 +109,7 @@ export class PostgresClient {
109
109
  }
110
110
  async createCatalogOperation(req, options) {
111
111
  const op = await this.createCatalog(req, options);
112
- return new CreateCatalogOperation(this, op);
112
+ return new CreateCatalogOperation(op, (req, options) => this.getOperation(req, options));
113
113
  }
114
114
  /**
115
115
  * Create a Database.
@@ -117,7 +117,8 @@ export class PostgresClient {
117
117
  * Creates a database in the specified branch. A branch can have multiple databases.
118
118
  */
119
119
  async createDatabase(req, options) {
120
- const url = `${this.host}/api/2.0/postgres/${req.parent ?? ''}/databases`;
120
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
121
+ const url = `${host}/api/2.0/postgres/${req.parent ?? ''}/databases`;
121
122
  const params = new URLSearchParams();
122
123
  if (req.databaseId !== undefined) {
123
124
  params.append('database_id', req.databaseId);
@@ -128,14 +129,14 @@ export class PostgresClient {
128
129
  let resp;
129
130
  const call = async (callSignal) => {
130
131
  const headers = new Headers({ 'Content-Type': 'application/json' });
131
- if (this.workspaceId !== undefined) {
132
- headers.set('X-Databricks-Org-Id', this.workspaceId);
132
+ if (workspaceId !== undefined) {
133
+ headers.set('X-Databricks-Org-Id', workspaceId);
133
134
  }
134
135
  headers.set('User-Agent', this.userAgent);
135
136
  const httpReq = buildHttpRequest('POST', fullUrl, headers, callSignal, body);
136
137
  const respBody = await executeHttpCall({
137
138
  request: httpReq,
138
- httpClient: this.httpClient,
139
+ httpClient,
139
140
  logger: this.logger,
140
141
  });
141
142
  resp = parseResponse(respBody, unmarshalOperationSchema);
@@ -148,11 +149,12 @@ export class PostgresClient {
148
149
  }
149
150
  async createDatabaseOperation(req, options) {
150
151
  const op = await this.createDatabase(req, options);
151
- return new CreateDatabaseOperation(this, op);
152
+ return new CreateDatabaseOperation(op, (req, options) => this.getOperation(req, options));
152
153
  }
153
154
  /** Creates a new compute endpoint in the branch. */
154
155
  async createEndpoint(req, options) {
155
- const url = `${this.host}/api/2.0/postgres/${req.parent ?? ''}/endpoints`;
156
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
157
+ const url = `${host}/api/2.0/postgres/${req.parent ?? ''}/endpoints`;
156
158
  const params = new URLSearchParams();
157
159
  if (req.endpointId !== undefined) {
158
160
  params.append('endpoint_id', req.endpointId);
@@ -166,14 +168,14 @@ export class PostgresClient {
166
168
  let resp;
167
169
  const call = async (callSignal) => {
168
170
  const headers = new Headers({ 'Content-Type': 'application/json' });
169
- if (this.workspaceId !== undefined) {
170
- headers.set('X-Databricks-Org-Id', this.workspaceId);
171
+ if (workspaceId !== undefined) {
172
+ headers.set('X-Databricks-Org-Id', workspaceId);
171
173
  }
172
174
  headers.set('User-Agent', this.userAgent);
173
175
  const httpReq = buildHttpRequest('POST', fullUrl, headers, callSignal, body);
174
176
  const respBody = await executeHttpCall({
175
177
  request: httpReq,
176
- httpClient: this.httpClient,
178
+ httpClient,
177
179
  logger: this.logger,
178
180
  });
179
181
  resp = parseResponse(respBody, unmarshalOperationSchema);
@@ -186,11 +188,12 @@ export class PostgresClient {
186
188
  }
187
189
  async createEndpointOperation(req, options) {
188
190
  const op = await this.createEndpoint(req, options);
189
- return new CreateEndpointOperation(this, op);
191
+ return new CreateEndpointOperation(op, (req, options) => this.getOperation(req, options));
190
192
  }
191
193
  /** Creates a new Lakebase Autoscaling Postgres database project, which contains branches and compute endpoints. */
192
194
  async createProject(req, options) {
193
- const url = `${this.host}/api/2.0/postgres/projects`;
195
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
196
+ const url = `${host}/api/2.0/postgres/projects`;
194
197
  const params = new URLSearchParams();
195
198
  if (req.projectId !== undefined) {
196
199
  params.append('project_id', req.projectId);
@@ -201,14 +204,14 @@ export class PostgresClient {
201
204
  let resp;
202
205
  const call = async (callSignal) => {
203
206
  const headers = new Headers({ 'Content-Type': 'application/json' });
204
- if (this.workspaceId !== undefined) {
205
- headers.set('X-Databricks-Org-Id', this.workspaceId);
207
+ if (workspaceId !== undefined) {
208
+ headers.set('X-Databricks-Org-Id', workspaceId);
206
209
  }
207
210
  headers.set('User-Agent', this.userAgent);
208
211
  const httpReq = buildHttpRequest('POST', fullUrl, headers, callSignal, body);
209
212
  const respBody = await executeHttpCall({
210
213
  request: httpReq,
211
- httpClient: this.httpClient,
214
+ httpClient,
212
215
  logger: this.logger,
213
216
  });
214
217
  resp = parseResponse(respBody, unmarshalOperationSchema);
@@ -221,11 +224,12 @@ export class PostgresClient {
221
224
  }
222
225
  async createProjectOperation(req, options) {
223
226
  const op = await this.createProject(req, options);
224
- return new CreateProjectOperation(this, op);
227
+ return new CreateProjectOperation(op, (req, options) => this.getOperation(req, options));
225
228
  }
226
229
  /** Creates a new Postgres role in the branch. */
227
230
  async createRole(req, options) {
228
- const url = `${this.host}/api/2.0/postgres/${req.parent ?? ''}/roles`;
231
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
232
+ const url = `${host}/api/2.0/postgres/${req.parent ?? ''}/roles`;
229
233
  const params = new URLSearchParams();
230
234
  if (req.roleId !== undefined) {
231
235
  params.append('role_id', req.roleId);
@@ -236,14 +240,14 @@ export class PostgresClient {
236
240
  let resp;
237
241
  const call = async (callSignal) => {
238
242
  const headers = new Headers({ 'Content-Type': 'application/json' });
239
- if (this.workspaceId !== undefined) {
240
- headers.set('X-Databricks-Org-Id', this.workspaceId);
243
+ if (workspaceId !== undefined) {
244
+ headers.set('X-Databricks-Org-Id', workspaceId);
241
245
  }
242
246
  headers.set('User-Agent', this.userAgent);
243
247
  const httpReq = buildHttpRequest('POST', fullUrl, headers, callSignal, body);
244
248
  const respBody = await executeHttpCall({
245
249
  request: httpReq,
246
- httpClient: this.httpClient,
250
+ httpClient,
247
251
  logger: this.logger,
248
252
  });
249
253
  resp = parseResponse(respBody, unmarshalOperationSchema);
@@ -256,11 +260,12 @@ export class PostgresClient {
256
260
  }
257
261
  async createRoleOperation(req, options) {
258
262
  const op = await this.createRole(req, options);
259
- return new CreateRoleOperation(this, op);
263
+ return new CreateRoleOperation(op, (req, options) => this.getOperation(req, options));
260
264
  }
261
265
  /** Create a Synced Table. */
262
266
  async createSyncedTable(req, options) {
263
- const url = `${this.host}/api/2.0/postgres/synced_tables`;
267
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
268
+ const url = `${host}/api/2.0/postgres/synced_tables`;
264
269
  const params = new URLSearchParams();
265
270
  if (req.syncedTableId !== undefined) {
266
271
  params.append('synced_table_id', req.syncedTableId);
@@ -271,14 +276,14 @@ export class PostgresClient {
271
276
  let resp;
272
277
  const call = async (callSignal) => {
273
278
  const headers = new Headers({ 'Content-Type': 'application/json' });
274
- if (this.workspaceId !== undefined) {
275
- headers.set('X-Databricks-Org-Id', this.workspaceId);
279
+ if (workspaceId !== undefined) {
280
+ headers.set('X-Databricks-Org-Id', workspaceId);
276
281
  }
277
282
  headers.set('User-Agent', this.userAgent);
278
283
  const httpReq = buildHttpRequest('POST', fullUrl, headers, callSignal, body);
279
284
  const respBody = await executeHttpCall({
280
285
  request: httpReq,
281
- httpClient: this.httpClient,
286
+ httpClient,
282
287
  logger: this.logger,
283
288
  });
284
289
  resp = parseResponse(respBody, unmarshalOperationSchema);
@@ -291,11 +296,12 @@ export class PostgresClient {
291
296
  }
292
297
  async createSyncedTableOperation(req, options) {
293
298
  const op = await this.createSyncedTable(req, options);
294
- return new CreateSyncedTableOperation(this, op);
299
+ return new CreateSyncedTableOperation(op, (req, options) => this.getOperation(req, options));
295
300
  }
296
301
  /** Deletes the specified database branch. */
297
302
  async deleteBranch(req, options) {
298
- const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}`;
303
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
304
+ const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
299
305
  const params = new URLSearchParams();
300
306
  if (req.purge !== undefined) {
301
307
  params.append('purge', String(req.purge));
@@ -305,14 +311,14 @@ export class PostgresClient {
305
311
  let resp;
306
312
  const call = async (callSignal) => {
307
313
  const headers = new Headers();
308
- if (this.workspaceId !== undefined) {
309
- headers.set('X-Databricks-Org-Id', this.workspaceId);
314
+ if (workspaceId !== undefined) {
315
+ headers.set('X-Databricks-Org-Id', workspaceId);
310
316
  }
311
317
  headers.set('User-Agent', this.userAgent);
312
318
  const httpReq = buildHttpRequest('DELETE', fullUrl, headers, callSignal);
313
319
  const respBody = await executeHttpCall({
314
320
  request: httpReq,
315
- httpClient: this.httpClient,
321
+ httpClient,
316
322
  logger: this.logger,
317
323
  });
318
324
  resp = parseResponse(respBody, unmarshalOperationSchema);
@@ -325,22 +331,23 @@ export class PostgresClient {
325
331
  }
326
332
  async deleteBranchOperation(req, options) {
327
333
  const op = await this.deleteBranch(req, options);
328
- return new DeleteBranchOperation(this, op);
334
+ return new DeleteBranchOperation(op, (req, options) => this.getOperation(req, options));
329
335
  }
330
336
  /** Delete a Database Catalog. */
331
337
  async deleteCatalog(req, options) {
332
- const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}`;
338
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
339
+ const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
333
340
  let resp;
334
341
  const call = async (callSignal) => {
335
342
  const headers = new Headers();
336
- if (this.workspaceId !== undefined) {
337
- headers.set('X-Databricks-Org-Id', this.workspaceId);
343
+ if (workspaceId !== undefined) {
344
+ headers.set('X-Databricks-Org-Id', workspaceId);
338
345
  }
339
346
  headers.set('User-Agent', this.userAgent);
340
347
  const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
341
348
  const respBody = await executeHttpCall({
342
349
  request: httpReq,
343
- httpClient: this.httpClient,
350
+ httpClient,
344
351
  logger: this.logger,
345
352
  });
346
353
  resp = parseResponse(respBody, unmarshalOperationSchema);
@@ -353,22 +360,23 @@ export class PostgresClient {
353
360
  }
354
361
  async deleteCatalogOperation(req, options) {
355
362
  const op = await this.deleteCatalog(req, options);
356
- return new DeleteCatalogOperation(this, op);
363
+ return new DeleteCatalogOperation(op, (req, options) => this.getOperation(req, options));
357
364
  }
358
365
  /** Delete a Database. */
359
366
  async deleteDatabase(req, options) {
360
- const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}`;
367
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
368
+ const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
361
369
  let resp;
362
370
  const call = async (callSignal) => {
363
371
  const headers = new Headers();
364
- if (this.workspaceId !== undefined) {
365
- headers.set('X-Databricks-Org-Id', this.workspaceId);
372
+ if (workspaceId !== undefined) {
373
+ headers.set('X-Databricks-Org-Id', workspaceId);
366
374
  }
367
375
  headers.set('User-Agent', this.userAgent);
368
376
  const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
369
377
  const respBody = await executeHttpCall({
370
378
  request: httpReq,
371
- httpClient: this.httpClient,
379
+ httpClient,
372
380
  logger: this.logger,
373
381
  });
374
382
  resp = parseResponse(respBody, unmarshalOperationSchema);
@@ -381,22 +389,23 @@ export class PostgresClient {
381
389
  }
382
390
  async deleteDatabaseOperation(req, options) {
383
391
  const op = await this.deleteDatabase(req, options);
384
- return new DeleteDatabaseOperation(this, op);
392
+ return new DeleteDatabaseOperation(op, (req, options) => this.getOperation(req, options));
385
393
  }
386
394
  /** Deletes the specified compute endpoint. */
387
395
  async deleteEndpoint(req, options) {
388
- const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}`;
396
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
397
+ const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
389
398
  let resp;
390
399
  const call = async (callSignal) => {
391
400
  const headers = new Headers();
392
- if (this.workspaceId !== undefined) {
393
- headers.set('X-Databricks-Org-Id', this.workspaceId);
401
+ if (workspaceId !== undefined) {
402
+ headers.set('X-Databricks-Org-Id', workspaceId);
394
403
  }
395
404
  headers.set('User-Agent', this.userAgent);
396
405
  const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
397
406
  const respBody = await executeHttpCall({
398
407
  request: httpReq,
399
- httpClient: this.httpClient,
408
+ httpClient,
400
409
  logger: this.logger,
401
410
  });
402
411
  resp = parseResponse(respBody, unmarshalOperationSchema);
@@ -409,11 +418,12 @@ export class PostgresClient {
409
418
  }
410
419
  async deleteEndpointOperation(req, options) {
411
420
  const op = await this.deleteEndpoint(req, options);
412
- return new DeleteEndpointOperation(this, op);
421
+ return new DeleteEndpointOperation(op, (req, options) => this.getOperation(req, options));
413
422
  }
414
423
  /** Deletes the specified database project. */
415
424
  async deleteProject(req, options) {
416
- const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}`;
425
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
426
+ const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
417
427
  const params = new URLSearchParams();
418
428
  if (req.purge !== undefined) {
419
429
  params.append('purge', String(req.purge));
@@ -423,14 +433,14 @@ export class PostgresClient {
423
433
  let resp;
424
434
  const call = async (callSignal) => {
425
435
  const headers = new Headers();
426
- if (this.workspaceId !== undefined) {
427
- headers.set('X-Databricks-Org-Id', this.workspaceId);
436
+ if (workspaceId !== undefined) {
437
+ headers.set('X-Databricks-Org-Id', workspaceId);
428
438
  }
429
439
  headers.set('User-Agent', this.userAgent);
430
440
  const httpReq = buildHttpRequest('DELETE', fullUrl, headers, callSignal);
431
441
  const respBody = await executeHttpCall({
432
442
  request: httpReq,
433
- httpClient: this.httpClient,
443
+ httpClient,
434
444
  logger: this.logger,
435
445
  });
436
446
  resp = parseResponse(respBody, unmarshalOperationSchema);
@@ -443,11 +453,12 @@ export class PostgresClient {
443
453
  }
444
454
  async deleteProjectOperation(req, options) {
445
455
  const op = await this.deleteProject(req, options);
446
- return new DeleteProjectOperation(this, op);
456
+ return new DeleteProjectOperation(op, (req, options) => this.getOperation(req, options));
447
457
  }
448
458
  /** Deletes the specified Postgres role. */
449
459
  async deleteRole(req, options) {
450
- const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}`;
460
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
461
+ const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
451
462
  const params = new URLSearchParams();
452
463
  if (req.reassignOwnedTo !== undefined) {
453
464
  params.append('reassign_owned_to', req.reassignOwnedTo);
@@ -457,14 +468,14 @@ export class PostgresClient {
457
468
  let resp;
458
469
  const call = async (callSignal) => {
459
470
  const headers = new Headers();
460
- if (this.workspaceId !== undefined) {
461
- headers.set('X-Databricks-Org-Id', this.workspaceId);
471
+ if (workspaceId !== undefined) {
472
+ headers.set('X-Databricks-Org-Id', workspaceId);
462
473
  }
463
474
  headers.set('User-Agent', this.userAgent);
464
475
  const httpReq = buildHttpRequest('DELETE', fullUrl, headers, callSignal);
465
476
  const respBody = await executeHttpCall({
466
477
  request: httpReq,
467
- httpClient: this.httpClient,
478
+ httpClient,
468
479
  logger: this.logger,
469
480
  });
470
481
  resp = parseResponse(respBody, unmarshalOperationSchema);
@@ -477,22 +488,23 @@ export class PostgresClient {
477
488
  }
478
489
  async deleteRoleOperation(req, options) {
479
490
  const op = await this.deleteRole(req, options);
480
- return new DeleteRoleOperation(this, op);
491
+ return new DeleteRoleOperation(op, (req, options) => this.getOperation(req, options));
481
492
  }
482
493
  /** Delete a Synced Table. */
483
494
  async deleteSyncedTable(req, options) {
484
- const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}`;
495
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
496
+ const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
485
497
  let resp;
486
498
  const call = async (callSignal) => {
487
499
  const headers = new Headers();
488
- if (this.workspaceId !== undefined) {
489
- headers.set('X-Databricks-Org-Id', this.workspaceId);
500
+ if (workspaceId !== undefined) {
501
+ headers.set('X-Databricks-Org-Id', workspaceId);
490
502
  }
491
503
  headers.set('User-Agent', this.userAgent);
492
504
  const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
493
505
  const respBody = await executeHttpCall({
494
506
  request: httpReq,
495
- httpClient: this.httpClient,
507
+ httpClient,
496
508
  logger: this.logger,
497
509
  });
498
510
  resp = parseResponse(respBody, unmarshalOperationSchema);
@@ -505,23 +517,24 @@ export class PostgresClient {
505
517
  }
506
518
  async deleteSyncedTableOperation(req, options) {
507
519
  const op = await this.deleteSyncedTable(req, options);
508
- return new DeleteSyncedTableOperation(this, op);
520
+ return new DeleteSyncedTableOperation(op, (req, options) => this.getOperation(req, options));
509
521
  }
510
522
  /** Generate OAuth credentials for a Postgres database. */
511
523
  async generateDatabaseCredential(req, options) {
512
- const url = `${this.host}/api/2.0/postgres/credentials`;
524
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
525
+ const url = `${host}/api/2.0/postgres/credentials`;
513
526
  const body = marshalRequest(req, marshalGenerateDatabaseCredentialRequestSchema);
514
527
  let resp;
515
528
  const call = async (callSignal) => {
516
529
  const headers = new Headers({ 'Content-Type': 'application/json' });
517
- if (this.workspaceId !== undefined) {
518
- headers.set('X-Databricks-Org-Id', this.workspaceId);
530
+ if (workspaceId !== undefined) {
531
+ headers.set('X-Databricks-Org-Id', workspaceId);
519
532
  }
520
533
  headers.set('User-Agent', this.userAgent);
521
534
  const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
522
535
  const respBody = await executeHttpCall({
523
536
  request: httpReq,
524
- httpClient: this.httpClient,
537
+ httpClient,
525
538
  logger: this.logger,
526
539
  });
527
540
  resp = parseResponse(respBody, unmarshalDatabaseCredentialSchema);
@@ -534,18 +547,19 @@ export class PostgresClient {
534
547
  }
535
548
  /** Retrieves information about the specified database branch. */
536
549
  async getBranch(req, options) {
537
- const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}`;
550
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
551
+ const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
538
552
  let resp;
539
553
  const call = async (callSignal) => {
540
554
  const headers = new Headers();
541
- if (this.workspaceId !== undefined) {
542
- headers.set('X-Databricks-Org-Id', this.workspaceId);
555
+ if (workspaceId !== undefined) {
556
+ headers.set('X-Databricks-Org-Id', workspaceId);
543
557
  }
544
558
  headers.set('User-Agent', this.userAgent);
545
559
  const httpReq = buildHttpRequest('GET', url, headers, callSignal);
546
560
  const respBody = await executeHttpCall({
547
561
  request: httpReq,
548
- httpClient: this.httpClient,
562
+ httpClient,
549
563
  logger: this.logger,
550
564
  });
551
565
  resp = parseResponse(respBody, unmarshalBranchSchema);
@@ -558,18 +572,19 @@ export class PostgresClient {
558
572
  }
559
573
  /** Get a Database Catalog. */
560
574
  async getCatalog(req, options) {
561
- const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}`;
575
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
576
+ const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
562
577
  let resp;
563
578
  const call = async (callSignal) => {
564
579
  const headers = new Headers();
565
- if (this.workspaceId !== undefined) {
566
- headers.set('X-Databricks-Org-Id', this.workspaceId);
580
+ if (workspaceId !== undefined) {
581
+ headers.set('X-Databricks-Org-Id', workspaceId);
567
582
  }
568
583
  headers.set('User-Agent', this.userAgent);
569
584
  const httpReq = buildHttpRequest('GET', url, headers, callSignal);
570
585
  const respBody = await executeHttpCall({
571
586
  request: httpReq,
572
- httpClient: this.httpClient,
587
+ httpClient,
573
588
  logger: this.logger,
574
589
  });
575
590
  resp = parseResponse(respBody, unmarshalCatalogSchema);
@@ -582,18 +597,19 @@ export class PostgresClient {
582
597
  }
583
598
  /** Get a Database. */
584
599
  async getDatabase(req, options) {
585
- const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}`;
600
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
601
+ const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
586
602
  let resp;
587
603
  const call = async (callSignal) => {
588
604
  const headers = new Headers();
589
- if (this.workspaceId !== undefined) {
590
- headers.set('X-Databricks-Org-Id', this.workspaceId);
605
+ if (workspaceId !== undefined) {
606
+ headers.set('X-Databricks-Org-Id', workspaceId);
591
607
  }
592
608
  headers.set('User-Agent', this.userAgent);
593
609
  const httpReq = buildHttpRequest('GET', url, headers, callSignal);
594
610
  const respBody = await executeHttpCall({
595
611
  request: httpReq,
596
- httpClient: this.httpClient,
612
+ httpClient,
597
613
  logger: this.logger,
598
614
  });
599
615
  resp = parseResponse(respBody, unmarshalDatabaseSchema);
@@ -606,18 +622,19 @@ export class PostgresClient {
606
622
  }
607
623
  /** Retrieves information about the specified compute endpoint, including its connection details and operational state. */
608
624
  async getEndpoint(req, options) {
609
- const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}`;
625
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
626
+ const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
610
627
  let resp;
611
628
  const call = async (callSignal) => {
612
629
  const headers = new Headers();
613
- if (this.workspaceId !== undefined) {
614
- headers.set('X-Databricks-Org-Id', this.workspaceId);
630
+ if (workspaceId !== undefined) {
631
+ headers.set('X-Databricks-Org-Id', workspaceId);
615
632
  }
616
633
  headers.set('User-Agent', this.userAgent);
617
634
  const httpReq = buildHttpRequest('GET', url, headers, callSignal);
618
635
  const respBody = await executeHttpCall({
619
636
  request: httpReq,
620
- httpClient: this.httpClient,
637
+ httpClient,
621
638
  logger: this.logger,
622
639
  });
623
640
  resp = parseResponse(respBody, unmarshalEndpointSchema);
@@ -630,18 +647,19 @@ export class PostgresClient {
630
647
  }
631
648
  /** Retrieves the status of a long-running operation. */
632
649
  async getOperation(req, options) {
633
- const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}`;
650
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
651
+ const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
634
652
  let resp;
635
653
  const call = async (callSignal) => {
636
654
  const headers = new Headers();
637
- if (this.workspaceId !== undefined) {
638
- headers.set('X-Databricks-Org-Id', this.workspaceId);
655
+ if (workspaceId !== undefined) {
656
+ headers.set('X-Databricks-Org-Id', workspaceId);
639
657
  }
640
658
  headers.set('User-Agent', this.userAgent);
641
659
  const httpReq = buildHttpRequest('GET', url, headers, callSignal);
642
660
  const respBody = await executeHttpCall({
643
661
  request: httpReq,
644
- httpClient: this.httpClient,
662
+ httpClient,
645
663
  logger: this.logger,
646
664
  });
647
665
  resp = parseResponse(respBody, unmarshalOperationSchema);
@@ -654,18 +672,19 @@ export class PostgresClient {
654
672
  }
655
673
  /** Retrieves information about the specified database project. */
656
674
  async getProject(req, options) {
657
- const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}`;
675
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
676
+ const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
658
677
  let resp;
659
678
  const call = async (callSignal) => {
660
679
  const headers = new Headers();
661
- if (this.workspaceId !== undefined) {
662
- headers.set('X-Databricks-Org-Id', this.workspaceId);
680
+ if (workspaceId !== undefined) {
681
+ headers.set('X-Databricks-Org-Id', workspaceId);
663
682
  }
664
683
  headers.set('User-Agent', this.userAgent);
665
684
  const httpReq = buildHttpRequest('GET', url, headers, callSignal);
666
685
  const respBody = await executeHttpCall({
667
686
  request: httpReq,
668
- httpClient: this.httpClient,
687
+ httpClient,
669
688
  logger: this.logger,
670
689
  });
671
690
  resp = parseResponse(respBody, unmarshalProjectSchema);
@@ -678,18 +697,19 @@ export class PostgresClient {
678
697
  }
679
698
  /** Retrieves information about the specified Postgres role, including its authentication method and permissions. */
680
699
  async getRole(req, options) {
681
- const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}`;
700
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
701
+ const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
682
702
  let resp;
683
703
  const call = async (callSignal) => {
684
704
  const headers = new Headers();
685
- if (this.workspaceId !== undefined) {
686
- headers.set('X-Databricks-Org-Id', this.workspaceId);
705
+ if (workspaceId !== undefined) {
706
+ headers.set('X-Databricks-Org-Id', workspaceId);
687
707
  }
688
708
  headers.set('User-Agent', this.userAgent);
689
709
  const httpReq = buildHttpRequest('GET', url, headers, callSignal);
690
710
  const respBody = await executeHttpCall({
691
711
  request: httpReq,
692
- httpClient: this.httpClient,
712
+ httpClient,
693
713
  logger: this.logger,
694
714
  });
695
715
  resp = parseResponse(respBody, unmarshalRoleSchema);
@@ -702,18 +722,19 @@ export class PostgresClient {
702
722
  }
703
723
  /** Get a Synced Table. */
704
724
  async getSyncedTable(req, options) {
705
- const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}`;
725
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
726
+ const url = `${host}/api/2.0/postgres/${req.name ?? ''}`;
706
727
  let resp;
707
728
  const call = async (callSignal) => {
708
729
  const headers = new Headers();
709
- if (this.workspaceId !== undefined) {
710
- headers.set('X-Databricks-Org-Id', this.workspaceId);
730
+ if (workspaceId !== undefined) {
731
+ headers.set('X-Databricks-Org-Id', workspaceId);
711
732
  }
712
733
  headers.set('User-Agent', this.userAgent);
713
734
  const httpReq = buildHttpRequest('GET', url, headers, callSignal);
714
735
  const respBody = await executeHttpCall({
715
736
  request: httpReq,
716
- httpClient: this.httpClient,
737
+ httpClient,
717
738
  logger: this.logger,
718
739
  });
719
740
  resp = parseResponse(respBody, unmarshalSyncedTableSchema);
@@ -726,7 +747,8 @@ export class PostgresClient {
726
747
  }
727
748
  /** Returns a paginated list of database branches in the project. */
728
749
  async listBranches(req, options) {
729
- const url = `${this.host}/api/2.0/postgres/${req.parent ?? ''}/branches`;
750
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
751
+ const url = `${host}/api/2.0/postgres/${req.parent ?? ''}/branches`;
730
752
  const params = new URLSearchParams();
731
753
  if (req.pageToken !== undefined) {
732
754
  params.append('page_token', req.pageToken);
@@ -742,14 +764,14 @@ export class PostgresClient {
742
764
  let resp;
743
765
  const call = async (callSignal) => {
744
766
  const headers = new Headers();
745
- if (this.workspaceId !== undefined) {
746
- headers.set('X-Databricks-Org-Id', this.workspaceId);
767
+ if (workspaceId !== undefined) {
768
+ headers.set('X-Databricks-Org-Id', workspaceId);
747
769
  }
748
770
  headers.set('User-Agent', this.userAgent);
749
771
  const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
750
772
  const respBody = await executeHttpCall({
751
773
  request: httpReq,
752
- httpClient: this.httpClient,
774
+ httpClient,
753
775
  logger: this.logger,
754
776
  });
755
777
  resp = parseResponse(respBody, unmarshalListBranchesResponseSchema);
@@ -775,7 +797,8 @@ export class PostgresClient {
775
797
  }
776
798
  /** List Databases. */
777
799
  async listDatabases(req, options) {
778
- const url = `${this.host}/api/2.0/postgres/${req.parent ?? ''}/databases`;
800
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
801
+ const url = `${host}/api/2.0/postgres/${req.parent ?? ''}/databases`;
779
802
  const params = new URLSearchParams();
780
803
  if (req.pageToken !== undefined) {
781
804
  params.append('page_token', req.pageToken);
@@ -788,14 +811,14 @@ export class PostgresClient {
788
811
  let resp;
789
812
  const call = async (callSignal) => {
790
813
  const headers = new Headers();
791
- if (this.workspaceId !== undefined) {
792
- headers.set('X-Databricks-Org-Id', this.workspaceId);
814
+ if (workspaceId !== undefined) {
815
+ headers.set('X-Databricks-Org-Id', workspaceId);
793
816
  }
794
817
  headers.set('User-Agent', this.userAgent);
795
818
  const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
796
819
  const respBody = await executeHttpCall({
797
820
  request: httpReq,
798
- httpClient: this.httpClient,
821
+ httpClient,
799
822
  logger: this.logger,
800
823
  });
801
824
  resp = parseResponse(respBody, unmarshalListDatabasesResponseSchema);
@@ -821,7 +844,8 @@ export class PostgresClient {
821
844
  }
822
845
  /** Returns a paginated list of compute endpoints in the branch. */
823
846
  async listEndpoints(req, options) {
824
- const url = `${this.host}/api/2.0/postgres/${req.parent ?? ''}/endpoints`;
847
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
848
+ const url = `${host}/api/2.0/postgres/${req.parent ?? ''}/endpoints`;
825
849
  const params = new URLSearchParams();
826
850
  if (req.pageToken !== undefined) {
827
851
  params.append('page_token', req.pageToken);
@@ -834,14 +858,14 @@ export class PostgresClient {
834
858
  let resp;
835
859
  const call = async (callSignal) => {
836
860
  const headers = new Headers();
837
- if (this.workspaceId !== undefined) {
838
- headers.set('X-Databricks-Org-Id', this.workspaceId);
861
+ if (workspaceId !== undefined) {
862
+ headers.set('X-Databricks-Org-Id', workspaceId);
839
863
  }
840
864
  headers.set('User-Agent', this.userAgent);
841
865
  const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
842
866
  const respBody = await executeHttpCall({
843
867
  request: httpReq,
844
- httpClient: this.httpClient,
868
+ httpClient,
845
869
  logger: this.logger,
846
870
  });
847
871
  resp = parseResponse(respBody, unmarshalListEndpointsResponseSchema);
@@ -867,7 +891,8 @@ export class PostgresClient {
867
891
  }
868
892
  /** Returns a paginated list of database projects in the workspace that the user has permission to access. */
869
893
  async listProjects(req, options) {
870
- const url = `${this.host}/api/2.0/postgres/projects`;
894
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
895
+ const url = `${host}/api/2.0/postgres/projects`;
871
896
  const params = new URLSearchParams();
872
897
  if (req.pageToken !== undefined) {
873
898
  params.append('page_token', req.pageToken);
@@ -883,14 +908,14 @@ export class PostgresClient {
883
908
  let resp;
884
909
  const call = async (callSignal) => {
885
910
  const headers = new Headers();
886
- if (this.workspaceId !== undefined) {
887
- headers.set('X-Databricks-Org-Id', this.workspaceId);
911
+ if (workspaceId !== undefined) {
912
+ headers.set('X-Databricks-Org-Id', workspaceId);
888
913
  }
889
914
  headers.set('User-Agent', this.userAgent);
890
915
  const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
891
916
  const respBody = await executeHttpCall({
892
917
  request: httpReq,
893
- httpClient: this.httpClient,
918
+ httpClient,
894
919
  logger: this.logger,
895
920
  });
896
921
  resp = parseResponse(respBody, unmarshalListProjectsResponseSchema);
@@ -916,7 +941,8 @@ export class PostgresClient {
916
941
  }
917
942
  /** Returns a paginated list of Postgres roles in the branch. */
918
943
  async listRoles(req, options) {
919
- const url = `${this.host}/api/2.0/postgres/${req.parent ?? ''}/roles`;
944
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
945
+ const url = `${host}/api/2.0/postgres/${req.parent ?? ''}/roles`;
920
946
  const params = new URLSearchParams();
921
947
  if (req.pageToken !== undefined) {
922
948
  params.append('page_token', req.pageToken);
@@ -929,14 +955,14 @@ export class PostgresClient {
929
955
  let resp;
930
956
  const call = async (callSignal) => {
931
957
  const headers = new Headers();
932
- if (this.workspaceId !== undefined) {
933
- headers.set('X-Databricks-Org-Id', this.workspaceId);
958
+ if (workspaceId !== undefined) {
959
+ headers.set('X-Databricks-Org-Id', workspaceId);
934
960
  }
935
961
  headers.set('User-Agent', this.userAgent);
936
962
  const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
937
963
  const respBody = await executeHttpCall({
938
964
  request: httpReq,
939
- httpClient: this.httpClient,
965
+ httpClient,
940
966
  logger: this.logger,
941
967
  });
942
968
  resp = parseResponse(respBody, unmarshalListRolesResponseSchema);
@@ -962,19 +988,20 @@ export class PostgresClient {
962
988
  }
963
989
  /** Undeletes the specified database branch. */
964
990
  async undeleteBranch(req, options) {
965
- const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}/undelete`;
991
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
992
+ const url = `${host}/api/2.0/postgres/${req.name ?? ''}/undelete`;
966
993
  const body = marshalRequest(req, marshalUndeleteBranchRequestSchema);
967
994
  let resp;
968
995
  const call = async (callSignal) => {
969
996
  const headers = new Headers({ 'Content-Type': 'application/json' });
970
- if (this.workspaceId !== undefined) {
971
- headers.set('X-Databricks-Org-Id', this.workspaceId);
997
+ if (workspaceId !== undefined) {
998
+ headers.set('X-Databricks-Org-Id', workspaceId);
972
999
  }
973
1000
  headers.set('User-Agent', this.userAgent);
974
1001
  const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
975
1002
  const respBody = await executeHttpCall({
976
1003
  request: httpReq,
977
- httpClient: this.httpClient,
1004
+ httpClient,
978
1005
  logger: this.logger,
979
1006
  });
980
1007
  resp = parseResponse(respBody, unmarshalOperationSchema);
@@ -987,23 +1014,24 @@ export class PostgresClient {
987
1014
  }
988
1015
  async undeleteBranchOperation(req, options) {
989
1016
  const op = await this.undeleteBranch(req, options);
990
- return new UndeleteBranchOperation(this, op);
1017
+ return new UndeleteBranchOperation(op, (req, options) => this.getOperation(req, options));
991
1018
  }
992
1019
  /** Undeletes a soft-deleted project. */
993
1020
  async undeleteProject(req, options) {
994
- const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}/undelete`;
1021
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
1022
+ const url = `${host}/api/2.0/postgres/${req.name ?? ''}/undelete`;
995
1023
  const body = marshalRequest(req, marshalUndeleteProjectRequestSchema);
996
1024
  let resp;
997
1025
  const call = async (callSignal) => {
998
1026
  const headers = new Headers({ 'Content-Type': 'application/json' });
999
- if (this.workspaceId !== undefined) {
1000
- headers.set('X-Databricks-Org-Id', this.workspaceId);
1027
+ if (workspaceId !== undefined) {
1028
+ headers.set('X-Databricks-Org-Id', workspaceId);
1001
1029
  }
1002
1030
  headers.set('User-Agent', this.userAgent);
1003
1031
  const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
1004
1032
  const respBody = await executeHttpCall({
1005
1033
  request: httpReq,
1006
- httpClient: this.httpClient,
1034
+ httpClient,
1007
1035
  logger: this.logger,
1008
1036
  });
1009
1037
  resp = parseResponse(respBody, unmarshalOperationSchema);
@@ -1016,11 +1044,12 @@ export class PostgresClient {
1016
1044
  }
1017
1045
  async undeleteProjectOperation(req, options) {
1018
1046
  const op = await this.undeleteProject(req, options);
1019
- return new UndeleteProjectOperation(this, op);
1047
+ return new UndeleteProjectOperation(op, (req, options) => this.getOperation(req, options));
1020
1048
  }
1021
1049
  /** Updates the specified database branch. You can set this branch as the project's default branch, or protect/unprotect it. */
1022
1050
  async updateBranch(req, options) {
1023
- const url = `${this.host}/api/2.0/postgres/${req.branch?.name ?? ''}`;
1051
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
1052
+ const url = `${host}/api/2.0/postgres/${req.branch?.name ?? ''}`;
1024
1053
  const params = new URLSearchParams();
1025
1054
  if (req.updateMask !== undefined) {
1026
1055
  params.append('update_mask', req.updateMask.toString());
@@ -1031,14 +1060,14 @@ export class PostgresClient {
1031
1060
  let resp;
1032
1061
  const call = async (callSignal) => {
1033
1062
  const headers = new Headers({ 'Content-Type': 'application/json' });
1034
- if (this.workspaceId !== undefined) {
1035
- headers.set('X-Databricks-Org-Id', this.workspaceId);
1063
+ if (workspaceId !== undefined) {
1064
+ headers.set('X-Databricks-Org-Id', workspaceId);
1036
1065
  }
1037
1066
  headers.set('User-Agent', this.userAgent);
1038
1067
  const httpReq = buildHttpRequest('PATCH', fullUrl, headers, callSignal, body);
1039
1068
  const respBody = await executeHttpCall({
1040
1069
  request: httpReq,
1041
- httpClient: this.httpClient,
1070
+ httpClient,
1042
1071
  logger: this.logger,
1043
1072
  });
1044
1073
  resp = parseResponse(respBody, unmarshalOperationSchema);
@@ -1051,11 +1080,12 @@ export class PostgresClient {
1051
1080
  }
1052
1081
  async updateBranchOperation(req, options) {
1053
1082
  const op = await this.updateBranch(req, options);
1054
- return new UpdateBranchOperation(this, op);
1083
+ return new UpdateBranchOperation(op, (req, options) => this.getOperation(req, options));
1055
1084
  }
1056
1085
  /** Update a Database. */
1057
1086
  async updateDatabase(req, options) {
1058
- const url = `${this.host}/api/2.0/postgres/${req.database?.name ?? ''}`;
1087
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
1088
+ const url = `${host}/api/2.0/postgres/${req.database?.name ?? ''}`;
1059
1089
  const params = new URLSearchParams();
1060
1090
  if (req.updateMask !== undefined) {
1061
1091
  params.append('update_mask', req.updateMask.toString());
@@ -1066,14 +1096,14 @@ export class PostgresClient {
1066
1096
  let resp;
1067
1097
  const call = async (callSignal) => {
1068
1098
  const headers = new Headers({ 'Content-Type': 'application/json' });
1069
- if (this.workspaceId !== undefined) {
1070
- headers.set('X-Databricks-Org-Id', this.workspaceId);
1099
+ if (workspaceId !== undefined) {
1100
+ headers.set('X-Databricks-Org-Id', workspaceId);
1071
1101
  }
1072
1102
  headers.set('User-Agent', this.userAgent);
1073
1103
  const httpReq = buildHttpRequest('PATCH', fullUrl, headers, callSignal, body);
1074
1104
  const respBody = await executeHttpCall({
1075
1105
  request: httpReq,
1076
- httpClient: this.httpClient,
1106
+ httpClient,
1077
1107
  logger: this.logger,
1078
1108
  });
1079
1109
  resp = parseResponse(respBody, unmarshalOperationSchema);
@@ -1086,11 +1116,12 @@ export class PostgresClient {
1086
1116
  }
1087
1117
  async updateDatabaseOperation(req, options) {
1088
1118
  const op = await this.updateDatabase(req, options);
1089
- return new UpdateDatabaseOperation(this, op);
1119
+ return new UpdateDatabaseOperation(op, (req, options) => this.getOperation(req, options));
1090
1120
  }
1091
1121
  /** Updates the specified compute endpoint. You can update autoscaling limits, suspend timeout, or enable/disable the compute endpoint. */
1092
1122
  async updateEndpoint(req, options) {
1093
- const url = `${this.host}/api/2.0/postgres/${req.endpoint?.name ?? ''}`;
1123
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
1124
+ const url = `${host}/api/2.0/postgres/${req.endpoint?.name ?? ''}`;
1094
1125
  const params = new URLSearchParams();
1095
1126
  if (req.updateMask !== undefined) {
1096
1127
  params.append('update_mask', req.updateMask.toString());
@@ -1101,14 +1132,14 @@ export class PostgresClient {
1101
1132
  let resp;
1102
1133
  const call = async (callSignal) => {
1103
1134
  const headers = new Headers({ 'Content-Type': 'application/json' });
1104
- if (this.workspaceId !== undefined) {
1105
- headers.set('X-Databricks-Org-Id', this.workspaceId);
1135
+ if (workspaceId !== undefined) {
1136
+ headers.set('X-Databricks-Org-Id', workspaceId);
1106
1137
  }
1107
1138
  headers.set('User-Agent', this.userAgent);
1108
1139
  const httpReq = buildHttpRequest('PATCH', fullUrl, headers, callSignal, body);
1109
1140
  const respBody = await executeHttpCall({
1110
1141
  request: httpReq,
1111
- httpClient: this.httpClient,
1142
+ httpClient,
1112
1143
  logger: this.logger,
1113
1144
  });
1114
1145
  resp = parseResponse(respBody, unmarshalOperationSchema);
@@ -1121,11 +1152,12 @@ export class PostgresClient {
1121
1152
  }
1122
1153
  async updateEndpointOperation(req, options) {
1123
1154
  const op = await this.updateEndpoint(req, options);
1124
- return new UpdateEndpointOperation(this, op);
1155
+ return new UpdateEndpointOperation(op, (req, options) => this.getOperation(req, options));
1125
1156
  }
1126
1157
  /** Updates the specified database project. */
1127
1158
  async updateProject(req, options) {
1128
- const url = `${this.host}/api/2.0/postgres/${req.project?.name ?? ''}`;
1159
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
1160
+ const url = `${host}/api/2.0/postgres/${req.project?.name ?? ''}`;
1129
1161
  const params = new URLSearchParams();
1130
1162
  if (req.updateMask !== undefined) {
1131
1163
  params.append('update_mask', req.updateMask.toString());
@@ -1136,14 +1168,14 @@ export class PostgresClient {
1136
1168
  let resp;
1137
1169
  const call = async (callSignal) => {
1138
1170
  const headers = new Headers({ 'Content-Type': 'application/json' });
1139
- if (this.workspaceId !== undefined) {
1140
- headers.set('X-Databricks-Org-Id', this.workspaceId);
1171
+ if (workspaceId !== undefined) {
1172
+ headers.set('X-Databricks-Org-Id', workspaceId);
1141
1173
  }
1142
1174
  headers.set('User-Agent', this.userAgent);
1143
1175
  const httpReq = buildHttpRequest('PATCH', fullUrl, headers, callSignal, body);
1144
1176
  const respBody = await executeHttpCall({
1145
1177
  request: httpReq,
1146
- httpClient: this.httpClient,
1178
+ httpClient,
1147
1179
  logger: this.logger,
1148
1180
  });
1149
1181
  resp = parseResponse(respBody, unmarshalOperationSchema);
@@ -1156,11 +1188,12 @@ export class PostgresClient {
1156
1188
  }
1157
1189
  async updateProjectOperation(req, options) {
1158
1190
  const op = await this.updateProject(req, options);
1159
- return new UpdateProjectOperation(this, op);
1191
+ return new UpdateProjectOperation(op, (req, options) => this.getOperation(req, options));
1160
1192
  }
1161
1193
  /** Update a role for a branch. */
1162
1194
  async updateRole(req, options) {
1163
- const url = `${this.host}/api/2.0/postgres/${req.role?.name ?? ''}`;
1195
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
1196
+ const url = `${host}/api/2.0/postgres/${req.role?.name ?? ''}`;
1164
1197
  const params = new URLSearchParams();
1165
1198
  if (req.updateMask !== undefined) {
1166
1199
  params.append('update_mask', req.updateMask.toString());
@@ -1171,14 +1204,14 @@ export class PostgresClient {
1171
1204
  let resp;
1172
1205
  const call = async (callSignal) => {
1173
1206
  const headers = new Headers({ 'Content-Type': 'application/json' });
1174
- if (this.workspaceId !== undefined) {
1175
- headers.set('X-Databricks-Org-Id', this.workspaceId);
1207
+ if (workspaceId !== undefined) {
1208
+ headers.set('X-Databricks-Org-Id', workspaceId);
1176
1209
  }
1177
1210
  headers.set('User-Agent', this.userAgent);
1178
1211
  const httpReq = buildHttpRequest('PATCH', fullUrl, headers, callSignal, body);
1179
1212
  const respBody = await executeHttpCall({
1180
1213
  request: httpReq,
1181
- httpClient: this.httpClient,
1214
+ httpClient,
1182
1215
  logger: this.logger,
1183
1216
  });
1184
1217
  resp = parseResponse(respBody, unmarshalOperationSchema);
@@ -1191,15 +1224,15 @@ export class PostgresClient {
1191
1224
  }
1192
1225
  async updateRoleOperation(req, options) {
1193
1226
  const op = await this.updateRole(req, options);
1194
- return new UpdateRoleOperation(this, op);
1227
+ return new UpdateRoleOperation(op, (req, options) => this.getOperation(req, options));
1195
1228
  }
1196
1229
  }
1197
1230
  export class CreateBranchOperation {
1198
- client;
1199
1231
  operation;
1200
- constructor(client, operation) {
1201
- this.client = client;
1232
+ getOperation;
1233
+ constructor(operation, getOperation) {
1202
1234
  this.operation = operation;
1235
+ this.getOperation = getOperation;
1203
1236
  }
1204
1237
  /** Returns the server-assigned name of the long-running operation. */
1205
1238
  name() {
@@ -1222,7 +1255,7 @@ export class CreateBranchOperation {
1222
1255
  async wait(options) {
1223
1256
  let result;
1224
1257
  const call = async (callSignal) => {
1225
- const op = await this.client.getOperation({
1258
+ const op = await this.getOperation({
1226
1259
  name: this.operation.name,
1227
1260
  }, callSignal !== undefined ? { signal: callSignal } : undefined);
1228
1261
  this.operation = op;
@@ -1255,17 +1288,17 @@ export class CreateBranchOperation {
1255
1288
  }
1256
1289
  /** Checks whether the operation has completed */
1257
1290
  async done(options) {
1258
- const op = await this.client.getOperation({ name: this.operation.name }, options);
1291
+ const op = await this.getOperation({ name: this.operation.name }, options);
1259
1292
  this.operation = op;
1260
1293
  return op.done;
1261
1294
  }
1262
1295
  }
1263
1296
  export class CreateCatalogOperation {
1264
- client;
1265
1297
  operation;
1266
- constructor(client, operation) {
1267
- this.client = client;
1298
+ getOperation;
1299
+ constructor(operation, getOperation) {
1268
1300
  this.operation = operation;
1301
+ this.getOperation = getOperation;
1269
1302
  }
1270
1303
  /** Returns the server-assigned name of the long-running operation. */
1271
1304
  name() {
@@ -1288,7 +1321,7 @@ export class CreateCatalogOperation {
1288
1321
  async wait(options) {
1289
1322
  let result;
1290
1323
  const call = async (callSignal) => {
1291
- const op = await this.client.getOperation({
1324
+ const op = await this.getOperation({
1292
1325
  name: this.operation.name,
1293
1326
  }, callSignal !== undefined ? { signal: callSignal } : undefined);
1294
1327
  this.operation = op;
@@ -1321,17 +1354,17 @@ export class CreateCatalogOperation {
1321
1354
  }
1322
1355
  /** Checks whether the operation has completed */
1323
1356
  async done(options) {
1324
- const op = await this.client.getOperation({ name: this.operation.name }, options);
1357
+ const op = await this.getOperation({ name: this.operation.name }, options);
1325
1358
  this.operation = op;
1326
1359
  return op.done;
1327
1360
  }
1328
1361
  }
1329
1362
  export class CreateDatabaseOperation {
1330
- client;
1331
1363
  operation;
1332
- constructor(client, operation) {
1333
- this.client = client;
1364
+ getOperation;
1365
+ constructor(operation, getOperation) {
1334
1366
  this.operation = operation;
1367
+ this.getOperation = getOperation;
1335
1368
  }
1336
1369
  /** Returns the server-assigned name of the long-running operation. */
1337
1370
  name() {
@@ -1354,7 +1387,7 @@ export class CreateDatabaseOperation {
1354
1387
  async wait(options) {
1355
1388
  let result;
1356
1389
  const call = async (callSignal) => {
1357
- const op = await this.client.getOperation({
1390
+ const op = await this.getOperation({
1358
1391
  name: this.operation.name,
1359
1392
  }, callSignal !== undefined ? { signal: callSignal } : undefined);
1360
1393
  this.operation = op;
@@ -1387,17 +1420,17 @@ export class CreateDatabaseOperation {
1387
1420
  }
1388
1421
  /** Checks whether the operation has completed */
1389
1422
  async done(options) {
1390
- const op = await this.client.getOperation({ name: this.operation.name }, options);
1423
+ const op = await this.getOperation({ name: this.operation.name }, options);
1391
1424
  this.operation = op;
1392
1425
  return op.done;
1393
1426
  }
1394
1427
  }
1395
1428
  export class CreateEndpointOperation {
1396
- client;
1397
1429
  operation;
1398
- constructor(client, operation) {
1399
- this.client = client;
1430
+ getOperation;
1431
+ constructor(operation, getOperation) {
1400
1432
  this.operation = operation;
1433
+ this.getOperation = getOperation;
1401
1434
  }
1402
1435
  /** Returns the server-assigned name of the long-running operation. */
1403
1436
  name() {
@@ -1420,7 +1453,7 @@ export class CreateEndpointOperation {
1420
1453
  async wait(options) {
1421
1454
  let result;
1422
1455
  const call = async (callSignal) => {
1423
- const op = await this.client.getOperation({
1456
+ const op = await this.getOperation({
1424
1457
  name: this.operation.name,
1425
1458
  }, callSignal !== undefined ? { signal: callSignal } : undefined);
1426
1459
  this.operation = op;
@@ -1453,17 +1486,17 @@ export class CreateEndpointOperation {
1453
1486
  }
1454
1487
  /** Checks whether the operation has completed */
1455
1488
  async done(options) {
1456
- const op = await this.client.getOperation({ name: this.operation.name }, options);
1489
+ const op = await this.getOperation({ name: this.operation.name }, options);
1457
1490
  this.operation = op;
1458
1491
  return op.done;
1459
1492
  }
1460
1493
  }
1461
1494
  export class CreateProjectOperation {
1462
- client;
1463
1495
  operation;
1464
- constructor(client, operation) {
1465
- this.client = client;
1496
+ getOperation;
1497
+ constructor(operation, getOperation) {
1466
1498
  this.operation = operation;
1499
+ this.getOperation = getOperation;
1467
1500
  }
1468
1501
  /** Returns the server-assigned name of the long-running operation. */
1469
1502
  name() {
@@ -1486,7 +1519,7 @@ export class CreateProjectOperation {
1486
1519
  async wait(options) {
1487
1520
  let result;
1488
1521
  const call = async (callSignal) => {
1489
- const op = await this.client.getOperation({
1522
+ const op = await this.getOperation({
1490
1523
  name: this.operation.name,
1491
1524
  }, callSignal !== undefined ? { signal: callSignal } : undefined);
1492
1525
  this.operation = op;
@@ -1519,17 +1552,17 @@ export class CreateProjectOperation {
1519
1552
  }
1520
1553
  /** Checks whether the operation has completed */
1521
1554
  async done(options) {
1522
- const op = await this.client.getOperation({ name: this.operation.name }, options);
1555
+ const op = await this.getOperation({ name: this.operation.name }, options);
1523
1556
  this.operation = op;
1524
1557
  return op.done;
1525
1558
  }
1526
1559
  }
1527
1560
  export class CreateRoleOperation {
1528
- client;
1529
1561
  operation;
1530
- constructor(client, operation) {
1531
- this.client = client;
1562
+ getOperation;
1563
+ constructor(operation, getOperation) {
1532
1564
  this.operation = operation;
1565
+ this.getOperation = getOperation;
1533
1566
  }
1534
1567
  /** Returns the server-assigned name of the long-running operation. */
1535
1568
  name() {
@@ -1552,7 +1585,7 @@ export class CreateRoleOperation {
1552
1585
  async wait(options) {
1553
1586
  let result;
1554
1587
  const call = async (callSignal) => {
1555
- const op = await this.client.getOperation({
1588
+ const op = await this.getOperation({
1556
1589
  name: this.operation.name,
1557
1590
  }, callSignal !== undefined ? { signal: callSignal } : undefined);
1558
1591
  this.operation = op;
@@ -1585,17 +1618,17 @@ export class CreateRoleOperation {
1585
1618
  }
1586
1619
  /** Checks whether the operation has completed */
1587
1620
  async done(options) {
1588
- const op = await this.client.getOperation({ name: this.operation.name }, options);
1621
+ const op = await this.getOperation({ name: this.operation.name }, options);
1589
1622
  this.operation = op;
1590
1623
  return op.done;
1591
1624
  }
1592
1625
  }
1593
1626
  export class CreateSyncedTableOperation {
1594
- client;
1595
1627
  operation;
1596
- constructor(client, operation) {
1597
- this.client = client;
1628
+ getOperation;
1629
+ constructor(operation, getOperation) {
1598
1630
  this.operation = operation;
1631
+ this.getOperation = getOperation;
1599
1632
  }
1600
1633
  /** Returns the server-assigned name of the long-running operation. */
1601
1634
  name() {
@@ -1618,7 +1651,7 @@ export class CreateSyncedTableOperation {
1618
1651
  async wait(options) {
1619
1652
  let result;
1620
1653
  const call = async (callSignal) => {
1621
- const op = await this.client.getOperation({
1654
+ const op = await this.getOperation({
1622
1655
  name: this.operation.name,
1623
1656
  }, callSignal !== undefined ? { signal: callSignal } : undefined);
1624
1657
  this.operation = op;
@@ -1653,17 +1686,17 @@ export class CreateSyncedTableOperation {
1653
1686
  }
1654
1687
  /** Checks whether the operation has completed */
1655
1688
  async done(options) {
1656
- const op = await this.client.getOperation({ name: this.operation.name }, options);
1689
+ const op = await this.getOperation({ name: this.operation.name }, options);
1657
1690
  this.operation = op;
1658
1691
  return op.done;
1659
1692
  }
1660
1693
  }
1661
1694
  export class DeleteBranchOperation {
1662
- client;
1663
1695
  operation;
1664
- constructor(client, operation) {
1665
- this.client = client;
1696
+ getOperation;
1697
+ constructor(operation, getOperation) {
1666
1698
  this.operation = operation;
1699
+ this.getOperation = getOperation;
1667
1700
  }
1668
1701
  /** Returns the server-assigned name of the long-running operation. */
1669
1702
  name() {
@@ -1685,7 +1718,7 @@ export class DeleteBranchOperation {
1685
1718
  */
1686
1719
  async wait(options) {
1687
1720
  const call = async (callSignal) => {
1688
- const op = await this.client.getOperation({
1721
+ const op = await this.getOperation({
1689
1722
  name: this.operation.name,
1690
1723
  }, callSignal !== undefined ? { signal: callSignal } : undefined);
1691
1724
  this.operation = op;
@@ -1710,17 +1743,17 @@ export class DeleteBranchOperation {
1710
1743
  }
1711
1744
  /** Checks whether the operation has completed */
1712
1745
  async done(options) {
1713
- const op = await this.client.getOperation({ name: this.operation.name }, options);
1746
+ const op = await this.getOperation({ name: this.operation.name }, options);
1714
1747
  this.operation = op;
1715
1748
  return op.done;
1716
1749
  }
1717
1750
  }
1718
1751
  export class DeleteCatalogOperation {
1719
- client;
1720
1752
  operation;
1721
- constructor(client, operation) {
1722
- this.client = client;
1753
+ getOperation;
1754
+ constructor(operation, getOperation) {
1723
1755
  this.operation = operation;
1756
+ this.getOperation = getOperation;
1724
1757
  }
1725
1758
  /** Returns the server-assigned name of the long-running operation. */
1726
1759
  name() {
@@ -1742,7 +1775,7 @@ export class DeleteCatalogOperation {
1742
1775
  */
1743
1776
  async wait(options) {
1744
1777
  const call = async (callSignal) => {
1745
- const op = await this.client.getOperation({
1778
+ const op = await this.getOperation({
1746
1779
  name: this.operation.name,
1747
1780
  }, callSignal !== undefined ? { signal: callSignal } : undefined);
1748
1781
  this.operation = op;
@@ -1767,17 +1800,17 @@ export class DeleteCatalogOperation {
1767
1800
  }
1768
1801
  /** Checks whether the operation has completed */
1769
1802
  async done(options) {
1770
- const op = await this.client.getOperation({ name: this.operation.name }, options);
1803
+ const op = await this.getOperation({ name: this.operation.name }, options);
1771
1804
  this.operation = op;
1772
1805
  return op.done;
1773
1806
  }
1774
1807
  }
1775
1808
  export class DeleteDatabaseOperation {
1776
- client;
1777
1809
  operation;
1778
- constructor(client, operation) {
1779
- this.client = client;
1810
+ getOperation;
1811
+ constructor(operation, getOperation) {
1780
1812
  this.operation = operation;
1813
+ this.getOperation = getOperation;
1781
1814
  }
1782
1815
  /** Returns the server-assigned name of the long-running operation. */
1783
1816
  name() {
@@ -1799,7 +1832,7 @@ export class DeleteDatabaseOperation {
1799
1832
  */
1800
1833
  async wait(options) {
1801
1834
  const call = async (callSignal) => {
1802
- const op = await this.client.getOperation({
1835
+ const op = await this.getOperation({
1803
1836
  name: this.operation.name,
1804
1837
  }, callSignal !== undefined ? { signal: callSignal } : undefined);
1805
1838
  this.operation = op;
@@ -1824,17 +1857,17 @@ export class DeleteDatabaseOperation {
1824
1857
  }
1825
1858
  /** Checks whether the operation has completed */
1826
1859
  async done(options) {
1827
- const op = await this.client.getOperation({ name: this.operation.name }, options);
1860
+ const op = await this.getOperation({ name: this.operation.name }, options);
1828
1861
  this.operation = op;
1829
1862
  return op.done;
1830
1863
  }
1831
1864
  }
1832
1865
  export class DeleteEndpointOperation {
1833
- client;
1834
1866
  operation;
1835
- constructor(client, operation) {
1836
- this.client = client;
1867
+ getOperation;
1868
+ constructor(operation, getOperation) {
1837
1869
  this.operation = operation;
1870
+ this.getOperation = getOperation;
1838
1871
  }
1839
1872
  /** Returns the server-assigned name of the long-running operation. */
1840
1873
  name() {
@@ -1856,7 +1889,7 @@ export class DeleteEndpointOperation {
1856
1889
  */
1857
1890
  async wait(options) {
1858
1891
  const call = async (callSignal) => {
1859
- const op = await this.client.getOperation({
1892
+ const op = await this.getOperation({
1860
1893
  name: this.operation.name,
1861
1894
  }, callSignal !== undefined ? { signal: callSignal } : undefined);
1862
1895
  this.operation = op;
@@ -1881,17 +1914,17 @@ export class DeleteEndpointOperation {
1881
1914
  }
1882
1915
  /** Checks whether the operation has completed */
1883
1916
  async done(options) {
1884
- const op = await this.client.getOperation({ name: this.operation.name }, options);
1917
+ const op = await this.getOperation({ name: this.operation.name }, options);
1885
1918
  this.operation = op;
1886
1919
  return op.done;
1887
1920
  }
1888
1921
  }
1889
1922
  export class DeleteProjectOperation {
1890
- client;
1891
1923
  operation;
1892
- constructor(client, operation) {
1893
- this.client = client;
1924
+ getOperation;
1925
+ constructor(operation, getOperation) {
1894
1926
  this.operation = operation;
1927
+ this.getOperation = getOperation;
1895
1928
  }
1896
1929
  /** Returns the server-assigned name of the long-running operation. */
1897
1930
  name() {
@@ -1913,7 +1946,7 @@ export class DeleteProjectOperation {
1913
1946
  */
1914
1947
  async wait(options) {
1915
1948
  const call = async (callSignal) => {
1916
- const op = await this.client.getOperation({
1949
+ const op = await this.getOperation({
1917
1950
  name: this.operation.name,
1918
1951
  }, callSignal !== undefined ? { signal: callSignal } : undefined);
1919
1952
  this.operation = op;
@@ -1938,17 +1971,17 @@ export class DeleteProjectOperation {
1938
1971
  }
1939
1972
  /** Checks whether the operation has completed */
1940
1973
  async done(options) {
1941
- const op = await this.client.getOperation({ name: this.operation.name }, options);
1974
+ const op = await this.getOperation({ name: this.operation.name }, options);
1942
1975
  this.operation = op;
1943
1976
  return op.done;
1944
1977
  }
1945
1978
  }
1946
1979
  export class DeleteRoleOperation {
1947
- client;
1948
1980
  operation;
1949
- constructor(client, operation) {
1950
- this.client = client;
1981
+ getOperation;
1982
+ constructor(operation, getOperation) {
1951
1983
  this.operation = operation;
1984
+ this.getOperation = getOperation;
1952
1985
  }
1953
1986
  /** Returns the server-assigned name of the long-running operation. */
1954
1987
  name() {
@@ -1970,7 +2003,7 @@ export class DeleteRoleOperation {
1970
2003
  */
1971
2004
  async wait(options) {
1972
2005
  const call = async (callSignal) => {
1973
- const op = await this.client.getOperation({
2006
+ const op = await this.getOperation({
1974
2007
  name: this.operation.name,
1975
2008
  }, callSignal !== undefined ? { signal: callSignal } : undefined);
1976
2009
  this.operation = op;
@@ -1995,17 +2028,17 @@ export class DeleteRoleOperation {
1995
2028
  }
1996
2029
  /** Checks whether the operation has completed */
1997
2030
  async done(options) {
1998
- const op = await this.client.getOperation({ name: this.operation.name }, options);
2031
+ const op = await this.getOperation({ name: this.operation.name }, options);
1999
2032
  this.operation = op;
2000
2033
  return op.done;
2001
2034
  }
2002
2035
  }
2003
2036
  export class DeleteSyncedTableOperation {
2004
- client;
2005
2037
  operation;
2006
- constructor(client, operation) {
2007
- this.client = client;
2038
+ getOperation;
2039
+ constructor(operation, getOperation) {
2008
2040
  this.operation = operation;
2041
+ this.getOperation = getOperation;
2009
2042
  }
2010
2043
  /** Returns the server-assigned name of the long-running operation. */
2011
2044
  name() {
@@ -2027,7 +2060,7 @@ export class DeleteSyncedTableOperation {
2027
2060
  */
2028
2061
  async wait(options) {
2029
2062
  const call = async (callSignal) => {
2030
- const op = await this.client.getOperation({
2063
+ const op = await this.getOperation({
2031
2064
  name: this.operation.name,
2032
2065
  }, callSignal !== undefined ? { signal: callSignal } : undefined);
2033
2066
  this.operation = op;
@@ -2052,17 +2085,17 @@ export class DeleteSyncedTableOperation {
2052
2085
  }
2053
2086
  /** Checks whether the operation has completed */
2054
2087
  async done(options) {
2055
- const op = await this.client.getOperation({ name: this.operation.name }, options);
2088
+ const op = await this.getOperation({ name: this.operation.name }, options);
2056
2089
  this.operation = op;
2057
2090
  return op.done;
2058
2091
  }
2059
2092
  }
2060
2093
  export class UndeleteBranchOperation {
2061
- client;
2062
2094
  operation;
2063
- constructor(client, operation) {
2064
- this.client = client;
2095
+ getOperation;
2096
+ constructor(operation, getOperation) {
2065
2097
  this.operation = operation;
2098
+ this.getOperation = getOperation;
2066
2099
  }
2067
2100
  /** Returns the server-assigned name of the long-running operation. */
2068
2101
  name() {
@@ -2084,7 +2117,7 @@ export class UndeleteBranchOperation {
2084
2117
  */
2085
2118
  async wait(options) {
2086
2119
  const call = async (callSignal) => {
2087
- const op = await this.client.getOperation({
2120
+ const op = await this.getOperation({
2088
2121
  name: this.operation.name,
2089
2122
  }, callSignal !== undefined ? { signal: callSignal } : undefined);
2090
2123
  this.operation = op;
@@ -2109,17 +2142,17 @@ export class UndeleteBranchOperation {
2109
2142
  }
2110
2143
  /** Checks whether the operation has completed */
2111
2144
  async done(options) {
2112
- const op = await this.client.getOperation({ name: this.operation.name }, options);
2145
+ const op = await this.getOperation({ name: this.operation.name }, options);
2113
2146
  this.operation = op;
2114
2147
  return op.done;
2115
2148
  }
2116
2149
  }
2117
2150
  export class UndeleteProjectOperation {
2118
- client;
2119
2151
  operation;
2120
- constructor(client, operation) {
2121
- this.client = client;
2152
+ getOperation;
2153
+ constructor(operation, getOperation) {
2122
2154
  this.operation = operation;
2155
+ this.getOperation = getOperation;
2123
2156
  }
2124
2157
  /** Returns the server-assigned name of the long-running operation. */
2125
2158
  name() {
@@ -2141,7 +2174,7 @@ export class UndeleteProjectOperation {
2141
2174
  */
2142
2175
  async wait(options) {
2143
2176
  const call = async (callSignal) => {
2144
- const op = await this.client.getOperation({
2177
+ const op = await this.getOperation({
2145
2178
  name: this.operation.name,
2146
2179
  }, callSignal !== undefined ? { signal: callSignal } : undefined);
2147
2180
  this.operation = op;
@@ -2166,17 +2199,17 @@ export class UndeleteProjectOperation {
2166
2199
  }
2167
2200
  /** Checks whether the operation has completed */
2168
2201
  async done(options) {
2169
- const op = await this.client.getOperation({ name: this.operation.name }, options);
2202
+ const op = await this.getOperation({ name: this.operation.name }, options);
2170
2203
  this.operation = op;
2171
2204
  return op.done;
2172
2205
  }
2173
2206
  }
2174
2207
  export class UpdateBranchOperation {
2175
- client;
2176
2208
  operation;
2177
- constructor(client, operation) {
2178
- this.client = client;
2209
+ getOperation;
2210
+ constructor(operation, getOperation) {
2179
2211
  this.operation = operation;
2212
+ this.getOperation = getOperation;
2180
2213
  }
2181
2214
  /** Returns the server-assigned name of the long-running operation. */
2182
2215
  name() {
@@ -2199,7 +2232,7 @@ export class UpdateBranchOperation {
2199
2232
  async wait(options) {
2200
2233
  let result;
2201
2234
  const call = async (callSignal) => {
2202
- const op = await this.client.getOperation({
2235
+ const op = await this.getOperation({
2203
2236
  name: this.operation.name,
2204
2237
  }, callSignal !== undefined ? { signal: callSignal } : undefined);
2205
2238
  this.operation = op;
@@ -2232,17 +2265,17 @@ export class UpdateBranchOperation {
2232
2265
  }
2233
2266
  /** Checks whether the operation has completed */
2234
2267
  async done(options) {
2235
- const op = await this.client.getOperation({ name: this.operation.name }, options);
2268
+ const op = await this.getOperation({ name: this.operation.name }, options);
2236
2269
  this.operation = op;
2237
2270
  return op.done;
2238
2271
  }
2239
2272
  }
2240
2273
  export class UpdateDatabaseOperation {
2241
- client;
2242
2274
  operation;
2243
- constructor(client, operation) {
2244
- this.client = client;
2275
+ getOperation;
2276
+ constructor(operation, getOperation) {
2245
2277
  this.operation = operation;
2278
+ this.getOperation = getOperation;
2246
2279
  }
2247
2280
  /** Returns the server-assigned name of the long-running operation. */
2248
2281
  name() {
@@ -2265,7 +2298,7 @@ export class UpdateDatabaseOperation {
2265
2298
  async wait(options) {
2266
2299
  let result;
2267
2300
  const call = async (callSignal) => {
2268
- const op = await this.client.getOperation({
2301
+ const op = await this.getOperation({
2269
2302
  name: this.operation.name,
2270
2303
  }, callSignal !== undefined ? { signal: callSignal } : undefined);
2271
2304
  this.operation = op;
@@ -2298,17 +2331,17 @@ export class UpdateDatabaseOperation {
2298
2331
  }
2299
2332
  /** Checks whether the operation has completed */
2300
2333
  async done(options) {
2301
- const op = await this.client.getOperation({ name: this.operation.name }, options);
2334
+ const op = await this.getOperation({ name: this.operation.name }, options);
2302
2335
  this.operation = op;
2303
2336
  return op.done;
2304
2337
  }
2305
2338
  }
2306
2339
  export class UpdateEndpointOperation {
2307
- client;
2308
2340
  operation;
2309
- constructor(client, operation) {
2310
- this.client = client;
2341
+ getOperation;
2342
+ constructor(operation, getOperation) {
2311
2343
  this.operation = operation;
2344
+ this.getOperation = getOperation;
2312
2345
  }
2313
2346
  /** Returns the server-assigned name of the long-running operation. */
2314
2347
  name() {
@@ -2331,7 +2364,7 @@ export class UpdateEndpointOperation {
2331
2364
  async wait(options) {
2332
2365
  let result;
2333
2366
  const call = async (callSignal) => {
2334
- const op = await this.client.getOperation({
2367
+ const op = await this.getOperation({
2335
2368
  name: this.operation.name,
2336
2369
  }, callSignal !== undefined ? { signal: callSignal } : undefined);
2337
2370
  this.operation = op;
@@ -2364,17 +2397,17 @@ export class UpdateEndpointOperation {
2364
2397
  }
2365
2398
  /** Checks whether the operation has completed */
2366
2399
  async done(options) {
2367
- const op = await this.client.getOperation({ name: this.operation.name }, options);
2400
+ const op = await this.getOperation({ name: this.operation.name }, options);
2368
2401
  this.operation = op;
2369
2402
  return op.done;
2370
2403
  }
2371
2404
  }
2372
2405
  export class UpdateProjectOperation {
2373
- client;
2374
2406
  operation;
2375
- constructor(client, operation) {
2376
- this.client = client;
2407
+ getOperation;
2408
+ constructor(operation, getOperation) {
2377
2409
  this.operation = operation;
2410
+ this.getOperation = getOperation;
2378
2411
  }
2379
2412
  /** Returns the server-assigned name of the long-running operation. */
2380
2413
  name() {
@@ -2397,7 +2430,7 @@ export class UpdateProjectOperation {
2397
2430
  async wait(options) {
2398
2431
  let result;
2399
2432
  const call = async (callSignal) => {
2400
- const op = await this.client.getOperation({
2433
+ const op = await this.getOperation({
2401
2434
  name: this.operation.name,
2402
2435
  }, callSignal !== undefined ? { signal: callSignal } : undefined);
2403
2436
  this.operation = op;
@@ -2430,17 +2463,17 @@ export class UpdateProjectOperation {
2430
2463
  }
2431
2464
  /** Checks whether the operation has completed */
2432
2465
  async done(options) {
2433
- const op = await this.client.getOperation({ name: this.operation.name }, options);
2466
+ const op = await this.getOperation({ name: this.operation.name }, options);
2434
2467
  this.operation = op;
2435
2468
  return op.done;
2436
2469
  }
2437
2470
  }
2438
2471
  export class UpdateRoleOperation {
2439
- client;
2440
2472
  operation;
2441
- constructor(client, operation) {
2442
- this.client = client;
2473
+ getOperation;
2474
+ constructor(operation, getOperation) {
2443
2475
  this.operation = operation;
2476
+ this.getOperation = getOperation;
2444
2477
  }
2445
2478
  /** Returns the server-assigned name of the long-running operation. */
2446
2479
  name() {
@@ -2463,7 +2496,7 @@ export class UpdateRoleOperation {
2463
2496
  async wait(options) {
2464
2497
  let result;
2465
2498
  const call = async (callSignal) => {
2466
- const op = await this.client.getOperation({
2499
+ const op = await this.getOperation({
2467
2500
  name: this.operation.name,
2468
2501
  }, callSignal !== undefined ? { signal: callSignal } : undefined);
2469
2502
  this.operation = op;
@@ -2496,7 +2529,7 @@ export class UpdateRoleOperation {
2496
2529
  }
2497
2530
  /** Checks whether the operation has completed */
2498
2531
  async done(options) {
2499
- const op = await this.client.getOperation({ name: this.operation.name }, options);
2532
+ const op = await this.getOperation({ name: this.operation.name }, options);
2500
2533
  this.operation = op;
2501
2534
  return op.done;
2502
2535
  }