@google-cloud/containeranalysis 6.1.0 → 6.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -108,26 +108,17 @@ class GrafeasV1Beta1Client {
108
108
  constructor(opts, gaxInstance) {
109
109
  // Ensure that options include all the required fields.
110
110
  const staticMembers = this.constructor;
111
- if (opts?.universe_domain &&
112
- opts?.universeDomain &&
113
- opts?.universe_domain !== opts?.universeDomain) {
111
+ if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) {
114
112
  throw new Error('Please set either universe_domain or universeDomain, but not both.');
115
113
  }
116
- const universeDomainEnvVar = typeof process === 'object' && typeof process.env === 'object'
117
- ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']
118
- : undefined;
119
- this._universeDomain =
120
- opts?.universeDomain ??
121
- opts?.universe_domain ??
122
- universeDomainEnvVar ??
123
- 'googleapis.com';
114
+ const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined;
115
+ this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com';
124
116
  this._servicePath = 'containeranalysis.' + this._universeDomain;
125
117
  const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath;
126
118
  this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint);
127
119
  const port = opts?.port || staticMembers.port;
128
120
  const clientConfig = opts?.clientConfig ?? {};
129
- const fallback = opts?.fallback ??
130
- (typeof window !== 'undefined' && typeof window?.fetch === 'function');
121
+ const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function');
131
122
  opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
132
123
  // Request numeric enum values if REST transport is used.
133
124
  opts.numericEnums = true;
@@ -156,7 +147,10 @@ class GrafeasV1Beta1Client {
156
147
  this.auth.defaultScopes = staticMembers.scopes;
157
148
  }
158
149
  // Determine the client header string.
159
- const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`];
150
+ const clientHeader = [
151
+ `gax/${this._gaxModule.version}`,
152
+ `gapic/${version}`,
153
+ ];
160
154
  if (typeof process === 'object' && 'versions' in process) {
161
155
  clientHeader.push(`gl-node/${process.versions.node}`);
162
156
  }
@@ -180,7 +174,7 @@ class GrafeasV1Beta1Client {
180
174
  this.descriptors.page = {
181
175
  listOccurrences: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'occurrences'),
182
176
  listNotes: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'notes'),
183
- listNoteOccurrences: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'occurrences'),
177
+ listNoteOccurrences: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'occurrences')
184
178
  };
185
179
  // Put together the default options sent with requests.
186
180
  this._defaults = this._gaxGrpc.constructSettings('grafeas.v1beta1.GrafeasV1Beta1', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') });
@@ -209,29 +203,13 @@ class GrafeasV1Beta1Client {
209
203
  }
210
204
  // Put together the "service stub" for
211
205
  // grafeas.v1beta1.GrafeasV1Beta1.
212
- this.grafeasV1Beta1Stub = this._gaxGrpc.createStub(this._opts.fallback
213
- ? this._protos.lookupService('grafeas.v1beta1.GrafeasV1Beta1')
214
- : // eslint-disable-next-line @typescript-eslint/no-explicit-any
215
- this._protos.grafeas.v1beta1.GrafeasV1Beta1, this._opts, this._providedCustomServicePath);
206
+ this.grafeasV1Beta1Stub = this._gaxGrpc.createStub(this._opts.fallback ?
207
+ this._protos.lookupService('grafeas.v1beta1.GrafeasV1Beta1') :
208
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
209
+ this._protos.grafeas.v1beta1.GrafeasV1Beta1, this._opts, this._providedCustomServicePath);
216
210
  // Iterate over each of the methods that the service provides
217
211
  // and create an API call method for each.
218
- const grafeasV1Beta1StubMethods = [
219
- 'getOccurrence',
220
- 'listOccurrences',
221
- 'deleteOccurrence',
222
- 'createOccurrence',
223
- 'batchCreateOccurrences',
224
- 'updateOccurrence',
225
- 'getOccurrenceNote',
226
- 'getNote',
227
- 'listNotes',
228
- 'deleteNote',
229
- 'createNote',
230
- 'batchCreateNotes',
231
- 'updateNote',
232
- 'listNoteOccurrences',
233
- 'getVulnerabilityOccurrencesSummary',
234
- ];
212
+ const grafeasV1Beta1StubMethods = ['getOccurrence', 'listOccurrences', 'deleteOccurrence', 'createOccurrence', 'batchCreateOccurrences', 'updateOccurrence', 'getOccurrenceNote', 'getNote', 'listNotes', 'deleteNote', 'createNote', 'batchCreateNotes', 'updateNote', 'listNoteOccurrences', 'getVulnerabilityOccurrencesSummary'];
235
213
  for (const methodName of grafeasV1Beta1StubMethods) {
236
214
  const callPromise = this.grafeasV1Beta1Stub.then(stub => (...args) => {
237
215
  if (this._terminated) {
@@ -242,7 +220,8 @@ class GrafeasV1Beta1Client {
242
220
  }, (err) => () => {
243
221
  throw err;
244
222
  });
245
- const descriptor = this.descriptors.page[methodName] || undefined;
223
+ const descriptor = this.descriptors.page[methodName] ||
224
+ undefined;
246
225
  const apiCall = this._gaxModule.createApiCall(callPromise, this._defaults[methodName], descriptor, this._opts.fallback);
247
226
  this.innerApiCalls[methodName] = apiCall;
248
227
  }
@@ -254,8 +233,7 @@ class GrafeasV1Beta1Client {
254
233
  * @returns {string} The DNS address for this service.
255
234
  */
256
235
  static get servicePath() {
257
- if (typeof process === 'object' &&
258
- typeof process.emitWarning === 'function') {
236
+ if (typeof process === 'object' && typeof process.emitWarning === 'function') {
259
237
  process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning');
260
238
  }
261
239
  return 'containeranalysis.googleapis.com';
@@ -266,8 +244,7 @@ class GrafeasV1Beta1Client {
266
244
  * @returns {string} The DNS address for this service.
267
245
  */
268
246
  static get apiEndpoint() {
269
- if (typeof process === 'object' &&
270
- typeof process.emitWarning === 'function') {
247
+ if (typeof process === 'object' && typeof process.emitWarning === 'function') {
271
248
  process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning');
272
249
  }
273
250
  return 'containeranalysis.googleapis.com';
@@ -295,7 +272,9 @@ class GrafeasV1Beta1Client {
295
272
  * @returns {string[]} List of default scopes.
296
273
  */
297
274
  static get scopes() {
298
- return ['https://www.googleapis.com/auth/cloud-platform'];
275
+ return [
276
+ 'https://www.googleapis.com/auth/cloud-platform'
277
+ ];
299
278
  }
300
279
  /**
301
280
  * Return the project ID used by this class.
@@ -321,13 +300,10 @@ class GrafeasV1Beta1Client {
321
300
  options = options || {};
322
301
  options.otherArgs = options.otherArgs || {};
323
302
  options.otherArgs.headers = options.otherArgs.headers || {};
324
- options.otherArgs.headers['x-goog-request-params'] =
325
- this._gaxModule.routingHeader.fromParams({
326
- name: request.name ?? '',
327
- });
328
- this.initialize().catch(err => {
329
- throw err;
303
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
304
+ 'name': request.name ?? '',
330
305
  });
306
+ this.initialize().catch(err => { throw err; });
331
307
  this._log.info('getOccurrence request %j', request);
332
308
  const wrappedCallback = callback
333
309
  ? (error, response, options, rawResponse) => {
@@ -335,11 +311,16 @@ class GrafeasV1Beta1Client {
335
311
  callback(error, response, options, rawResponse); // We verified callback above.
336
312
  }
337
313
  : undefined;
338
- return this.innerApiCalls
339
- .getOccurrence(request, options, wrappedCallback)
314
+ return this.innerApiCalls.getOccurrence(request, options, wrappedCallback)
340
315
  ?.then(([response, options, rawResponse]) => {
341
316
  this._log.info('getOccurrence response %j', response);
342
317
  return [response, options, rawResponse];
318
+ }).catch((error) => {
319
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
320
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
321
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
322
+ }
323
+ throw error;
343
324
  });
344
325
  }
345
326
  deleteOccurrence(request, optionsOrCallback, callback) {
@@ -355,13 +336,10 @@ class GrafeasV1Beta1Client {
355
336
  options = options || {};
356
337
  options.otherArgs = options.otherArgs || {};
357
338
  options.otherArgs.headers = options.otherArgs.headers || {};
358
- options.otherArgs.headers['x-goog-request-params'] =
359
- this._gaxModule.routingHeader.fromParams({
360
- name: request.name ?? '',
361
- });
362
- this.initialize().catch(err => {
363
- throw err;
339
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
340
+ 'name': request.name ?? '',
364
341
  });
342
+ this.initialize().catch(err => { throw err; });
365
343
  this._log.info('deleteOccurrence request %j', request);
366
344
  const wrappedCallback = callback
367
345
  ? (error, response, options, rawResponse) => {
@@ -369,11 +347,16 @@ class GrafeasV1Beta1Client {
369
347
  callback(error, response, options, rawResponse); // We verified callback above.
370
348
  }
371
349
  : undefined;
372
- return this.innerApiCalls
373
- .deleteOccurrence(request, options, wrappedCallback)
350
+ return this.innerApiCalls.deleteOccurrence(request, options, wrappedCallback)
374
351
  ?.then(([response, options, rawResponse]) => {
375
352
  this._log.info('deleteOccurrence response %j', response);
376
353
  return [response, options, rawResponse];
354
+ }).catch((error) => {
355
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
356
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
357
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
358
+ }
359
+ throw error;
377
360
  });
378
361
  }
379
362
  createOccurrence(request, optionsOrCallback, callback) {
@@ -389,13 +372,10 @@ class GrafeasV1Beta1Client {
389
372
  options = options || {};
390
373
  options.otherArgs = options.otherArgs || {};
391
374
  options.otherArgs.headers = options.otherArgs.headers || {};
392
- options.otherArgs.headers['x-goog-request-params'] =
393
- this._gaxModule.routingHeader.fromParams({
394
- parent: request.parent ?? '',
395
- });
396
- this.initialize().catch(err => {
397
- throw err;
375
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
376
+ 'parent': request.parent ?? '',
398
377
  });
378
+ this.initialize().catch(err => { throw err; });
399
379
  this._log.info('createOccurrence request %j', request);
400
380
  const wrappedCallback = callback
401
381
  ? (error, response, options, rawResponse) => {
@@ -403,11 +383,16 @@ class GrafeasV1Beta1Client {
403
383
  callback(error, response, options, rawResponse); // We verified callback above.
404
384
  }
405
385
  : undefined;
406
- return this.innerApiCalls
407
- .createOccurrence(request, options, wrappedCallback)
386
+ return this.innerApiCalls.createOccurrence(request, options, wrappedCallback)
408
387
  ?.then(([response, options, rawResponse]) => {
409
388
  this._log.info('createOccurrence response %j', response);
410
389
  return [response, options, rawResponse];
390
+ }).catch((error) => {
391
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
392
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
393
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
394
+ }
395
+ throw error;
411
396
  });
412
397
  }
413
398
  batchCreateOccurrences(request, optionsOrCallback, callback) {
@@ -423,13 +408,10 @@ class GrafeasV1Beta1Client {
423
408
  options = options || {};
424
409
  options.otherArgs = options.otherArgs || {};
425
410
  options.otherArgs.headers = options.otherArgs.headers || {};
426
- options.otherArgs.headers['x-goog-request-params'] =
427
- this._gaxModule.routingHeader.fromParams({
428
- parent: request.parent ?? '',
429
- });
430
- this.initialize().catch(err => {
431
- throw err;
411
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
412
+ 'parent': request.parent ?? '',
432
413
  });
414
+ this.initialize().catch(err => { throw err; });
433
415
  this._log.info('batchCreateOccurrences request %j', request);
434
416
  const wrappedCallback = callback
435
417
  ? (error, response, options, rawResponse) => {
@@ -437,11 +419,16 @@ class GrafeasV1Beta1Client {
437
419
  callback(error, response, options, rawResponse); // We verified callback above.
438
420
  }
439
421
  : undefined;
440
- return this.innerApiCalls
441
- .batchCreateOccurrences(request, options, wrappedCallback)
422
+ return this.innerApiCalls.batchCreateOccurrences(request, options, wrappedCallback)
442
423
  ?.then(([response, options, rawResponse]) => {
443
424
  this._log.info('batchCreateOccurrences response %j', response);
444
425
  return [response, options, rawResponse];
426
+ }).catch((error) => {
427
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
428
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
429
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
430
+ }
431
+ throw error;
445
432
  });
446
433
  }
447
434
  updateOccurrence(request, optionsOrCallback, callback) {
@@ -457,13 +444,10 @@ class GrafeasV1Beta1Client {
457
444
  options = options || {};
458
445
  options.otherArgs = options.otherArgs || {};
459
446
  options.otherArgs.headers = options.otherArgs.headers || {};
460
- options.otherArgs.headers['x-goog-request-params'] =
461
- this._gaxModule.routingHeader.fromParams({
462
- name: request.name ?? '',
463
- });
464
- this.initialize().catch(err => {
465
- throw err;
447
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
448
+ 'name': request.name ?? '',
466
449
  });
450
+ this.initialize().catch(err => { throw err; });
467
451
  this._log.info('updateOccurrence request %j', request);
468
452
  const wrappedCallback = callback
469
453
  ? (error, response, options, rawResponse) => {
@@ -471,11 +455,16 @@ class GrafeasV1Beta1Client {
471
455
  callback(error, response, options, rawResponse); // We verified callback above.
472
456
  }
473
457
  : undefined;
474
- return this.innerApiCalls
475
- .updateOccurrence(request, options, wrappedCallback)
458
+ return this.innerApiCalls.updateOccurrence(request, options, wrappedCallback)
476
459
  ?.then(([response, options, rawResponse]) => {
477
460
  this._log.info('updateOccurrence response %j', response);
478
461
  return [response, options, rawResponse];
462
+ }).catch((error) => {
463
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
464
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
465
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
466
+ }
467
+ throw error;
479
468
  });
480
469
  }
481
470
  getOccurrenceNote(request, optionsOrCallback, callback) {
@@ -491,13 +480,10 @@ class GrafeasV1Beta1Client {
491
480
  options = options || {};
492
481
  options.otherArgs = options.otherArgs || {};
493
482
  options.otherArgs.headers = options.otherArgs.headers || {};
494
- options.otherArgs.headers['x-goog-request-params'] =
495
- this._gaxModule.routingHeader.fromParams({
496
- name: request.name ?? '',
497
- });
498
- this.initialize().catch(err => {
499
- throw err;
483
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
484
+ 'name': request.name ?? '',
500
485
  });
486
+ this.initialize().catch(err => { throw err; });
501
487
  this._log.info('getOccurrenceNote request %j', request);
502
488
  const wrappedCallback = callback
503
489
  ? (error, response, options, rawResponse) => {
@@ -505,11 +491,16 @@ class GrafeasV1Beta1Client {
505
491
  callback(error, response, options, rawResponse); // We verified callback above.
506
492
  }
507
493
  : undefined;
508
- return this.innerApiCalls
509
- .getOccurrenceNote(request, options, wrappedCallback)
494
+ return this.innerApiCalls.getOccurrenceNote(request, options, wrappedCallback)
510
495
  ?.then(([response, options, rawResponse]) => {
511
496
  this._log.info('getOccurrenceNote response %j', response);
512
497
  return [response, options, rawResponse];
498
+ }).catch((error) => {
499
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
500
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
501
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
502
+ }
503
+ throw error;
513
504
  });
514
505
  }
515
506
  getNote(request, optionsOrCallback, callback) {
@@ -525,13 +516,10 @@ class GrafeasV1Beta1Client {
525
516
  options = options || {};
526
517
  options.otherArgs = options.otherArgs || {};
527
518
  options.otherArgs.headers = options.otherArgs.headers || {};
528
- options.otherArgs.headers['x-goog-request-params'] =
529
- this._gaxModule.routingHeader.fromParams({
530
- name: request.name ?? '',
531
- });
532
- this.initialize().catch(err => {
533
- throw err;
519
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
520
+ 'name': request.name ?? '',
534
521
  });
522
+ this.initialize().catch(err => { throw err; });
535
523
  this._log.info('getNote request %j', request);
536
524
  const wrappedCallback = callback
537
525
  ? (error, response, options, rawResponse) => {
@@ -539,11 +527,16 @@ class GrafeasV1Beta1Client {
539
527
  callback(error, response, options, rawResponse); // We verified callback above.
540
528
  }
541
529
  : undefined;
542
- return this.innerApiCalls
543
- .getNote(request, options, wrappedCallback)
530
+ return this.innerApiCalls.getNote(request, options, wrappedCallback)
544
531
  ?.then(([response, options, rawResponse]) => {
545
532
  this._log.info('getNote response %j', response);
546
533
  return [response, options, rawResponse];
534
+ }).catch((error) => {
535
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
536
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
537
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
538
+ }
539
+ throw error;
547
540
  });
548
541
  }
549
542
  deleteNote(request, optionsOrCallback, callback) {
@@ -559,13 +552,10 @@ class GrafeasV1Beta1Client {
559
552
  options = options || {};
560
553
  options.otherArgs = options.otherArgs || {};
561
554
  options.otherArgs.headers = options.otherArgs.headers || {};
562
- options.otherArgs.headers['x-goog-request-params'] =
563
- this._gaxModule.routingHeader.fromParams({
564
- name: request.name ?? '',
565
- });
566
- this.initialize().catch(err => {
567
- throw err;
555
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
556
+ 'name': request.name ?? '',
568
557
  });
558
+ this.initialize().catch(err => { throw err; });
569
559
  this._log.info('deleteNote request %j', request);
570
560
  const wrappedCallback = callback
571
561
  ? (error, response, options, rawResponse) => {
@@ -573,11 +563,16 @@ class GrafeasV1Beta1Client {
573
563
  callback(error, response, options, rawResponse); // We verified callback above.
574
564
  }
575
565
  : undefined;
576
- return this.innerApiCalls
577
- .deleteNote(request, options, wrappedCallback)
566
+ return this.innerApiCalls.deleteNote(request, options, wrappedCallback)
578
567
  ?.then(([response, options, rawResponse]) => {
579
568
  this._log.info('deleteNote response %j', response);
580
569
  return [response, options, rawResponse];
570
+ }).catch((error) => {
571
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
572
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
573
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
574
+ }
575
+ throw error;
581
576
  });
582
577
  }
583
578
  createNote(request, optionsOrCallback, callback) {
@@ -593,13 +588,10 @@ class GrafeasV1Beta1Client {
593
588
  options = options || {};
594
589
  options.otherArgs = options.otherArgs || {};
595
590
  options.otherArgs.headers = options.otherArgs.headers || {};
596
- options.otherArgs.headers['x-goog-request-params'] =
597
- this._gaxModule.routingHeader.fromParams({
598
- parent: request.parent ?? '',
599
- });
600
- this.initialize().catch(err => {
601
- throw err;
591
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
592
+ 'parent': request.parent ?? '',
602
593
  });
594
+ this.initialize().catch(err => { throw err; });
603
595
  this._log.info('createNote request %j', request);
604
596
  const wrappedCallback = callback
605
597
  ? (error, response, options, rawResponse) => {
@@ -607,11 +599,16 @@ class GrafeasV1Beta1Client {
607
599
  callback(error, response, options, rawResponse); // We verified callback above.
608
600
  }
609
601
  : undefined;
610
- return this.innerApiCalls
611
- .createNote(request, options, wrappedCallback)
602
+ return this.innerApiCalls.createNote(request, options, wrappedCallback)
612
603
  ?.then(([response, options, rawResponse]) => {
613
604
  this._log.info('createNote response %j', response);
614
605
  return [response, options, rawResponse];
606
+ }).catch((error) => {
607
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
608
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
609
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
610
+ }
611
+ throw error;
615
612
  });
616
613
  }
617
614
  batchCreateNotes(request, optionsOrCallback, callback) {
@@ -627,13 +624,10 @@ class GrafeasV1Beta1Client {
627
624
  options = options || {};
628
625
  options.otherArgs = options.otherArgs || {};
629
626
  options.otherArgs.headers = options.otherArgs.headers || {};
630
- options.otherArgs.headers['x-goog-request-params'] =
631
- this._gaxModule.routingHeader.fromParams({
632
- parent: request.parent ?? '',
633
- });
634
- this.initialize().catch(err => {
635
- throw err;
627
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
628
+ 'parent': request.parent ?? '',
636
629
  });
630
+ this.initialize().catch(err => { throw err; });
637
631
  this._log.info('batchCreateNotes request %j', request);
638
632
  const wrappedCallback = callback
639
633
  ? (error, response, options, rawResponse) => {
@@ -641,11 +635,16 @@ class GrafeasV1Beta1Client {
641
635
  callback(error, response, options, rawResponse); // We verified callback above.
642
636
  }
643
637
  : undefined;
644
- return this.innerApiCalls
645
- .batchCreateNotes(request, options, wrappedCallback)
638
+ return this.innerApiCalls.batchCreateNotes(request, options, wrappedCallback)
646
639
  ?.then(([response, options, rawResponse]) => {
647
640
  this._log.info('batchCreateNotes response %j', response);
648
641
  return [response, options, rawResponse];
642
+ }).catch((error) => {
643
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
644
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
645
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
646
+ }
647
+ throw error;
649
648
  });
650
649
  }
651
650
  updateNote(request, optionsOrCallback, callback) {
@@ -661,13 +660,10 @@ class GrafeasV1Beta1Client {
661
660
  options = options || {};
662
661
  options.otherArgs = options.otherArgs || {};
663
662
  options.otherArgs.headers = options.otherArgs.headers || {};
664
- options.otherArgs.headers['x-goog-request-params'] =
665
- this._gaxModule.routingHeader.fromParams({
666
- name: request.name ?? '',
667
- });
668
- this.initialize().catch(err => {
669
- throw err;
663
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
664
+ 'name': request.name ?? '',
670
665
  });
666
+ this.initialize().catch(err => { throw err; });
671
667
  this._log.info('updateNote request %j', request);
672
668
  const wrappedCallback = callback
673
669
  ? (error, response, options, rawResponse) => {
@@ -675,11 +671,16 @@ class GrafeasV1Beta1Client {
675
671
  callback(error, response, options, rawResponse); // We verified callback above.
676
672
  }
677
673
  : undefined;
678
- return this.innerApiCalls
679
- .updateNote(request, options, wrappedCallback)
674
+ return this.innerApiCalls.updateNote(request, options, wrappedCallback)
680
675
  ?.then(([response, options, rawResponse]) => {
681
676
  this._log.info('updateNote response %j', response);
682
677
  return [response, options, rawResponse];
678
+ }).catch((error) => {
679
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
680
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
681
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
682
+ }
683
+ throw error;
683
684
  });
684
685
  }
685
686
  getVulnerabilityOccurrencesSummary(request, optionsOrCallback, callback) {
@@ -695,13 +696,10 @@ class GrafeasV1Beta1Client {
695
696
  options = options || {};
696
697
  options.otherArgs = options.otherArgs || {};
697
698
  options.otherArgs.headers = options.otherArgs.headers || {};
698
- options.otherArgs.headers['x-goog-request-params'] =
699
- this._gaxModule.routingHeader.fromParams({
700
- parent: request.parent ?? '',
701
- });
702
- this.initialize().catch(err => {
703
- throw err;
699
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
700
+ 'parent': request.parent ?? '',
704
701
  });
702
+ this.initialize().catch(err => { throw err; });
705
703
  this._log.info('getVulnerabilityOccurrencesSummary request %j', request);
706
704
  const wrappedCallback = callback
707
705
  ? (error, response, options, rawResponse) => {
@@ -709,11 +707,16 @@ class GrafeasV1Beta1Client {
709
707
  callback(error, response, options, rawResponse); // We verified callback above.
710
708
  }
711
709
  : undefined;
712
- return this.innerApiCalls
713
- .getVulnerabilityOccurrencesSummary(request, options, wrappedCallback)
710
+ return this.innerApiCalls.getVulnerabilityOccurrencesSummary(request, options, wrappedCallback)
714
711
  ?.then(([response, options, rawResponse]) => {
715
712
  this._log.info('getVulnerabilityOccurrencesSummary response %j', response);
716
713
  return [response, options, rawResponse];
714
+ }).catch((error) => {
715
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
716
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
717
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
718
+ }
719
+ throw error;
717
720
  });
718
721
  }
719
722
  listOccurrences(request, optionsOrCallback, callback) {
@@ -729,13 +732,10 @@ class GrafeasV1Beta1Client {
729
732
  options = options || {};
730
733
  options.otherArgs = options.otherArgs || {};
731
734
  options.otherArgs.headers = options.otherArgs.headers || {};
732
- options.otherArgs.headers['x-goog-request-params'] =
733
- this._gaxModule.routingHeader.fromParams({
734
- parent: request.parent ?? '',
735
- });
736
- this.initialize().catch(err => {
737
- throw err;
735
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
736
+ 'parent': request.parent ?? '',
738
737
  });
738
+ this.initialize().catch(err => { throw err; });
739
739
  const wrappedCallback = callback
740
740
  ? (error, values, nextPageRequest, rawResponse) => {
741
741
  this._log.info('listOccurrences values %j', values);
@@ -779,15 +779,12 @@ class GrafeasV1Beta1Client {
779
779
  options = options || {};
780
780
  options.otherArgs = options.otherArgs || {};
781
781
  options.otherArgs.headers = options.otherArgs.headers || {};
782
- options.otherArgs.headers['x-goog-request-params'] =
783
- this._gaxModule.routingHeader.fromParams({
784
- parent: request.parent ?? '',
785
- });
782
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
783
+ 'parent': request.parent ?? '',
784
+ });
786
785
  const defaultCallSettings = this._defaults['listOccurrences'];
787
786
  const callSettings = defaultCallSettings.merge(options);
788
- this.initialize().catch(err => {
789
- throw err;
790
- });
787
+ this.initialize().catch(err => { throw err; });
791
788
  this._log.info('listOccurrences stream %j', request);
792
789
  return this.descriptors.page.listOccurrences.createStream(this.innerApiCalls.listOccurrences, request, callSettings);
793
790
  }
@@ -823,15 +820,12 @@ class GrafeasV1Beta1Client {
823
820
  options = options || {};
824
821
  options.otherArgs = options.otherArgs || {};
825
822
  options.otherArgs.headers = options.otherArgs.headers || {};
826
- options.otherArgs.headers['x-goog-request-params'] =
827
- this._gaxModule.routingHeader.fromParams({
828
- parent: request.parent ?? '',
829
- });
823
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
824
+ 'parent': request.parent ?? '',
825
+ });
830
826
  const defaultCallSettings = this._defaults['listOccurrences'];
831
827
  const callSettings = defaultCallSettings.merge(options);
832
- this.initialize().catch(err => {
833
- throw err;
834
- });
828
+ this.initialize().catch(err => { throw err; });
835
829
  this._log.info('listOccurrences iterate %j', request);
836
830
  return this.descriptors.page.listOccurrences.asyncIterate(this.innerApiCalls['listOccurrences'], request, callSettings);
837
831
  }
@@ -848,13 +842,10 @@ class GrafeasV1Beta1Client {
848
842
  options = options || {};
849
843
  options.otherArgs = options.otherArgs || {};
850
844
  options.otherArgs.headers = options.otherArgs.headers || {};
851
- options.otherArgs.headers['x-goog-request-params'] =
852
- this._gaxModule.routingHeader.fromParams({
853
- parent: request.parent ?? '',
854
- });
855
- this.initialize().catch(err => {
856
- throw err;
845
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
846
+ 'parent': request.parent ?? '',
857
847
  });
848
+ this.initialize().catch(err => { throw err; });
858
849
  const wrappedCallback = callback
859
850
  ? (error, values, nextPageRequest, rawResponse) => {
860
851
  this._log.info('listNotes values %j', values);
@@ -898,15 +889,12 @@ class GrafeasV1Beta1Client {
898
889
  options = options || {};
899
890
  options.otherArgs = options.otherArgs || {};
900
891
  options.otherArgs.headers = options.otherArgs.headers || {};
901
- options.otherArgs.headers['x-goog-request-params'] =
902
- this._gaxModule.routingHeader.fromParams({
903
- parent: request.parent ?? '',
904
- });
892
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
893
+ 'parent': request.parent ?? '',
894
+ });
905
895
  const defaultCallSettings = this._defaults['listNotes'];
906
896
  const callSettings = defaultCallSettings.merge(options);
907
- this.initialize().catch(err => {
908
- throw err;
909
- });
897
+ this.initialize().catch(err => { throw err; });
910
898
  this._log.info('listNotes stream %j', request);
911
899
  return this.descriptors.page.listNotes.createStream(this.innerApiCalls.listNotes, request, callSettings);
912
900
  }
@@ -942,15 +930,12 @@ class GrafeasV1Beta1Client {
942
930
  options = options || {};
943
931
  options.otherArgs = options.otherArgs || {};
944
932
  options.otherArgs.headers = options.otherArgs.headers || {};
945
- options.otherArgs.headers['x-goog-request-params'] =
946
- this._gaxModule.routingHeader.fromParams({
947
- parent: request.parent ?? '',
948
- });
933
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
934
+ 'parent': request.parent ?? '',
935
+ });
949
936
  const defaultCallSettings = this._defaults['listNotes'];
950
937
  const callSettings = defaultCallSettings.merge(options);
951
- this.initialize().catch(err => {
952
- throw err;
953
- });
938
+ this.initialize().catch(err => { throw err; });
954
939
  this._log.info('listNotes iterate %j', request);
955
940
  return this.descriptors.page.listNotes.asyncIterate(this.innerApiCalls['listNotes'], request, callSettings);
956
941
  }
@@ -967,13 +952,10 @@ class GrafeasV1Beta1Client {
967
952
  options = options || {};
968
953
  options.otherArgs = options.otherArgs || {};
969
954
  options.otherArgs.headers = options.otherArgs.headers || {};
970
- options.otherArgs.headers['x-goog-request-params'] =
971
- this._gaxModule.routingHeader.fromParams({
972
- name: request.name ?? '',
973
- });
974
- this.initialize().catch(err => {
975
- throw err;
955
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
956
+ 'name': request.name ?? '',
976
957
  });
958
+ this.initialize().catch(err => { throw err; });
977
959
  const wrappedCallback = callback
978
960
  ? (error, values, nextPageRequest, rawResponse) => {
979
961
  this._log.info('listNoteOccurrences values %j', values);
@@ -1017,15 +999,12 @@ class GrafeasV1Beta1Client {
1017
999
  options = options || {};
1018
1000
  options.otherArgs = options.otherArgs || {};
1019
1001
  options.otherArgs.headers = options.otherArgs.headers || {};
1020
- options.otherArgs.headers['x-goog-request-params'] =
1021
- this._gaxModule.routingHeader.fromParams({
1022
- name: request.name ?? '',
1023
- });
1002
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
1003
+ 'name': request.name ?? '',
1004
+ });
1024
1005
  const defaultCallSettings = this._defaults['listNoteOccurrences'];
1025
1006
  const callSettings = defaultCallSettings.merge(options);
1026
- this.initialize().catch(err => {
1027
- throw err;
1028
- });
1007
+ this.initialize().catch(err => { throw err; });
1029
1008
  this._log.info('listNoteOccurrences stream %j', request);
1030
1009
  return this.descriptors.page.listNoteOccurrences.createStream(this.innerApiCalls.listNoteOccurrences, request, callSettings);
1031
1010
  }
@@ -1061,15 +1040,12 @@ class GrafeasV1Beta1Client {
1061
1040
  options = options || {};
1062
1041
  options.otherArgs = options.otherArgs || {};
1063
1042
  options.otherArgs.headers = options.otherArgs.headers || {};
1064
- options.otherArgs.headers['x-goog-request-params'] =
1065
- this._gaxModule.routingHeader.fromParams({
1066
- name: request.name ?? '',
1067
- });
1043
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
1044
+ 'name': request.name ?? '',
1045
+ });
1068
1046
  const defaultCallSettings = this._defaults['listNoteOccurrences'];
1069
1047
  const callSettings = defaultCallSettings.merge(options);
1070
- this.initialize().catch(err => {
1071
- throw err;
1072
- });
1048
+ this.initialize().catch(err => { throw err; });
1073
1049
  this._log.info('listNoteOccurrences iterate %j', request);
1074
1050
  return this.descriptors.page.listNoteOccurrences.asyncIterate(this.innerApiCalls['listNoteOccurrences'], request, callSettings);
1075
1051
  }