@google-cloud/apikeys 1.3.0 → 2.0.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 +23 -0
- package/README.md +5 -4
- package/build/protos/google/api/apikeys/v2/apikeys.proto +1 -1
- package/build/protos/google/api/apikeys/v2/resources.proto +1 -1
- package/build/protos/protos.d.ts +1 -1
- package/build/protos/protos.js +1 -1
- package/build/src/index.js +1 -1
- package/build/src/v2/api_keys_client.d.ts +6 -6
- package/build/src/v2/api_keys_client.js +214 -49
- package/build/src/v2/api_keys_proto_list.json +4 -0
- package/build/src/v2/gapic_metadata.json +107 -0
- package/build/src/v2/index.js +1 -1
- package/package.json +16 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.0.0](https://github.com/googleapis/google-cloud-node/compare/apikeys-v1.3.1...apikeys-v2.0.0) (2025-03-18)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### ⚠ BREAKING CHANGES
|
|
7
|
+
|
|
8
|
+
* upgrade to Node 18 ([#6096](https://github.com/googleapis/google-cloud-node/issues/6096))
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* [Many APIs] add request/response debug logging to gapics, update templates to gax 5 ([54a73fe](https://github.com/googleapis/google-cloud-node/commit/54a73fe74eab0675c006f24d5f1e4574c44d829b))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Miscellaneous Chores
|
|
16
|
+
|
|
17
|
+
* Upgrade to Node 18 ([#6096](https://github.com/googleapis/google-cloud-node/issues/6096)) ([eadae64](https://github.com/googleapis/google-cloud-node/commit/eadae64d54e07aa2c65097ea52e65008d4e87436))
|
|
18
|
+
|
|
19
|
+
## [1.3.1](https://github.com/googleapis/google-cloud-node/compare/apikeys-v1.3.0...apikeys-v1.3.1) (2025-02-12)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* [Many APIs] finalize fixing typings for headers in generator ([#6011](https://github.com/googleapis/google-cloud-node/issues/6011)) ([ee865ff](https://github.com/googleapis/google-cloud-node/commit/ee865ff34a696fbd657e4cfb6cc4be2f6651f77a))
|
|
25
|
+
|
|
3
26
|
## [1.3.0](https://github.com/googleapis/google-cloud-node/compare/apikeys-v1.2.0...apikeys-v1.3.0) (2024-05-21)
|
|
4
27
|
|
|
5
28
|
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# [API Keys API: Node.js Client](https://github.com/googleapis/google-cloud-node/tree/main/packages/google-api-apikeys)
|
|
6
6
|
|
|
7
|
-
[](https://cloud.google.com/terms/launch-stages)
|
|
8
8
|
[](https://www.npmjs.org/package/@google-cloud/apikeys)
|
|
9
9
|
|
|
10
10
|
|
|
@@ -154,13 +154,14 @@ This library follows [Semantic Versioning](http://semver.org/).
|
|
|
154
154
|
|
|
155
155
|
|
|
156
156
|
|
|
157
|
+
This library is considered to be **stable**. The code surface will not change in backwards-incompatible ways
|
|
158
|
+
unless absolutely necessary (e.g. because of critical security issues) or with
|
|
159
|
+
an extensive deprecation period. Issues and requests against **stable** libraries
|
|
160
|
+
are addressed with the highest priority.
|
|
157
161
|
|
|
158
162
|
|
|
159
163
|
|
|
160
164
|
|
|
161
|
-
This library is considered to be in **preview**. This means it is still a
|
|
162
|
-
work-in-progress and under active development. Any release is subject to
|
|
163
|
-
backwards-incompatible changes at any time.
|
|
164
165
|
|
|
165
166
|
|
|
166
167
|
More Information: [Google Cloud Platform Launch Stages][launch_stages]
|
package/build/protos/protos.d.ts
CHANGED
package/build/protos/protos.js
CHANGED
package/build/src/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import type * as gax from 'google-gax';
|
|
3
2
|
import type { Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback } from 'google-gax';
|
|
4
3
|
import { Transform } from 'stream';
|
|
@@ -18,6 +17,7 @@ export declare class ApiKeysClient {
|
|
|
18
17
|
private _defaults;
|
|
19
18
|
private _universeDomain;
|
|
20
19
|
private _servicePath;
|
|
20
|
+
private _log;
|
|
21
21
|
auth: gax.GoogleAuth;
|
|
22
22
|
descriptors: Descriptors;
|
|
23
23
|
warn: (code: string, message: string, warnType?: string) => void;
|
|
@@ -53,7 +53,7 @@ export declare class ApiKeysClient {
|
|
|
53
53
|
* Developer's Console, e.g. 'grape-spaceship-123'. We will also check
|
|
54
54
|
* the environment variable GCLOUD_PROJECT for your project ID. If your
|
|
55
55
|
* app is running in an environment which supports
|
|
56
|
-
* {@link https://
|
|
56
|
+
* {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials},
|
|
57
57
|
* your project ID will be detected automatically.
|
|
58
58
|
* @param {string} [options.apiEndpoint] - The domain name of the
|
|
59
59
|
* API remote host.
|
|
@@ -423,7 +423,7 @@ export declare class ApiKeysClient {
|
|
|
423
423
|
listKeys(request: protos.google.api.apikeys.v2.IListKeysRequest, options: CallOptions, callback: PaginationCallback<protos.google.api.apikeys.v2.IListKeysRequest, protos.google.api.apikeys.v2.IListKeysResponse | null | undefined, protos.google.api.apikeys.v2.IKey>): void;
|
|
424
424
|
listKeys(request: protos.google.api.apikeys.v2.IListKeysRequest, callback: PaginationCallback<protos.google.api.apikeys.v2.IListKeysRequest, protos.google.api.apikeys.v2.IListKeysResponse | null | undefined, protos.google.api.apikeys.v2.IKey>): void;
|
|
425
425
|
/**
|
|
426
|
-
* Equivalent to `
|
|
426
|
+
* Equivalent to `listKeys`, but returns a NodeJS Stream object.
|
|
427
427
|
* @param {Object} request
|
|
428
428
|
* The request object that will be sent.
|
|
429
429
|
* @param {string} request.parent
|
|
@@ -505,7 +505,7 @@ export declare class ApiKeysClient {
|
|
|
505
505
|
* // doThingsWith(response)
|
|
506
506
|
* ```
|
|
507
507
|
*/
|
|
508
|
-
getOperation(request: protos.google.longrunning.GetOperationRequest,
|
|
508
|
+
getOperation(request: protos.google.longrunning.GetOperationRequest, optionsOrCallback?: gax.CallOptions | Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>, callback?: Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>): Promise<[protos.google.longrunning.Operation]>;
|
|
509
509
|
/**
|
|
510
510
|
* Lists operations that match the specified filter in the request. If the
|
|
511
511
|
* server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object.
|
|
@@ -568,7 +568,7 @@ export declare class ApiKeysClient {
|
|
|
568
568
|
* await client.cancelOperation({name: ''});
|
|
569
569
|
* ```
|
|
570
570
|
*/
|
|
571
|
-
cancelOperation(request: protos.google.longrunning.CancelOperationRequest,
|
|
571
|
+
cancelOperation(request: protos.google.longrunning.CancelOperationRequest, optionsOrCallback?: gax.CallOptions | Callback<protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null>, callback?: Callback<protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null>): Promise<protos.google.protobuf.Empty>;
|
|
572
572
|
/**
|
|
573
573
|
* Deletes a long-running operation. This method indicates that the client is
|
|
574
574
|
* no longer interested in the operation result. It does not cancel the
|
|
@@ -594,7 +594,7 @@ export declare class ApiKeysClient {
|
|
|
594
594
|
* await client.deleteOperation({name: ''});
|
|
595
595
|
* ```
|
|
596
596
|
*/
|
|
597
|
-
deleteOperation(request: protos.google.longrunning.DeleteOperationRequest,
|
|
597
|
+
deleteOperation(request: protos.google.longrunning.DeleteOperationRequest, optionsOrCallback?: gax.CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>, callback?: Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>): Promise<protos.google.protobuf.Empty>;
|
|
598
598
|
/**
|
|
599
599
|
* Return a fully-qualified key resource name string.
|
|
600
600
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// Copyright
|
|
2
|
+
// Copyright 2025 Google LLC
|
|
3
3
|
//
|
|
4
4
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
// you may not use this file except in compliance with the License.
|
|
@@ -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://
|
|
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 (
|
|
86
|
-
|
|
87
|
-
|
|
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
|
-
|
|
109
|
+
opts?.universeDomain ??
|
|
110
|
+
opts?.universe_domain ??
|
|
111
|
+
universeDomainEnvVar ??
|
|
112
|
+
'googleapis.com';
|
|
95
113
|
this._servicePath = 'apikeys.' + this._universeDomain;
|
|
96
|
-
const servicePath =
|
|
97
|
-
this._providedCustomServicePath = !!(
|
|
98
|
-
const port =
|
|
99
|
-
const clientConfig =
|
|
100
|
-
const fallback =
|
|
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,24 @@ 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:
|
|
353
|
+
name: request.name ?? '',
|
|
336
354
|
});
|
|
337
355
|
this.initialize();
|
|
338
|
-
|
|
356
|
+
this._log.info('getKey request %j', request);
|
|
357
|
+
const wrappedCallback = callback
|
|
358
|
+
? (error, response, options, rawResponse) => {
|
|
359
|
+
this._log.info('getKey response %j', response);
|
|
360
|
+
callback(error, response, options, rawResponse); // We verified callback above.
|
|
361
|
+
}
|
|
362
|
+
: undefined;
|
|
363
|
+
return this.innerApiCalls
|
|
364
|
+
.getKey(request, options, wrappedCallback)
|
|
365
|
+
?.then(([response, options, rawResponse]) => {
|
|
366
|
+
this._log.info('getKey response %j', response);
|
|
367
|
+
return [response, options, rawResponse];
|
|
368
|
+
});
|
|
339
369
|
}
|
|
340
370
|
getKeyString(request, optionsOrCallback, callback) {
|
|
341
|
-
var _a;
|
|
342
371
|
request = request || {};
|
|
343
372
|
let options;
|
|
344
373
|
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
@@ -353,10 +382,22 @@ class ApiKeysClient {
|
|
|
353
382
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
354
383
|
options.otherArgs.headers['x-goog-request-params'] =
|
|
355
384
|
this._gaxModule.routingHeader.fromParams({
|
|
356
|
-
name:
|
|
385
|
+
name: request.name ?? '',
|
|
357
386
|
});
|
|
358
387
|
this.initialize();
|
|
359
|
-
|
|
388
|
+
this._log.info('getKeyString request %j', request);
|
|
389
|
+
const wrappedCallback = callback
|
|
390
|
+
? (error, response, options, rawResponse) => {
|
|
391
|
+
this._log.info('getKeyString response %j', response);
|
|
392
|
+
callback(error, response, options, rawResponse); // We verified callback above.
|
|
393
|
+
}
|
|
394
|
+
: undefined;
|
|
395
|
+
return this.innerApiCalls
|
|
396
|
+
.getKeyString(request, options, wrappedCallback)
|
|
397
|
+
?.then(([response, options, rawResponse]) => {
|
|
398
|
+
this._log.info('getKeyString response %j', response);
|
|
399
|
+
return [response, options, rawResponse];
|
|
400
|
+
});
|
|
360
401
|
}
|
|
361
402
|
lookupKey(request, optionsOrCallback, callback) {
|
|
362
403
|
request = request || {};
|
|
@@ -372,10 +413,21 @@ class ApiKeysClient {
|
|
|
372
413
|
options.otherArgs = options.otherArgs || {};
|
|
373
414
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
374
415
|
this.initialize();
|
|
375
|
-
|
|
416
|
+
this._log.info('lookupKey request %j', request);
|
|
417
|
+
const wrappedCallback = callback
|
|
418
|
+
? (error, response, options, rawResponse) => {
|
|
419
|
+
this._log.info('lookupKey response %j', response);
|
|
420
|
+
callback(error, response, options, rawResponse); // We verified callback above.
|
|
421
|
+
}
|
|
422
|
+
: undefined;
|
|
423
|
+
return this.innerApiCalls
|
|
424
|
+
.lookupKey(request, options, wrappedCallback)
|
|
425
|
+
?.then(([response, options, rawResponse]) => {
|
|
426
|
+
this._log.info('lookupKey response %j', response);
|
|
427
|
+
return [response, options, rawResponse];
|
|
428
|
+
});
|
|
376
429
|
}
|
|
377
430
|
createKey(request, optionsOrCallback, callback) {
|
|
378
|
-
var _a;
|
|
379
431
|
request = request || {};
|
|
380
432
|
let options;
|
|
381
433
|
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
@@ -390,10 +442,22 @@ class ApiKeysClient {
|
|
|
390
442
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
391
443
|
options.otherArgs.headers['x-goog-request-params'] =
|
|
392
444
|
this._gaxModule.routingHeader.fromParams({
|
|
393
|
-
parent:
|
|
445
|
+
parent: request.parent ?? '',
|
|
394
446
|
});
|
|
395
447
|
this.initialize();
|
|
396
|
-
|
|
448
|
+
const wrappedCallback = callback
|
|
449
|
+
? (error, response, rawResponse, _) => {
|
|
450
|
+
this._log.info('createKey response %j', rawResponse);
|
|
451
|
+
callback(error, response, rawResponse, _); // We verified callback above.
|
|
452
|
+
}
|
|
453
|
+
: undefined;
|
|
454
|
+
this._log.info('createKey request %j', request);
|
|
455
|
+
return this.innerApiCalls
|
|
456
|
+
.createKey(request, options, wrappedCallback)
|
|
457
|
+
?.then(([response, rawResponse, _]) => {
|
|
458
|
+
this._log.info('createKey response %j', rawResponse);
|
|
459
|
+
return [response, rawResponse, _];
|
|
460
|
+
});
|
|
397
461
|
}
|
|
398
462
|
/**
|
|
399
463
|
* Check the status of the long running operation returned by `createKey()`.
|
|
@@ -407,13 +471,13 @@ class ApiKeysClient {
|
|
|
407
471
|
* region_tag:apikeys_v2_generated_ApiKeys_CreateKey_async
|
|
408
472
|
*/
|
|
409
473
|
async checkCreateKeyProgress(name) {
|
|
474
|
+
this._log.info('createKey long-running');
|
|
410
475
|
const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
|
|
411
476
|
const [operation] = await this.operationsClient.getOperation(request);
|
|
412
477
|
const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createKey, this._gaxModule.createDefaultBackoffSettings());
|
|
413
478
|
return decodeOperation;
|
|
414
479
|
}
|
|
415
480
|
updateKey(request, optionsOrCallback, callback) {
|
|
416
|
-
var _a;
|
|
417
481
|
request = request || {};
|
|
418
482
|
let options;
|
|
419
483
|
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
@@ -428,10 +492,22 @@ class ApiKeysClient {
|
|
|
428
492
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
429
493
|
options.otherArgs.headers['x-goog-request-params'] =
|
|
430
494
|
this._gaxModule.routingHeader.fromParams({
|
|
431
|
-
'key.name':
|
|
495
|
+
'key.name': request.key.name ?? '',
|
|
432
496
|
});
|
|
433
497
|
this.initialize();
|
|
434
|
-
|
|
498
|
+
const wrappedCallback = callback
|
|
499
|
+
? (error, response, rawResponse, _) => {
|
|
500
|
+
this._log.info('updateKey response %j', rawResponse);
|
|
501
|
+
callback(error, response, rawResponse, _); // We verified callback above.
|
|
502
|
+
}
|
|
503
|
+
: undefined;
|
|
504
|
+
this._log.info('updateKey request %j', request);
|
|
505
|
+
return this.innerApiCalls
|
|
506
|
+
.updateKey(request, options, wrappedCallback)
|
|
507
|
+
?.then(([response, rawResponse, _]) => {
|
|
508
|
+
this._log.info('updateKey response %j', rawResponse);
|
|
509
|
+
return [response, rawResponse, _];
|
|
510
|
+
});
|
|
435
511
|
}
|
|
436
512
|
/**
|
|
437
513
|
* Check the status of the long running operation returned by `updateKey()`.
|
|
@@ -445,13 +521,13 @@ class ApiKeysClient {
|
|
|
445
521
|
* region_tag:apikeys_v2_generated_ApiKeys_UpdateKey_async
|
|
446
522
|
*/
|
|
447
523
|
async checkUpdateKeyProgress(name) {
|
|
524
|
+
this._log.info('updateKey long-running');
|
|
448
525
|
const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
|
|
449
526
|
const [operation] = await this.operationsClient.getOperation(request);
|
|
450
527
|
const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateKey, this._gaxModule.createDefaultBackoffSettings());
|
|
451
528
|
return decodeOperation;
|
|
452
529
|
}
|
|
453
530
|
deleteKey(request, optionsOrCallback, callback) {
|
|
454
|
-
var _a;
|
|
455
531
|
request = request || {};
|
|
456
532
|
let options;
|
|
457
533
|
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
@@ -466,10 +542,22 @@ class ApiKeysClient {
|
|
|
466
542
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
467
543
|
options.otherArgs.headers['x-goog-request-params'] =
|
|
468
544
|
this._gaxModule.routingHeader.fromParams({
|
|
469
|
-
name:
|
|
545
|
+
name: request.name ?? '',
|
|
470
546
|
});
|
|
471
547
|
this.initialize();
|
|
472
|
-
|
|
548
|
+
const wrappedCallback = callback
|
|
549
|
+
? (error, response, rawResponse, _) => {
|
|
550
|
+
this._log.info('deleteKey response %j', rawResponse);
|
|
551
|
+
callback(error, response, rawResponse, _); // We verified callback above.
|
|
552
|
+
}
|
|
553
|
+
: undefined;
|
|
554
|
+
this._log.info('deleteKey request %j', request);
|
|
555
|
+
return this.innerApiCalls
|
|
556
|
+
.deleteKey(request, options, wrappedCallback)
|
|
557
|
+
?.then(([response, rawResponse, _]) => {
|
|
558
|
+
this._log.info('deleteKey response %j', rawResponse);
|
|
559
|
+
return [response, rawResponse, _];
|
|
560
|
+
});
|
|
473
561
|
}
|
|
474
562
|
/**
|
|
475
563
|
* Check the status of the long running operation returned by `deleteKey()`.
|
|
@@ -483,13 +571,13 @@ class ApiKeysClient {
|
|
|
483
571
|
* region_tag:apikeys_v2_generated_ApiKeys_DeleteKey_async
|
|
484
572
|
*/
|
|
485
573
|
async checkDeleteKeyProgress(name) {
|
|
574
|
+
this._log.info('deleteKey long-running');
|
|
486
575
|
const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
|
|
487
576
|
const [operation] = await this.operationsClient.getOperation(request);
|
|
488
577
|
const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteKey, this._gaxModule.createDefaultBackoffSettings());
|
|
489
578
|
return decodeOperation;
|
|
490
579
|
}
|
|
491
580
|
undeleteKey(request, optionsOrCallback, callback) {
|
|
492
|
-
var _a;
|
|
493
581
|
request = request || {};
|
|
494
582
|
let options;
|
|
495
583
|
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
@@ -504,10 +592,22 @@ class ApiKeysClient {
|
|
|
504
592
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
505
593
|
options.otherArgs.headers['x-goog-request-params'] =
|
|
506
594
|
this._gaxModule.routingHeader.fromParams({
|
|
507
|
-
name:
|
|
595
|
+
name: request.name ?? '',
|
|
508
596
|
});
|
|
509
597
|
this.initialize();
|
|
510
|
-
|
|
598
|
+
const wrappedCallback = callback
|
|
599
|
+
? (error, response, rawResponse, _) => {
|
|
600
|
+
this._log.info('undeleteKey response %j', rawResponse);
|
|
601
|
+
callback(error, response, rawResponse, _); // We verified callback above.
|
|
602
|
+
}
|
|
603
|
+
: undefined;
|
|
604
|
+
this._log.info('undeleteKey request %j', request);
|
|
605
|
+
return this.innerApiCalls
|
|
606
|
+
.undeleteKey(request, options, wrappedCallback)
|
|
607
|
+
?.then(([response, rawResponse, _]) => {
|
|
608
|
+
this._log.info('undeleteKey response %j', rawResponse);
|
|
609
|
+
return [response, rawResponse, _];
|
|
610
|
+
});
|
|
511
611
|
}
|
|
512
612
|
/**
|
|
513
613
|
* Check the status of the long running operation returned by `undeleteKey()`.
|
|
@@ -521,13 +621,13 @@ class ApiKeysClient {
|
|
|
521
621
|
* region_tag:apikeys_v2_generated_ApiKeys_UndeleteKey_async
|
|
522
622
|
*/
|
|
523
623
|
async checkUndeleteKeyProgress(name) {
|
|
624
|
+
this._log.info('undeleteKey long-running');
|
|
524
625
|
const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
|
|
525
626
|
const [operation] = await this.operationsClient.getOperation(request);
|
|
526
627
|
const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.undeleteKey, this._gaxModule.createDefaultBackoffSettings());
|
|
527
628
|
return decodeOperation;
|
|
528
629
|
}
|
|
529
630
|
listKeys(request, optionsOrCallback, callback) {
|
|
530
|
-
var _a;
|
|
531
631
|
request = request || {};
|
|
532
632
|
let options;
|
|
533
633
|
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
@@ -542,13 +642,25 @@ class ApiKeysClient {
|
|
|
542
642
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
543
643
|
options.otherArgs.headers['x-goog-request-params'] =
|
|
544
644
|
this._gaxModule.routingHeader.fromParams({
|
|
545
|
-
parent:
|
|
645
|
+
parent: request.parent ?? '',
|
|
546
646
|
});
|
|
547
647
|
this.initialize();
|
|
548
|
-
|
|
648
|
+
const wrappedCallback = callback
|
|
649
|
+
? (error, values, nextPageRequest, rawResponse) => {
|
|
650
|
+
this._log.info('listKeys values %j', values);
|
|
651
|
+
callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
|
|
652
|
+
}
|
|
653
|
+
: undefined;
|
|
654
|
+
this._log.info('listKeys request %j', request);
|
|
655
|
+
return this.innerApiCalls
|
|
656
|
+
.listKeys(request, options, wrappedCallback)
|
|
657
|
+
?.then(([response, input, output]) => {
|
|
658
|
+
this._log.info('listKeys values %j', response);
|
|
659
|
+
return [response, input, output];
|
|
660
|
+
});
|
|
549
661
|
}
|
|
550
662
|
/**
|
|
551
|
-
* Equivalent to `
|
|
663
|
+
* Equivalent to `listKeys`, but returns a NodeJS Stream object.
|
|
552
664
|
* @param {Object} request
|
|
553
665
|
* The request object that will be sent.
|
|
554
666
|
* @param {string} request.parent
|
|
@@ -572,18 +684,18 @@ class ApiKeysClient {
|
|
|
572
684
|
* for more details and examples.
|
|
573
685
|
*/
|
|
574
686
|
listKeysStream(request, options) {
|
|
575
|
-
var _a;
|
|
576
687
|
request = request || {};
|
|
577
688
|
options = options || {};
|
|
578
689
|
options.otherArgs = options.otherArgs || {};
|
|
579
690
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
580
691
|
options.otherArgs.headers['x-goog-request-params'] =
|
|
581
692
|
this._gaxModule.routingHeader.fromParams({
|
|
582
|
-
parent:
|
|
693
|
+
parent: request.parent ?? '',
|
|
583
694
|
});
|
|
584
695
|
const defaultCallSettings = this._defaults['listKeys'];
|
|
585
696
|
const callSettings = defaultCallSettings.merge(options);
|
|
586
697
|
this.initialize();
|
|
698
|
+
this._log.info('listKeys stream %j', request);
|
|
587
699
|
return this.descriptors.page.listKeys.createStream(this.innerApiCalls.listKeys, request, callSettings);
|
|
588
700
|
}
|
|
589
701
|
/**
|
|
@@ -614,18 +726,18 @@ class ApiKeysClient {
|
|
|
614
726
|
* region_tag:apikeys_v2_generated_ApiKeys_ListKeys_async
|
|
615
727
|
*/
|
|
616
728
|
listKeysAsync(request, options) {
|
|
617
|
-
var _a;
|
|
618
729
|
request = request || {};
|
|
619
730
|
options = options || {};
|
|
620
731
|
options.otherArgs = options.otherArgs || {};
|
|
621
732
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
622
733
|
options.otherArgs.headers['x-goog-request-params'] =
|
|
623
734
|
this._gaxModule.routingHeader.fromParams({
|
|
624
|
-
parent:
|
|
735
|
+
parent: request.parent ?? '',
|
|
625
736
|
});
|
|
626
737
|
const defaultCallSettings = this._defaults['listKeys'];
|
|
627
738
|
const callSettings = defaultCallSettings.merge(options);
|
|
628
739
|
this.initialize();
|
|
740
|
+
this._log.info('listKeys iterate %j', request);
|
|
629
741
|
return this.descriptors.page.listKeys.asyncIterate(this.innerApiCalls['listKeys'], request, callSettings);
|
|
630
742
|
}
|
|
631
743
|
/**
|
|
@@ -658,7 +770,22 @@ class ApiKeysClient {
|
|
|
658
770
|
* // doThingsWith(response)
|
|
659
771
|
* ```
|
|
660
772
|
*/
|
|
661
|
-
getOperation(request,
|
|
773
|
+
getOperation(request, optionsOrCallback, callback) {
|
|
774
|
+
let options;
|
|
775
|
+
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
776
|
+
callback = optionsOrCallback;
|
|
777
|
+
options = {};
|
|
778
|
+
}
|
|
779
|
+
else {
|
|
780
|
+
options = optionsOrCallback;
|
|
781
|
+
}
|
|
782
|
+
options = options || {};
|
|
783
|
+
options.otherArgs = options.otherArgs || {};
|
|
784
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
785
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
786
|
+
this._gaxModule.routingHeader.fromParams({
|
|
787
|
+
name: request.name ?? '',
|
|
788
|
+
});
|
|
662
789
|
return this.operationsClient.getOperation(request, options, callback);
|
|
663
790
|
}
|
|
664
791
|
/**
|
|
@@ -692,6 +819,13 @@ class ApiKeysClient {
|
|
|
692
819
|
* ```
|
|
693
820
|
*/
|
|
694
821
|
listOperationsAsync(request, options) {
|
|
822
|
+
options = options || {};
|
|
823
|
+
options.otherArgs = options.otherArgs || {};
|
|
824
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
825
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
826
|
+
this._gaxModule.routingHeader.fromParams({
|
|
827
|
+
name: request.name ?? '',
|
|
828
|
+
});
|
|
695
829
|
return this.operationsClient.listOperationsAsync(request, options);
|
|
696
830
|
}
|
|
697
831
|
/**
|
|
@@ -725,7 +859,22 @@ class ApiKeysClient {
|
|
|
725
859
|
* await client.cancelOperation({name: ''});
|
|
726
860
|
* ```
|
|
727
861
|
*/
|
|
728
|
-
cancelOperation(request,
|
|
862
|
+
cancelOperation(request, optionsOrCallback, callback) {
|
|
863
|
+
let options;
|
|
864
|
+
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
865
|
+
callback = optionsOrCallback;
|
|
866
|
+
options = {};
|
|
867
|
+
}
|
|
868
|
+
else {
|
|
869
|
+
options = optionsOrCallback;
|
|
870
|
+
}
|
|
871
|
+
options = options || {};
|
|
872
|
+
options.otherArgs = options.otherArgs || {};
|
|
873
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
874
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
875
|
+
this._gaxModule.routingHeader.fromParams({
|
|
876
|
+
name: request.name ?? '',
|
|
877
|
+
});
|
|
729
878
|
return this.operationsClient.cancelOperation(request, options, callback);
|
|
730
879
|
}
|
|
731
880
|
/**
|
|
@@ -753,7 +902,22 @@ class ApiKeysClient {
|
|
|
753
902
|
* await client.deleteOperation({name: ''});
|
|
754
903
|
* ```
|
|
755
904
|
*/
|
|
756
|
-
deleteOperation(request,
|
|
905
|
+
deleteOperation(request, optionsOrCallback, callback) {
|
|
906
|
+
let options;
|
|
907
|
+
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
908
|
+
callback = optionsOrCallback;
|
|
909
|
+
options = {};
|
|
910
|
+
}
|
|
911
|
+
else {
|
|
912
|
+
options = optionsOrCallback;
|
|
913
|
+
}
|
|
914
|
+
options = options || {};
|
|
915
|
+
options.otherArgs = options.otherArgs || {};
|
|
916
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
917
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
918
|
+
this._gaxModule.routingHeader.fromParams({
|
|
919
|
+
name: request.name ?? '',
|
|
920
|
+
});
|
|
757
921
|
return this.operationsClient.deleteOperation(request, options, callback);
|
|
758
922
|
}
|
|
759
923
|
// --------------------
|
|
@@ -867,6 +1031,7 @@ class ApiKeysClient {
|
|
|
867
1031
|
close() {
|
|
868
1032
|
if (this.apiKeysStub && !this._terminated) {
|
|
869
1033
|
return this.apiKeysStub.then(stub => {
|
|
1034
|
+
this._log.info('ending gRPC channel');
|
|
870
1035
|
this._terminated = true;
|
|
871
1036
|
stub.close();
|
|
872
1037
|
this.operationsClient.close();
|
|
@@ -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/build/src/v2/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@google-cloud/apikeys",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.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": "^
|
|
49
|
+
"google-gax": "^5.0.0-rc.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@types/mocha": "^
|
|
53
|
-
"@types/node": "^
|
|
54
|
-
"@types/sinon": "^17.0.
|
|
55
|
-
"c8": "^
|
|
56
|
-
"gapic-tools": "^0.
|
|
57
|
-
"gts": "^
|
|
58
|
-
"jsdoc": "^4.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": "
|
|
62
|
-
"long": "^5.
|
|
63
|
-
"mocha": "^
|
|
64
|
-
"pack-n-play": "^
|
|
65
|
-
"sinon": "^
|
|
66
|
-
"typescript": "^5.
|
|
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": ">=
|
|
69
|
+
"node": ">=18"
|
|
70
70
|
}
|
|
71
71
|
}
|