@databricks/sdk-jobs 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/v2/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,50 +15,52 @@ 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
  BaseJob,
23
24
  BaseRun,
24
25
  CancelAllRunsRequest,
25
- CancelAllRunsRequest_Response,
26
+ CancelAllRunsResponse,
26
27
  CancelRunRequest,
27
- CancelRunRequest_Response,
28
+ CancelRunResponse,
28
29
  CreateJobRequest,
29
- CreateJobRequest_Response,
30
+ CreateJobResponse,
30
31
  DeleteJobRequest,
31
- DeleteJobRequest_Response,
32
+ DeleteJobResponse,
32
33
  DeleteRunRequest,
33
- DeleteRunRequest_Response,
34
+ DeleteRunResponse,
34
35
  EnforcePolicyComplianceForJob,
35
- EnforcePolicyComplianceForJob_Response,
36
+ EnforcePolicyComplianceResponse,
36
37
  ExportRunRequest,
37
- ExportRunRequest_Response,
38
+ ExportRunResponse,
38
39
  GetJobRequest,
39
- GetJobRequest_Response,
40
+ GetJobResponse,
40
41
  GetPolicyComplianceForJob,
41
- GetPolicyComplianceForJob_Response,
42
+ GetPolicyComplianceForJobResponse,
42
43
  GetRunOutputRequest,
43
- GetRunOutputRequest_Response,
44
+ GetRunOutputResponse,
44
45
  GetRunRequest,
45
- GetRunRequest_Response,
46
+ GetRunResponse,
46
47
  ListJobComplianceForPolicy,
47
48
  ListJobComplianceForPolicy_JobCompliance,
48
- ListJobComplianceForPolicy_Response,
49
+ ListJobComplianceResponse,
49
50
  ListJobsRequest,
50
- ListJobsRequest_Response,
51
+ ListJobsResponse,
51
52
  ListRunsRequest,
52
- ListRunsRequest_Response,
53
+ ListRunsResponse,
53
54
  RepairRunRequest,
54
- RepairRunRequest_Response,
55
+ RepairRunResponse,
55
56
  ResetJobRequest,
56
- ResetJobRequest_Response,
57
+ ResetJobResponse,
57
58
  RunNowRequest,
58
- RunNowRequest_Response,
59
+ RunNowResponse,
59
60
  SubmitRunRequest,
60
- SubmitRunRequest_Response,
61
+ SubmitRunResponse,
61
62
  UpdateJobRequest,
62
- UpdateJobRequest_Response,
63
+ UpdateJobResponse,
63
64
  } from './model';
