google-cloud-container_analysis-v1 1.8.0 → 1.8.2

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.
Files changed (27) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +0 -4
  3. data/lib/google/cloud/container_analysis/v1/container_analysis/client.rb +1 -1
  4. data/lib/google/cloud/container_analysis/v1/container_analysis/credentials.rb +1 -1
  5. data/lib/google/cloud/container_analysis/v1/container_analysis/paths.rb +1 -1
  6. data/lib/google/cloud/container_analysis/v1/container_analysis/rest/client.rb +833 -0
  7. data/lib/google/cloud/container_analysis/v1/container_analysis/rest/service_stub.rb +477 -0
  8. data/lib/google/cloud/container_analysis/v1/container_analysis/rest.rb +64 -0
  9. data/lib/google/cloud/container_analysis/v1/container_analysis.rb +7 -1
  10. data/lib/google/cloud/container_analysis/v1/rest.rb +37 -0
  11. data/lib/google/cloud/container_analysis/v1/version.rb +1 -1
  12. data/lib/google/cloud/container_analysis/v1.rb +6 -1
  13. data/lib/google/devtools/containeranalysis/v1/containeranalysis_services_pb.rb +1 -1
  14. data/lib/google-cloud-container_analysis-v1.rb +1 -1
  15. data/proto_docs/google/api/client.rb +1 -1
  16. data/proto_docs/google/api/field_behavior.rb +1 -1
  17. data/proto_docs/google/api/launch_stage.rb +1 -1
  18. data/proto_docs/google/api/resource.rb +1 -1
  19. data/proto_docs/google/devtools/containeranalysis/v1/containeranalysis.rb +1 -1
  20. data/proto_docs/google/iam/v1/iam_policy.rb +1 -1
  21. data/proto_docs/google/iam/v1/options.rb +1 -1
  22. data/proto_docs/google/iam/v1/policy.rb +1 -1
  23. data/proto_docs/google/protobuf/duration.rb +1 -1
  24. data/proto_docs/google/protobuf/field_mask.rb +1 -1
  25. data/proto_docs/google/type/expr.rb +1 -1
  26. data/proto_docs/grafeas/v1/severity.rb +1 -1
  27. metadata +13 -6
