@google-cloud/containeranalysis 5.5.0 → 6.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.
@@ -0,0 +1,229 @@
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.devtools.containeranalysis.v1",
6
+ "libraryPackage": "@google-cloud/containeranalysis",
7
+ "services": {
8
+ "ContainerAnalysis": {
9
+ "clients": {
10
+ "grpc": {
11
+ "libraryClient": "ContainerAnalysisClient",
12
+ "rpcs": {
13
+ "SetIamPolicy": {
14
+ "methods": [
15
+ "setIamPolicy"
16
+ ]
17
+ },
18
+ "GetIamPolicy": {
19
+ "methods": [
20
+ "getIamPolicy"
21
+ ]
22
+ },
23
+ "TestIamPermissions": {
24
+ "methods": [
25
+ "testIamPermissions"
26
+ ]
27
+ },
28
+ "GetVulnerabilityOccurrencesSummary": {
29
+ "methods": [
30
+ "getVulnerabilityOccurrencesSummary"
31
+ ]
32
+ }
33
+ }
34
+ },
35
+ "grpc-fallback": {
36
+ "libraryClient": "ContainerAnalysisClient",
37
+ "rpcs": {
38
+ "SetIamPolicy": {
39
+ "methods": [
40
+ "setIamPolicy"
41
+ ]
42
+ },
43
+ "GetIamPolicy": {
44
+ "methods": [
45
+ "getIamPolicy"
46
+ ]
47
+ },
48
+ "TestIamPermissions": {
49
+ "methods": [
50
+ "testIamPermissions"
51
+ ]
52
+ },
53
+ "GetVulnerabilityOccurrencesSummary": {
54
+ "methods": [
55
+ "getVulnerabilityOccurrencesSummary"
56
+ ]
57
+ }
58
+ }
59
+ }
60
+ }
61
+ },
62
+ "Grafeas": {
63
+ "clients": {
64
+ "grpc": {
65
+ "libraryClient": "GrafeasClient",
66
+ "rpcs": {
67
+ "GetOccurrence": {
68
+ "methods": [
69
+ "getOccurrence"
70
+ ]
71
+ },
72
+ "DeleteOccurrence": {
73
+ "methods": [
74
+ "deleteOccurrence"
75
+ ]
76
+ },
77
+ "CreateOccurrence": {
78
+ "methods": [
79
+ "createOccurrence"
80
+ ]
81
+ },
82
+ "BatchCreateOccurrences": {
83
+ "methods": [
84
+ "batchCreateOccurrences"
85
+ ]
86
+ },
87
+ "UpdateOccurrence": {
88
+ "methods": [
89
+ "updateOccurrence"
90
+ ]
91
+ },
92
+ "GetOccurrenceNote": {
93
+ "methods": [
94
+ "getOccurrenceNote"
95
+ ]
96
+ },
97
+ "GetNote": {
98
+ "methods": [
99
+ "getNote"
100
+ ]
101
+ },
102
+ "DeleteNote": {
103
+ "methods": [
104
+ "deleteNote"
105
+ ]
106
+ },
107
+ "CreateNote": {
108
+ "methods": [
109
+ "createNote"
110
+ ]
111
+ },
112
+ "BatchCreateNotes": {
113
+ "methods": [
114
+ "batchCreateNotes"
115
+ ]
116
+ },
117
+ "UpdateNote": {
118
+ "methods": [
119
+ "updateNote"
120
+ ]
121
+ },
122
+ "ListOccurrences": {
123
+ "methods": [
124
+ "listOccurrences",
125
+ "listOccurrencesStream",
126
+ "listOccurrencesAsync"
127
+ ]
128
+ },
129
+ "ListNotes": {
130
+ "methods": [
131
+ "listNotes",
132
+ "listNotesStream",
133
+ "listNotesAsync"
134
+ ]
135
+ },
136
+ "ListNoteOccurrences": {
137
+ "methods": [
138
+ "listNoteOccurrences",
139
+ "listNoteOccurrencesStream",
140
+ "listNoteOccurrencesAsync"
141
+ ]
142
+ }
143
+ }
144
+ },
145
+ "grpc-fallback": {
146
+ "libraryClient": "GrafeasClient",
147
+ "rpcs": {
148
+ "GetOccurrence": {
149
+ "methods": [
150
+ "getOccurrence"
151
+ ]
152
+ },
153
+ "DeleteOccurrence": {
154
+ "methods": [
155
+ "deleteOccurrence"
156
+ ]
157
+ },
158
+ "CreateOccurrence": {
159
+ "methods": [
160
+ "createOccurrence"
161
+ ]
162
+ },
163
+ "BatchCreateOccurrences": {
164
+ "methods": [
165
+ "batchCreateOccurrences"
166
+ ]
167
+ },
168
+ "UpdateOccurrence": {
169
+ "methods": [
170
+ "updateOccurrence"
171
+ ]
172
+ },
173
+ "GetOccurrenceNote": {
174
+ "methods": [
175
+ "getOccurrenceNote"
176
+ ]
177
+ },
178
+ "GetNote": {
179
+ "methods": [
180
+ "getNote"
181
+ ]
182
+ },
183
+ "DeleteNote": {
184
+ "methods": [
185
+ "deleteNote"
186
+ ]
187
+ },
188
+ "CreateNote": {
189
+ "methods": [
190
+ "createNote"
191
+ ]
192
+ },
193
+ "BatchCreateNotes": {
194
+ "methods": [
195
+ "batchCreateNotes"
196
+ ]
197
+ },
198
+ "UpdateNote": {
199
+ "methods": [
200
+ "updateNote"
201
+ ]
202
+ },
203
+ "ListOccurrences": {
204
+ "methods": [
205
+ "listOccurrences",
206
+ "listOccurrencesStream",
207
+ "listOccurrencesAsync"
208
+ ]
209
+ },
210
+ "ListNotes": {
211
+ "methods": [
212
+ "listNotes",
213
+ "listNotesStream",
214
+ "listNotesAsync"
215
+ ]
216
+ },
217
+ "ListNoteOccurrences": {
218
+ "methods": [
219
+ "listNoteOccurrences",
220
+ "listNoteOccurrencesStream",
221
+ "listNoteOccurrencesAsync"
222
+ ]
223
+ }
224
+ }
225
+ }
226
+ }
227
+ }
228
+ }
229
+ }
@@ -0,0 +1,24 @@
1
+ [
2
+ "../../protos/google/devtools/containeranalysis/v1/containeranalysis.proto",
3
+ "../../protos/grafeas/v1/attestation.proto",
4
+ "../../protos/grafeas/v1/build.proto",
5
+ "../../protos/grafeas/v1/common.proto",
6
+ "../../protos/grafeas/v1/compliance.proto",
7
+ "../../protos/grafeas/v1/cvss.proto",
8
+ "../../protos/grafeas/v1/deployment.proto",
9
+ "../../protos/grafeas/v1/discovery.proto",
10
+ "../../protos/grafeas/v1/dsse_attestation.proto",
11
+ "../../protos/grafeas/v1/grafeas.proto",
12
+ "../../protos/grafeas/v1/image.proto",
13
+ "../../protos/grafeas/v1/intoto_provenance.proto",
14
+ "../../protos/grafeas/v1/intoto_statement.proto",
15
+ "../../protos/grafeas/v1/package.proto",
16
+ "../../protos/grafeas/v1/provenance.proto",
17
+ "../../protos/grafeas/v1/sbom.proto",
18
+ "../../protos/grafeas/v1/severity.proto",
19
+ "../../protos/grafeas/v1/slsa_provenance.proto",
20
+ "../../protos/grafeas/v1/slsa_provenance_zero_two.proto",
21
+ "../../protos/grafeas/v1/upgrade.proto",
22
+ "../../protos/grafeas/v1/vex.proto",
23
+ "../../protos/grafeas/v1/vulnerability.proto"
24
+ ]
@@ -28,6 +28,7 @@ export declare class ContainerAnalysisV1Beta1Client {
28
28
  private _defaults;
29
29
  private _universeDomain;
30
30
  private _servicePath;
31
+ private _log;
31
32
  auth: gax.GoogleAuth;
32
33
  descriptors: Descriptors;
33
34
  warn: (code: string, message: string, warnType?: string) => void;
@@ -59,7 +60,7 @@ export declare class ContainerAnalysisV1Beta1Client {
59
60
  * Developer's Console, e.g. 'grape-spaceship-123'. We will also check
60
61
  * the environment variable GCLOUD_PROJECT for your project ID. If your
61
62
  * app is running in an environment which supports
62
- * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials},
63
+ * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials},
63
64
  * your project ID will be detected automatically.
