@databricks/sdk-warehouses 0.1.0-dev.1 → 0.1.0-dev.3

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/src/v1/client.ts CHANGED
@@ -1,13 +1,12 @@
1
1
  // Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
2
2
 
3
3
  import {VERSION as AUTH_VERSION} from '@databricks/sdk-auth';
4
- import type {Call} from '@databricks/sdk-core/api';
5
- import {retryOn} from '@databricks/sdk-core/api';
6
4
  import {createDefault} from '@databricks/sdk-core/clientinfo';
7
5
  import type {Logger} from '@databricks/sdk-core/logger';
8
6
  import {NoOpLogger} from '@databricks/sdk-core/logger';
9
7
  import type {CallOptions} from '@databricks/sdk-options/call';
10
8
  import type {ClientOptions} from '@databricks/sdk-options/client';
9
+ import type {LroOptions} from '@databricks/sdk-options/lro';
11
10
  import type {HttpClient} from '@databricks/sdk-core/http';
12
11
  import {newHttpClient} from './transport';
13
12
  import {
@@ -16,34 +15,36 @@ import {
16
15
  executeHttpCall,
17
16
  marshalRequest,
18
17
  parseResponse,
18
+ executeWait,
19
+ StillRunningError,
19
20
  } from './utils';
20
21
  import pkgJson from '../../package.json' with {type: 'json'};
21
22
  import type {
22
23
  CreateDefaultWarehouseOverrideRequest,
23
24
  CreateWarehouseRequest,
24
- CreateWarehouseRequest_Response,
25
+ CreateWarehouseResponse,
25
26
  DefaultWarehouseOverride,
26
27
  DeleteDefaultWarehouseOverrideRequest,
27
28
  DeleteWarehouseRequest,
28
- DeleteWarehouseRequest_Response,
29
+ DeleteWarehouseResponse,
29
30
  EditWarehouseRequest,
30
- EditWarehouseRequest_Response,
31
+ EditWarehouseResponse,
31
32
  EndpointInfo,
32
33
  GetDefaultWarehouseOverrideRequest,
33
34
  GetWarehouseRequest,
34
- GetWarehouseRequest_Response,
35
+ GetWarehouseResponse,
35
36
  GetWorkspaceWarehouseConfigRequest,
36
- GetWorkspaceWarehouseConfigRequest_Response,
37
+ GetWorkspaceWarehouseConfigResponse,
37
38
  ListDefaultWarehouseOverridesRequest,
38
39
  ListDefaultWarehouseOverridesResponse,
39
40
  ListWarehousesRequest,
40
- ListWarehousesRequest_Response,
41
+ ListWarehousesResponse,
41
42
  SetWorkspaceWarehouseConfigRequest,
42
- SetWorkspaceWarehouseConfigRequest_Response,
43
+ SetWorkspaceWarehouseConfigResponse,
43
44
  StartRequest,
44
- StartRequest_Response,
45
+ StartResponse,
45
46
  StopRequest,
46
- StopRequest_Response,
47
+ StopResponse,
47
48
  UpdateDefaultWarehouseOverrideRequest,
48
49
  } from './model';
49
50
  import {
@@ -54,17 +55,17 @@ import {
54
55
  marshalSetWorkspaceWarehouseConfigRequestSchema,
55
56
  marshalStartRequestSchema,
56
57
  marshalStopRequestSchema,
57
- unmarshalCreateWarehouseRequest_ResponseSchema,
58
+ unmarshalCreateWarehouseResponseSchema,
58
59
  unmarshalDefaultWarehouseOverrideSchema,
59
- unmarshalDeleteWarehouseRequest_ResponseSchema,
60
- unmarshalEditWarehouseRequest_ResponseSchema,
61
- unmarshalGetWarehouseRequest_ResponseSchema,
62
- unmarshalGetWorkspaceWarehouseConfigRequest_ResponseSchema,
60
+ unmarshalDeleteWarehouseResponseSchema,
61
+ unmarshalEditWarehouseResponseSchema,
62
+ unmarshalGetWarehouseResponseSchema,
63
+ unmarshalGetWorkspaceWarehouseConfigResponseSchema,
63
64
  unmarshalListDefaultWarehouseOverridesResponseSchema,
64
- unmarshalListWarehousesRequest_ResponseSchema,
65
- unmarshalSetWorkspaceWarehouseConfigRequest_ResponseSchema,
66
- unmarshalStartRequest_ResponseSchema,
67
- unmarshalStopRequest_ResponseSchema,
65
+ unmarshalListWarehousesResponseSchema,
66
+ unmarshalSetWorkspaceWarehouseConfigResponseSchema,
67
+ unmarshalStartResponseSchema,
68
+ unmarshalStopResponseSchema,
68
69
  } from './model';
69
70
 
70
71
  // Package identity segment for this client to be used in the User-Agent header.
@@ -73,8 +74,6 @@ const PACKAGE_SEGMENT = {
73
74
  value: pkgJson.version,
74
75
  };
75
76
 
76
- class StillRunningError extends Error {}
77
-
78
77
  export class WarehousesClient {
79
78
  private readonly host: string;
80
79
  // Workspace ID used to route workspace-level calls on unified hosts (SPOG).
@@ -126,7 +125,7 @@ export class WarehousesClient {
126
125
  marshalDefaultWarehouseOverrideSchema
127
126
  );
128
127
  let resp: DefaultWarehouseOverride | undefined;
129
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
128
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
130
129
  const headers = new Headers({'Content-Type': 'application/json'});
131
130
  if (this.workspaceId !== undefined) {
132
131
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -148,20 +147,20 @@ export class WarehousesClient {
148
147
  };
149
148
  await executeCall(call, options);
150
149
  if (resp === undefined) {
151
- throw new Error('API call completed without a result.');
150
+ throw new Error('operation completed without a result.');
152
151
  }
153
152
  return resp;
154
153
  }
155
154
 
156
155
  /** Creates a new SQL warehouse. */
157
- async createWarehouse(
156
+ private async createWarehouse(
158
157
  req: CreateWarehouseRequest,
159
158
  options?: CallOptions
160
- ): Promise<CreateWarehouseRequest_Response> {
159
+ ): Promise<CreateWarehouseResponse> {
161
160
  const url = `${this.host}/api/2.0/sql/warehouses`;
162
161
  const body = marshalRequest(req, marshalCreateWarehouseRequestSchema);
163
- let resp: CreateWarehouseRequest_Response | undefined;
164
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
162
+ let resp: CreateWarehouseResponse | undefined;
163
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
165
164
  const headers = new Headers({'Content-Type': 'application/json'});
166
165
  if (this.workspaceId !== undefined) {
167
166
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -173,14 +172,11 @@ export class WarehousesClient {
173
172
  httpClient: this.httpClient,
174
173
  logger: this.logger,
175
174
  });
176
- resp = parseResponse(
177
- respBody,
178
- unmarshalCreateWarehouseRequest_ResponseSchema
179
- );
175
+ resp = parseResponse(respBody, unmarshalCreateWarehouseResponseSchema);
180
176
  };
181
177
  await executeCall(call, options);
182
178
  if (resp === undefined) {
183
- throw new Error('API call completed without a result.');
179
+ throw new Error('operation completed without a result.');
184
180
  }
185
181
  return resp;
186
182
  }
@@ -206,7 +202,7 @@ export class WarehousesClient {
206
202
  options?: CallOptions
207
203
  ): Promise<void> {
208
204
  const url = `${this.host}/api/warehouses/v1/${req.name ?? ''}`;
209
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
205
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
210
206
  const headers = new Headers();
211
207
  if (this.workspaceId !== undefined) {
212
208
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -226,10 +222,10 @@ export class WarehousesClient {
226
222
  async deleteWarehouse(
227
223
  req: DeleteWarehouseRequest,
228
224
  options?: CallOptions
229
- ): Promise<DeleteWarehouseRequest_Response> {
225
+ ): Promise<DeleteWarehouseResponse> {
230
226
  const url = `${this.host}/api/2.0/sql/warehouses/${req.id ?? ''}`;
231
- let resp: DeleteWarehouseRequest_Response | undefined;
232
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
227
+ let resp: DeleteWarehouseResponse | undefined;
228
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
233
229
  const headers = new Headers();
234
230
  if (this.workspaceId !== undefined) {
235
231
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -241,27 +237,24 @@ export class WarehousesClient {
241
237
  httpClient: this.httpClient,
242
238
  logger: this.logger,
243
239
  });
244
- resp = parseResponse(
245
- respBody,
246
- unmarshalDeleteWarehouseRequest_ResponseSchema
247
- );
240
+ resp = parseResponse(respBody, unmarshalDeleteWarehouseResponseSchema);
248
241
  };
249
242
  await executeCall(call, options);
250
243
  if (resp === undefined) {
251
- throw new Error('API call completed without a result.');
244
+ throw new Error('operation completed without a result.');
252
245
  }
253
246
  return resp;
254
247
  }
255
248
 
256
249
  /** Updates the configuration for a SQL warehouse. */
257
- async editWarehouse(
250
+ private async editWarehouse(
258
251
  req: EditWarehouseRequest,
259
252
  options?: CallOptions
260
- ): Promise<EditWarehouseRequest_Response> {
253
+ ): Promise<EditWarehouseResponse> {
261
254
  const url = `${this.host}/api/2.0/sql/warehouses/${req.id ?? ''}/edit`;
262
255
  const body = marshalRequest(req, marshalEditWarehouseRequestSchema);
263
- let resp: EditWarehouseRequest_Response | undefined;
264
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
256
+ let resp: EditWarehouseResponse | undefined;
257
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
265
258
  const headers = new Headers({'Content-Type': 'application/json'});
266
259
  if (this.workspaceId !== undefined) {
267
260
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -273,14 +266,11 @@ export class WarehousesClient {
273
266
  httpClient: this.httpClient,
274
267
  logger: this.logger,
275
268
  });
276
- resp = parseResponse(
277
- respBody,
278
- unmarshalEditWarehouseRequest_ResponseSchema
279
- );
269
+ resp = parseResponse(respBody, unmarshalEditWarehouseResponseSchema);
280
270
  };
281
271
  await executeCall(call, options);
282
272
  if (resp === undefined) {
283
- throw new Error('API call completed without a result.');
273
+ throw new Error('operation completed without a result.');
284
274
  }
285
275
  return resp;
286
276
  }
@@ -307,7 +297,7 @@ export class WarehousesClient {
307
297
  ): Promise<DefaultWarehouseOverride> {
308
298
  const url = `${this.host}/api/warehouses/v1/${req.name ?? ''}`;
309
299
  let resp: DefaultWarehouseOverride | undefined;
310
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
300
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
311
301
  const headers = new Headers();
312
302
  if (this.workspaceId !== undefined) {
313
303
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -323,7 +313,7 @@ export class WarehousesClient {
323
313
  };
324
314
  await executeCall(call, options);
325
315
  if (resp === undefined) {
326
- throw new Error('API call completed without a result.');
316
+ throw new Error('operation completed without a result.');
327
317
  }
328
318
  return resp;
329
319
  }
@@ -332,10 +322,10 @@ export class WarehousesClient {
332
322
  async getWarehouse(
333
323
  req: GetWarehouseRequest,
334
324
  options?: CallOptions
335
- ): Promise<GetWarehouseRequest_Response> {
325
+ ): Promise<GetWarehouseResponse> {
336
326
  const url = `${this.host}/api/2.0/sql/warehouses/${req.id ?? ''}`;
337
- let resp: GetWarehouseRequest_Response | undefined;
338
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
327
+ let resp: GetWarehouseResponse | undefined;
328
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
339
329
  const headers = new Headers();
340
330
  if (this.workspaceId !== undefined) {
341
331
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -347,14 +337,11 @@ export class WarehousesClient {
347
337
  httpClient: this.httpClient,
348
338
  logger: this.logger,
349
339
  });
350
- resp = parseResponse(
351
- respBody,
352
- unmarshalGetWarehouseRequest_ResponseSchema
353
- );
340
+ resp = parseResponse(respBody, unmarshalGetWarehouseResponseSchema);
354
341
  };
355
342
  await executeCall(call, options);
356
343
  if (resp === undefined) {
357
- throw new Error('API call completed without a result.');
344
+ throw new Error('operation completed without a result.');
358
345
  }
359
346
  return resp;
360
347
  }
@@ -363,10 +350,10 @@ export class WarehousesClient {
363
350
  async getWorkspaceWarehouseConfig(
364
351
  _req: GetWorkspaceWarehouseConfigRequest,
365
352
  options?: CallOptions
366
- ): Promise<GetWorkspaceWarehouseConfigRequest_Response> {
353
+ ): Promise<GetWorkspaceWarehouseConfigResponse> {
367
354
  const url = `${this.host}/api/2.0/sql/config/warehouses`;
368
- let resp: GetWorkspaceWarehouseConfigRequest_Response | undefined;
369
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
355
+ let resp: GetWorkspaceWarehouseConfigResponse | undefined;
356
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
370
357
  const headers = new Headers();
371
358
  if (this.workspaceId !== undefined) {
372
359
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -380,12 +367,12 @@ export class WarehousesClient {
380
367
  });
381
368
  resp = parseResponse(
382
369
  respBody,
383
- unmarshalGetWorkspaceWarehouseConfigRequest_ResponseSchema
370
+ unmarshalGetWorkspaceWarehouseConfigResponseSchema
384
371
  );
385
372
  };
386
373
  await executeCall(call, options);
387
374
  if (resp === undefined) {
388
- throw new Error('API call completed without a result.');
375
+ throw new Error('operation completed without a result.');
389
376
  }
390
377
  return resp;
391
378
  }
@@ -409,7 +396,7 @@ export class WarehousesClient {
409
396
  const query = params.toString();
410
397
  const fullUrl = query !== '' ? `${url}?${query}` : url;
411
398
  let resp: ListDefaultWarehouseOverridesResponse | undefined;
412
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
399
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
413
400
  const headers = new Headers();
414
401
  if (this.workspaceId !== undefined) {
415
402
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -428,7 +415,7 @@ export class WarehousesClient {
428
415
  };
429
416
  await executeCall(call, options);
430
417
  if (resp === undefined) {
431
- throw new Error('API call completed without a result.');
418
+ throw new Error('operation completed without a result.');
432
419
  }
433
420
  return resp;
434
421
  }
@@ -454,7 +441,7 @@ export class WarehousesClient {
454
441
  async listWarehouses(
455
442
  req: ListWarehousesRequest,
456
443
  options?: CallOptions
457
- ): Promise<ListWarehousesRequest_Response> {
444
+ ): Promise<ListWarehousesResponse> {
458
445
  const url = `${this.host}/api/2.0/sql/warehouses`;
459
446
  const params = new URLSearchParams();
460
447
  if (req.runAsUserId !== undefined) {
@@ -468,8 +455,8 @@ export class WarehousesClient {
468
455
  }
469
456
  const query = params.toString();
470
457
  const fullUrl = query !== '' ? `${url}?${query}` : url;
471
- let resp: ListWarehousesRequest_Response | undefined;
472
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
458
+ let resp: ListWarehousesResponse | undefined;
459
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
473
460
  const headers = new Headers();
474
461
  if (this.workspaceId !== undefined) {
475
462
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -481,14 +468,11 @@ export class WarehousesClient {
481
468
  httpClient: this.httpClient,
482
469
  logger: this.logger,
483
470
  });
484
- resp = parseResponse(
485
- respBody,
486
- unmarshalListWarehousesRequest_ResponseSchema
487
- );
471
+ resp = parseResponse(respBody, unmarshalListWarehousesResponseSchema);
488
472
  };
489
473
  await executeCall(call, options);
490
474
  if (resp === undefined) {
491
- throw new Error('API call completed without a result.');
475
+ throw new Error('operation completed without a result.');
492
476
  }
493
477
  return resp;
494
478
  }
@@ -514,14 +498,14 @@ export class WarehousesClient {
514
498
  async setWorkspaceWarehouseConfig(
515
499
  req: SetWorkspaceWarehouseConfigRequest,
516
500
  options?: CallOptions
517
- ): Promise<SetWorkspaceWarehouseConfigRequest_Response> {
501
+ ): Promise<SetWorkspaceWarehouseConfigResponse> {
518
502
  const url = `${this.host}/api/2.0/sql/config/warehouses`;
519
503
  const body = marshalRequest(
520
504
  req,
521
505
  marshalSetWorkspaceWarehouseConfigRequestSchema
522
506
  );
523
- let resp: SetWorkspaceWarehouseConfigRequest_Response | undefined;
524
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
507
+ let resp: SetWorkspaceWarehouseConfigResponse | undefined;
508
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
525
509
  const headers = new Headers({'Content-Type': 'application/json'});
526
510
  if (this.workspaceId !== undefined) {
527
511
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -535,25 +519,25 @@ export class WarehousesClient {
535
519
  });
536
520
  resp = parseResponse(
537
521
  respBody,
538
- unmarshalSetWorkspaceWarehouseConfigRequest_ResponseSchema
522
+ unmarshalSetWorkspaceWarehouseConfigResponseSchema
539
523
  );
540
524
  };
541
525
  await executeCall(call, options);
542
526
  if (resp === undefined) {
543
- throw new Error('API call completed without a result.');
527
+ throw new Error('operation completed without a result.');
544
528
  }
545
529
  return resp;
546
530
  }
547
531
 
548
532
  /** Starts a SQL warehouse. */
549
- async startWarehouse(
533
+ private async startWarehouse(
550
534
  req: StartRequest,
551
535
  options?: CallOptions
552
- ): Promise<StartRequest_Response> {
536
+ ): Promise<StartResponse> {
553
537
  const url = `${this.host}/api/2.0/sql/warehouses/${req.id ?? ''}/start`;
554
538
  const body = marshalRequest(req, marshalStartRequestSchema);
555
- let resp: StartRequest_Response | undefined;
556
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
539
+ let resp: StartResponse | undefined;
540
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
557
541
  const headers = new Headers({'Content-Type': 'application/json'});
558
542
  if (this.workspaceId !== undefined) {
559
543
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -565,11 +549,11 @@ export class WarehousesClient {
565
549
  httpClient: this.httpClient,
566
550
  logger: this.logger,
567
551
  });
568
- resp = parseResponse(respBody, unmarshalStartRequest_ResponseSchema);
552
+ resp = parseResponse(respBody, unmarshalStartResponseSchema);
569
553
  };
570
554
  await executeCall(call, options);
571
555
  if (resp === undefined) {
572
- throw new Error('API call completed without a result.');
556
+ throw new Error('operation completed without a result.');
573
557
  }
574
558
  return resp;
575
559
  }
@@ -586,14 +570,14 @@ export class WarehousesClient {
586
570
  }
587
571
 
588
572
  /** Stops a SQL warehouse. */
589
- async stopWarehouse(
573
+ private async stopWarehouse(
590
574
  req: StopRequest,
591
575
  options?: CallOptions
592
- ): Promise<StopRequest_Response> {
576
+ ): Promise<StopResponse> {
593
577
  const url = `${this.host}/api/2.0/sql/warehouses/${req.id ?? ''}/stop`;
594
578
  const body = marshalRequest(req, marshalStopRequestSchema);
595
- let resp: StopRequest_Response | undefined;
596
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
579
+ let resp: StopResponse | undefined;
580
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
597
581
  const headers = new Headers({'Content-Type': 'application/json'});
598
582
  if (this.workspaceId !== undefined) {
599
583
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -605,11 +589,11 @@ export class WarehousesClient {
605
589
  httpClient: this.httpClient,
606
590
  logger: this.logger,
607
591
  });
608
- resp = parseResponse(respBody, unmarshalStopRequest_ResponseSchema);
592
+ resp = parseResponse(respBody, unmarshalStopResponseSchema);
609
593
  };
610
594
  await executeCall(call, options);
611
595
  if (resp === undefined) {
612
- throw new Error('API call completed without a result.');
596
+ throw new Error('operation completed without a result.');
613
597
  }
614
598
  return resp;
615
599
  }
@@ -648,7 +632,7 @@ export class WarehousesClient {
648
632
  marshalDefaultWarehouseOverrideSchema
649
633
  );
650
634
  let resp: DefaultWarehouseOverride | undefined;
651
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
635
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
652
636
  const headers = new Headers({'Content-Type': 'application/json'});
653
637
  if (this.workspaceId !== undefined) {
654
638
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -670,7 +654,7 @@ export class WarehousesClient {
670
654
  };
671
655
  await executeCall(call, options);
672
656
  if (resp === undefined) {
673
- throw new Error('API call completed without a result.');
657
+ throw new Error('operation completed without a result.');
674
658
  }
675
659
  return resp;
676
660
  }
@@ -687,15 +671,15 @@ export class CreateWarehouseWaiter {
687
671
  *
688
672
  * Throws if a failure state is reached.
689
673
  */
690
- async wait(options?: CallOptions): Promise<GetWarehouseRequest_Response> {
691
- let result: GetWarehouseRequest_Response | undefined;
674
+ async wait(options?: LroOptions): Promise<GetWarehouseResponse> {
675
+ let result: GetWarehouseResponse | undefined;
692
676
 
693
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
677
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
694
678
  const pollResp = await this.client.getWarehouse(
695
679
  {
696
680
  id: this.id,
697
681
  },
698
- {...options, ...(callSignal !== undefined && {signal: callSignal})}
682
+ callSignal !== undefined ? {signal: callSignal} : undefined
699
683
  );
700
684
 
701
685
  const status = pollResp.state;
@@ -717,16 +701,9 @@ export class CreateWarehouseWaiter {
717
701
  }
718
702
  };
719
703
 
720
- const retryOptions: CallOptions = {
721
- ...(options?.signal !== undefined && {signal: options.signal}),
722
- retrier: () =>
723
- retryOn({}, (err: Error) => {
724
- return err instanceof StillRunningError;
725
- }),
726
- };
727
- await executeCall(call, retryOptions);
704
+ await executeWait(call, options);
728
705
  if (result === undefined) {
729
- throw new Error('API call completed without a result.');
706
+ throw new Error('operation completed without a result.');
730
707
  }
731
708
  return result;
732
709
  }
@@ -767,15 +744,15 @@ export class EditWarehouseWaiter {
767
744
  *
768
745
  * Throws if a failure state is reached.
769
746
  */
770
- async wait(options?: CallOptions): Promise<GetWarehouseRequest_Response> {
771
- let result: GetWarehouseRequest_Response | undefined;
747
+ async wait(options?: LroOptions): Promise<GetWarehouseResponse> {
748
+ let result: GetWarehouseResponse | undefined;
772
749
 
773
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
750
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
774
751
  const pollResp = await this.client.getWarehouse(
775
752
  {
776
753
  id: this.id,
777
754
  },
778
- {...options, ...(callSignal !== undefined && {signal: callSignal})}
755
+ callSignal !== undefined ? {signal: callSignal} : undefined
779
756
  );
780
757
 
781
758
  const status = pollResp.state;
@@ -797,16 +774,9 @@ export class EditWarehouseWaiter {
797
774
  }
798
775
  };
799
776
 
800
- const retryOptions: CallOptions = {
801
- ...(options?.signal !== undefined && {signal: options.signal}),
802
- retrier: () =>
803
- retryOn({}, (err: Error) => {
804
- return err instanceof StillRunningError;
805
- }),
806
- };
807
- await executeCall(call, retryOptions);
777
+ await executeWait(call, options);
808
778
  if (result === undefined) {
809
- throw new Error('API call completed without a result.');
779
+ throw new Error('operation completed without a result.');
810
780
  }
811
781
  return result;
812
782
  }
@@ -847,15 +817,15 @@ export class StartWarehouseWaiter {
847
817
  *
848
818
  * Throws if a failure state is reached.
849
819
  */
850
- async wait(options?: CallOptions): Promise<GetWarehouseRequest_Response> {
851
- let result: GetWarehouseRequest_Response | undefined;
820
+ async wait(options?: LroOptions): Promise<GetWarehouseResponse> {
821
+ let result: GetWarehouseResponse | undefined;
852
822
 
853
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
823
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
854
824
  const pollResp = await this.client.getWarehouse(
855
825
  {
856
826
  id: this.id,
857
827
  },
858
- {...options, ...(callSignal !== undefined && {signal: callSignal})}
828
+ callSignal !== undefined ? {signal: callSignal} : undefined
859
829
  );
860
830
 
861
831
  const status = pollResp.state;
@@ -877,16 +847,9 @@ export class StartWarehouseWaiter {
877
847
  }
878
848
  };
879
849
 
880
- const retryOptions: CallOptions = {
881
- ...(options?.signal !== undefined && {signal: options.signal}),
882
- retrier: () =>
883
- retryOn({}, (err: Error) => {
884
- return err instanceof StillRunningError;
885
- }),
886
- };
887
- await executeCall(call, retryOptions);
850
+ await executeWait(call, options);
888
851
  if (result === undefined) {
889
- throw new Error('API call completed without a result.');
852
+ throw new Error('operation completed without a result.');
890
853
  }
891
854
  return result;
892
855
  }
@@ -927,15 +890,15 @@ export class StopWarehouseWaiter {
927
890
  *
928
891
  * Throws if a failure state is reached.
929
892
  */
930
- async wait(options?: CallOptions): Promise<GetWarehouseRequest_Response> {
931
- let result: GetWarehouseRequest_Response | undefined;
893
+ async wait(options?: LroOptions): Promise<GetWarehouseResponse> {
894
+ let result: GetWarehouseResponse | undefined;
932
895
 
933
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
896
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
934
897
  const pollResp = await this.client.getWarehouse(
935
898
  {
936
899
  id: this.id,
937
900
  },
938
- {...options, ...(callSignal !== undefined && {signal: callSignal})}
901
+ callSignal !== undefined ? {signal: callSignal} : undefined
939
902
  );
940
903
 
941
904
  const status = pollResp.state;
@@ -952,16 +915,9 @@ export class StopWarehouseWaiter {
952
915
  }
953
916
  };
954
917
 
955
- const retryOptions: CallOptions = {
956
- ...(options?.signal !== undefined && {signal: options.signal}),
957
- retrier: () =>
958
- retryOn({}, (err: Error) => {
959
- return err instanceof StillRunningError;
960
- }),
961
- };
962
- await executeCall(call, retryOptions);
918
+ await executeWait(call, options);
963
919
  if (result === undefined) {
964
- throw new Error('API call completed without a result.');
920
+ throw new Error('operation completed without a result.');
965
921
  }
966
922
  return result;
967
923
  }
package/src/v1/index.ts CHANGED
@@ -24,11 +24,12 @@ export type {
24
24
  Channel,
25
25
  CreateDefaultWarehouseOverrideRequest,
26
26
  CreateWarehouseRequest,
27
- CreateWarehouseRequest_Response,
27
+ CreateWarehouseResponse,
28
28
  DefaultWarehouseOverride,
29
29
  DeleteDefaultWarehouseOverrideRequest,
30
+ DeleteWarehouseResponse,
30
31
  EditWarehouseRequest,
31
- EditWarehouseRequest_Response,
32
+ EditWarehouseResponse,
32
33
  EndpointConfPair,
33
34
  EndpointHealth,
34
35
  EndpointInfo,
@@ -36,27 +37,26 @@ export type {
36
37
  EndpointTags,
37
38
  GetDefaultWarehouseOverrideRequest,
38
39
  GetWarehouseRequest,
39
- GetWarehouseRequest_Response,
40
+ GetWarehouseResponse,
40
41
  GetWorkspaceWarehouseConfigRequest,
41
- GetWorkspaceWarehouseConfigRequest_Response,
42
+ GetWorkspaceWarehouseConfigResponse,
42
43
  ListDefaultWarehouseOverridesRequest,
43
44
  ListDefaultWarehouseOverridesResponse,
45
+ ListWarehousesResponse,
44
46
  OdbcParams,
45
47
  RepeatedEndpointConfPairs,
46
48
  SetWorkspaceWarehouseConfigRequest,
47
- SetWorkspaceWarehouseConfigRequest_Response,
49
+ SetWorkspaceWarehouseConfigResponse,
50
+ StartResponse,
51
+ StopResponse,
48
52
  TerminationReason,
49
53
  TerminationReason_ParametersEntry,
50
54
  UpdateDefaultWarehouseOverrideRequest,
51
55
  WarehouseTypePair,
52
56
  DeleteWarehouseRequest,
53
- DeleteWarehouseRequest_Response,
54
57
  ListWarehousesRequest,
55
- ListWarehousesRequest_Response,
56
58
  StartRequest,
57
- StartRequest_Response,
58
59
  StopRequest,
59
- StopRequest_Response,
60
60
  } from './model';
61
61
 
62
62
  export {defaultWarehouseOverrideFieldMask} from './model';