@@ -0,0 +1,833 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2026 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/devtools/containeranalysis/v1/containeranalysis_pb"
21
+ require "google/cloud/container_analysis/v1/container_analysis/rest/service_stub"
22
+
23
+ module Google
24
+ module Cloud
25
+ module ContainerAnalysis
26
+ module V1
27
+ module ContainerAnalysis
28
+ module Rest
29
+ ##
30
+ # REST client for the ContainerAnalysis service.
31
+ #
32
+ # Retrieves analysis results of Cloud components such as Docker container
33
+ # images. The Container Analysis API is an implementation of the
34
+ # [Grafeas](https://grafeas.io) API.
35
+ #
36
+ # Analysis results are stored as a series of occurrences. An `Occurrence`
37
+ # contains information about a specific analysis instance on a resource. An
38
+ # occurrence refers to a `Note`. A note contains details describing the
39
+ # analysis and is generally stored in a separate project, called a `Provider`.
40
+ # Multiple occurrences can refer to the same note.
41
+ #
42
+ # For example, an SSL vulnerability could affect multiple images. In this case,
43
+ # there would be one note for the vulnerability and an occurrence for each
44
+ # image with the vulnerability referring to that note.
45
+ #
46
+ class Client
47
+ # @private
48
+ API_VERSION = ""
49
+
50
+ # @private
51
+ DEFAULT_ENDPOINT_TEMPLATE = "containeranalysis.$UNIVERSE_DOMAIN$"
52
+
53
+ include Paths
54
+
55
+ # @private
56
+ attr_reader :container_analysis_stub
57
+
58
+ ##
59
+ # Configure the ContainerAnalysis Client class.
60
+ #
61
+ # See {::Google::Cloud::ContainerAnalysis::V1::ContainerAnalysis::Rest::Client::Configuration}
62
+ # for a description of the configuration fields.
63
+ #
64
+ # @example
65
+ #
66
+ # # Modify the configuration for all ContainerAnalysis clients
67
+ # ::Google::Cloud::ContainerAnalysis::V1::ContainerAnalysis::Rest::Client.configure do |config|
68
+ # config.timeout = 10.0
69
+ # end
70
+ #
71
+ # @yield [config] Configure the Client client.
72
+ # @yieldparam config [Client::Configuration]
73
+ #
74
+ # @return [Client::Configuration]
75
+ #
76
+ def self.configure
77
+ @configure ||= begin
78
+ namespace = ["Google", "Cloud", "ContainerAnalysis", "V1"]
79
+ parent_config = while namespace.any?
80
+ parent_name = namespace.join "::"
81
+ parent_const = const_get parent_name
82
+ break parent_const.configure if parent_const.respond_to? :configure
83
+ namespace.pop
84
+ end
85
+ default_config = Client::Configuration.new parent_config
86
+
87
+ default_config.rpcs.set_iam_policy.timeout = 30.0
88
+
89
+ default_config.rpcs.get_iam_policy.timeout = 30.0
90
+
91
+ default_config.rpcs.test_iam_permissions.timeout = 30.0
92
+
93
+ default_config
94
+ end
95
+ yield @configure if block_given?
96
+ @configure
97
+ end
98
+
99
+ ##
100
+ # Configure the ContainerAnalysis Client instance.
101
+ #
102
+ # The configuration is set to the derived mode, meaning that values can be changed,
103
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
104
+ # should be made on {Client.configure}.
105
+ #
106
+ # See {::Google::Cloud::ContainerAnalysis::V1::ContainerAnalysis::Rest::Client::Configuration}
107
+ # for a description of the configuration fields.
108
+ #
109
+ # @yield [config] Configure the Client client.
110
+ # @yieldparam config [Client::Configuration]
111
+ #
112
+ # @return [Client::Configuration]
113
+ #
114
+ def configure
115
+ yield @config if block_given?
116
+ @config
117
+ end
118
+
119
+ ##
120
+ # The effective universe domain
121
+ #
122
+ # @return [String]
123
+ #
124
+ def universe_domain
125
+ @container_analysis_stub.universe_domain
126
+ end
127
+
128
+ ##
129
+ # Create a new ContainerAnalysis REST client object.
130
+ #
131
+ # @example
132
+ #
133
+ # # Create a client using the default configuration
134
+ # client = ::Google::Cloud::ContainerAnalysis::V1::ContainerAnalysis::Rest::Client.new
135
+ #
136
+ # # Create a client using a custom configuration
137
+ # client = ::Google::Cloud::ContainerAnalysis::V1::ContainerAnalysis::Rest::Client.new do |config|
138
+ # config.timeout = 10.0
139
+ # end
140
+ #
141
+ # @yield [config] Configure the ContainerAnalysis client.
142
+ # @yieldparam config [Client::Configuration]
143
+ #
144
+ def initialize
145
+ # Create the configuration object
146
+ @config = Configuration.new Client.configure
147
+
148
+ # Yield the configuration if needed
149
+ yield @config if block_given?
150
+
151
+ # Create credentials
152
+ credentials = @config.credentials
153
+ # Use self-signed JWT if the endpoint is unchanged from default,
154
+ # but only if the default endpoint does not have a region prefix.
155
+ enable_self_signed_jwt = @config.endpoint.nil? ||
156
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
157
+ !@config.endpoint.split(".").first.include?("-"))
158
+ credentials ||= Credentials.default scope: @config.scope,
159
+ enable_self_signed_jwt: enable_self_signed_jwt
160
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
161
+ credentials = Credentials.new credentials, scope: @config.scope
162
+ end
163
+
164
+ @quota_project_id = @config.quota_project
165
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
166
+
167
+ @container_analysis_stub = ::Google::Cloud::ContainerAnalysis::V1::ContainerAnalysis::Rest::ServiceStub.new(
168
+ endpoint: @config.endpoint,
169
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
170
+ universe_domain: @config.universe_domain,
171
+ credentials: credentials,
172
+ logger: @config.logger
173
+ )
174
+
175
+ @container_analysis_stub.logger(stub: true)&.info do |entry|
176
+ entry.set_system_name
177
+ entry.set_service
178
+ entry.message = "Created client for #{entry.service}"
179
+ entry.set_credentials_fields credentials
180
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
181
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
182
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
183
+ end
184
+ end
185
+
186
+ ##
187
+ # The logger used for request/response debug logging.
188
+ #
189
+ # @return [Logger]
190
+ #
191
+ def logger
192
+ @container_analysis_stub.logger
193
+ end
194
+
195
+ # Service calls
196
+
197
+ ##
198
+ # Sets the access control policy on the specified note or occurrence.
199
+ # Requires `containeranalysis.notes.setIamPolicy` or
200
+ # `containeranalysis.occurrences.setIamPolicy` permission if the resource is
201
+ # a note or an occurrence, respectively.
202
+ #
203
+ # The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for
204
+ # notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for
205
+ # occurrences.
206
+ #
207
+ # @overload set_iam_policy(request, options = nil)
208
+ # Pass arguments to `set_iam_policy` via a request object, either of type
209
+ # {::Google::Iam::V1::SetIamPolicyRequest} or an equivalent Hash.
210
+ #
211
+ # @param request [::Google::Iam::V1::SetIamPolicyRequest, ::Hash]
212
+ # A request object representing the call parameters. Required. To specify no
213
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
214
+ # @param options [::Gapic::CallOptions, ::Hash]
215
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
216
+ #
217
+ # @overload set_iam_policy(resource: nil, policy: nil, update_mask: nil)
218
+ # Pass arguments to `set_iam_policy` via keyword arguments. Note that at
219
+ # least one keyword argument is required. To specify no parameters, or to keep all
220
+ # the default parameter values, pass an empty Hash as a request object (see above).
221
+ #
222
+ # @param resource [::String]
223
+ # REQUIRED: The resource for which the policy is being specified.
224
+ # See the operation documentation for the appropriate value for this field.
225
+ # @param policy [::Google::Iam::V1::Policy, ::Hash]
226
+ # REQUIRED: The complete policy to be applied to the `resource`. The size of
227
+ # the policy is limited to a few 10s of KB. An empty policy is a
228
+ # valid policy but certain Cloud Platform services (such as Projects)
229
+ # might reject them.
230
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
231
+ # OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only
232
+ # the fields in the mask will be modified. If no mask is provided, the
233
+ # following default mask is used:
234
+ #
235
+ # `paths: "bindings, etag"`
236
+ # @yield [result, operation] Access the result along with the TransportOperation object
237
+ # @yieldparam result [::Google::Iam::V1::Policy]
238
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
239
+ #
240
+ # @return [::Google::Iam::V1::Policy]
241
+ #
242
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
243
+ #
244
+ # @example Basic example
245
+ # require "google/cloud/container_analysis/v1"
246
+ #
247
+ # # Create a client object. The client can be reused for multiple calls.
248
+ # client = Google::Cloud::ContainerAnalysis::V1::ContainerAnalysis::Rest::Client.new
249
+ #
250
+ # # Create a request. To set request fields, pass in keyword arguments.
251
+ # request = Google::Iam::V1::SetIamPolicyRequest.new
252
+ #
253
+ # # Call the set_iam_policy method.
254
+ # result = client.set_iam_policy request
255
+ #
256
+ # # The returned object is of type Google::Iam::V1::Policy.
257
+ # p result
258
+ #
259
+ def set_iam_policy request, options = nil
260
+ raise ::ArgumentError, "request must be provided" if request.nil?
261
+
262
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::SetIamPolicyRequest
263
+
264
+ # Converts hash and nil to an options object
265
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
266
+
267
+ # Customize the options with defaults
268
+ call_metadata = @config.rpcs.set_iam_policy.metadata.to_h
269
+
270
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
271
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
272
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
273
+ gapic_version: ::Google::Cloud::ContainerAnalysis::V1::VERSION,
274
+ transports_version_send: [:rest]
275
+
276
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
277
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
278
+
279
+ options.apply_defaults timeout: @config.rpcs.set_iam_policy.timeout,
280
+ metadata: call_metadata,
281
+ retry_policy: @config.rpcs.set_iam_policy.retry_policy
282
+
283
+ options.apply_defaults timeout: @config.timeout,
284
+ metadata: @config.metadata,
285
+ retry_policy: @config.retry_policy
286
+
287
+ @container_analysis_stub.set_iam_policy request, options do |result, operation|
288
+ yield result, operation if block_given?
289
+ end
290
+ rescue ::Gapic::Rest::Error => e
291
+ raise ::Google::Cloud::Error.from_error(e)
292
+ end
293
+
294
+ ##
295
+ # Gets the access control policy for a note or an occurrence resource.
296
+ # Requires `containeranalysis.notes.setIamPolicy` or
297
+ # `containeranalysis.occurrences.setIamPolicy` permission if the resource is
298
+ # a note or occurrence, respectively.
299
+ #
300
+ # The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for
301
+ # notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for
302
+ # occurrences.
303
+ #
304
+ # @overload get_iam_policy(request, options = nil)
305
+ # Pass arguments to `get_iam_policy` via a request object, either of type
306
+ # {::Google::Iam::V1::GetIamPolicyRequest} or an equivalent Hash.
307
+ #
308
+ # @param request [::Google::Iam::V1::GetIamPolicyRequest, ::Hash]
309
+ # A request object representing the call parameters. Required. To specify no
310
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
311
+ # @param options [::Gapic::CallOptions, ::Hash]
312
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
313
+ #
314
+ # @overload get_iam_policy(resource: nil, options: nil)
315
+ # Pass arguments to `get_iam_policy` via keyword arguments. Note that at
316
+ # least one keyword argument is required. To specify no parameters, or to keep all
317
+ # the default parameter values, pass an empty Hash as a request object (see above).
318
+ #
319
+ # @param resource [::String]
320
+ # REQUIRED: The resource for which the policy is being requested.
321
+ # See the operation documentation for the appropriate value for this field.
322
+ # @param options [::Google::Iam::V1::GetPolicyOptions, ::Hash]
323
+ # OPTIONAL: A `GetPolicyOptions` object for specifying options to
324
+ # `GetIamPolicy`.
325
+ # @yield [result, operation] Access the result along with the TransportOperation object
326
+ # @yieldparam result [::Google::Iam::V1::Policy]
327
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
328
+ #
329
+ # @return [::Google::Iam::V1::Policy]
330
+ #
331
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
332
+ #
333
+ # @example Basic example
334
+ # require "google/cloud/container_analysis/v1"
335
+ #
336
+ # # Create a client object. The client can be reused for multiple calls.
337
+ # client = Google::Cloud::ContainerAnalysis::V1::ContainerAnalysis::Rest::Client.new
338
+ #
339
+ # # Create a request. To set request fields, pass in keyword arguments.
340
+ # request = Google::Iam::V1::GetIamPolicyRequest.new
341
+ #
342
+ # # Call the get_iam_policy method.
343
+ # result = client.get_iam_policy request
344
+ #
345
+ # # The returned object is of type Google::Iam::V1::Policy.
346
+ # p result
347
+ #
348
+ def get_iam_policy request, options = nil
349
+ raise ::ArgumentError, "request must be provided" if request.nil?
350
+
351
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::GetIamPolicyRequest
352
+
353
+ # Converts hash and nil to an options object
354
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
355
+
356
+ # Customize the options with defaults
357
+ call_metadata = @config.rpcs.get_iam_policy.metadata.to_h
358
+
359
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
360
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
361
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
362
+ gapic_version: ::Google::Cloud::ContainerAnalysis::V1::VERSION,
363
+ transports_version_send: [:rest]
364
+
365
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
366
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
367
+
368
+ options.apply_defaults timeout: @config.rpcs.get_iam_policy.timeout,
369
+ metadata: call_metadata,
370
+ retry_policy: @config.rpcs.get_iam_policy.retry_policy
371
+
372
+ options.apply_defaults timeout: @config.timeout,
373
+ metadata: @config.metadata,
374
+ retry_policy: @config.retry_policy
375
+
376
+ @container_analysis_stub.get_iam_policy request, options do |result, operation|
377
+ yield result, operation if block_given?
378
+ end
379
+ rescue ::Gapic::Rest::Error => e
380
+ raise ::Google::Cloud::Error.from_error(e)
381
+ end
382
+
383
+ ##
384
+ # Returns the permissions that a caller has on the specified note or
385
+ # occurrence. Requires list permission on the project (for example,
386
+ # `containeranalysis.notes.list`).
387
+ #
388
+ # The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for
389
+ # notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for
390
+ # occurrences.
391
+ #
392
+ # @overload test_iam_permissions(request, options = nil)
393
+ # Pass arguments to `test_iam_permissions` via a request object, either of type
394
+ # {::Google::Iam::V1::TestIamPermissionsRequest} or an equivalent Hash.
395
+ #
396
+ # @param request [::Google::Iam::V1::TestIamPermissionsRequest, ::Hash]
397
+ # A request object representing the call parameters. Required. To specify no
398
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
399
+ # @param options [::Gapic::CallOptions, ::Hash]
400
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
401
+ #
402
+ # @overload test_iam_permissions(resource: nil, permissions: nil)
403
+ # Pass arguments to `test_iam_permissions` via keyword arguments. Note that at
404
+ # least one keyword argument is required. To specify no parameters, or to keep all
405
+ # the default parameter values, pass an empty Hash as a request object (see above).
406
+ #
407
+ # @param resource [::String]
408
+ # REQUIRED: The resource for which the policy detail is being requested.
409
+ # See the operation documentation for the appropriate value for this field.
410
+ # @param permissions [::Array<::String>]
411
+ # The set of permissions to check for the `resource`. Permissions with
412
+ # wildcards (such as '*' or 'storage.*') are not allowed. For more
413
+ # information see
414
+ # [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
415
+ # @yield [result, operation] Access the result along with the TransportOperation object
416
+ # @yieldparam result [::Google::Iam::V1::TestIamPermissionsResponse]
417
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
418
+ #
419
+ # @return [::Google::Iam::V1::TestIamPermissionsResponse]
420
+ #
421
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
422
+ #
423
+ # @example Basic example
424
+ # require "google/cloud/container_analysis/v1"
425
+ #
426
+ # # Create a client object. The client can be reused for multiple calls.
427
+ # client = Google::Cloud::ContainerAnalysis::V1::ContainerAnalysis::Rest::Client.new
428
+ #
429
+ # # Create a request. To set request fields, pass in keyword arguments.
430
+ # request = Google::Iam::V1::TestIamPermissionsRequest.new
431
+ #
432
+ # # Call the test_iam_permissions method.
433
+ # result = client.test_iam_permissions request
434
+ #
435
+ # # The returned object is of type Google::Iam::V1::TestIamPermissionsResponse.
436
+ # p result
437
+ #
438
+ def test_iam_permissions request, options = nil
439
+ raise ::ArgumentError, "request must be provided" if request.nil?
440
+
441
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::TestIamPermissionsRequest
442
+
443
+ # Converts hash and nil to an options object
444
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
445
+
446
+ # Customize the options with defaults
447
+ call_metadata = @config.rpcs.test_iam_permissions.metadata.to_h
448
+
449
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
450
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
451
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
452
+ gapic_version: ::Google::Cloud::ContainerAnalysis::V1::VERSION,
453
+ transports_version_send: [:rest]
454
+
455
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
456
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
457
+
458
+ options.apply_defaults timeout: @config.rpcs.test_iam_permissions.timeout,
459
+ metadata: call_metadata,
460
+ retry_policy: @config.rpcs.test_iam_permissions.retry_policy
461
+
462
+ options.apply_defaults timeout: @config.timeout,
463
+ metadata: @config.metadata,
464
+ retry_policy: @config.retry_policy
465
+
466
+ @container_analysis_stub.test_iam_permissions request, options do |result, operation|
467
+ yield result, operation if block_given?
468
+ end
469
+ rescue ::Gapic::Rest::Error => e
470
+ raise ::Google::Cloud::Error.from_error(e)
471
+ end
472
+
473
+ ##
474
+ # Gets a summary of the number and severity of occurrences.
475
+ #
476
+ # @overload get_vulnerability_occurrences_summary(request, options = nil)
477
+ # Pass arguments to `get_vulnerability_occurrences_summary` via a request object, either of type
478
+ # {::Google::Cloud::ContainerAnalysis::V1::GetVulnerabilityOccurrencesSummaryRequest} or an equivalent Hash.
479
+ #
480
+ # @param request [::Google::Cloud::ContainerAnalysis::V1::GetVulnerabilityOccurrencesSummaryRequest, ::Hash]
481
+ # A request object representing the call parameters. Required. To specify no
482
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
483
+ # @param options [::Gapic::CallOptions, ::Hash]
484
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
485
+ #
486
+ # @overload get_vulnerability_occurrences_summary(parent: nil, filter: nil)
487
+ # Pass arguments to `get_vulnerability_occurrences_summary` via keyword arguments. Note that at
488
+ # least one keyword argument is required. To specify no parameters, or to keep all
489
+ # the default parameter values, pass an empty Hash as a request object (see above).
490
+ #
491
+ # @param parent [::String]
492
+ # Required. The name of the project to get a vulnerability summary for in the
493
+ # form of `projects/[PROJECT_ID]`.
494
+ # @param filter [::String]
495
+ # The filter expression.
496
+ # @yield [result, operation] Access the result along with the TransportOperation object
497
+ # @yieldparam result [::Google::Cloud::ContainerAnalysis::V1::VulnerabilityOccurrencesSummary]
498
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
499
+ #
500
+ # @return [::Google::Cloud::ContainerAnalysis::V1::VulnerabilityOccurrencesSummary]
501
+ #
502
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
503
+ #
504
+ # @example Basic example
505
+ # require "google/cloud/container_analysis/v1"
506
+ #
507
+ # # Create a client object. The client can be reused for multiple calls.
508
+ # client = Google::Cloud::ContainerAnalysis::V1::ContainerAnalysis::Rest::Client.new
509
+ #
510
+ # # Create a request. To set request fields, pass in keyword arguments.
511
+ # request = Google::Cloud::ContainerAnalysis::V1::GetVulnerabilityOccurrencesSummaryRequest.new
512
+ #
513
+ # # Call the get_vulnerability_occurrences_summary method.
514
+ # result = client.get_vulnerability_occurrences_summary request
515
+ #
516
+ # # The returned object is of type Google::Cloud::ContainerAnalysis::V1::VulnerabilityOccurrencesSummary.
517
+ # p result
518
+ #
519
+ def get_vulnerability_occurrences_summary request, options = nil
520
+ raise ::ArgumentError, "request must be provided" if request.nil?
521
+
522
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ContainerAnalysis::V1::GetVulnerabilityOccurrencesSummaryRequest
523
+
524
+ # Converts hash and nil to an options object
525
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
526
+
527
+ # Customize the options with defaults
528
+ call_metadata = @config.rpcs.get_vulnerability_occurrences_summary.metadata.to_h
529
+
530
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
531
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
532
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
533
+ gapic_version: ::Google::Cloud::ContainerAnalysis::V1::VERSION,
534
+ transports_version_send: [:rest]
535
+
536
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
537
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
538
+
539
+ options.apply_defaults timeout: @config.rpcs.get_vulnerability_occurrences_summary.timeout,
540
+ metadata: call_metadata,
541
+ retry_policy: @config.rpcs.get_vulnerability_occurrences_summary.retry_policy
542
+
543
+ options.apply_defaults timeout: @config.timeout,
544
+ metadata: @config.metadata,
545
+ retry_policy: @config.retry_policy
546
+
547
+ @container_analysis_stub.get_vulnerability_occurrences_summary request, options do |result, operation|
548
+ yield result, operation if block_given?
549
+ end
550
+ rescue ::Gapic::Rest::Error => e
551
+ raise ::Google::Cloud::Error.from_error(e)
552
+ end
553
+
554
+ ##
555
+ # Generates an SBOM for the given resource.
556
+ #
557
+ # @overload export_sbom(request, options = nil)
558
+ # Pass arguments to `export_sbom` via a request object, either of type
559
+ # {::Google::Cloud::ContainerAnalysis::V1::ExportSBOMRequest} or an equivalent Hash.
560
+ #
561
+ # @param request [::Google::Cloud::ContainerAnalysis::V1::ExportSBOMRequest, ::Hash]
562
+ # A request object representing the call parameters. Required. To specify no
563
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
564
+ # @param options [::Gapic::CallOptions, ::Hash]
565
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
566
+ #
567
+ # @overload export_sbom(name: nil, cloud_storage_location: nil)
568
+ # Pass arguments to `export_sbom` via keyword arguments. Note that at
569
+ # least one keyword argument is required. To specify no parameters, or to keep all
570
+ # the default parameter values, pass an empty Hash as a request object (see above).
571
+ #
572
+ # @param name [::String]
573
+ # Required. The name of the resource in the form of
574
+ # `projects/[PROJECT_ID]/resources/[RESOURCE_URL]`.
575
+ # @param cloud_storage_location [::Google::Cloud::ContainerAnalysis::V1::ExportSBOMRequest::CloudStorageLocation, ::Hash]
576
+ # Optional. Empty placeholder to denote that this is a Google Cloud Storage
577
+ # export request.
578
+ # @yield [result, operation] Access the result along with the TransportOperation object
579
+ # @yieldparam result [::Google::Cloud::ContainerAnalysis::V1::ExportSBOMResponse]
580
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
581
+ #
582
+ # @return [::Google::Cloud::ContainerAnalysis::V1::ExportSBOMResponse]
583
+ #
584
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
585
+ #
586
+ # @example Basic example
587
+ # require "google/cloud/container_analysis/v1"
588
+ #
589
+ # # Create a client object. The client can be reused for multiple calls.
590
+ # client = Google::Cloud::ContainerAnalysis::V1::ContainerAnalysis::Rest::Client.new
591
+ #
592
+ # # Create a request. To set request fields, pass in keyword arguments.
593
+ # request = Google::Cloud::ContainerAnalysis::V1::ExportSBOMRequest.new
594
+ #
595
+ # # Call the export_sbom method.
596
+ # result = client.export_sbom request
597
+ #
598
+ # # The returned object is of type Google::Cloud::ContainerAnalysis::V1::ExportSBOMResponse.
599
+ # p result
600
+ #
601
+ def export_sbom request, options = nil
602
+ raise ::ArgumentError, "request must be provided" if request.nil?
603
+
604
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ContainerAnalysis::V1::ExportSBOMRequest
605
+
606
+ # Converts hash and nil to an options object
607
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
608
+
609
+ # Customize the options with defaults
610
+ call_metadata = @config.rpcs.export_sbom.metadata.to_h
611
+
612
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
613
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
614
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
615
+ gapic_version: ::Google::Cloud::ContainerAnalysis::V1::VERSION,
616
+ transports_version_send: [:rest]
617
+
618
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
619
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
620
+
621
+ options.apply_defaults timeout: @config.rpcs.export_sbom.timeout,
622
+ metadata: call_metadata,
623
+ retry_policy: @config.rpcs.export_sbom.retry_policy
624
+
625
+ options.apply_defaults timeout: @config.timeout,
626
+ metadata: @config.metadata,
627
+ retry_policy: @config.retry_policy
628
+
629
+ @container_analysis_stub.export_sbom request, options do |result, operation|
630
+ yield result, operation if block_given?
631
+ end
632
+ rescue ::Gapic::Rest::Error => e
633
+ raise ::Google::Cloud::Error.from_error(e)
634
+ end
635
+
636
+ ##
637
+ # Configuration class for the ContainerAnalysis REST API.
638
+ #
639
+ # This class represents the configuration for ContainerAnalysis REST,
640
+ # providing control over timeouts, retry behavior, logging, transport
641
+ # parameters, and other low-level controls. Certain parameters can also be
642
+ # applied individually to specific RPCs. See
643
+ # {::Google::Cloud::ContainerAnalysis::V1::ContainerAnalysis::Rest::Client::Configuration::Rpcs}
644
+ # for a list of RPCs that can be configured independently.
645
+ #
646
+ # Configuration can be applied globally to all clients, or to a single client
647
+ # on construction.
648
+ #
649
+ # @example
650
+ #
651
+ # # Modify the global config, setting the timeout for
652
+ # # set_iam_policy to 20 seconds,
653
+ # # and all remaining timeouts to 10 seconds.
654
+ # ::Google::Cloud::ContainerAnalysis::V1::ContainerAnalysis::Rest::Client.configure do |config|
655
+ # config.timeout = 10.0
656
+ # config.rpcs.set_iam_policy.timeout = 20.0
657
+ # end
658
+ #
659
+ # # Apply the above configuration only to a new client.
660
+ # client = ::Google::Cloud::ContainerAnalysis::V1::ContainerAnalysis::Rest::Client.new do |config|
661
+ # config.timeout = 10.0
662
+ # config.rpcs.set_iam_policy.timeout = 20.0
663
+ # end
664
+ #
665
+ # @!attribute [rw] endpoint
666
+ # A custom service endpoint, as a hostname or hostname:port. The default is
667
+ # nil, indicating to use the default endpoint in the current universe domain.
668
+ # @return [::String,nil]
669
+ # @!attribute [rw] credentials
670
+ # Credentials to send with calls. You may provide any of the following types:
671
+ # * (`String`) The path to a service account key file in JSON format
672
+ # * (`Hash`) A service account key as a Hash
673
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
674
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
675
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
676
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
677
+ # * (`nil`) indicating no credentials
678
+ #
679
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
680
+ # external source for authentication to Google Cloud, you must validate it before
681
+ # providing it to a Google API client library. Providing an unvalidated credential
682
+ # configuration to Google APIs can compromise the security of your systems and data.
683
+ # For more information, refer to [Validate credential configurations from external
684
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
685
+ # @return [::Object]
686
+ # @!attribute [rw] scope
687
+ # The OAuth scopes
688
+ # @return [::Array<::String>]
689
+ # @!attribute [rw] lib_name
690
+ # The library name as recorded in instrumentation and logging
691
+ # @return [::String]
692
+ # @!attribute [rw] lib_version
693
+ # The library version as recorded in instrumentation and logging
694
+ # @return [::String]
695
+ # @!attribute [rw] timeout
696
+ # The call timeout in seconds.
697
+ # @return [::Numeric]
698
+ # @!attribute [rw] metadata
699
+ # Additional headers to be sent with the call.
700
+ # @return [::Hash{::Symbol=>::String}]
701
+ # @!attribute [rw] retry_policy
702
+ # The retry policy. The value is a hash with the following keys:
703
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
704
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
705
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
706
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
707
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
708
+ # trigger a retry.
709
+ # @return [::Hash]
710
+ # @!attribute [rw] quota_project
711
+ # A separate project against which to charge quota.
712
+ # @return [::String]
713
+ # @!attribute [rw] universe_domain
714
+ # The universe domain within which to make requests. This determines the
715
+ # default endpoint URL. The default value of nil uses the environment
716
+ # universe (usually the default "googleapis.com" universe).
717
+ # @return [::String,nil]
718
+ # @!attribute [rw] logger
719
+ # A custom logger to use for request/response debug logging, or the value
720
+ # `:default` (the default) to construct a default logger, or `nil` to
721
+ # explicitly disable logging.
722
+ # @return [::Logger,:default,nil]
723
+ #
724
+ class Configuration
725
+ extend ::Gapic::Config
726
+
727
+ # @private
728
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
729
+ DEFAULT_ENDPOINT = "containeranalysis.googleapis.com"
730
+
731
+ config_attr :endpoint, nil, ::String, nil
732
+ config_attr :credentials, nil do |value|
733
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
734
+ allowed.any? { |klass| klass === value }
735
+ end
736
+ config_attr :scope, nil, ::String, ::Array, nil
737
+ config_attr :lib_name, nil, ::String, nil
738
+ config_attr :lib_version, nil, ::String, nil
739
+ config_attr :timeout, nil, ::Numeric, nil
740
+ config_attr :metadata, nil, ::Hash, nil
741
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
742
+ config_attr :quota_project, nil, ::String, nil
743
+ config_attr :universe_domain, nil, ::String, nil
744
+ config_attr :logger, :default, ::Logger, nil, :default
745
+
746
+ # @private
747
+ def initialize parent_config = nil
748
+ @parent_config = parent_config unless parent_config.nil?
749
+
750
+ yield self if block_given?
751
+ end
752
+
753
+ ##
754
+ # Configurations for individual RPCs
755
+ # @return [Rpcs]
756
+ #
757
+ def rpcs
758
+ @rpcs ||= begin
759
+ parent_rpcs = nil
760
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
761
+ Rpcs.new parent_rpcs
762
+ end
763
+ end
764
+
765
+ ##
766
+ # Configuration RPC class for the ContainerAnalysis API.
767
+ #
768
+ # Includes fields providing the configuration for each RPC in this service.
769
+ # Each configuration object is of type `Gapic::Config::Method` and includes
770
+ # the following configuration fields:
771
+ #
772
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
773
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
774
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
775
+ # include the following keys:
776
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
777
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
778
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
779
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
780
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
781
+ # trigger a retry.
782
+ #
783
+ class Rpcs
784
+ ##
785
+ # RPC-specific configuration for `set_iam_policy`
786
+ # @return [::Gapic::Config::Method]
787
+ #
788
+ attr_reader :set_iam_policy
789
+ ##
790
+ # RPC-specific configuration for `get_iam_policy`
791
+ # @return [::Gapic::Config::Method]
792
+ #
793
+ attr_reader :get_iam_policy
794
+ ##
795
+ # RPC-specific configuration for `test_iam_permissions`
796
+ # @return [::Gapic::Config::Method]
797
+ #
798
+ attr_reader :test_iam_permissions
799
+ ##
800
+ # RPC-specific configuration for `get_vulnerability_occurrences_summary`
801
+ # @return [::Gapic::Config::Method]
802
+ #
803
+ attr_reader :get_vulnerability_occurrences_summary
804
+ ##
805
+ # RPC-specific configuration for `export_sbom`
806
+ # @return [::Gapic::Config::Method]
807
+ #
808
+ attr_reader :export_sbom
809
+
810
+ # @private
811
+ def initialize parent_rpcs = nil
812
+ set_iam_policy_config = parent_rpcs.set_iam_policy if parent_rpcs.respond_to? :set_iam_policy
813
+ @set_iam_policy = ::Gapic::Config::Method.new set_iam_policy_config
814
+ get_iam_policy_config = parent_rpcs.get_iam_policy if parent_rpcs.respond_to? :get_iam_policy
815
+ @get_iam_policy = ::Gapic::Config::Method.new get_iam_policy_config
816
+ test_iam_permissions_config = parent_rpcs.test_iam_permissions if parent_rpcs.respond_to? :test_iam_permissions
817
+ @test_iam_permissions = ::Gapic::Config::Method.new test_iam_permissions_config
818
+ get_vulnerability_occurrences_summary_config = parent_rpcs.get_vulnerability_occurrences_summary if parent_rpcs.respond_to? :get_vulnerability_occurrences_summary
819
+ @get_vulnerability_occurrences_summary = ::Gapic::Config::Method.new get_vulnerability_occurrences_summary_config
820
+ export_sbom_config = parent_rpcs.export_sbom if parent_rpcs.respond_to? :export_sbom
821
+ @export_sbom = ::Gapic::Config::Method.new export_sbom_config
822
+
823
+ yield self if block_given?
824
+ end
825
+ end
826
+ end
827
+ end
828
+ end
829
+ end
830
+ end
831
+ end
832
+ end
833
+ end