64
65
  import {
65
66
  RunLifeCycleState_RunLifeCycleState,
@@ -74,25 +75,25 @@ import {
74
75
  marshalRunNowRequestSchema,
75
76
  marshalSubmitRunRequestSchema,
76
77
  marshalUpdateJobRequestSchema,
77
- unmarshalCancelAllRunsRequest_ResponseSchema,
78
- unmarshalCancelRunRequest_ResponseSchema,
79
- unmarshalCreateJobRequest_ResponseSchema,
80
- unmarshalDeleteJobRequest_ResponseSchema,
81
- unmarshalDeleteRunRequest_ResponseSchema,
82
- unmarshalEnforcePolicyComplianceForJob_ResponseSchema,
83
- unmarshalExportRunRequest_ResponseSchema,
84
- unmarshalGetJobRequest_ResponseSchema,
85
- unmarshalGetPolicyComplianceForJob_ResponseSchema,
86
- unmarshalGetRunOutputRequest_ResponseSchema,
87
- unmarshalGetRunRequest_ResponseSchema,
88
- unmarshalListJobComplianceForPolicy_ResponseSchema,
89
- unmarshalListJobsRequest_ResponseSchema,
90
- unmarshalListRunsRequest_ResponseSchema,
91
- unmarshalRepairRunRequest_ResponseSchema,
92
- unmarshalResetJobRequest_ResponseSchema,
93
- unmarshalRunNowRequest_ResponseSchema,
94
- unmarshalSubmitRunRequest_ResponseSchema,
95
- unmarshalUpdateJobRequest_ResponseSchema,
78
+ unmarshalCancelAllRunsResponseSchema,
79
+ unmarshalCancelRunResponseSchema,
80
+ unmarshalCreateJobResponseSchema,
81
+ unmarshalDeleteJobResponseSchema,
82
+ unmarshalDeleteRunResponseSchema,
83
+ unmarshalEnforcePolicyComplianceResponseSchema,
84
+ unmarshalExportRunResponseSchema,
85
+ unmarshalGetJobResponseSchema,
86
+ unmarshalGetPolicyComplianceForJobResponseSchema,
87
+ unmarshalGetRunOutputResponseSchema,
88
+ unmarshalGetRunResponseSchema,
89
+ unmarshalListJobComplianceResponseSchema,
90
+ unmarshalListJobsResponseSchema,
91
+ unmarshalListRunsResponseSchema,
92
+ unmarshalRepairRunResponseSchema,
93
+ unmarshalResetJobResponseSchema,
94
+ unmarshalRunNowResponseSchema,
95
+ unmarshalSubmitRunResponseSchema,
96
+ unmarshalUpdateJobResponseSchema,
96
97
  } from './model';
97
98
 
98
99
  // Package identity segment for this client to be used in the User-Agent header.
@@ -101,8 +102,6 @@ const PACKAGE_SEGMENT = {
101
102
  value: pkgJson.version,
102
103
  };
103
104
 
104
- class StillRunningError extends Error {}
105
-
106
105
  export class JobsClient {
107
106
  private readonly host: string;
108
107
  // Workspace ID used to route workspace-level calls on unified hosts (SPOG).
@@ -140,14 +139,14 @@ export class JobsClient {
140
139
  async enforcePolicyComplianceForJob(
141
140
  req: EnforcePolicyComplianceForJob,
142
141
  options?: CallOptions
143
- ): Promise<EnforcePolicyComplianceForJob_Response> {
142
+ ): Promise<EnforcePolicyComplianceResponse> {
144
143
  const url = `${this.host}/api/2.0/policies/jobs/enforce-compliance`;
145
144
  const body = marshalRequest(
146
145
  req,
147
146
  marshalEnforcePolicyComplianceForJobSchema
148
147
  );
149
- let resp: EnforcePolicyComplianceForJob_Response | undefined;
150
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
148
+ let resp: EnforcePolicyComplianceResponse | undefined;
149
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
151
150
  const headers = new Headers({'Content-Type': 'application/json'});
152
151
  if (this.workspaceId !== undefined) {
153
152
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -161,12 +160,12 @@ export class JobsClient {
161
160
  });
162
161
  resp = parseResponse(
163
162
  respBody,
164
- unmarshalEnforcePolicyComplianceForJob_ResponseSchema
163
+ unmarshalEnforcePolicyComplianceResponseSchema
165
164
  );
166
165
  };
167
166
  await executeCall(call, options);
168
167
  if (resp === undefined) {
169
- throw new Error('API call completed without a result.');
168
+ throw new Error('operation completed without a result.');
170
169
  }
171
170
  return resp;
172
171
  }
@@ -180,7 +179,7 @@ export class JobsClient {
180
179
  async getPolicyComplianceForJob(
181
180
  req: GetPolicyComplianceForJob,
182
181
  options?: CallOptions
183
- ): Promise<GetPolicyComplianceForJob_Response> {
182
+ ): Promise<GetPolicyComplianceForJobResponse> {
184
183
  const url = `${this.host}/api/2.0/policies/jobs/get-compliance`;
185
184
  const params = new URLSearchParams();
186
185
  if (req.jobId !== undefined) {
@@ -188,8 +187,8 @@ export class JobsClient {
188
187
  }
189
188
  const query = params.toString();
190
189
  const fullUrl = query !== '' ? `${url}?${query}` : url;
191
- let resp: GetPolicyComplianceForJob_Response | undefined;
192
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
190
+ let resp: GetPolicyComplianceForJobResponse | undefined;
191
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
193
192
  const headers = new Headers();
194
193
  if (this.workspaceId !== undefined) {
195
194
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -203,12 +202,12 @@ export class JobsClient {
203
202
  });
204
203
  resp = parseResponse(
205
204
  respBody,
206
- unmarshalGetPolicyComplianceForJob_ResponseSchema
205
+ unmarshalGetPolicyComplianceForJobResponseSchema
207
206
  );
208
207
  };
209
208
  await executeCall(call, options);
210
209
  if (resp === undefined) {
211
- throw new Error('API call completed without a result.');
210
+ throw new Error('operation completed without a result.');
212
211
  }
213
212
  return resp;
214
213
  }
@@ -222,7 +221,7 @@ export class JobsClient {
222
221
  async listJobComplianceForPolicy(
223
222
  req: ListJobComplianceForPolicy,
224
223
  options?: CallOptions
225
- ): Promise<ListJobComplianceForPolicy_Response> {
224
+ ): Promise<ListJobComplianceResponse> {
226
225
  const url = `${this.host}/api/2.0/policies/jobs/list-compliance`;
227
226
  const params = new URLSearchParams();
228
227
  if (req.policyId !== undefined) {
@@ -236,8 +235,8 @@ export class JobsClient {
236
235
  }
237
236
  const query = params.toString();
238
237
  const fullUrl = query !== '' ? `${url}?${query}` : url;
239
- let resp: ListJobComplianceForPolicy_Response | undefined;
240
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
238
+ let resp: ListJobComplianceResponse | undefined;
239
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
241
240
  const headers = new Headers();
242
241
  if (this.workspaceId !== undefined) {
243
242
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -249,14 +248,11 @@ export class JobsClient {
249
248
  httpClient: this.httpClient,
250
249
  logger: this.logger,
251
250
  });
252
- resp = parseResponse(
253
- respBody,
254
- unmarshalListJobComplianceForPolicy_ResponseSchema
255
- );
251
+ resp = parseResponse(respBody, unmarshalListJobComplianceResponseSchema);
256
252
  };
257
253
  await executeCall(call, options);
258
254
  if (resp === undefined) {
259
- throw new Error('API call completed without a result.');
255
+ throw new Error('operation completed without a result.');
260
256
  }
261
257
  return resp;
262
258
  }
@@ -285,11 +281,11 @@ export class JobsClient {
285
281
  async cancelAllRuns(
286
282
  req: CancelAllRunsRequest,
287
283
  options?: CallOptions
288
- ): Promise<CancelAllRunsRequest_Response> {
284
+ ): Promise<CancelAllRunsResponse> {
289
285
  const url = `${this.host}/api/2.2/jobs/runs/cancel-all`;
290
286
  const body = marshalRequest(req, marshalCancelAllRunsRequestSchema);
291
- let resp: CancelAllRunsRequest_Response | undefined;
292
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
287
+ let resp: CancelAllRunsResponse | undefined;
288
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
293
289
  const headers = new Headers({'Content-Type': 'application/json'});
294
290
  if (this.workspaceId !== undefined) {
295
291
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -301,14 +297,11 @@ export class JobsClient {
301
297
  httpClient: this.httpClient,
302
298
  logger: this.logger,
303
299
  });
304
- resp = parseResponse(
305
- respBody,
306
- unmarshalCancelAllRunsRequest_ResponseSchema
307
- );
300
+ resp = parseResponse(respBody, unmarshalCancelAllRunsResponseSchema);
308
301
  };
309
302
  await executeCall(call, options);
310
303
  if (resp === undefined) {
311
- throw new Error('API call completed without a result.');
304
+ throw new Error('operation completed without a result.');
312
305
  }
313
306
  return resp;
314
307
  }
@@ -317,14 +310,14 @@ export class JobsClient {
317
310
  * Cancels a job run or a task run. The run is canceled asynchronously, so it may still be running when
318
311
  * this request completes.
319
312
  */
320
- async cancelRun(
313
+ private async cancelRun(
321
314
  req: CancelRunRequest,
322
315
  options?: CallOptions
323
- ): Promise<CancelRunRequest_Response> {
316
+ ): Promise<CancelRunResponse> {
324
317
  const url = `${this.host}/api/2.2/jobs/runs/cancel`;
325
318
  const body = marshalRequest(req, marshalCancelRunRequestSchema);
326
- let resp: CancelRunRequest_Response | undefined;
327
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
319
+ let resp: CancelRunResponse | undefined;
320
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
328
321
  const headers = new Headers({'Content-Type': 'application/json'});
329
322
  if (this.workspaceId !== undefined) {
330
323
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -336,11 +329,11 @@ export class JobsClient {
336
329
  httpClient: this.httpClient,
337
330
  logger: this.logger,
338
331
  });
339
- resp = parseResponse(respBody, unmarshalCancelRunRequest_ResponseSchema);
332
+ resp = parseResponse(respBody, unmarshalCancelRunResponseSchema);
340
333
  };
341
334
  await executeCall(call, options);
342
335
  if (resp === undefined) {
343
- throw new Error('API call completed without a result.');
336
+ throw new Error('operation completed without a result.');
344
337
  }
345
338
  return resp;
346
339
  }
@@ -360,11 +353,11 @@ export class JobsClient {
360
353
  async createJob(
361
354
  req: CreateJobRequest,
362
355
  options?: CallOptions
363
- ): Promise<CreateJobRequest_Response> {
356
+ ): Promise<CreateJobResponse> {
364
357
  const url = `${this.host}/api/2.2/jobs/create`;
365
358
  const body = marshalRequest(req, marshalCreateJobRequestSchema);
366
- let resp: CreateJobRequest_Response | undefined;
367
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
359
+ let resp: CreateJobResponse | undefined;
360
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
368
361
  const headers = new Headers({'Content-Type': 'application/json'});
369
362
  if (this.workspaceId !== undefined) {
370
363
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -376,11 +369,11 @@ export class JobsClient {
376
369
  httpClient: this.httpClient,
377
370
  logger: this.logger,
378
371
  });
379
- resp = parseResponse(respBody, unmarshalCreateJobRequest_ResponseSchema);
372
+ resp = parseResponse(respBody, unmarshalCreateJobResponseSchema);
380
373
  };
381
374
  await executeCall(call, options);
382
375
  if (resp === undefined) {
383
- throw new Error('API call completed without a result.');
376
+ throw new Error('operation completed without a result.');
384
377
  }
385
378
  return resp;
386
379
  }
@@ -389,11 +382,11 @@ export class JobsClient {
389
382
  async deleteJob(
390
383
  req: DeleteJobRequest,
391
384
  options?: CallOptions
392
- ): Promise<DeleteJobRequest_Response> {
385
+ ): Promise<DeleteJobResponse> {
393
386
  const url = `${this.host}/api/2.2/jobs/delete`;
394
387
  const body = marshalRequest(req, marshalDeleteJobRequestSchema);
395
- let resp: DeleteJobRequest_Response | undefined;
396
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
388
+ let resp: DeleteJobResponse | undefined;
389
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
397
390
  const headers = new Headers({'Content-Type': 'application/json'});
398
391
  if (this.workspaceId !== undefined) {
399
392
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -405,11 +398,11 @@ export class JobsClient {
405
398
  httpClient: this.httpClient,
406
399
  logger: this.logger,
407
400
  });
408
- resp = parseResponse(respBody, unmarshalDeleteJobRequest_ResponseSchema);
401
+ resp = parseResponse(respBody, unmarshalDeleteJobResponseSchema);
409
402
  };
410
403
  await executeCall(call, options);
411
404
  if (resp === undefined) {
412
- throw new Error('API call completed without a result.');
405
+ throw new Error('operation completed without a result.');
413
406
  }
414
407
  return resp;
415
408
  }
@@ -418,11 +411,11 @@ export class JobsClient {
418
411
  async deleteRun(
419
412
  req: DeleteRunRequest,
420
413
  options?: CallOptions
421
- ): Promise<DeleteRunRequest_Response> {
414
+ ): Promise<DeleteRunResponse> {
422
415
  const url = `${this.host}/api/2.2/jobs/runs/delete`;
423
416
  const body = marshalRequest(req, marshalDeleteRunRequestSchema);
424
- let resp: DeleteRunRequest_Response | undefined;
425
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
417
+ let resp: DeleteRunResponse | undefined;
418
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
426
419
  const headers = new Headers({'Content-Type': 'application/json'});
427
420
  if (this.workspaceId !== undefined) {
428
421
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -434,11 +427,11 @@ export class JobsClient {
434
427
  httpClient: this.httpClient,
435
428
  logger: this.logger,
436
429
  });
437
- resp = parseResponse(respBody, unmarshalDeleteRunRequest_ResponseSchema);
430
+ resp = parseResponse(respBody, unmarshalDeleteRunResponseSchema);
438
431
  };
439
432
  await executeCall(call, options);
440
433
  if (resp === undefined) {
441
- throw new Error('API call completed without a result.');
434
+ throw new Error('operation completed without a result.');
442
435
  }
443
436
  return resp;
444
437
  }
@@ -447,7 +440,7 @@ export class JobsClient {
447
440
  async exportRun(
448
441
  req: ExportRunRequest,
449
442
  options?: CallOptions
450
- ): Promise<ExportRunRequest_Response> {
443
+ ): Promise<ExportRunResponse> {
451
444
  const url = `${this.host}/api/2.2/jobs/runs/export`;
452
445
  const params = new URLSearchParams();
453
446
  if (req.runId !== undefined) {
@@ -458,8 +451,8 @@ export class JobsClient {
458
451
  }
459
452
  const query = params.toString();
460
453
  const fullUrl = query !== '' ? `${url}?${query}` : url;
461
- let resp: ExportRunRequest_Response | undefined;
462
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
454
+ let resp: ExportRunResponse | undefined;
455
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
463
456
  const headers = new Headers();
464
457
  if (this.workspaceId !== undefined) {
465
458
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -471,11 +464,11 @@ export class JobsClient {
471
464
  httpClient: this.httpClient,
472
465
  logger: this.logger,
473
466
  });
474
- resp = parseResponse(respBody, unmarshalExportRunRequest_ResponseSchema);
467
+ resp = parseResponse(respBody, unmarshalExportRunResponseSchema);
475
468
  };
476
469
  await executeCall(call, options);
477
470
  if (resp === undefined) {
478
- throw new Error('API call completed without a result.');
471
+ throw new Error('operation completed without a result.');
479
472
  }
480
473
  return resp;
481
474
  }
@@ -491,7 +484,7 @@ export class JobsClient {
491
484
  async getJob(
492
485
  req: GetJobRequest,
493
486
  options?: CallOptions
494
- ): Promise<GetJobRequest_Response> {
487
+ ): Promise<GetJobResponse> {
495
488
  const url = `${this.host}/api/2.2/jobs/get`;
496
489
  const params = new URLSearchParams();
497
490
  if (req.jobId !== undefined) {
@@ -505,8 +498,8 @@ export class JobsClient {
505
498
  }
506
499
  const query = params.toString();
507
500
  const fullUrl = query !== '' ? `${url}?${query}` : url;
508
- let resp: GetJobRequest_Response | undefined;
509
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
501
+ let resp: GetJobResponse | undefined;
502
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
510
503
  const headers = new Headers();
511
504
  if (this.workspaceId !== undefined) {
512
505
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -518,11 +511,11 @@ export class JobsClient {
518
511
  httpClient: this.httpClient,
519
512
  logger: this.logger,
520
513
  });
521
- resp = parseResponse(respBody, unmarshalGetJobRequest_ResponseSchema);
514
+ resp = parseResponse(respBody, unmarshalGetJobResponseSchema);
522
515
  };
523
516
  await executeCall(call, options);
524
517
  if (resp === undefined) {
525
- throw new Error('API call completed without a result.');
518
+ throw new Error('operation completed without a result.');
526
519
  }
527
520
  return resp;
528
521
  }
@@ -538,7 +531,7 @@ export class JobsClient {
538
531
  async getRun(
539
532
  req: GetRunRequest,
540
533
  options?: CallOptions
541
- ): Promise<GetRunRequest_Response> {
534
+ ): Promise<GetRunResponse> {
542
535
  const url = `${this.host}/api/2.2/jobs/runs/get`;
543
536
  const params = new URLSearchParams();
544
537
  if (req.runId !== undefined) {
@@ -558,8 +551,8 @@ export class JobsClient {
558
551
  }
559
552
  const query = params.toString();
560
553
  const fullUrl = query !== '' ? `${url}?${query}` : url;
561
- let resp: GetRunRequest_Response | undefined;
562
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
554
+ let resp: GetRunResponse | undefined;
555
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
563
556
  const headers = new Headers();
564
557
  if (this.workspaceId !== undefined) {
565
558
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -571,11 +564,11 @@ export class JobsClient {
571
564
  httpClient: this.httpClient,
572
565
  logger: this.logger,
573
566
  });
574
- resp = parseResponse(respBody, unmarshalGetRunRequest_ResponseSchema);
567
+ resp = parseResponse(respBody, unmarshalGetRunResponseSchema);
575
568
  };
576
569
  await executeCall(call, options);
577
570
  if (resp === undefined) {
578
- throw new Error('API call completed without a result.');
571
+ throw new Error('operation completed without a result.');
579
572
  }
580
573
  return resp;
581
574
  }
@@ -594,7 +587,7 @@ export class JobsClient {
594
587
  async getRunOutput(
595
588
  req: GetRunOutputRequest,
596
589
  options?: CallOptions
597
- ): Promise<GetRunOutputRequest_Response> {
590
+ ): Promise<GetRunOutputResponse> {
598
591
  const url = `${this.host}/api/2.2/jobs/runs/get-output`;
599
592
  const params = new URLSearchParams();
600
593
  if (req.runId !== undefined) {
@@ -602,8 +595,8 @@ export class JobsClient {
602
595
  }
603
596
  const query = params.toString();
604
597
  const fullUrl = query !== '' ? `${url}?${query}` : url;
605
- let resp: GetRunOutputRequest_Response | undefined;
606
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
598
+ let resp: GetRunOutputResponse | undefined;
599
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
607
600
  const headers = new Headers();
608
601
  if (this.workspaceId !== undefined) {
609
602
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -615,14 +608,11 @@ export class JobsClient {
615
608
  httpClient: this.httpClient,
616
609
  logger: this.logger,
617
610
  });
618
- resp = parseResponse(
619
- respBody,
620
- unmarshalGetRunOutputRequest_ResponseSchema
621
- );
611
+ resp = parseResponse(respBody, unmarshalGetRunOutputResponseSchema);
622
612
  };
623
613
  await executeCall(call, options);
624
614
  if (resp === undefined) {
625
- throw new Error('API call completed without a result.');
615
+ throw new Error('operation completed without a result.');
626
616
  }
627
617
  return resp;
628
618
  }
@@ -631,7 +621,7 @@ export class JobsClient {
631
621
  async listJobs(
632
622
  req: ListJobsRequest,
633
623
  options?: CallOptions
634
- ): Promise<ListJobsRequest_Response> {
624
+ ): Promise<ListJobsResponse> {
635
625
  const url = `${this.host}/api/2.2/jobs/list`;
636
626
  const params = new URLSearchParams();
637
627
  if (req.offset !== undefined) {
@@ -651,8 +641,8 @@ export class JobsClient {
651
641
  }
652
642
  const query = params.toString();
653
643
  const fullUrl = query !== '' ? `${url}?${query}` : url;
654
- let resp: ListJobsRequest_Response | undefined;
655
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
644
+ let resp: ListJobsResponse | undefined;
645
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
656
646
  const headers = new Headers();
657
647
  if (this.workspaceId !== undefined) {
658
648
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -664,11 +654,11 @@ export class JobsClient {
664
654
  httpClient: this.httpClient,
665
655
  logger: this.logger,
666
656
  });
667
- resp = parseResponse(respBody, unmarshalListJobsRequest_ResponseSchema);
657
+ resp = parseResponse(respBody, unmarshalListJobsResponseSchema);
668
658
  };
669
659
  await executeCall(call, options);
670
660
  if (resp === undefined) {
671
- throw new Error('API call completed without a result.');
661
+ throw new Error('operation completed without a result.');
672
662
  }
673
663
  return resp;
674
664
  }
@@ -694,7 +684,7 @@ export class JobsClient {
694
684
  async listRuns(
695
685
  req: ListRunsRequest,
696
686
  options?: CallOptions
697
- ): Promise<ListRunsRequest_Response> {
687
+ ): Promise<ListRunsResponse> {
698
688
  const url = `${this.host}/api/2.2/jobs/runs/list`;
699
689
  const params = new URLSearchParams();
700
690
  if (req.jobId !== undefined) {
@@ -732,8 +722,8 @@ export class JobsClient {
732
722
  }
733
723
  const query = params.toString();
734
724
  const fullUrl = query !== '' ? `${url}?${query}` : url;
735
- let resp: ListRunsRequest_Response | undefined;
736
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
725
+ let resp: ListRunsResponse | undefined;
726
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
737
727
  const headers = new Headers();
738
728
  if (this.workspaceId !== undefined) {
739
729
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -745,11 +735,11 @@ export class JobsClient {
745
735
  httpClient: this.httpClient,
746
736
  logger: this.logger,
747
737
  });
748
- resp = parseResponse(respBody, unmarshalListRunsRequest_ResponseSchema);
738
+ resp = parseResponse(respBody, unmarshalListRunsResponseSchema);
749
739
  };
750
740
  await executeCall(call, options);
751
741
  if (resp === undefined) {
752
- throw new Error('API call completed without a result.');
742
+ throw new Error('operation completed without a result.');
753
743
  }
754
744
  return resp;
755
745
  }
@@ -776,14 +766,14 @@ export class JobsClient {
776
766
  * They use the current job and task settings, and can be viewed in the history for the
777
767
  * original job run.
778
768
  */
779
- async repair(
769
+ private async repair(
780
770
  req: RepairRunRequest,
781
771
  options?: CallOptions
782
- ): Promise<RepairRunRequest_Response> {
772
+ ): Promise<RepairRunResponse> {
783
773
  const url = `${this.host}/api/2.2/jobs/runs/repair`;
784
774
  const body = marshalRequest(req, marshalRepairRunRequestSchema);
785
- let resp: RepairRunRequest_Response | undefined;
786
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
775
+ let resp: RepairRunResponse | undefined;
776
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
787
777
  const headers = new Headers({'Content-Type': 'application/json'});
788
778
  if (this.workspaceId !== undefined) {
789
779
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -795,11 +785,11 @@ export class JobsClient {
795
785
  httpClient: this.httpClient,
796
786
  logger: this.logger,
797
787
  });
798
- resp = parseResponse(respBody, unmarshalRepairRunRequest_ResponseSchema);
788
+ resp = parseResponse(respBody, unmarshalRepairRunResponseSchema);
799
789
  };
800
790
  await executeCall(call, options);
801
791
  if (resp === undefined) {
802
- throw new Error('API call completed without a result.');
792
+ throw new Error('operation completed without a result.');
803
793
  }
804
794
  return resp;
805
795
  }
@@ -819,11 +809,11 @@ export class JobsClient {
819
809
  async resetJob(
820
810
  req: ResetJobRequest,
821
811
  options?: CallOptions
822
- ): Promise<ResetJobRequest_Response> {
812
+ ): Promise<ResetJobResponse> {
823
813
  const url = `${this.host}/api/2.2/jobs/reset`;
824
814
  const body = marshalRequest(req, marshalResetJobRequestSchema);
825
- let resp: ResetJobRequest_Response | undefined;
826
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
815
+ let resp: ResetJobResponse | undefined;
816
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
827
817
  const headers = new Headers({'Content-Type': 'application/json'});
828
818
  if (this.workspaceId !== undefined) {
829
819
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -835,24 +825,24 @@ export class JobsClient {
835
825
  httpClient: this.httpClient,
836
826
  logger: this.logger,
837
827
  });
838
- resp = parseResponse(respBody, unmarshalResetJobRequest_ResponseSchema);
828
+ resp = parseResponse(respBody, unmarshalResetJobResponseSchema);
839
829
  };
840
830
  await executeCall(call, options);
841
831
  if (resp === undefined) {
842
- throw new Error('API call completed without a result.');
832
+ throw new Error('operation completed without a result.');
843
833
  }
844
834
  return resp;
845
835
  }
846
836
 
847
837
  /** Run a job and return the `run_id` of the triggered run. */
848
- async runNow(
838
+ private async runNow(
849
839
  req: RunNowRequest,
850
840
  options?: CallOptions
851
- ): Promise<RunNowRequest_Response> {
841
+ ): Promise<RunNowResponse> {
852
842
  const url = `${this.host}/api/2.2/jobs/run-now`;
853
843
  const body = marshalRequest(req, marshalRunNowRequestSchema);
854
- let resp: RunNowRequest_Response | undefined;
855
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
844
+ let resp: RunNowResponse | undefined;
845
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
856
846
  const headers = new Headers({'Content-Type': 'application/json'});
857
847
  if (this.workspaceId !== undefined) {
858
848
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -864,11 +854,11 @@ export class JobsClient {
864
854
  httpClient: this.httpClient,
865
855
  logger: this.logger,
866
856
  });
867
- resp = parseResponse(respBody, unmarshalRunNowRequest_ResponseSchema);
857
+ resp = parseResponse(respBody, unmarshalRunNowResponseSchema);
868
858
  };
869
859
  await executeCall(call, options);
870
860
  if (resp === undefined) {
871
- throw new Error('API call completed without a result.');
861
+ throw new Error('operation completed without a result.');
872
862
  }
873
863
  return resp;
874
864
  }
@@ -897,14 +887,14 @@ export class JobsClient {
897
887
  * the compute needs for the job. Alternatively, use the `POST /jobs/create` and
898
888
  * `POST /jobs/run-now` endpoints to create and run a saved job.
899
889
  */
900
- async submitRun(
890
+ private async submitRun(
901
891
  req: SubmitRunRequest,
902
892
  options?: CallOptions
903
- ): Promise<SubmitRunRequest_Response> {
893
+ ): Promise<SubmitRunResponse> {
904
894
  const url = `${this.host}/api/2.2/jobs/runs/submit`;
905
895
  const body = marshalRequest(req, marshalSubmitRunRequestSchema);
906
- let resp: SubmitRunRequest_Response | undefined;
907
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
896
+ let resp: SubmitRunResponse | undefined;
897
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
908
898
  const headers = new Headers({'Content-Type': 'application/json'});
909
899
  if (this.workspaceId !== undefined) {
910
900
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -916,11 +906,11 @@ export class JobsClient {
916
906
  httpClient: this.httpClient,
917
907
  logger: this.logger,
918
908
  });
919
- resp = parseResponse(respBody, unmarshalSubmitRunRequest_ResponseSchema);
909
+ resp = parseResponse(respBody, unmarshalSubmitRunResponseSchema);
920
910
  };
921
911
  await executeCall(call, options);
922
912
  if (resp === undefined) {
923
- throw new Error('API call completed without a result.');
913
+ throw new Error('operation completed without a result.');
924
914
  }
925
915
  return resp;
926
916
  }
@@ -940,11 +930,11 @@ export class JobsClient {
940
930
  async updateJob(
941
931
  req: UpdateJobRequest,
942
932
  options?: CallOptions
943
- ): Promise<UpdateJobRequest_Response> {
933
+ ): Promise<UpdateJobResponse> {
944
934
  const url = `${this.host}/api/2.2/jobs/update`;
945
935
  const body = marshalRequest(req, marshalUpdateJobRequestSchema);
946
- let resp: UpdateJobRequest_Response | undefined;
947
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
936
+ let resp: UpdateJobResponse | undefined;
937
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
948
938
  const headers = new Headers({'Content-Type': 'application/json'});
949
939
  if (this.workspaceId !== undefined) {
950
940
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -956,11 +946,11 @@ export class JobsClient {
956
946
  httpClient: this.httpClient,
957
947
  logger: this.logger,
958
948
  });
959
- resp = parseResponse(respBody, unmarshalUpdateJobRequest_ResponseSchema);
949
+ resp = parseResponse(respBody, unmarshalUpdateJobResponseSchema);
960
950
  };
961
951
  await executeCall(call, options);
962
952
  if (resp === undefined) {
963
- throw new Error('API call completed without a result.');
953
+ throw new Error('operation completed without a result.');
964
954
  }
965
955
  return resp;
966
956
  }
@@ -977,15 +967,15 @@ export class CancelRunWaiter {
977
967
  *
978
968
  * Throws if a failure state is reached.
979
969
  */
980
- async wait(options?: CallOptions): Promise<GetRunRequest_Response> {
981
- let result: GetRunRequest_Response | undefined;
970
+ async wait(options?: LroOptions): Promise<GetRunResponse> {
971
+ let result: GetRunResponse | undefined;
982
972
 
983
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
973
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
984
974
  const pollResp = await this.client.getRun(
985
975
  {
986
976
  runId: this.runId,
987
977
  },
988
- {...options, ...(callSignal !== undefined && {signal: callSignal})}
978
+ callSignal !== undefined ? {signal: callSignal} : undefined
989
979
  );
990
980
 
991
981
  const status = pollResp.state?.lifeCycleState;
@@ -1007,16 +997,9 @@ export class CancelRunWaiter {
1007
997
  }
1008
998
  };
1009
999
 
1010
- const retryOptions: CallOptions = {
1011
- ...(options?.signal !== undefined && {signal: options.signal}),
1012
- retrier: () =>
1013
- retryOn({}, (err: Error) => {
1014
- return err instanceof StillRunningError;
1015
- }),
1016
- };
1017
- await executeCall(call, retryOptions);
1000
+ await executeWait(call, options);
1018
1001
  if (result === undefined) {
1019
- throw new Error('API call completed without a result.');
1002
+ throw new Error('operation completed without a result.');
1020
1003
  }
1021
1004
  return result;
1022
1005
  }
@@ -1057,15 +1040,15 @@ export class RepairWaiter {
1057
1040
  *
1058
1041
  * Throws if a failure state is reached.
1059
1042
  */
1060
- async wait(options?: CallOptions): Promise<GetRunRequest_Response> {
1061
- let result: GetRunRequest_Response | undefined;
1043
+ async wait(options?: LroOptions): Promise<GetRunResponse> {
1044
+ let result: GetRunResponse | undefined;
1062
1045
 
1063
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
1046
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
1064
1047
  const pollResp = await this.client.getRun(
1065
1048
  {
1066
1049
  runId: this.runId,
1067
1050
  },
1068
- {...options, ...(callSignal !== undefined && {signal: callSignal})}
1051
+ callSignal !== undefined ? {signal: callSignal} : undefined
1069
1052
  );
1070
1053
 
1071
1054
  const status = pollResp.state?.lifeCycleState;
@@ -1087,16 +1070,9 @@ export class RepairWaiter {
1087
1070
  }
1088
1071
  };
1089
1072
 
1090
- const retryOptions: CallOptions = {
1091
- ...(options?.signal !== undefined && {signal: options.signal}),
1092
- retrier: () =>
1093
- retryOn({}, (err: Error) => {
1094
- return err instanceof StillRunningError;
1095
- }),
1096
- };
1097
- await executeCall(call, retryOptions);
1073
+ await executeWait(call, options);
1098
1074
  if (result === undefined) {
1099
- throw new Error('API call completed without a result.');
1075
+ throw new Error('operation completed without a result.');
1100
1076
  }
1101
1077
  return result;
1102
1078
  }
@@ -1137,15 +1113,15 @@ export class RunNowWaiter {
1137
1113
  *
1138
1114
  * Throws if a failure state is reached.
1139
1115
  */
1140
- async wait(options?: CallOptions): Promise<GetRunRequest_Response> {
1141
- let result: GetRunRequest_Response | undefined;
1116
+ async wait(options?: LroOptions): Promise<GetRunResponse> {
1117
+ let result: GetRunResponse | undefined;
1142
1118
 
1143
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
1119
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
1144
1120
  const pollResp = await this.client.getRun(
1145
1121
  {
1146
1122
  runId: this.runId,
1147
1123
  },
1148
- {...options, ...(callSignal !== undefined && {signal: callSignal})}
1124
+ callSignal !== undefined ? {signal: callSignal} : undefined
1149
1125
  );
1150
1126
 
1151
1127
  const status = pollResp.state?.lifeCycleState;
@@ -1167,16 +1143,9 @@ export class RunNowWaiter {
1167
1143
  }
1168
1144
  };
1169
1145
 
1170
- const retryOptions: CallOptions = {
1171
- ...(options?.signal !== undefined && {signal: options.signal}),
1172
- retrier: () =>
1173
- retryOn({}, (err: Error) => {
1174
- return err instanceof StillRunningError;
1175
- }),
1176
- };
1177
- await executeCall(call, retryOptions);
1146
+ await executeWait(call, options);
1178
1147
  if (result === undefined) {
1179
- throw new Error('API call completed without a result.');
1148
+ throw new Error('operation completed without a result.');
1180
1149
  }
1181
1150
  return result;
1182
1151
  }
@@ -1217,15 +1186,15 @@ export class SubmitRunWaiter {
1217
1186
  *
1218
1187
  * Throws if a failure state is reached.
1219
1188
  */
1220
- async wait(options?: CallOptions): Promise<GetRunRequest_Response> {
1221
- let result: GetRunRequest_Response | undefined;
1189
+ async wait(options?: LroOptions): Promise<GetRunResponse> {
1190
+ let result: GetRunResponse | undefined;
1222
1191
 
1223
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
1192
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
1224
1193
  const pollResp = await this.client.getRun(
1225
1194
  {
1226
1195
  runId: this.runId,
1227
1196
  },
1228
- {...options, ...(callSignal !== undefined && {signal: callSignal})}
1197
+ callSignal !== undefined ? {signal: callSignal} : undefined
1229
1198
  );
1230
1199
 
1231
1200
  const status = pollResp.state?.lifeCycleState;
@@ -1247,16 +1216,9 @@ export class SubmitRunWaiter {
1247
1216
  }
1248
1217
  };
1249
1218
 
1250
- const retryOptions: CallOptions = {
1251
- ...(options?.signal !== undefined && {signal: options.signal}),
1252
- retrier: () =>
1253
- retryOn({}, (err: Error) => {
1254
- return err instanceof StillRunningError;
1255
- }),
1256
- };
1257
- await executeCall(call, retryOptions);
1219
+ await executeWait(call, options);
1258
1220
  if (result === undefined) {
1259
- throw new Error('API call completed without a result.');
1221
+ throw new Error('operation completed without a result.');
1260
1222
  }
1261
1223
  return result;
1262
1224
  }