64
65
  * @param {string} [options.apiEndpoint] - The domain name of the
65
66
  * API remote host.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2024 Google LLC
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.ContainerAnalysisV1Beta1Client = 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/v1beta1/container_analysis_v1_beta1_client_config.json`.
@@ -44,6 +45,26 @@ const version = require('../../../package.json').version;
44
45
  * @memberof v1beta1
45
46
  */
46
47
  class ContainerAnalysisV1Beta1Client {
48
+ _terminated = false;
49
+ _opts;
50
+ _providedCustomServicePath;
51
+ _gaxModule;
52
+ _gaxGrpc;
53
+ _protos;
54
+ _defaults;
55
+ _universeDomain;
56
+ _servicePath;
57
+ _log = google_gax_1.loggingUtils.log('containeranalysis');
58
+ auth;
59
+ descriptors = {
60
+ page: {},
61
+ stream: {},
62
+ longrunning: {},
63
+ batching: {},
64
+ };
65
+ warn;
66
+ innerApiCalls;
67
+ containerAnalysisV1Beta1Stub;
47
68
  /**
48
69
  * Construct an instance of ContainerAnalysisV1Beta1Client.
49
70
  *
@@ -66,7 +87,7 @@ class ContainerAnalysisV1Beta1Client {
66
87
  * Developer's Console, e.g. 'grape-spaceship-123'. We will also check
67
88
  * the environment variable GCLOUD_PROJECT for your project ID. If your
68
89
  * app is running in an environment which supports
69
- * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials},
90
+ * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials},
70
91
  * your project ID will be detected automatically.
71
92
  * @param {string} [options.apiEndpoint] - The domain name of the
72
93
  * API remote host.
@@ -84,33 +105,29 @@ class ContainerAnalysisV1Beta1Client {
84
105
  * ```
