@google-cloud/apikeys 1.0.1 → 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,12 @@
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
+
3
10
  ## [1.0.1](https://github.com/googleapis/google-cloud-node/compare/apikeys-v1.0.0...apikeys-v1.0.1) (2023-09-06)
4
11
 
5
12
 
@@ -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;
@@ -85,15 +87,22 @@ export declare class ApiKeysClient {
85
87
  }>;
86
88
  /**
87
89
  * The DNS address for this API service.
90
+ * @deprecated Use the apiEndpoint method of the client instance.
88
91
  * @returns {string} The DNS address for this service.
89
92
  */
90
93
  static get servicePath(): string;
91
94
  /**
92
- * The DNS address for this API service - same as servicePath(),
93
- * 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.
94
97
  * @returns {string} The DNS address for this service.
95
98
  */
96
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;
97
106
  /**
98
107
  * The port for this API service.
99
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.
@@ -72,7 +72,7 @@ class ApiKeysClient {
72
72
  * ```
73
73
  */
74
74
  constructor(opts, gaxInstance) {
75
- var _a, _b;
75
+ var _a, _b, _c, _d;
76
76
  this._terminated = false;
77
77
  this.descriptors = {
78
78
  page: {},
@@ -82,16 +82,24 @@ class ApiKeysClient {
82
82
  };
83
83
  // Ensure that options include all the required fields.
84
84
  const staticMembers = this.constructor;
85
- 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;
86
94
  this._providedCustomServicePath = !!((opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint));
87
95
  const port = (opts === null || opts === void 0 ? void 0 : opts.port) || staticMembers.port;
88
- const clientConfig = (_a = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _a !== void 0 ? _a : {};
89
- 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');
90
98
  opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
91
99
  // Request numeric enum values if REST transport is used.
92
100
  opts.numericEnums = true;
93
101
  // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case.
94
- if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) {
102
+ if (servicePath !== this._servicePath && !('scopes' in opts)) {
95
103
  opts['scopes'] = staticMembers.scopes;
96
104
  }
97
105
  // Load google-gax module synchronously if needed
@@ -109,9 +117,9 @@ class ApiKeysClient {
109
117
  // Set useJWTAccessWithScope on the auth object.
110
118
  this.auth.useJWTAccessWithScope = true;
111
119
  // Set defaultServicePath on the auth object.
112
- this.auth.defaultServicePath = staticMembers.servicePath;
120
+ this.auth.defaultServicePath = this._servicePath;
113
121
  // Set the default scopes in auth client if needed.
114
- if (servicePath === staticMembers.servicePath) {
122
+ if (servicePath === this._servicePath) {
115
123
  this.auth.defaultScopes = staticMembers.scopes;
116
124
  }
117
125
  // Determine the client header string.
@@ -244,19 +252,38 @@ class ApiKeysClient {
244
252
  }
245
253
  /**
246
254
  * The DNS address for this API service.
255
+ * @deprecated Use the apiEndpoint method of the client instance.
247
256
  * @returns {string} The DNS address for this service.
248
257
  */
249
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
+ }
250
263
  return 'apikeys.googleapis.com';
251
264
  }
252
265
  /**
253
- * The DNS address for this API service - same as servicePath(),
254
- * 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.
255
268
  * @returns {string} The DNS address for this service.
256
269
  */
257
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
+ }
258
275
  return 'apikeys.googleapis.com';
259
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
+ }
260
287
  /**
261
288
  * The port for this API service.
262
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.1",
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,9 +51,9 @@
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
59
  "jsdoc-fresh": "^3.0.0",
@@ -61,8 +61,8 @@
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": {