@google-cloud/containeranalysis 5.0.1 → 5.2.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.
@@ -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.
@@ -73,8 +73,7 @@ class ContainerAnalysisClient {
73
73
  * API remote host.
74
74
  * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
75
75
  * Follows the structure of {@link gapicConfig}.
76
- * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
77
- * Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
76
+ * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
78
77
  * For more information, please check the
79
78
  * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
80
79
  * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
@@ -82,11 +81,11 @@ class ContainerAnalysisClient {
82
81
  * HTTP implementation. Load only fallback version and pass it to the constructor:
83
82
  * ```
84
83
  * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
85
- * const client = new ContainerAnalysisClient({fallback: 'rest'}, gax);
84
+ * const client = new ContainerAnalysisClient({fallback: true}, gax);
86
85
  * ```
87
86
  */
88
87
  constructor(opts, gaxInstance) {
89
- var _a, _b;
88
+ var _a, _b, _c, _d;
90
89
  this._terminated = false;
91
90
  this.descriptors = {
92
91
  page: {},
@@ -96,16 +95,24 @@ class ContainerAnalysisClient {
96
95
  };
97
96
  // Ensure that options include all the required fields.
98
97
  const staticMembers = this.constructor;
99
- const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || staticMembers.servicePath;
98
+ if ((opts === null || opts === void 0 ? void 0 : opts.universe_domain) &&
99
+ (opts === null || opts === void 0 ? void 0 : opts.universeDomain) &&
100
+ (opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== (opts === null || opts === void 0 ? void 0 : opts.universeDomain)) {
101
+ throw new Error('Please set either universe_domain or universeDomain, but not both.');
102
+ }
103
+ this._universeDomain =
104
+ (_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';
105
+ this._servicePath = 'containeranalysis.' + this._universeDomain;
106
+ const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || this._servicePath;
100
107
  this._providedCustomServicePath = !!((opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint));
101
108
  const port = (opts === null || opts === void 0 ? void 0 : opts.port) || staticMembers.port;
102
- const clientConfig = (_a = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _a !== void 0 ? _a : {};
103
- 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');
109
+ const clientConfig = (_c = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _c !== void 0 ? _c : {};
110
+ 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');
104
111
  opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
105
112
  // Request numeric enum values if REST transport is used.
106
113
  opts.numericEnums = true;
107
114
  // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case.
108
- if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) {
115
+ if (servicePath !== this._servicePath && !('scopes' in opts)) {
109
116
  opts['scopes'] = staticMembers.scopes;
110
117
  }
111
118
  // Load google-gax module synchronously if needed
@@ -123,9 +130,9 @@ class ContainerAnalysisClient {
123
130
  // Set useJWTAccessWithScope on the auth object.
124
131
  this.auth.useJWTAccessWithScope = true;
125
132
  // Set defaultServicePath on the auth object.
126
- this.auth.defaultServicePath = staticMembers.servicePath;
133
+ this.auth.defaultServicePath = this._servicePath;
127
134
  // Set the default scopes in auth client if needed.
128
- if (servicePath === staticMembers.servicePath) {
135
+ if (servicePath === this._servicePath) {
129
136
  this.auth.defaultScopes = staticMembers.scopes;
130
137
  }
131
138
  // Determine the client header string.
@@ -139,7 +146,7 @@ class ContainerAnalysisClient {
139
146
  if (!opts.fallback) {
140
147
  clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
141
148
  }
142
- else if (opts.fallback === 'rest') {
149
+ else {
143
150
  clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
144
151
  }
145
152
  if (opts.libName && opts.libVersion) {
@@ -213,19 +220,38 @@ class ContainerAnalysisClient {
213
220
  }
214
221
  /**
215
222
  * The DNS address for this API service.
223
+ * @deprecated Use the apiEndpoint method of the client instance.
216
224
  * @returns {string} The DNS address for this service.
217
225
  */
218
226
  static get servicePath() {
227
+ if (typeof process !== undefined &&
228
+ typeof process.emitWarning === 'function') {
229
+ process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning');
230
+ }
219
231
  return 'containeranalysis.googleapis.com';
220
232
  }
221
233
  /**
222
- * The DNS address for this API service - same as servicePath(),
223
- * exists for compatibility reasons.
234
+ * The DNS address for this API service - same as servicePath.
235
+ * @deprecated Use the apiEndpoint method of the client instance.
224
236
  * @returns {string} The DNS address for this service.
225
237
  */
226
238
  static get apiEndpoint() {
239
+ if (typeof process !== undefined &&
240
+ typeof process.emitWarning === 'function') {
241
+ process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning');
242
+ }
227
243
  return 'containeranalysis.googleapis.com';
228
244
  }
245
+ /**
246
+ * The DNS address for this API service.
247
+ * @returns {string} The DNS address for this service.
248
+ */
249
+ get apiEndpoint() {
250
+ return this._servicePath;
251
+ }
252
+ get universeDomain() {
253
+ return this._universeDomain;
254
+ }
229
255
  /**
230
256
  * The port for this API service.
231
257
  * @returns {number} The default port for this service.
@@ -26,6 +26,8 @@ export declare class ContainerAnalysisV1Beta1Client {
26
26
  private _gaxGrpc;
27
27
  private _protos;
28
28
  private _defaults;
29
+ private _universeDomain;
30
+ private _servicePath;
29
31
  auth: gax.GoogleAuth;
30
32
  descriptors: Descriptors;
31
33
  warn: (code: string, message: string, warnType?: string) => void;
@@ -63,8 +65,7 @@ export declare class ContainerAnalysisV1Beta1Client {
63
65
  * API remote host.
64
66
  * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
65
67
  * Follows the structure of {@link gapicConfig}.
66
- * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
67
- * Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
68
+ * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
68
69
  * For more information, please check the
69
70
  * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
70
71
  * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
@@ -72,7 +73,7 @@ export declare class ContainerAnalysisV1Beta1Client {
72
73
  * HTTP implementation. Load only fallback version and pass it to the constructor:
73
74
  * ```
74
75
  * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
75
- * const client = new ContainerAnalysisV1Beta1Client({fallback: 'rest'}, gax);
76
+ * const client = new ContainerAnalysisV1Beta1Client({fallback: true}, gax);
76
77
  * ```
77
78
  */
78
79
  constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);
@@ -92,15 +93,22 @@ export declare class ContainerAnalysisV1Beta1Client {
92
93
  }>;
93
94
  /**
94
95
  * The DNS address for this API service.
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 servicePath(): string;
98
100
  /**
99
- * The DNS address for this API service - same as servicePath(),
100
- * exists for compatibility reasons.
101
+ * The DNS address for this API service - same as servicePath.
102
+ * @deprecated Use the apiEndpoint method of the client instance.
101
103
  * @returns {string} The DNS address for this service.
102
104
  */
103
105
  static get apiEndpoint(): string;
106
+ /**
107
+ * The DNS address for this API service.
108
+ * @returns {string} The DNS address for this service.
109
+ */
110
+ get apiEndpoint(): string;
111
+ get universeDomain(): string;
104
112
  /**
105
113
  * The port for this API service.
106
114
  * @returns {number} The default port for this service.
@@ -249,6 +257,30 @@ export declare class ContainerAnalysisV1Beta1Client {
249
257
  ]>;
250
258
  generatePackagesSummary(request: protos.google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest, options: CallOptions, callback: Callback<protos.google.devtools.containeranalysis.v1beta1.IPackagesSummaryResponse, protos.google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest | null | undefined, {} | null | undefined>): void;
251
259
  generatePackagesSummary(request: protos.google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest, callback: Callback<protos.google.devtools.containeranalysis.v1beta1.IPackagesSummaryResponse, protos.google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest | null | undefined, {} | null | undefined>): void;
260
+ /**
261
+ * Generates an SBOM and other dependency information for the given resource.
262
+ *
263
+ * @param {Object} request
264
+ * The request object that will be sent.
265
+ * @param {string} request.name
266
+ * Required. The name of the resource in the form of
267
+ * `projects/[PROJECT_ID]/resources/[RESOURCE_URL]`.
268
+ * @param {object} [options]
269
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
270
+ * @returns {Promise} - The promise which resolves to an array.
271
+ * The first element of the array is an object representing {@link protos.google.devtools.containeranalysis.v1beta1.ExportSBOMResponse|ExportSBOMResponse}.
272
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
273
+ * for more details and examples.
274
+ * @example <caption>include:samples/generated/v1beta1/container_analysis_v1_beta1.export_s_b_o_m.js</caption>
275
+ * region_tag:containeranalysis_v1beta1_generated_ContainerAnalysisV1Beta1_ExportSBOM_async
276
+ */
277
+ exportSBOM(request?: protos.google.devtools.containeranalysis.v1beta1.IExportSBOMRequest, options?: CallOptions): Promise<[
278
+ protos.google.devtools.containeranalysis.v1beta1.IExportSBOMResponse,
279
+ (protos.google.devtools.containeranalysis.v1beta1.IExportSBOMRequest | undefined),
280
+ {} | undefined
281
+ ]>;
282
+ exportSBOM(request: protos.google.devtools.containeranalysis.v1beta1.IExportSBOMRequest, options: CallOptions, callback: Callback<protos.google.devtools.containeranalysis.v1beta1.IExportSBOMResponse, protos.google.devtools.containeranalysis.v1beta1.IExportSBOMRequest | null | undefined, {} | null | undefined>): void;
283
+ exportSBOM(request: protos.google.devtools.containeranalysis.v1beta1.IExportSBOMRequest, callback: Callback<protos.google.devtools.containeranalysis.v1beta1.IExportSBOMResponse, protos.google.devtools.containeranalysis.v1beta1.IExportSBOMRequest | null | undefined, {} | null | undefined>): void;
252
284
  /**
253
285
  * Terminate the gRPC channel and close the client.
254
286
  *
@@ -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,8 +72,7 @@ class ContainerAnalysisV1Beta1Client {
72
72
  * API remote host.
73
73
  * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
74
74
  * Follows the structure of {@link gapicConfig}.
75
- * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
76
- * Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
75
+ * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
77
76
  * For more information, please check the
78
77
  * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
79
78
  * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
@@ -81,11 +80,11 @@ class ContainerAnalysisV1Beta1Client {
81
80
  * HTTP implementation. Load only fallback version and pass it to the constructor:
82
81
  * ```
83
82
  * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
84
- * const client = new ContainerAnalysisV1Beta1Client({fallback: 'rest'}, gax);
83
+ * const client = new ContainerAnalysisV1Beta1Client({fallback: true}, gax);
85
84
  * ```
86
85
  */
87
86
  constructor(opts, gaxInstance) {
88
- var _a, _b;
87
+ var _a, _b, _c, _d;
89
88
  this._terminated = false;
90
89
  this.descriptors = {
91
90
  page: {},
@@ -96,16 +95,24 @@ class ContainerAnalysisV1Beta1Client {
96
95
  // Ensure that options include all the required fields.
97
96
  const staticMembers = this
98
97
  .constructor;
99
- const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || staticMembers.servicePath;
98
+ if ((opts === null || opts === void 0 ? void 0 : opts.universe_domain) &&
99
+ (opts === null || opts === void 0 ? void 0 : opts.universeDomain) &&
100
+ (opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== (opts === null || opts === void 0 ? void 0 : opts.universeDomain)) {
101
+ throw new Error('Please set either universe_domain or universeDomain, but not both.');
102
+ }
103
+ this._universeDomain =
104
+ (_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';
105
+ this._servicePath = 'containeranalysis.' + this._universeDomain;
106
+ const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || this._servicePath;
100
107
  this._providedCustomServicePath = !!((opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint));
101
108
  const port = (opts === null || opts === void 0 ? void 0 : opts.port) || staticMembers.port;
102
- const clientConfig = (_a = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _a !== void 0 ? _a : {};
103
- 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');
109
+ const clientConfig = (_c = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _c !== void 0 ? _c : {};
110
+ 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');
104
111
  opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
105
112
  // Request numeric enum values if REST transport is used.
106
113
  opts.numericEnums = true;
107
114
  // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case.
108
- if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) {
115
+ if (servicePath !== this._servicePath && !('scopes' in opts)) {
109
116
  opts['scopes'] = staticMembers.scopes;
110
117
  }
111
118
  // Load google-gax module synchronously if needed
@@ -123,9 +130,9 @@ class ContainerAnalysisV1Beta1Client {
123
130
  // Set useJWTAccessWithScope on the auth object.
124
131
  this.auth.useJWTAccessWithScope = true;
125
132
  // Set defaultServicePath on the auth object.
126
- this.auth.defaultServicePath = staticMembers.servicePath;
133
+ this.auth.defaultServicePath = this._servicePath;
127
134
  // Set the default scopes in auth client if needed.
128
- if (servicePath === staticMembers.servicePath) {
135
+ if (servicePath === this._servicePath) {
129
136
  this.auth.defaultScopes = staticMembers.scopes;
130
137
  }
131
138
  // Determine the client header string.
@@ -139,7 +146,7 @@ class ContainerAnalysisV1Beta1Client {
139
146
  if (!opts.fallback) {
140
147
  clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
141
148
  }
142
- else if (opts.fallback === 'rest') {
149
+ else {
143
150
  clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
144
151
  }
145
152
  if (opts.libName && opts.libVersion) {
@@ -186,6 +193,7 @@ class ContainerAnalysisV1Beta1Client {
186
193
  'getIamPolicy',
187
194
  'testIamPermissions',
188
195
  'generatePackagesSummary',
196
+ 'exportSboM',
189
197
  ];
190
198
  for (const methodName of containerAnalysisV1Beta1StubMethods) {
191
199
  const callPromise = this.containerAnalysisV1Beta1Stub.then(stub => (...args) => {
@@ -205,19 +213,38 @@ class ContainerAnalysisV1Beta1Client {
205
213
  }
206
214
  /**
207
215
  * The DNS address for this API service.
216
+ * @deprecated Use the apiEndpoint method of the client instance.
208
217
  * @returns {string} The DNS address for this service.
209
218
  */
210
219
  static get servicePath() {
220
+ if (typeof process !== undefined &&
221
+ typeof process.emitWarning === 'function') {
222
+ process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning');
223
+ }
211
224
  return 'containeranalysis.googleapis.com';
212
225
  }
213
226
  /**
214
- * The DNS address for this API service - same as servicePath(),
215
- * exists for compatibility reasons.
227
+ * The DNS address for this API service - same as servicePath.
228
+ * @deprecated Use the apiEndpoint method of the client instance.
216
229
  * @returns {string} The DNS address for this service.
217
230
  */
218
231
  static get apiEndpoint() {
232
+ if (typeof process !== undefined &&
233
+ typeof process.emitWarning === 'function') {
234
+ process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning');
235
+ }
219
236
  return 'containeranalysis.googleapis.com';
220
237
  }
238
+ /**
239
+ * The DNS address for this API service.
240
+ * @returns {string} The DNS address for this service.
241
+ */
242
+ get apiEndpoint() {
243
+ return this._servicePath;
244
+ }
245
+ get universeDomain() {
246
+ return this._universeDomain;
247
+ }
221
248
  /**
222
249
  * The port for this API service.
223
250
  * @returns {number} The default port for this service.
@@ -328,6 +355,27 @@ class ContainerAnalysisV1Beta1Client {
328
355
  this.initialize();
329
356
  return this.innerApiCalls.generatePackagesSummary(request, options, callback);
330
357
  }
358
+ exportSBOM(request, optionsOrCallback, callback) {
359
+ var _a;
360
+ request = request || {};
361
+ let options;
362
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
363
+ callback = optionsOrCallback;
364
+ options = {};
365
+ }
366
+ else {
367
+ options = optionsOrCallback;
368
+ }
369
+ options = options || {};
370
+ options.otherArgs = options.otherArgs || {};
371
+ options.otherArgs.headers = options.otherArgs.headers || {};
372
+ options.otherArgs.headers['x-goog-request-params'] =
373
+ this._gaxModule.routingHeader.fromParams({
374
+ name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
375
+ });
376
+ this.initialize();
377
+ return this.innerApiCalls.exportSboM(request, options, callback);
378
+ }
331
379
  /**
332
380
  * Terminate the gRPC channel and close the client.
333
381
  *
@@ -35,6 +35,10 @@
35
35
  "GeneratePackagesSummary": {
36
36
  "retry_codes_name": "non_idempotent",
37
37
  "retry_params_name": "default"
38
+ },
39
+ "ExportSBOM": {
40
+ "retry_codes_name": "non_idempotent",
41
+ "retry_params_name": "default"
38
42
  }
39
43
  }
40
44
  }
@@ -29,6 +29,8 @@ export declare class GrafeasV1Beta1Client {
29
29
  private _gaxGrpc;
30
30
  private _protos;
31
31
  private _defaults;
32
+ private _universeDomain;
33
+ private _servicePath;
32
34
  auth: gax.GoogleAuth;
33
35
  descriptors: Descriptors;
34
36
  warn: (code: string, message: string, warnType?: string) => void;
@@ -66,8 +68,7 @@ export declare class GrafeasV1Beta1Client {
66
68
  * API remote host.
67
69
  * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
68
70
  * Follows the structure of {@link gapicConfig}.
69
- * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
70
- * Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
71
+ * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
71
72
  * For more information, please check the
72
73
  * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
73
74
  * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
@@ -75,7 +76,7 @@ export declare class GrafeasV1Beta1Client {
75
76
  * HTTP implementation. Load only fallback version and pass it to the constructor:
76
77
  * ```
77
78
  * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
78
- * const client = new GrafeasV1Beta1Client({fallback: 'rest'}, gax);
79
+ * const client = new GrafeasV1Beta1Client({fallback: true}, gax);
79
80
  * ```
80
81
  */
81
82
  constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);
@@ -95,15 +96,22 @@ export declare class GrafeasV1Beta1Client {
95
96
  }>;
96
97
  /**
97
98
  * The DNS address for this API service.
99
+ * @deprecated Use the apiEndpoint method of the client instance.
98
100
  * @returns {string} The DNS address for this service.
99
101
  */
100
102
  static get servicePath(): string;
101
103
  /**
102
- * The DNS address for this API service - same as servicePath(),
103
- * exists for compatibility reasons.
104
+ * The DNS address for this API service - same as servicePath.
105
+ * @deprecated Use the apiEndpoint method of the client instance.
104
106
  * @returns {string} The DNS address for this service.
105
107
  */
106
108
  static get apiEndpoint(): string;
109
+ /**
110
+ * The DNS address for this API service.
111
+ * @returns {string} The DNS address for this service.
112
+ */
113
+ get apiEndpoint(): string;
114
+ get universeDomain(): string;
107
115
  /**
108
116
  * The port for this API service.
109
117
  * @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.
@@ -73,8 +73,7 @@ class GrafeasV1Beta1Client {
73
73
  * API remote host.
74
74
  * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
75
75
  * Follows the structure of {@link gapicConfig}.
76
- * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
77
- * Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
76
+ * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
78
77
  * For more information, please check the
79
78
  * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
80
79
  * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
@@ -82,11 +81,11 @@ class GrafeasV1Beta1Client {
82
81
  * HTTP implementation. Load only fallback version and pass it to the constructor:
83
82
  * ```
84
83
  * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
85
- * const client = new GrafeasV1Beta1Client({fallback: 'rest'}, gax);
84
+ * const client = new GrafeasV1Beta1Client({fallback: true}, gax);
86
85
  * ```
87
86
  */
88
87
  constructor(opts, gaxInstance) {
89
- var _a, _b;
88
+ var _a, _b, _c, _d;
90
89
  this._terminated = false;
91
90
  this.descriptors = {
92
91
  page: {},
@@ -96,16 +95,24 @@ class GrafeasV1Beta1Client {
96
95
  };
97
96
  // Ensure that options include all the required fields.
98
97
  const staticMembers = this.constructor;
99
- const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || staticMembers.servicePath;
98
+ if ((opts === null || opts === void 0 ? void 0 : opts.universe_domain) &&
99
+ (opts === null || opts === void 0 ? void 0 : opts.universeDomain) &&
100
+ (opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== (opts === null || opts === void 0 ? void 0 : opts.universeDomain)) {
101
+ throw new Error('Please set either universe_domain or universeDomain, but not both.');
102
+ }
103
+ this._universeDomain =
104
+ (_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';
105
+ this._servicePath = 'containeranalysis.' + this._universeDomain;
106
+ const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || this._servicePath;
100
107
  this._providedCustomServicePath = !!((opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint));
101
108
  const port = (opts === null || opts === void 0 ? void 0 : opts.port) || staticMembers.port;
102
- const clientConfig = (_a = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _a !== void 0 ? _a : {};
103
- 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');
109
+ const clientConfig = (_c = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _c !== void 0 ? _c : {};
110
+ 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');
104
111
  opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
105
112
  // Request numeric enum values if REST transport is used.
106
113
  opts.numericEnums = true;
107
114
  // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case.
108
- if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) {
115
+ if (servicePath !== this._servicePath && !('scopes' in opts)) {
109
116
  opts['scopes'] = staticMembers.scopes;
110
117
  }
111
118
  // Load google-gax module synchronously if needed
@@ -123,9 +130,9 @@ class GrafeasV1Beta1Client {
123
130
  // Set useJWTAccessWithScope on the auth object.
124
131
  this.auth.useJWTAccessWithScope = true;
125
132
  // Set defaultServicePath on the auth object.
126
- this.auth.defaultServicePath = staticMembers.servicePath;
133
+ this.auth.defaultServicePath = this._servicePath;
127
134
  // Set the default scopes in auth client if needed.
128
- if (servicePath === staticMembers.servicePath) {
135
+ if (servicePath === this._servicePath) {
129
136
  this.auth.defaultScopes = staticMembers.scopes;
130
137
  }
131
138
  // Determine the client header string.
@@ -139,7 +146,7 @@ class GrafeasV1Beta1Client {
139
146
  if (!opts.fallback) {
140
147
  clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
141
148
  }
142
- else if (opts.fallback === 'rest') {
149
+ else {
143
150
  clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
144
151
  }
145
152
  if (opts.libName && opts.libVersion) {
@@ -223,19 +230,38 @@ class GrafeasV1Beta1Client {
223
230
  }
224
231
  /**
225
232
  * The DNS address for this API service.
233
+ * @deprecated Use the apiEndpoint method of the client instance.
226
234
  * @returns {string} The DNS address for this service.
227
235
  */
228
236
  static get servicePath() {
237
+ if (typeof process !== undefined &&
238
+ typeof process.emitWarning === 'function') {
239
+ process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning');
240
+ }
229
241
  return 'containeranalysis.googleapis.com';
230
242
  }
231
243
  /**
232
- * The DNS address for this API service - same as servicePath(),
233
- * exists for compatibility reasons.
244
+ * The DNS address for this API service - same as servicePath.
245
+ * @deprecated Use the apiEndpoint method of the client instance.
234
246
  * @returns {string} The DNS address for this service.
235
247
  */
236
248
  static get apiEndpoint() {
249
+ if (typeof process !== undefined &&
250
+ typeof process.emitWarning === 'function') {
251
+ process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning');
252
+ }
237
253
  return 'containeranalysis.googleapis.com';
238
254
  }
255
+ /**
256
+ * The DNS address for this API service.
257
+ * @returns {string} The DNS address for this service.
258
+ */
259
+ get apiEndpoint() {
260
+ return this._servicePath;
261
+ }
262
+ get universeDomain() {
263
+ return this._universeDomain;
264
+ }
239
265
  /**
240
266
  * The port for this API service.
241
267
  * @returns {number} The default port for this service.
package/package.json CHANGED
@@ -1,8 +1,13 @@
1
1
  {
2
2
  "name": "@google-cloud/containeranalysis",
3
- "version": "5.0.1",
3
+ "version": "5.2.0",
4
4
  "description": "Containeranalysis client for Node.js",
5
- "repository": "googleapis/nodejs-containeranalysis",
5
+ "repository": {
6
+ "type": "git",
7
+ "directory": "packages/google-devtools-containeranalysis",
8
+ "url": "https://github.com/googleapis/google-cloud-node.git"
9
+ },
10
+ "homepage": "https://github.com/googleapis/google-cloud-node/tree/main/packages/google-devtools-containeranalysis",
6
11
  "license": "Apache-2.0",
7
12
  "author": "Google LLC",
8
13
  "main": "build/src/index.js",
@@ -34,7 +39,7 @@
34
39
  "docs-test": "linkinator docs",
35
40
  "fix": "gts fix",
36
41
  "lint": "gts check",
37
- "prepare": "npm run compile-protos && npm run compile",
42
+ "prepare": "npm run compile",
38
43
  "prelint": "cd samples; npm link ../; npm i",
39
44
  "postpack": "minifyProtoJson",
40
45
  "samples-test": "cd samples/ && npm link ../ && npm i && npm test",
@@ -48,9 +53,9 @@
48
53
  "devDependencies": {
49
54
  "@types/mocha": "^10.0.1",
50
55
  "@types/node": "^20.4.5",
51
- "@types/sinon": "^10.0.13",
56
+ "@types/sinon": "^17.0.0",
52
57
  "c8": "^8.0.1",
53
- "gapic-tools": "^0.1.8",
58
+ "gapic-tools": "^0.3.0",
54
59
  "gts": "^5.0.0",
55
60
  "jsdoc": "^4.0.0",
56
61
  "jsdoc-fresh": "^3.0.0",
@@ -58,8 +63,8 @@
58
63
  "linkinator": "4.1.2",
59
64
  "long": "^5.2.3",
60
65
  "mocha": "^10.2.0",
61
- "pack-n-play": "^1.0.0-2",
62
- "sinon": "^15.0.1",
66
+ "pack-n-play": "^2.0.0",
67
+ "sinon": "^17.0.0",
63
68
  "typescript": "^5.1.6"
64
69
  },
65
70
  "engines": {