85
106
  */
86
107
  constructor(opts, gaxInstance) {
87
- var _a, _b, _c, _d, _e;
88
- this._terminated = false;
89
- this.descriptors = {
90
- page: {},
91
- stream: {},
92
- longrunning: {},
93
- batching: {},
94
- };
95
108
  // Ensure that options include all the required fields.
96
109
  const staticMembers = this
97
110
  .constructor;
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)) {
111
+ if (opts?.universe_domain &&
112
+ opts?.universeDomain &&
113
+ opts?.universe_domain !== opts?.universeDomain) {
101
114
  throw new Error('Please set either universe_domain or universeDomain, but not both.');
102
115
  }
103
116
  const universeDomainEnvVar = typeof process === 'object' && typeof process.env === 'object'
104
117
  ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']
105
118
  : undefined;
106
119
  this._universeDomain =
107
- (_c = (_b = (_a = opts === null || opts === void 0 ? void 0 : opts.universeDomain) !== null && _a !== void 0 ? _a : opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== null && _b !== void 0 ? _b : universeDomainEnvVar) !== null && _c !== void 0 ? _c : 'googleapis.com';
120
+ opts?.universeDomain ??
121
+ opts?.universe_domain ??
122
+ universeDomainEnvVar ??
123
+ 'googleapis.com';
108
124
  this._servicePath = 'containeranalysis.' + this._universeDomain;
109
- const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || this._servicePath;
110
- this._providedCustomServicePath = !!((opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint));
111
- const port = (opts === null || opts === void 0 ? void 0 : opts.port) || staticMembers.port;
112
- const clientConfig = (_d = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _d !== void 0 ? _d : {};
113
- const fallback = (_e = opts === null || opts === void 0 ? void 0 : opts.fallback) !== null && _e !== void 0 ? _e : (typeof window !== 'undefined' && typeof (window === null || window === void 0 ? void 0 : window.fetch) === 'function');
125
+ const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath;
126
+ this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint);
127
+ const port = opts?.port || staticMembers.port;
128
+ const clientConfig = opts?.clientConfig ?? {};
129
+ const fallback = opts?.fallback ??
130
+ (typeof window !== 'undefined' && typeof window?.fetch === 'function');
114
131
  opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
115
132
  // Request numeric enum values if REST transport is used.
116
133
  opts.numericEnums = true;
@@ -275,7 +292,6 @@ class ContainerAnalysisV1Beta1Client {
275
292
  return this.auth.getProjectId();
276
293
  }
277
294
  setIamPolicy(request, optionsOrCallback, callback) {
278
- var _a;
279
295
  request = request || {};
280
296
  let options;
281
297
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -290,13 +306,24 @@ class ContainerAnalysisV1Beta1Client {
290
306
  options.otherArgs.headers = options.otherArgs.headers || {};
291
307
  options.otherArgs.headers['x-goog-request-params'] =
292
308
  this._gaxModule.routingHeader.fromParams({
293
- resource: (_a = request.resource) !== null && _a !== void 0 ? _a : '',
309
+ resource: request.resource ?? '',
294
310
  });
295
311
  this.initialize();
296
- return this.innerApiCalls.setIamPolicy(request, options, callback);
312
+ this._log.info('setIamPolicy request %j', request);
313
+ const wrappedCallback = callback
314
+ ? (error, response, options, rawResponse) => {
315
+ this._log.info('setIamPolicy response %j', response);
316
+ callback(error, response, options, rawResponse); // We verified callback above.
317
+ }
318
+ : undefined;
319
+ return this.innerApiCalls
320
+ .setIamPolicy(request, options, wrappedCallback)
321
+ ?.then(([response, options, rawResponse]) => {
322
+ this._log.info('setIamPolicy response %j', response);
323
+ return [response, options, rawResponse];
324
+ });
297
325
  }
298
326
  getIamPolicy(request, optionsOrCallback, callback) {
299
- var _a;
300
327
  request = request || {};
301
328
  let options;
302
329
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -311,13 +338,24 @@ class ContainerAnalysisV1Beta1Client {
311
338
  options.otherArgs.headers = options.otherArgs.headers || {};
312
339
  options.otherArgs.headers['x-goog-request-params'] =
313
340
  this._gaxModule.routingHeader.fromParams({
314
- resource: (_a = request.resource) !== null && _a !== void 0 ? _a : '',
341
+ resource: request.resource ?? '',
315
342
  });
316
343
  this.initialize();
317
- return this.innerApiCalls.getIamPolicy(request, options, callback);
344
+ this._log.info('getIamPolicy request %j', request);
345
+ const wrappedCallback = callback
346
+ ? (error, response, options, rawResponse) => {
347
+ this._log.info('getIamPolicy response %j', response);
348
+ callback(error, response, options, rawResponse); // We verified callback above.
349
+ }
350
+ : undefined;
351
+ return this.innerApiCalls
352
+ .getIamPolicy(request, options, wrappedCallback)
353
+ ?.then(([response, options, rawResponse]) => {
354
+ this._log.info('getIamPolicy response %j', response);
355
+ return [response, options, rawResponse];
356
+ });
318
357
  }
319
358
  testIamPermissions(request, optionsOrCallback, callback) {
320
- var _a;
321
359
  request = request || {};
322
360
  let options;
323
361
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -332,13 +370,24 @@ class ContainerAnalysisV1Beta1Client {
332
370
  options.otherArgs.headers = options.otherArgs.headers || {};
333
371
  options.otherArgs.headers['x-goog-request-params'] =
334
372
  this._gaxModule.routingHeader.fromParams({
335
- resource: (_a = request.resource) !== null && _a !== void 0 ? _a : '',
373
+ resource: request.resource ?? '',
336
374
  });
337
375
  this.initialize();
338
- return this.innerApiCalls.testIamPermissions(request, options, callback);
376
+ this._log.info('testIamPermissions request %j', request);
377
+ const wrappedCallback = callback
378
+ ? (error, response, options, rawResponse) => {
379
+ this._log.info('testIamPermissions response %j', response);
380
+ callback(error, response, options, rawResponse); // We verified callback above.
381
+ }
382
+ : undefined;
383
+ return this.innerApiCalls
384
+ .testIamPermissions(request, options, wrappedCallback)
385
+ ?.then(([response, options, rawResponse]) => {
386
+ this._log.info('testIamPermissions response %j', response);
387
+ return [response, options, rawResponse];
388
+ });
339
389
  }
340
390
  generatePackagesSummary(request, optionsOrCallback, callback) {
341
- var _a;
342
391
  request = request || {};
343
392
  let options;
344
393
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -353,13 +402,24 @@ class ContainerAnalysisV1Beta1Client {
353
402
  options.otherArgs.headers = options.otherArgs.headers || {};
354
403
  options.otherArgs.headers['x-goog-request-params'] =
355
404
  this._gaxModule.routingHeader.fromParams({
356
- name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
405
+ name: request.name ?? '',
357
406
  });
358
407
  this.initialize();
359
- return this.innerApiCalls.generatePackagesSummary(request, options, callback);
408
+ this._log.info('generatePackagesSummary request %j', request);
409
+ const wrappedCallback = callback
410
+ ? (error, response, options, rawResponse) => {
411
+ this._log.info('generatePackagesSummary response %j', response);
412
+ callback(error, response, options, rawResponse); // We verified callback above.
413
+ }
414
+ : undefined;
415
+ return this.innerApiCalls
416
+ .generatePackagesSummary(request, options, wrappedCallback)
417
+ ?.then(([response, options, rawResponse]) => {
418
+ this._log.info('generatePackagesSummary response %j', response);
419
+ return [response, options, rawResponse];
420
+ });
360
421
  }
361
422
  exportSBOM(request, optionsOrCallback, callback) {
362
- var _a;
363
423
  request = request || {};
364
424
  let options;
365
425
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -374,10 +434,22 @@ class ContainerAnalysisV1Beta1Client {
374
434
  options.otherArgs.headers = options.otherArgs.headers || {};
375
435
  options.otherArgs.headers['x-goog-request-params'] =
376
436
  this._gaxModule.routingHeader.fromParams({
377
- name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
437
+ name: request.name ?? '',
378
438
  });
379
439
  this.initialize();
380
- return this.innerApiCalls.exportSboM(request, options, callback);
440
+ this._log.info('exportSBOM request %j', request);
441
+ const wrappedCallback = callback
442
+ ? (error, response, options, rawResponse) => {
443
+ this._log.info('exportSBOM response %j', response);
444
+ callback(error, response, options, rawResponse); // We verified callback above.
445
+ }
446
+ : undefined;
447
+ return this.innerApiCalls
448
+ .exportSboM(request, options, wrappedCallback)
449
+ ?.then(([response, options, rawResponse]) => {
450
+ this._log.info('exportSBOM response %j', response);
451
+ return [response, options, rawResponse];
452
+ });
381
453
  }
382
454
  /**
383
455
  * Terminate the gRPC channel and close the client.
@@ -388,6 +460,7 @@ class ContainerAnalysisV1Beta1Client {
388
460
  close() {
389
461
  if (this.containerAnalysisV1Beta1Stub && !this._terminated) {
390
462
  return this.containerAnalysisV1Beta1Stub.then(stub => {
463
+ this._log.info('ending gRPC channel');
391
464
  this._terminated = true;
392
465
  stub.close();
393
466
  });
@@ -0,0 +1,15 @@
1
+ [
2
+ "../../protos/google/devtools/containeranalysis/v1beta1/attestation/attestation.proto",
3
+ "../../protos/google/devtools/containeranalysis/v1beta1/build/build.proto",
4
+ "../../protos/google/devtools/containeranalysis/v1beta1/common/common.proto",
5
+ "../../protos/google/devtools/containeranalysis/v1beta1/containeranalysis.proto",
6
+ "../../protos/google/devtools/containeranalysis/v1beta1/cvss/cvss.proto",
7
+ "../../protos/google/devtools/containeranalysis/v1beta1/deployment/deployment.proto",
8
+ "../../protos/google/devtools/containeranalysis/v1beta1/discovery/discovery.proto",
9
+ "../../protos/google/devtools/containeranalysis/v1beta1/grafeas/grafeas.proto",
10
+ "../../protos/google/devtools/containeranalysis/v1beta1/image/image.proto",
11
+ "../../protos/google/devtools/containeranalysis/v1beta1/package/package.proto",
12
+ "../../protos/google/devtools/containeranalysis/v1beta1/provenance/provenance.proto",
13
+ "../../protos/google/devtools/containeranalysis/v1beta1/source/source.proto",
14
+ "../../protos/google/devtools/containeranalysis/v1beta1/vulnerability/vulnerability.proto"
15
+ ]