@google-cloud/apikeys 1.0.0 → 1.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,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.1.0](https://github.com/googleapis/google-cloud-node/compare/apikeys-v1.0.1...apikeys-v1.1.0) (2024-02-09)
4
+
5
+
6
+ ### Features
7
+
8
+ * Trusted Private Cloud support, use the universeDomain parameter ([#5022](https://github.com/googleapis/google-cloud-node/issues/5022)) ([b6498d8](https://github.com/googleapis/google-cloud-node/commit/b6498d8580d056817981dedbaa0ea5d82e9dccc2))
9
+
10
+ ## [1.0.1](https://github.com/googleapis/google-cloud-node/compare/apikeys-v1.0.0...apikeys-v1.0.1) (2023-09-06)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * [Many APIs] simplify logic for HTTP/1.1 REST fallback option ([#4583](https://github.com/googleapis/google-cloud-node/issues/4583)) ([c3ddba8](https://github.com/googleapis/google-cloud-node/commit/c3ddba8df9fee6185e36a4e99f7c67b0319f1242))
16
+
3
17
  ## [1.0.0](https://github.com/googleapis/google-cloud-node/compare/apikeys-v0.2.2...apikeys-v1.0.0) (2023-08-06)
4
18
 
5
19
 
package/README.md CHANGED
@@ -129,7 +129,7 @@ also contains samples.
129
129
 
130
130
  ## Supported Node.js Versions
131
131
 
132
- Our client libraries follow the [Node.js release schedule](https://nodejs.org/en/about/releases/).
132
+ Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule).
133
133
  Libraries are compatible with all current _active_ and _maintenance_ versions of
134
134
  Node.js.
135
135
  If you are using an end-of-life version of Node.js, we recommend that you update
@@ -1,4 +1,4 @@
1
- // Copyright 2022 Google LLC
1
+ // Copyright 2023 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.
@@ -22,6 +22,7 @@ import "google/api/client.proto";
22
22
  import "google/api/field_behavior.proto";
23
23
  import "google/api/resource.proto";
24
24
  import "google/longrunning/operations.proto";
25
+ import "google/protobuf/empty.proto";
25
26
  import "google/protobuf/field_mask.proto";
26
27
 
27
28
  option csharp_namespace = "Google.Cloud.ApiKeys.V2";
@@ -1,4 +1,4 @@
1
- // Copyright 2022 Google LLC
1
+ // Copyright 2023 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.
@@ -61,15 +61,18 @@ message Key {
61
61
 
62
62
  // Output only. A timestamp identifying the time this key was originally
63
63
  // created.
64
- google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
64
+ google.protobuf.Timestamp create_time = 4
65
+ [(google.api.field_behavior) = OUTPUT_ONLY];
65
66
 
66
67
  // Output only. A timestamp identifying the time this key was last
67
68
  // updated.
68
- google.protobuf.Timestamp update_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
69
+ google.protobuf.Timestamp update_time = 6
70
+ [(google.api.field_behavior) = OUTPUT_ONLY];
69
71
 
70
- // Output only. A timestamp when this key was deleted. If the resource is not deleted,
71
- // this must be empty.
72
- google.protobuf.Timestamp delete_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
72
+ // Output only. A timestamp when this key was deleted. If the resource is not
73
+ // deleted, this must be empty.
74
+ google.protobuf.Timestamp delete_time = 7
75
+ [(google.api.field_behavior) = OUTPUT_ONLY];
73
76
 
74
77
  // Annotations is an unstructured key-value map stored with a policy that
75
78
  // may be set by external tools to store and retrieve arbitrary metadata.
@@ -79,10 +82,10 @@ message Key {
79
82
  // Key restrictions.
80
83
  Restrictions restrictions = 9;
81
84
 
82
- // Output only. A checksum computed by the server based on the current value of the Key
83
- // resource. This may be sent on update and delete requests to ensure the
84
- // client has an up-to-date value before proceeding.
85
- // See https://google.aip.dev/154.
85
+ // Output only. A checksum computed by the server based on the current value
86
+ // of the Key resource. This may be sent on update and delete requests to
87
+ // ensure the client has an up-to-date value before proceeding. See
88
+ // https://google.aip.dev/154.
86
89
  string etag = 11 [(google.api.field_behavior) = OUTPUT_ONLY];
87
90
  }
88
91
 
@@ -1,4 +1,4 @@
1
- // Copyright 2023 Google LLC
1
+ // Copyright 2024 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 2023 Google LLC
1
+ // Copyright 2024 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,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2023 Google LLC
2
+ // Copyright 2024 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.
@@ -16,6 +16,8 @@ export declare class ApiKeysClient {
16
16
  private _gaxGrpc;
17
17
  private _protos;
18
18
  private _defaults;
19
+ private _universeDomain;
20
+ private _servicePath;
19
21
  auth: gax.GoogleAuth;
20
22
  descriptors: Descriptors;
21
23
  warn: (code: string, message: string, warnType?: string) => void;
@@ -57,8 +59,7 @@ export declare class ApiKeysClient {
57
59
  * API remote host.
58
60
  * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
59
61
  * Follows the structure of {@link gapicConfig}.
60
- * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
61
- * Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
62
+ * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
62
63
  * For more information, please check the
63
64
  * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
64
65
  * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
@@ -66,7 +67,7 @@ export declare class ApiKeysClient {
66
67
  * HTTP implementation. Load only fallback version and pass it to the constructor:
67
68
  * ```
68
69
  * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
69
- * const client = new ApiKeysClient({fallback: 'rest'}, gax);
70
+ * const client = new ApiKeysClient({fallback: true}, gax);
70
71
  * ```
71
72
  */
72
73
  constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);
@@ -86,15 +87,22 @@ export declare class ApiKeysClient {
86
87
  }>;
87
88
  /**
88
89
  * The DNS address for this API service.
90
+ * @deprecated Use the apiEndpoint method of the client instance.
89
91
  * @returns {string} The DNS address for this service.
90
92
  */
91
93
  static get servicePath(): string;
92
94
  /**
93
- * The DNS address for this API service - same as servicePath(),
94
- * exists for compatibility reasons.
95
+ * The DNS address for this API service - same as servicePath.
96
+ * @deprecated Use the apiEndpoint method of the client instance.
95
97
  * @returns {string} The DNS address for this service.
96
98
  */
97
99
  static get apiEndpoint(): string;
100
+ /**
101
+ * The DNS address for this API service.
102
+ * @returns {string} The DNS address for this service.
103
+ */
104
+ get apiEndpoint(): string;
105
+ get universeDomain(): string;
98
106
  /**
99
107
  * The port for this API service.
100
108
  * @returns {number} The default port for this service.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2023 Google LLC
2
+ // Copyright 2024 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.
@@ -60,8 +60,7 @@ class ApiKeysClient {
60
60
  * API remote host.
61
61
  * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
62
62
  * Follows the structure of {@link gapicConfig}.
63
- * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
64
- * Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
63
+ * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
65
64
  * For more information, please check the
66
65
  * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
67
66
  * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
@@ -69,11 +68,11 @@ class ApiKeysClient {
69
68
  * HTTP implementation. Load only fallback version and pass it to the constructor:
70
69
  * ```
71
70
  * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
72
- * const client = new ApiKeysClient({fallback: 'rest'}, gax);
71
+ * const client = new ApiKeysClient({fallback: true}, gax);
73
72
  * ```
74
73
  */
75
74
  constructor(opts, gaxInstance) {
76
- var _a, _b;
75
+ var _a, _b, _c, _d;
77
76
  this._terminated = false;
78
77
  this.descriptors = {
79
78
  page: {},
@@ -83,16 +82,24 @@ class ApiKeysClient {
83
82
  };
84
83
  // Ensure that options include all the required fields.
85
84
  const staticMembers = this.constructor;
86
- const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || staticMembers.servicePath;
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)) {
88
+ throw new Error('Please set either universe_domain or universeDomain, but not both.');
89
+ }
90
+ this._universeDomain =
91
+ (_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 : 'googleapis.com';
92
+ this._servicePath = 'apikeys.' + this._universeDomain;
93
+ const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || this._servicePath;
87
94
  this._providedCustomServicePath = !!((opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint));
88
95
  const port = (opts === null || opts === void 0 ? void 0 : opts.port) || staticMembers.port;
89
- const clientConfig = (_a = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _a !== void 0 ? _a : {};
90
- const fallback = (_b = opts === null || opts === void 0 ? void 0 : opts.fallback) !== null && _b !== void 0 ? _b : (typeof window !== 'undefined' && typeof (window === null || window === void 0 ? void 0 : window.fetch) === 'function');
96
+ const clientConfig = (_c = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _c !== void 0 ? _c : {};
97
+ const fallback = (_d = opts === null || opts === void 0 ? void 0 : opts.fallback) !== null && _d !== void 0 ? _d : (typeof window !== 'undefined' && typeof (window === null || window === void 0 ? void 0 : window.fetch) === 'function');
91
98
  opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
92
99
  // Request numeric enum values if REST transport is used.
93
100
  opts.numericEnums = true;
94
101
  // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case.
95
- if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) {
102
+ if (servicePath !== this._servicePath && !('scopes' in opts)) {
96
103
  opts['scopes'] = staticMembers.scopes;
97
104
  }
98
105
  // Load google-gax module synchronously if needed
@@ -110,9 +117,9 @@ class ApiKeysClient {
110
117
  // Set useJWTAccessWithScope on the auth object.
111
118
  this.auth.useJWTAccessWithScope = true;
112
119
  // Set defaultServicePath on the auth object.
113
- this.auth.defaultServicePath = staticMembers.servicePath;
120
+ this.auth.defaultServicePath = this._servicePath;
114
121
  // Set the default scopes in auth client if needed.
115
- if (servicePath === staticMembers.servicePath) {
122
+ if (servicePath === this._servicePath) {
116
123
  this.auth.defaultScopes = staticMembers.scopes;
117
124
  }
118
125
  // Determine the client header string.
@@ -126,7 +133,7 @@ class ApiKeysClient {
126
133
  if (!opts.fallback) {
127
134
  clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
128
135
  }
129
- else if (opts.fallback === 'rest') {
136
+ else {
130
137
  clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
131
138
  }
132
139
  if (opts.libName && opts.libVersion) {
@@ -156,7 +163,7 @@ class ApiKeysClient {
156
163
  auth: this.auth,
157
164
  grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
158
165
  };
159
- if (opts.fallback === 'rest') {
166
+ if (opts.fallback) {
160
167
  lroOptions.protoJson = protoFilesRoot;
161
168
  lroOptions.httpRules = [
162
169
  {
@@ -245,19 +252,38 @@ class ApiKeysClient {
245
252
  }
246
253
  /**
247
254
  * The DNS address for this API service.
255
+ * @deprecated Use the apiEndpoint method of the client instance.
248
256
  * @returns {string} The DNS address for this service.
249
257
  */
250
258
  static get servicePath() {
259
+ if (typeof process !== undefined &&
260
+ typeof process.emitWarning === 'function') {
261
+ process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning');
262
+ }
251
263
  return 'apikeys.googleapis.com';
252
264
  }
253
265
  /**
254
- * The DNS address for this API service - same as servicePath(),
255
- * exists for compatibility reasons.
266
+ * The DNS address for this API service - same as servicePath.
267
+ * @deprecated Use the apiEndpoint method of the client instance.
256
268
  * @returns {string} The DNS address for this service.
257
269
  */
258
270
  static get apiEndpoint() {
271
+ if (typeof process !== undefined &&
272
+ typeof process.emitWarning === 'function') {
273
+ process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning');
274
+ }
259
275
  return 'apikeys.googleapis.com';
260
276
  }
277
+ /**
278
+ * The DNS address for this API service.
279
+ * @returns {string} The DNS address for this service.
280
+ */
281
+ get apiEndpoint() {
282
+ return this._servicePath;
283
+ }
284
+ get universeDomain() {
285
+ return this._universeDomain;
286
+ }
261
287
  /**
262
288
  * The port for this API service.
263
289
  * @returns {number} The default port for this service.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2023 Google LLC
2
+ // Copyright 2024 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@google-cloud/apikeys",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "API Keys API client for Node.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -38,7 +38,7 @@
38
38
  "docs-test": "linkinator docs",
39
39
  "fix": "gts fix",
40
40
  "lint": "gts check",
41
- "prepare": "npm run compile-protos && npm run compile",
41
+ "prepare": "npm run compile",
42
42
  "prelint": "cd samples; npm link ../; npm i",
43
43
  "postpack": "minifyProtoJson",
44
44
  "samples-test": "cd samples/ && npm link ../ && npm i && npm test",
@@ -51,18 +51,18 @@
51
51
  "devDependencies": {
52
52
  "@types/mocha": "^9.0.0",
53
53
  "@types/node": "^20.4.5",
54
- "@types/sinon": "^10.0.0",
54
+ "@types/sinon": "^17.0.0",
55
55
  "c8": "^8.0.1",
56
- "gapic-tools": "^0.1.8",
56
+ "gapic-tools": "^0.3.0",
57
57
  "gts": "^5.0.0",
58
58
  "jsdoc": "^4.0.0",
59
- "jsdoc-fresh": "^2.0.0",
60
- "jsdoc-region-tag": "^2.0.0",
59
+ "jsdoc-fresh": "^3.0.0",
60
+ "jsdoc-region-tag": "^3.0.0",
61
61
  "linkinator": "4.1.2",
62
62
  "long": "^5.2.3",
63
63
  "mocha": "^9.2.2",
64
- "pack-n-play": "^1.0.0-2",
65
- "sinon": "^15.0.0",
64
+ "pack-n-play": "^2.0.0",
65
+ "sinon": "^17.0.0",
66
66
  "typescript": "^5.1.6"
67
67
  },
68
68
  "engines": {