google-cloud-container_analysis-v1 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 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
+ # This gem does not autoload during Bundler.require. To load this gem,
20
+ # issue explicit require statements for the packages desired, e.g.:
21
+ # require "google/cloud/container_analysis/v1"
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 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/container_analysis/v1/container_analysis"
20
+ require "google/cloud/container_analysis/v1/version"
21
+
22
+ module Google
23
+ module Cloud
24
+ module ContainerAnalysis
25
+ ##
26
+ # To load this package, including all its services, and instantiate a client:
27
+ #
28
+ # require "google/cloud/container_analysis/v1"
29
+ # client = ::Google::Cloud::ContainerAnalysis::V1::ContainerAnalysis::Client.new
30
+ #
31
+ module V1
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 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 "gapic/common"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/cloud/container_analysis/v1/version"
24
+
25
+ require "google/cloud/container_analysis/v1/container_analysis/credentials"
26
+ require "google/cloud/container_analysis/v1/container_analysis/client"
27
+
28
+ module Google
29
+ module Cloud
30
+ module ContainerAnalysis
31
+ module V1
32
+ ##
33
+ # Retrieves analysis results of Cloud components such as Docker container
34
+ # images. The Container Analysis API is an implementation of the
35
+ # [Grafeas](https://grafeas.io) API.
36
+ #
37
+ # Analysis results are stored as a series of occurrences. An `Occurrence`
38
+ # contains information about a specific analysis instance on a resource. An
39
+ # occurrence refers to a `Note`. A note contains details describing the
40
+ # analysis and is generally stored in a separate project, called a `Provider`.
41
+ # Multiple occurrences can refer to the same note.
42
+ #
43
+ # For example, an SSL vulnerability could affect multiple images. In this case,
44
+ # there would be one note for the vulnerability and an occurrence for each
45
+ # image with the vulnerability referring to that note.
46
+ #
47
+ # To load this service and instantiate a client:
48
+ #
49
+ # require "google/cloud/container_analysis/v1/container_analysis"
50
+ # client = ::Google::Cloud::ContainerAnalysis::V1::ContainerAnalysis::Client.new
51
+ #
52
+ module ContainerAnalysis
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
58
+
59
+ helper_path = ::File.join __dir__, "container_analysis", "helpers.rb"
60
+ require "google/cloud/container_analysis/v1/container_analysis/helpers" if ::File.file? helper_path
@@ -0,0 +1,567 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 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
+
22
+ module Google
23
+ module Cloud
24
+ module ContainerAnalysis
25
+ module V1
26
+ module ContainerAnalysis
27
+ ##
28
+ # Client for the ContainerAnalysis service.
29
+ #
30
+ # Retrieves analysis results of Cloud components such as Docker container
31
+ # images. The Container Analysis API is an implementation of the
32
+ # [Grafeas](https://grafeas.io) API.
33
+ #
34
+ # Analysis results are stored as a series of occurrences. An `Occurrence`
35
+ # contains information about a specific analysis instance on a resource. An
36
+ # occurrence refers to a `Note`. A note contains details describing the
37
+ # analysis and is generally stored in a separate project, called a `Provider`.
38
+ # Multiple occurrences can refer to the same note.
39
+ #
40
+ # For example, an SSL vulnerability could affect multiple images. In this case,
41
+ # there would be one note for the vulnerability and an occurrence for each
42
+ # image with the vulnerability referring to that note.
43
+ #
44
+ class Client
45
+ # @private
46
+ attr_reader :container_analysis_stub
47
+
48
+ ##
49
+ # Configure the ContainerAnalysis Client class.
50
+ #
51
+ # See {::Google::Cloud::ContainerAnalysis::V1::ContainerAnalysis::Client::Configuration}
52
+ # for a description of the configuration fields.
53
+ #
54
+ # ## Example
55
+ #
56
+ # To modify the configuration for all ContainerAnalysis clients:
57
+ #
58
+ # ::Google::Cloud::ContainerAnalysis::V1::ContainerAnalysis::Client.configure do |config|
59
+ # config.timeout = 10.0
60
+ # end
61
+ #
62
+ # @yield [config] Configure the Client client.
63
+ # @yieldparam config [Client::Configuration]
64
+ #
65
+ # @return [Client::Configuration]
66
+ #
67
+ def self.configure
68
+ @configure ||= begin
69
+ namespace = ["Google", "Cloud", "ContainerAnalysis", "V1"]
70
+ parent_config = while namespace.any?
71
+ parent_name = namespace.join "::"
72
+ parent_const = const_get parent_name
73
+ break parent_const.configure if parent_const&.respond_to? :configure
74
+ namespace.pop
75
+ end
76
+ default_config = Client::Configuration.new parent_config
77
+
78
+ default_config.rpcs.set_iam_policy.timeout = 30.0
79
+
80
+ default_config.rpcs.get_iam_policy.timeout = 30.0
81
+
82
+ default_config.rpcs.test_iam_permissions.timeout = 30.0
83
+
84
+ default_config
85
+ end
86
+ yield @configure if block_given?
87
+ @configure
88
+ end
89
+
90
+ ##
91
+ # Configure the ContainerAnalysis Client instance.
92
+ #
93
+ # The configuration is set to the derived mode, meaning that values can be changed,
94
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
95
+ # should be made on {Client.configure}.
96
+ #
97
+ # See {::Google::Cloud::ContainerAnalysis::V1::ContainerAnalysis::Client::Configuration}
98
+ # for a description of the configuration fields.
99
+ #
100
+ # @yield [config] Configure the Client client.
101
+ # @yieldparam config [Client::Configuration]
102
+ #
103
+ # @return [Client::Configuration]
104
+ #
105
+ def configure
106
+ yield @config if block_given?
107
+ @config
108
+ end
109
+
110
+ ##
111
+ # Create a new ContainerAnalysis client object.
112
+ #
113
+ # ## Examples
114
+ #
115
+ # To create a new ContainerAnalysis client with the default
116
+ # configuration:
117
+ #
118
+ # client = ::Google::Cloud::ContainerAnalysis::V1::ContainerAnalysis::Client.new
119
+ #
120
+ # To create a new ContainerAnalysis client with a custom
121
+ # configuration:
122
+ #
123
+ # client = ::Google::Cloud::ContainerAnalysis::V1::ContainerAnalysis::Client.new do |config|
124
+ # config.timeout = 10.0
125
+ # end
126
+ #
127
+ # @yield [config] Configure the ContainerAnalysis client.
128
+ # @yieldparam config [Client::Configuration]
129
+ #
130
+ def initialize
131
+ # These require statements are intentionally placed here to initialize
132
+ # the gRPC module only when it's required.
133
+ # See https://github.com/googleapis/toolkit/issues/446
134
+ require "gapic/grpc"
135
+ require "google/devtools/containeranalysis/v1/containeranalysis_services_pb"
136
+
137
+ # Create the configuration object
138
+ @config = Configuration.new Client.configure
139
+
140
+ # Yield the configuration if needed
141
+ yield @config if block_given?
142
+
143
+ # Create credentials
144
+ credentials = @config.credentials
145
+ credentials ||= Credentials.default scope: @config.scope
146
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
147
+ credentials = Credentials.new credentials, scope: @config.scope
148
+ end
149
+ @quota_project_id = @config.quota_project
150
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
151
+
152
+ @container_analysis_stub = ::Gapic::ServiceStub.new(
153
+ ::Google::Cloud::ContainerAnalysis::V1::ContainerAnalysis::Stub,
154
+ credentials: credentials,
155
+ endpoint: @config.endpoint,
156
+ channel_args: @config.channel_args,
157
+ interceptors: @config.interceptors
158
+ )
159
+ end
160
+
161
+ # Service calls
162
+
163
+ ##
164
+ # Sets the access control policy on the specified note or occurrence.
165
+ # Requires `containeranalysis.notes.setIamPolicy` or
166
+ # `containeranalysis.occurrences.setIamPolicy` permission if the resource is
167
+ # a note or an occurrence, respectively.
168
+ #
169
+ # The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for
170
+ # notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for
171
+ # occurrences.
172
+ #
173
+ # @overload set_iam_policy(request, options = nil)
174
+ # Pass arguments to `set_iam_policy` via a request object, either of type
175
+ # {::Google::Iam::V1::SetIamPolicyRequest} or an equivalent Hash.
176
+ #
177
+ # @param request [::Google::Iam::V1::SetIamPolicyRequest, ::Hash]
178
+ # A request object representing the call parameters. Required. To specify no
179
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
180
+ # @param options [::Gapic::CallOptions, ::Hash]
181
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
182
+ #
183
+ # @overload set_iam_policy(resource: nil, policy: nil)
184
+ # Pass arguments to `set_iam_policy` via keyword arguments. Note that at
185
+ # least one keyword argument is required. To specify no parameters, or to keep all
186
+ # the default parameter values, pass an empty Hash as a request object (see above).
187
+ #
188
+ # @param resource [::String]
189
+ # REQUIRED: The resource for which the policy is being specified.
190
+ # See the operation documentation for the appropriate value for this field.
191
+ # @param policy [::Google::Iam::V1::Policy, ::Hash]
192
+ # REQUIRED: The complete policy to be applied to the `resource`. The size of
193
+ # the policy is limited to a few 10s of KB. An empty policy is a
194
+ # valid policy but certain Cloud Platform services (such as Projects)
195
+ # might reject them.
196
+ #
197
+ # @yield [response, operation] Access the result along with the RPC operation
198
+ # @yieldparam response [::Google::Iam::V1::Policy]
199
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
200
+ #
201
+ # @return [::Google::Iam::V1::Policy]
202
+ #
203
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
204
+ #
205
+ def set_iam_policy request, options = nil
206
+ raise ::ArgumentError, "request must be provided" if request.nil?
207
+
208
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::SetIamPolicyRequest
209
+
210
+ # Converts hash and nil to an options object
211
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
212
+
213
+ # Customize the options with defaults
214
+ metadata = @config.rpcs.set_iam_policy.metadata.to_h
215
+
216
+ # Set x-goog-api-client and x-goog-user-project headers
217
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
218
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
219
+ gapic_version: ::Google::Cloud::ContainerAnalysis::V1::VERSION
220
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
221
+
222
+ header_params = {
223
+ "resource" => request.resource
224
+ }
225
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
226
+ metadata[:"x-goog-request-params"] ||= request_params_header
227
+
228
+ options.apply_defaults timeout: @config.rpcs.set_iam_policy.timeout,
229
+ metadata: metadata,
230
+ retry_policy: @config.rpcs.set_iam_policy.retry_policy
231
+ options.apply_defaults metadata: @config.metadata,
232
+ retry_policy: @config.retry_policy
233
+
234
+ @container_analysis_stub.call_rpc :set_iam_policy, request, options: options do |response, operation|
235
+ yield response, operation if block_given?
236
+ return response
237
+ end
238
+ rescue ::GRPC::BadStatus => e
239
+ raise ::Google::Cloud::Error.from_error(e)
240
+ end
241
+
242
+ ##
243
+ # Gets the access control policy for a note or an occurrence resource.
244
+ # Requires `containeranalysis.notes.setIamPolicy` or
245
+ # `containeranalysis.occurrences.setIamPolicy` permission if the resource is
246
+ # a note or occurrence, respectively.
247
+ #
248
+ # The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for
249
+ # notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for
250
+ # occurrences.
251
+ #
252
+ # @overload get_iam_policy(request, options = nil)
253
+ # Pass arguments to `get_iam_policy` via a request object, either of type
254
+ # {::Google::Iam::V1::GetIamPolicyRequest} or an equivalent Hash.
255
+ #
256
+ # @param request [::Google::Iam::V1::GetIamPolicyRequest, ::Hash]
257
+ # A request object representing the call parameters. Required. To specify no
258
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
259
+ # @param options [::Gapic::CallOptions, ::Hash]
260
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
261
+ #
262
+ # @overload get_iam_policy(resource: nil, options: nil)
263
+ # Pass arguments to `get_iam_policy` via keyword arguments. Note that at
264
+ # least one keyword argument is required. To specify no parameters, or to keep all
265
+ # the default parameter values, pass an empty Hash as a request object (see above).
266
+ #
267
+ # @param resource [::String]
268
+ # REQUIRED: The resource for which the policy is being requested.
269
+ # See the operation documentation for the appropriate value for this field.
270
+ # @param options [::Google::Iam::V1::GetPolicyOptions, ::Hash]
271
+ # OPTIONAL: A `GetPolicyOptions` object for specifying options to
272
+ # `GetIamPolicy`. This field is only used by Cloud IAM.
273
+ #
274
+ # @yield [response, operation] Access the result along with the RPC operation
275
+ # @yieldparam response [::Google::Iam::V1::Policy]
276
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
277
+ #
278
+ # @return [::Google::Iam::V1::Policy]
279
+ #
280
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
281
+ #
282
+ def get_iam_policy request, options = nil
283
+ raise ::ArgumentError, "request must be provided" if request.nil?
284
+
285
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::GetIamPolicyRequest
286
+
287
+ # Converts hash and nil to an options object
288
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
289
+
290
+ # Customize the options with defaults
291
+ metadata = @config.rpcs.get_iam_policy.metadata.to_h
292
+
293
+ # Set x-goog-api-client and x-goog-user-project headers
294
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
295
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
296
+ gapic_version: ::Google::Cloud::ContainerAnalysis::V1::VERSION
297
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
298
+
299
+ header_params = {
300
+ "resource" => request.resource
301
+ }
302
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
303
+ metadata[:"x-goog-request-params"] ||= request_params_header
304
+
305
+ options.apply_defaults timeout: @config.rpcs.get_iam_policy.timeout,
306
+ metadata: metadata,
307
+ retry_policy: @config.rpcs.get_iam_policy.retry_policy
308
+ options.apply_defaults metadata: @config.metadata,
309
+ retry_policy: @config.retry_policy
310
+
311
+ @container_analysis_stub.call_rpc :get_iam_policy, request, options: options do |response, operation|
312
+ yield response, operation if block_given?
313
+ return response
314
+ end
315
+ rescue ::GRPC::BadStatus => e
316
+ raise ::Google::Cloud::Error.from_error(e)
317
+ end
318
+
319
+ ##
320
+ # Returns the permissions that a caller has on the specified note or
321
+ # occurrence. Requires list permission on the project (for example,
322
+ # `containeranalysis.notes.list`).
323
+ #
324
+ # The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for
325
+ # notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for
326
+ # occurrences.
327
+ #
328
+ # @overload test_iam_permissions(request, options = nil)
329
+ # Pass arguments to `test_iam_permissions` via a request object, either of type
330
+ # {::Google::Iam::V1::TestIamPermissionsRequest} or an equivalent Hash.
331
+ #
332
+ # @param request [::Google::Iam::V1::TestIamPermissionsRequest, ::Hash]
333
+ # A request object representing the call parameters. Required. To specify no
334
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
335
+ # @param options [::Gapic::CallOptions, ::Hash]
336
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
337
+ #
338
+ # @overload test_iam_permissions(resource: nil, permissions: nil)
339
+ # Pass arguments to `test_iam_permissions` via keyword arguments. Note that at
340
+ # least one keyword argument is required. To specify no parameters, or to keep all
341
+ # the default parameter values, pass an empty Hash as a request object (see above).
342
+ #
343
+ # @param resource [::String]
344
+ # REQUIRED: The resource for which the policy detail is being requested.
345
+ # See the operation documentation for the appropriate value for this field.
346
+ # @param permissions [::Array<::String>]
347
+ # The set of permissions to check for the `resource`. Permissions with
348
+ # wildcards (such as '*' or 'storage.*') are not allowed. For more
349
+ # information see
350
+ # [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
351
+ #
352
+ # @yield [response, operation] Access the result along with the RPC operation
353
+ # @yieldparam response [::Google::Iam::V1::TestIamPermissionsResponse]
354
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
355
+ #
356
+ # @return [::Google::Iam::V1::TestIamPermissionsResponse]
357
+ #
358
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
359
+ #
360
+ def test_iam_permissions request, options = nil
361
+ raise ::ArgumentError, "request must be provided" if request.nil?
362
+
363
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::TestIamPermissionsRequest
364
+
365
+ # Converts hash and nil to an options object
366
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
367
+
368
+ # Customize the options with defaults
369
+ metadata = @config.rpcs.test_iam_permissions.metadata.to_h
370
+
371
+ # Set x-goog-api-client and x-goog-user-project headers
372
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
373
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
374
+ gapic_version: ::Google::Cloud::ContainerAnalysis::V1::VERSION
375
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
376
+
377
+ header_params = {
378
+ "resource" => request.resource
379
+ }
380
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
381
+ metadata[:"x-goog-request-params"] ||= request_params_header
382
+
383
+ options.apply_defaults timeout: @config.rpcs.test_iam_permissions.timeout,
384
+ metadata: metadata,
385
+ retry_policy: @config.rpcs.test_iam_permissions.retry_policy
386
+ options.apply_defaults metadata: @config.metadata,
387
+ retry_policy: @config.retry_policy
388
+
389
+ @container_analysis_stub.call_rpc :test_iam_permissions, request, options: options do |response, operation|
390
+ yield response, operation if block_given?
391
+ return response
392
+ end
393
+ rescue ::GRPC::BadStatus => e
394
+ raise ::Google::Cloud::Error.from_error(e)
395
+ end
396
+
397
+ ##
398
+ # Configuration class for the ContainerAnalysis API.
399
+ #
400
+ # This class represents the configuration for ContainerAnalysis,
401
+ # providing control over timeouts, retry behavior, logging, transport
402
+ # parameters, and other low-level controls. Certain parameters can also be
403
+ # applied individually to specific RPCs. See
404
+ # {::Google::Cloud::ContainerAnalysis::V1::ContainerAnalysis::Client::Configuration::Rpcs}
405
+ # for a list of RPCs that can be configured independently.
406
+ #
407
+ # Configuration can be applied globally to all clients, or to a single client
408
+ # on construction.
409
+ #
410
+ # # Examples
411
+ #
412
+ # To modify the global config, setting the timeout for set_iam_policy
413
+ # to 20 seconds, and all remaining timeouts to 10 seconds:
414
+ #
415
+ # ::Google::Cloud::ContainerAnalysis::V1::ContainerAnalysis::Client.configure do |config|
416
+ # config.timeout = 10.0
417
+ # config.rpcs.set_iam_policy.timeout = 20.0
418
+ # end
419
+ #
420
+ # To apply the above configuration only to a new client:
421
+ #
422
+ # client = ::Google::Cloud::ContainerAnalysis::V1::ContainerAnalysis::Client.new do |config|
423
+ # config.timeout = 10.0
424
+ # config.rpcs.set_iam_policy.timeout = 20.0
425
+ # end
426
+ #
427
+ # @!attribute [rw] endpoint
428
+ # The hostname or hostname:port of the service endpoint.
429
+ # Defaults to `"containeranalysis.googleapis.com"`.
430
+ # @return [::String]
431
+ # @!attribute [rw] credentials
432
+ # Credentials to send with calls. You may provide any of the following types:
433
+ # * (`String`) The path to a service account key file in JSON format
434
+ # * (`Hash`) A service account key as a Hash
435
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
436
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
437
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
438
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
439
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
440
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
441
+ # * (`nil`) indicating no credentials
442
+ # @return [::Object]
443
+ # @!attribute [rw] scope
444
+ # The OAuth scopes
445
+ # @return [::Array<::String>]
446
+ # @!attribute [rw] lib_name
447
+ # The library name as recorded in instrumentation and logging
448
+ # @return [::String]
449
+ # @!attribute [rw] lib_version
450
+ # The library version as recorded in instrumentation and logging
451
+ # @return [::String]
452
+ # @!attribute [rw] channel_args
453
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
454
+ # `GRPC::Core::Channel` object is provided as the credential.
455
+ # @return [::Hash]
456
+ # @!attribute [rw] interceptors
457
+ # An array of interceptors that are run before calls are executed.
458
+ # @return [::Array<::GRPC::ClientInterceptor>]
459
+ # @!attribute [rw] timeout
460
+ # The call timeout in seconds.
461
+ # @return [::Numeric]
462
+ # @!attribute [rw] metadata
463
+ # Additional gRPC headers to be sent with the call.
464
+ # @return [::Hash{::Symbol=>::String}]
465
+ # @!attribute [rw] retry_policy
466
+ # The retry policy. The value is a hash with the following keys:
467
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
468
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
469
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
470
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
471
+ # trigger a retry.
472
+ # @return [::Hash]
473
+ # @!attribute [rw] quota_project
474
+ # A separate project against which to charge quota.
475
+ # @return [::String]
476
+ #
477
+ class Configuration
478
+ extend ::Gapic::Config
479
+
480
+ config_attr :endpoint, "containeranalysis.googleapis.com", ::String
481
+ config_attr :credentials, nil do |value|
482
+ allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
483
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
484
+ allowed.any? { |klass| klass === value }
485
+ end
486
+ config_attr :scope, nil, ::String, ::Array, nil
487
+ config_attr :lib_name, nil, ::String, nil
488
+ config_attr :lib_version, nil, ::String, nil
489
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
490
+ config_attr :interceptors, nil, ::Array, nil
491
+ config_attr :timeout, nil, ::Numeric, nil
492
+ config_attr :metadata, nil, ::Hash, nil
493
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
494
+ config_attr :quota_project, nil, ::String, nil
495
+
496
+ # @private
497
+ def initialize parent_config = nil
498
+ @parent_config = parent_config unless parent_config.nil?
499
+
500
+ yield self if block_given?
501
+ end
502
+
503
+ ##
504
+ # Configurations for individual RPCs
505
+ # @return [Rpcs]
506
+ #
507
+ def rpcs
508
+ @rpcs ||= begin
509
+ parent_rpcs = nil
510
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
511
+ Rpcs.new parent_rpcs
512
+ end
513
+ end
514
+
515
+ ##
516
+ # Configuration RPC class for the ContainerAnalysis API.
517
+ #
518
+ # Includes fields providing the configuration for each RPC in this service.
519
+ # Each configuration object is of type `Gapic::Config::Method` and includes
520
+ # the following configuration fields:
521
+ #
522
+ # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
523
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
524
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
525
+ # include the following keys:
526
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
527
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
528
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
529
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
530
+ # trigger a retry.
531
+ #
532
+ class Rpcs
533
+ ##
534
+ # RPC-specific configuration for `set_iam_policy`
535
+ # @return [::Gapic::Config::Method]
536
+ #
537
+ attr_reader :set_iam_policy
538
+ ##
539
+ # RPC-specific configuration for `get_iam_policy`
540
+ # @return [::Gapic::Config::Method]
541
+ #
542
+ attr_reader :get_iam_policy
543
+ ##
544
+ # RPC-specific configuration for `test_iam_permissions`
545
+ # @return [::Gapic::Config::Method]
546
+ #
547
+ attr_reader :test_iam_permissions
548
+
549
+ # @private
550
+ def initialize parent_rpcs = nil
551
+ set_iam_policy_config = parent_rpcs&.set_iam_policy if parent_rpcs&.respond_to? :set_iam_policy
552
+ @set_iam_policy = ::Gapic::Config::Method.new set_iam_policy_config
553
+ get_iam_policy_config = parent_rpcs&.get_iam_policy if parent_rpcs&.respond_to? :get_iam_policy
554
+ @get_iam_policy = ::Gapic::Config::Method.new get_iam_policy_config
555
+ test_iam_permissions_config = parent_rpcs&.test_iam_permissions if parent_rpcs&.respond_to? :test_iam_permissions
556
+ @test_iam_permissions = ::Gapic::Config::Method.new test_iam_permissions_config
557
+
558
+ yield self if block_given?
559
+ end
560
+ end
561
+ end
562
+ end
563
+ end
564
+ end
565
+ end
566
+ end
567
+ end