@google-cloud/apikeys 1.3.1 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.1.0](https://github.com/googleapis/google-cloud-node/compare/apikeys-v2.0.0...apikeys-v2.1.0) (2025-03-19)
4
+
5
+
6
+ ### Features
7
+
8
+ * [Many APIs] await/catch promises, and update listOperationsAsync return type ([#6182](https://github.com/googleapis/google-cloud-node/issues/6182)) ([c41ff07](https://github.com/googleapis/google-cloud-node/commit/c41ff0729b65a1207978b4029d6369cc0552e0bf))
9
+
10
+ ## [2.0.0](https://github.com/googleapis/google-cloud-node/compare/apikeys-v1.3.1...apikeys-v2.0.0) (2025-03-18)
11
+
12
+
13
+ ### ⚠ BREAKING CHANGES
14
+
15
+ * upgrade to Node 18 ([#6096](https://github.com/googleapis/google-cloud-node/issues/6096))
16
+
17
+ ### Features
18
+
19
+ * [Many APIs] add request/response debug logging to gapics, update templates to gax 5 ([54a73fe](https://github.com/googleapis/google-cloud-node/commit/54a73fe74eab0675c006f24d5f1e4574c44d829b))
20
+
21
+
22
+ ### Miscellaneous Chores
23
+
24
+ * Upgrade to Node 18 ([#6096](https://github.com/googleapis/google-cloud-node/issues/6096)) ([eadae64](https://github.com/googleapis/google-cloud-node/commit/eadae64d54e07aa2c65097ea52e65008d4e87436))
25
+
3
26
  ## [1.3.1](https://github.com/googleapis/google-cloud-node/compare/apikeys-v1.3.0...apikeys-v1.3.1) (2025-02-12)
4
27
 
5
28
 
package/README.md CHANGED
@@ -44,7 +44,7 @@ Google APIs Client Libraries, in [Client Libraries Explained][explained].
44
44
  1. [Select or create a Cloud Platform project][projects].
45
45
  1. [Enable billing for your project][billing].
46
46
  1. [Enable the API Keys API API][enable_api].
47
- 1. [Set up authentication][auth] so you can access the
47
+ 1. [Set up authentication with a service account][auth] so you can access the
48
48
  API from your local workstation.
49
49
 
50
50
  ### Installing the client library
@@ -190,4 +190,4 @@ See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE)
190
190
  [projects]: https://console.cloud.google.com/project
191
191
  [billing]: https://support.google.com/cloud/answer/6293499#enable-billing
192
192
  [enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=apikeys.googleapis.com
193
- [auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local
193
+ [auth]: https://cloud.google.com/docs/authentication/getting-started
@@ -1,4 +1,4 @@
1
- // Copyright 2024 Google LLC
1
+ // Copyright 2025 Google LLC
2
2
  //
3
3
  // Licensed under the Apache License, Version 2.0 (the "License");
4
4
  // you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- // Copyright 2024 Google LLC
1
+ // Copyright 2025 Google LLC
2
2
  //
3
3
  // Licensed under the Apache License, Version 2.0 (the "License");
4
4
  // you may not use this file except in compliance with the License.
@@ -1,7 +1,4 @@
1
1
  {
2
- "options": {
3
- "syntax": "proto3"
4
- },
5
2
  "nested": {
6
3
  "google": {
7
4
  "nested": {
@@ -17,6 +17,7 @@ export declare class ApiKeysClient {
17
17
  private _defaults;
18
18
  private _universeDomain;
19
19
  private _servicePath;
20
+ private _log;
20
21
  auth: gax.GoogleAuth;
21
22
  descriptors: Descriptors;
22
23
  warn: (code: string, message: string, warnType?: string) => void;
@@ -52,7 +53,7 @@ export declare class ApiKeysClient {
52
53
  * Developer's Console, e.g. 'grape-spaceship-123'. We will also check
53
54
  * the environment variable GCLOUD_PROJECT for your project ID. If your
54
55
  * app is running in an environment which supports
55
- * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials},
56
+ * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials},
56
57
  * your project ID will be detected automatically.
57
58
  * @param {string} [options.apiEndpoint] - The domain name of the
58
59
  * API remote host.
@@ -535,7 +536,7 @@ export declare class ApiKeysClient {
535
536
  * // doThingsWith(response)
536
537
  * ```
537
538
  */
538
- listOperationsAsync(request: protos.google.longrunning.ListOperationsRequest, options?: gax.CallOptions): AsyncIterable<protos.google.longrunning.ListOperationsResponse>;
539
+ listOperationsAsync(request: protos.google.longrunning.ListOperationsRequest, options?: gax.CallOptions): AsyncIterable<protos.google.longrunning.IOperation>;
539
540
  /**
540
541
  * Starts asynchronous cancellation on a long-running operation. The server
541
542
  * makes a best effort to cancel the operation, but success is not
@@ -19,6 +19,7 @@
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
20
  exports.ApiKeysClient = void 0;
21
21
  const jsonProtos = require("../../protos/protos.json");
22
+ const google_gax_1 = require("google-gax");
22
23
  /**
23
24
  * Client JSON configuration object, loaded from
24
25
  * `src/v2/api_keys_client_config.json`.
@@ -32,6 +33,28 @@ const version = require('../../../package.json').version;
32
33
  * @memberof v2
33
34
  */
34
35
  class ApiKeysClient {
36
+ _terminated = false;
37
+ _opts;
38
+ _providedCustomServicePath;
39
+ _gaxModule;
40
+ _gaxGrpc;
41
+ _protos;
42
+ _defaults;
43
+ _universeDomain;
44
+ _servicePath;
45
+ _log = google_gax_1.loggingUtils.log('apikeys');
46
+ auth;
47
+ descriptors = {
48
+ page: {},
49
+ stream: {},
50
+ longrunning: {},
51
+ batching: {},
52
+ };
53
+ warn;
54
+ innerApiCalls;
55
+ pathTemplates;
56
+ operationsClient;
57
+ apiKeysStub;
35
58
  /**
36
59
  * Construct an instance of ApiKeysClient.
37
60
  *
@@ -54,7 +77,7 @@ class ApiKeysClient {
54
77
  * Developer's Console, e.g. 'grape-spaceship-123'. We will also check
55
78
  * the environment variable GCLOUD_PROJECT for your project ID. If your
56
79
  * app is running in an environment which supports
57
- * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials},
80
+ * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials},
58
81
  * your project ID will be detected automatically.
59
82
  * @param {string} [options.apiEndpoint] - The domain name of the
60
83
  * API remote host.
@@ -72,32 +95,28 @@ class ApiKeysClient {
72
95
  * ```
73
96
  */
74
97
  constructor(opts, gaxInstance) {
75
- var _a, _b, _c, _d, _e;
76
- this._terminated = false;
77
- this.descriptors = {
78
- page: {},
79
- stream: {},
80
- longrunning: {},
81
- batching: {},
82
- };
83
98
  // Ensure that options include all the required fields.
84
99
  const staticMembers = this.constructor;
85
- if ((opts === null || opts === void 0 ? void 0 : opts.universe_domain) &&
86
- (opts === null || opts === void 0 ? void 0 : opts.universeDomain) &&
87
- (opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== (opts === null || opts === void 0 ? void 0 : opts.universeDomain)) {
100
+ if (opts?.universe_domain &&
101
+ opts?.universeDomain &&
102
+ opts?.universe_domain !== opts?.universeDomain) {
88
103
  throw new Error('Please set either universe_domain or universeDomain, but not both.');
89
104
  }
90
105
  const universeDomainEnvVar = typeof process === 'object' && typeof process.env === 'object'
91
106
  ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']
92
107
  : undefined;
93
108
  this._universeDomain =
94
- (_c = (_b = (_a = opts === null || opts === void 0 ? void 0 : opts.universeDomain) !== null && _a !== void 0 ? _a : opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== null && _b !== void 0 ? _b : universeDomainEnvVar) !== null && _c !== void 0 ? _c : 'googleapis.com';
109
+ opts?.universeDomain ??
110
+ opts?.universe_domain ??
111
+ universeDomainEnvVar ??
112
+ 'googleapis.com';
95
113
  this._servicePath = 'apikeys.' + this._universeDomain;
96
- const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || this._servicePath;
97
- this._providedCustomServicePath = !!((opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint));
98
- const port = (opts === null || opts === void 0 ? void 0 : opts.port) || staticMembers.port;
99
- const clientConfig = (_d = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _d !== void 0 ? _d : {};
100
- const fallback = (_e = opts === null || opts === void 0 ? void 0 : opts.fallback) !== null && _e !== void 0 ? _e : (typeof window !== 'undefined' && typeof (window === null || window === void 0 ? void 0 : window.fetch) === 'function');
114
+ const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath;
115
+ this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint);
116
+ const port = opts?.port || staticMembers.port;
117
+ const clientConfig = opts?.clientConfig ?? {};
118
+ const fallback = opts?.fallback ??
119
+ (typeof window !== 'undefined' && typeof window?.fetch === 'function');
101
120
  opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
102
121
  // Request numeric enum values if REST transport is used.
103
122
  opts.numericEnums = true;
@@ -317,7 +336,6 @@ class ApiKeysClient {
317
336
  return this.auth.getProjectId();
318
337
  }
319
338
  getKey(request, optionsOrCallback, callback) {
320
- var _a;
321
339
  request = request || {};
322
340
  let options;
323
341
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -332,13 +350,26 @@ class ApiKeysClient {
332
350
  options.otherArgs.headers = options.otherArgs.headers || {};
333
351
  options.otherArgs.headers['x-goog-request-params'] =
334
352
  this._gaxModule.routingHeader.fromParams({
335
- name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
353
+ name: request.name ?? '',
336
354
  });
337
- this.initialize();
338
- return this.innerApiCalls.getKey(request, options, callback);
355
+ this.initialize().catch(err => {
356
+ throw err;
357
+ });
358
+ this._log.info('getKey request %j', request);
359
+ const wrappedCallback = callback
360
+ ? (error, response, options, rawResponse) => {
361
+ this._log.info('getKey response %j', response);
362
+ callback(error, response, options, rawResponse); // We verified callback above.
363
+ }
364
+ : undefined;
365
+ return this.innerApiCalls
366
+ .getKey(request, options, wrappedCallback)
367
+ ?.then(([response, options, rawResponse]) => {
368
+ this._log.info('getKey response %j', response);
369
+ return [response, options, rawResponse];
370
+ });
339
371
  }
340
372
  getKeyString(request, optionsOrCallback, callback) {
341
- var _a;
342
373
  request = request || {};
343
374
  let options;
344
375
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -353,10 +384,24 @@ class ApiKeysClient {
353
384
  options.otherArgs.headers = options.otherArgs.headers || {};
354
385
  options.otherArgs.headers['x-goog-request-params'] =
355
386
  this._gaxModule.routingHeader.fromParams({
356
- name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
387
+ name: request.name ?? '',
357
388
  });
358
- this.initialize();
359
- return this.innerApiCalls.getKeyString(request, options, callback);
389
+ this.initialize().catch(err => {
390
+ throw err;
391
+ });
392
+ this._log.info('getKeyString request %j', request);
393
+ const wrappedCallback = callback
394
+ ? (error, response, options, rawResponse) => {
395
+ this._log.info('getKeyString response %j', response);
396
+ callback(error, response, options, rawResponse); // We verified callback above.
397
+ }
398
+ : undefined;
399
+ return this.innerApiCalls
400
+ .getKeyString(request, options, wrappedCallback)
401
+ ?.then(([response, options, rawResponse]) => {
402
+ this._log.info('getKeyString response %j', response);
403
+ return [response, options, rawResponse];
404
+ });
360
405
  }
361
406
  lookupKey(request, optionsOrCallback, callback) {
362
407
  request = request || {};
@@ -371,11 +416,24 @@ class ApiKeysClient {
371
416
  options = options || {};
372
417
  options.otherArgs = options.otherArgs || {};
373
418
  options.otherArgs.headers = options.otherArgs.headers || {};
374
- this.initialize();
375
- return this.innerApiCalls.lookupKey(request, options, callback);
419
+ this.initialize().catch(err => {
420
+ throw err;
421
+ });
422
+ this._log.info('lookupKey request %j', request);
423
+ const wrappedCallback = callback
424
+ ? (error, response, options, rawResponse) => {
425
+ this._log.info('lookupKey response %j', response);
426
+ callback(error, response, options, rawResponse); // We verified callback above.
427
+ }
428
+ : undefined;
429
+ return this.innerApiCalls
430
+ .lookupKey(request, options, wrappedCallback)
431
+ ?.then(([response, options, rawResponse]) => {
432
+ this._log.info('lookupKey response %j', response);
433
+ return [response, options, rawResponse];
434
+ });
376
435
  }
377
436
  createKey(request, optionsOrCallback, callback) {
378
- var _a;
379
437
  request = request || {};
380
438
  let options;
381
439
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -390,10 +448,24 @@ class ApiKeysClient {
390
448
  options.otherArgs.headers = options.otherArgs.headers || {};
391
449
  options.otherArgs.headers['x-goog-request-params'] =
392
450
  this._gaxModule.routingHeader.fromParams({
393
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
451
+ parent: request.parent ?? '',
394
452
  });
395
- this.initialize();
396
- return this.innerApiCalls.createKey(request, options, callback);
453
+ this.initialize().catch(err => {
454
+ throw err;
455
+ });
456
+ const wrappedCallback = callback
457
+ ? (error, response, rawResponse, _) => {
458
+ this._log.info('createKey response %j', rawResponse);
459
+ callback(error, response, rawResponse, _); // We verified callback above.
460
+ }
461
+ : undefined;
462
+ this._log.info('createKey request %j', request);
463
+ return this.innerApiCalls
464
+ .createKey(request, options, wrappedCallback)
465
+ ?.then(([response, rawResponse, _]) => {
466
+ this._log.info('createKey response %j', rawResponse);
467
+ return [response, rawResponse, _];
468
+ });
397
469
  }
398
470
  /**
399
471
  * Check the status of the long running operation returned by `createKey()`.
@@ -407,13 +479,13 @@ class ApiKeysClient {
407
479
  * region_tag:apikeys_v2_generated_ApiKeys_CreateKey_async
408
480
  */
409
481
  async checkCreateKeyProgress(name) {
482
+ this._log.info('createKey long-running');
410
483
  const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
411
484
  const [operation] = await this.operationsClient.getOperation(request);
412
485
  const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createKey, this._gaxModule.createDefaultBackoffSettings());
413
486
  return decodeOperation;
414
487
  }
415
488
  updateKey(request, optionsOrCallback, callback) {
416
- var _a;
417
489
  request = request || {};
418
490
  let options;
419
491
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -428,10 +500,24 @@ class ApiKeysClient {
428
500
  options.otherArgs.headers = options.otherArgs.headers || {};
429
501
  options.otherArgs.headers['x-goog-request-params'] =
430
502
  this._gaxModule.routingHeader.fromParams({
431
- 'key.name': (_a = request.key.name) !== null && _a !== void 0 ? _a : '',
503
+ 'key.name': request.key.name ?? '',
432
504
  });
433
- this.initialize();
434
- return this.innerApiCalls.updateKey(request, options, callback);
505
+ this.initialize().catch(err => {
506
+ throw err;
507
+ });
508
+ const wrappedCallback = callback
509
+ ? (error, response, rawResponse, _) => {
510
+ this._log.info('updateKey response %j', rawResponse);
511
+ callback(error, response, rawResponse, _); // We verified callback above.
512
+ }
513
+ : undefined;
514
+ this._log.info('updateKey request %j', request);
515
+ return this.innerApiCalls
516
+ .updateKey(request, options, wrappedCallback)
517
+ ?.then(([response, rawResponse, _]) => {
518
+ this._log.info('updateKey response %j', rawResponse);
519
+ return [response, rawResponse, _];
520
+ });
435
521
  }
436
522
  /**
437
523
  * Check the status of the long running operation returned by `updateKey()`.
@@ -445,13 +531,13 @@ class ApiKeysClient {
445
531
  * region_tag:apikeys_v2_generated_ApiKeys_UpdateKey_async
446
532
  */
447
533
  async checkUpdateKeyProgress(name) {
534
+ this._log.info('updateKey long-running');
448
535
  const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
449
536
  const [operation] = await this.operationsClient.getOperation(request);
450
537
  const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateKey, this._gaxModule.createDefaultBackoffSettings());
451
538
  return decodeOperation;
452
539
  }
453
540
  deleteKey(request, optionsOrCallback, callback) {
454
- var _a;
455
541
  request = request || {};
456
542
  let options;
457
543
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -466,10 +552,24 @@ class ApiKeysClient {
466
552
  options.otherArgs.headers = options.otherArgs.headers || {};
467
553
  options.otherArgs.headers['x-goog-request-params'] =
468
554
  this._gaxModule.routingHeader.fromParams({
469
- name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
555
+ name: request.name ?? '',
470
556
  });
471
- this.initialize();
472
- return this.innerApiCalls.deleteKey(request, options, callback);
557
+ this.initialize().catch(err => {
558
+ throw err;
559
+ });
560
+ const wrappedCallback = callback
561
+ ? (error, response, rawResponse, _) => {
562
+ this._log.info('deleteKey response %j', rawResponse);
563
+ callback(error, response, rawResponse, _); // We verified callback above.
564
+ }
565
+ : undefined;
566
+ this._log.info('deleteKey request %j', request);
567
+ return this.innerApiCalls
568
+ .deleteKey(request, options, wrappedCallback)
569
+ ?.then(([response, rawResponse, _]) => {
570
+ this._log.info('deleteKey response %j', rawResponse);
571
+ return [response, rawResponse, _];
572
+ });
473
573
  }
474
574
  /**
475
575
  * Check the status of the long running operation returned by `deleteKey()`.
@@ -483,13 +583,13 @@ class ApiKeysClient {
483
583
  * region_tag:apikeys_v2_generated_ApiKeys_DeleteKey_async
484
584
  */
485
585
  async checkDeleteKeyProgress(name) {
586
+ this._log.info('deleteKey long-running');
486
587
  const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
487
588
  const [operation] = await this.operationsClient.getOperation(request);
488
589
  const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteKey, this._gaxModule.createDefaultBackoffSettings());
489
590
  return decodeOperation;
490
591
  }
491
592
  undeleteKey(request, optionsOrCallback, callback) {
492
- var _a;
493
593
  request = request || {};
494
594
  let options;
495
595
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -504,10 +604,24 @@ class ApiKeysClient {
504
604
  options.otherArgs.headers = options.otherArgs.headers || {};
505
605
  options.otherArgs.headers['x-goog-request-params'] =
506
606
  this._gaxModule.routingHeader.fromParams({
507
- name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
607
+ name: request.name ?? '',
508
608
  });
509
- this.initialize();
510
- return this.innerApiCalls.undeleteKey(request, options, callback);
609
+ this.initialize().catch(err => {
610
+ throw err;
611
+ });
612
+ const wrappedCallback = callback
613
+ ? (error, response, rawResponse, _) => {
614
+ this._log.info('undeleteKey response %j', rawResponse);
615
+ callback(error, response, rawResponse, _); // We verified callback above.
616
+ }
617
+ : undefined;
618
+ this._log.info('undeleteKey request %j', request);
619
+ return this.innerApiCalls
620
+ .undeleteKey(request, options, wrappedCallback)
621
+ ?.then(([response, rawResponse, _]) => {
622
+ this._log.info('undeleteKey response %j', rawResponse);
623
+ return [response, rawResponse, _];
624
+ });
511
625
  }
512
626
  /**
513
627
  * Check the status of the long running operation returned by `undeleteKey()`.
@@ -521,13 +635,13 @@ class ApiKeysClient {
521
635
  * region_tag:apikeys_v2_generated_ApiKeys_UndeleteKey_async
522
636
  */
523
637
  async checkUndeleteKeyProgress(name) {
638
+ this._log.info('undeleteKey long-running');
524
639
  const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
525
640
  const [operation] = await this.operationsClient.getOperation(request);
526
641
  const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.undeleteKey, this._gaxModule.createDefaultBackoffSettings());
527
642
  return decodeOperation;
528
643
  }
529
644
  listKeys(request, optionsOrCallback, callback) {
530
- var _a;
531
645
  request = request || {};
532
646
  let options;
533
647
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -542,10 +656,24 @@ class ApiKeysClient {
542
656
  options.otherArgs.headers = options.otherArgs.headers || {};
543
657
  options.otherArgs.headers['x-goog-request-params'] =
544
658
  this._gaxModule.routingHeader.fromParams({
545
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
659
+ parent: request.parent ?? '',
546
660
  });
547
- this.initialize();
548
- return this.innerApiCalls.listKeys(request, options, callback);
661
+ this.initialize().catch(err => {
662
+ throw err;
663
+ });
664
+ const wrappedCallback = callback
665
+ ? (error, values, nextPageRequest, rawResponse) => {
666
+ this._log.info('listKeys values %j', values);
667
+ callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
668
+ }
669
+ : undefined;
670
+ this._log.info('listKeys request %j', request);
671
+ return this.innerApiCalls
672
+ .listKeys(request, options, wrappedCallback)
673
+ ?.then(([response, input, output]) => {
674
+ this._log.info('listKeys values %j', response);
675
+ return [response, input, output];
676
+ });
549
677
  }
550
678
  /**
551
679
  * Equivalent to `listKeys`, but returns a NodeJS Stream object.
@@ -572,18 +700,20 @@ class ApiKeysClient {
572
700
  * for more details and examples.
573
701
  */
574
702
  listKeysStream(request, options) {
575
- var _a;
576
703
  request = request || {};
577
704
  options = options || {};
578
705
  options.otherArgs = options.otherArgs || {};
579
706
  options.otherArgs.headers = options.otherArgs.headers || {};
580
707
  options.otherArgs.headers['x-goog-request-params'] =
581
708
  this._gaxModule.routingHeader.fromParams({
582
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
709
+ parent: request.parent ?? '',
583
710
  });
584
711
  const defaultCallSettings = this._defaults['listKeys'];
585
712
  const callSettings = defaultCallSettings.merge(options);
586
- this.initialize();
713
+ this.initialize().catch(err => {
714
+ throw err;
715
+ });
716
+ this._log.info('listKeys stream %j', request);
587
717
  return this.descriptors.page.listKeys.createStream(this.innerApiCalls.listKeys, request, callSettings);
588
718
  }
589
719
  /**
@@ -614,18 +744,20 @@ class ApiKeysClient {
614
744
  * region_tag:apikeys_v2_generated_ApiKeys_ListKeys_async
615
745
  */
616
746
  listKeysAsync(request, options) {
617
- var _a;
618
747
  request = request || {};
619
748
  options = options || {};
620
749
  options.otherArgs = options.otherArgs || {};
621
750
  options.otherArgs.headers = options.otherArgs.headers || {};
622
751
  options.otherArgs.headers['x-goog-request-params'] =
623
752
  this._gaxModule.routingHeader.fromParams({
624
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
753
+ parent: request.parent ?? '',
625
754
  });
626
755
  const defaultCallSettings = this._defaults['listKeys'];
627
756
  const callSettings = defaultCallSettings.merge(options);
628
- this.initialize();
757
+ this.initialize().catch(err => {
758
+ throw err;
759
+ });
760
+ this._log.info('listKeys iterate %j', request);
629
761
  return this.descriptors.page.listKeys.asyncIterate(this.innerApiCalls['listKeys'], request, callSettings);
630
762
  }
631
763
  /**
@@ -659,7 +791,6 @@ class ApiKeysClient {
659
791
  * ```
660
792
  */
661
793
  getOperation(request, optionsOrCallback, callback) {
662
- var _a;
663
794
  let options;
664
795
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
665
796
  callback = optionsOrCallback;
@@ -673,7 +804,7 @@ class ApiKeysClient {
673
804
  options.otherArgs.headers = options.otherArgs.headers || {};
674
805
  options.otherArgs.headers['x-goog-request-params'] =
675
806
  this._gaxModule.routingHeader.fromParams({
676
- name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
807
+ name: request.name ?? '',
677
808
  });
678
809
  return this.operationsClient.getOperation(request, options, callback);
679
810
  }
@@ -708,13 +839,12 @@ class ApiKeysClient {
708
839
  * ```
709
840
  */
710
841
  listOperationsAsync(request, options) {
711
- var _a;
712
842
  options = options || {};
713
843
  options.otherArgs = options.otherArgs || {};
714
844
  options.otherArgs.headers = options.otherArgs.headers || {};
715
845
  options.otherArgs.headers['x-goog-request-params'] =
716
846
  this._gaxModule.routingHeader.fromParams({
717
- name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
847
+ name: request.name ?? '',
718
848
  });
719
849
  return this.operationsClient.listOperationsAsync(request, options);
720
850
  }
@@ -750,7 +880,6 @@ class ApiKeysClient {
750
880
  * ```
751
881
  */
752
882
  cancelOperation(request, optionsOrCallback, callback) {
753
- var _a;
754
883
  let options;
755
884
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
756
885
  callback = optionsOrCallback;
@@ -764,7 +893,7 @@ class ApiKeysClient {
764
893
  options.otherArgs.headers = options.otherArgs.headers || {};
765
894
  options.otherArgs.headers['x-goog-request-params'] =
766
895
  this._gaxModule.routingHeader.fromParams({
767
- name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
896
+ name: request.name ?? '',
768
897
  });
769
898
  return this.operationsClient.cancelOperation(request, options, callback);
770
899
  }
@@ -794,7 +923,6 @@ class ApiKeysClient {
794
923
  * ```
795
924
  */
796
925
  deleteOperation(request, optionsOrCallback, callback) {
797
- var _a;
798
926
  let options;
799
927
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
800
928
  callback = optionsOrCallback;
@@ -808,7 +936,7 @@ class ApiKeysClient {
808
936
  options.otherArgs.headers = options.otherArgs.headers || {};
809
937
  options.otherArgs.headers['x-goog-request-params'] =
810
938
  this._gaxModule.routingHeader.fromParams({
811
- name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
939
+ name: request.name ?? '',
812
940
  });
813
941
  return this.operationsClient.deleteOperation(request, options, callback);
814
942
  }
@@ -923,6 +1051,7 @@ class ApiKeysClient {
923
1051
  close() {
924
1052
  if (this.apiKeysStub && !this._terminated) {
925
1053
  return this.apiKeysStub.then(stub => {
1054
+ this._log.info('ending gRPC channel');
926
1055
  this._terminated = true;
927
1056
  stub.close();
928
1057
  this.operationsClient.close();
@@ -0,0 +1,4 @@
1
+ [
2
+ "../../protos/google/api/apikeys/v2/apikeys.proto",
3
+ "../../protos/google/api/apikeys/v2/resources.proto"
4
+ ]
@@ -0,0 +1,107 @@
1
+ {
2
+ "schema": "1.0",
3
+ "comment": "This file maps proto services/RPCs to the corresponding library clients/methods",
4
+ "language": "typescript",
5
+ "protoPackage": "google.api.apikeys.v2",
6
+ "libraryPackage": "@google-cloud/apikeys",
7
+ "services": {
8
+ "ApiKeys": {
9
+ "clients": {
10
+ "grpc": {
11
+ "libraryClient": "ApiKeysClient",
12
+ "rpcs": {
13
+ "GetKey": {
14
+ "methods": [
15
+ "getKey"
16
+ ]
17
+ },
18
+ "GetKeyString": {
19
+ "methods": [
20
+ "getKeyString"
21
+ ]
22
+ },
23
+ "LookupKey": {
24
+ "methods": [
25
+ "lookupKey"
26
+ ]
27
+ },
28
+ "CreateKey": {
29
+ "methods": [
30
+ "createKey"
31
+ ]
32
+ },
33
+ "UpdateKey": {
34
+ "methods": [
35
+ "updateKey"
36
+ ]
37
+ },
38
+ "DeleteKey": {
39
+ "methods": [
40
+ "deleteKey"
41
+ ]
42
+ },
43
+ "UndeleteKey": {
44
+ "methods": [
45
+ "undeleteKey"
46
+ ]
47
+ },
48
+ "ListKeys": {
49
+ "methods": [
50
+ "listKeys",
51
+ "listKeysStream",
52
+ "listKeysAsync"
53
+ ]
54
+ }
55
+ }
56
+ },
57
+ "grpc-fallback": {
58
+ "libraryClient": "ApiKeysClient",
59
+ "rpcs": {
60
+ "GetKey": {
61
+ "methods": [
62
+ "getKey"
63
+ ]
64
+ },
65
+ "GetKeyString": {
66
+ "methods": [
67
+ "getKeyString"
68
+ ]
69
+ },
70
+ "LookupKey": {
71
+ "methods": [
72
+ "lookupKey"
73
+ ]
74
+ },
75
+ "CreateKey": {
76
+ "methods": [
77
+ "createKey"
78
+ ]
79
+ },
80
+ "UpdateKey": {
81
+ "methods": [
82
+ "updateKey"
83
+ ]
84
+ },
85
+ "DeleteKey": {
86
+ "methods": [
87
+ "deleteKey"
88
+ ]
89
+ },
90
+ "UndeleteKey": {
91
+ "methods": [
92
+ "undeleteKey"
93
+ ]
94
+ },
95
+ "ListKeys": {
96
+ "methods": [
97
+ "listKeys",
98
+ "listKeysStream",
99
+ "listKeysAsync"
100
+ ]
101
+ }
102
+ }
103
+ }
104
+ }
105
+ }
106
+ }
107
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@google-cloud/apikeys",
3
- "version": "1.3.1",
3
+ "version": "2.1.0",
4
4
  "description": "API Keys API client for Node.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -46,26 +46,26 @@
46
46
  "test": "c8 mocha build/test"
47
47
  },
48
48
  "dependencies": {
49
- "google-gax": "^4.0.3"
49
+ "google-gax": "^5.0.1-rc.0"
50
50
  },
51
51
  "devDependencies": {
52
- "@types/mocha": "^9.0.0",
53
- "@types/node": "^22.0.0",
54
- "@types/sinon": "^17.0.0",
55
- "c8": "^9.0.0",
56
- "gapic-tools": "^0.4.0",
57
- "gts": "^5.0.0",
58
- "jsdoc": "^4.0.0",
52
+ "@types/mocha": "^10.0.10",
53
+ "@types/node": "^22.13.9",
54
+ "@types/sinon": "^17.0.4",
55
+ "c8": "^10.1.3",
56
+ "gapic-tools": "^1.0.0",
57
+ "gts": "^6.0.2",
58
+ "jsdoc": "^4.0.4",
59
59
  "jsdoc-fresh": "^3.0.0",
60
60
  "jsdoc-region-tag": "^3.0.0",
61
- "linkinator": "4.1.2",
62
- "long": "^5.2.3",
63
- "mocha": "^9.2.2",
64
- "pack-n-play": "^2.0.0",
65
- "sinon": "^18.0.0",
66
- "typescript": "^5.1.6"
61
+ "linkinator": "^6.1.2",
62
+ "long": "^5.3.1",
63
+ "mocha": "^11.1.0",
64
+ "pack-n-play": "^3.0.0",
65
+ "sinon": "^19.0.2",
66
+ "typescript": "^5.8.2"
67
67
  },
68
68
  "engines": {
69
- "node": ">=14.0.0"
69
+ "node": ">=18"
70
70
  }
71
71
  }