google-cloud-storage-control-v2 1.4.0 → 1.6.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,694 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2025 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/iam/v1/iam_policy_pb"
21
+
22
+ module Google
23
+ module Iam
24
+ module V1
25
+ module IAMPolicy
26
+ ##
27
+ # Client for the IAMPolicy service.
28
+ #
29
+ # API Overview
30
+ #
31
+ # Manages Identity and Access Management (IAM) policies.
32
+ #
33
+ # Any implementation of an API that offers access control features
34
+ # implements the google.iam.v1.IAMPolicy interface.
35
+ #
36
+ # ## Data model
37
+ #
38
+ # Access control is applied when a principal (user or service account), takes
39
+ # some action on a resource exposed by a service. Resources, identified by
40
+ # URI-like names, are the unit of access control specification. Service
41
+ # implementations can choose the granularity of access control and the
42
+ # supported permissions for their resources.
43
+ # For example one database service may allow access control to be
44
+ # specified only at the Table level, whereas another might allow access control
45
+ # to also be specified at the Column level.
46
+ #
47
+ # ## Policy Structure
48
+ #
49
+ # See google.iam.v1.Policy
50
+ #
51
+ # This is intentionally not a CRUD style API because access control policies
52
+ # are created and deleted implicitly with the resources to which they are
53
+ # attached.
54
+ #
55
+ class Client
56
+ # @private
57
+ API_VERSION = ""
58
+
59
+ # @private
60
+ DEFAULT_ENDPOINT_TEMPLATE = "iam-meta-api.$UNIVERSE_DOMAIN$"
61
+
62
+ # @private
63
+ attr_reader :iam_policy_stub
64
+
65
+ ##
66
+ # Configure the IAMPolicy Client class.
67
+ #
68
+ # See {::Google::Iam::V1::IAMPolicy::Client::Configuration}
69
+ # for a description of the configuration fields.
70
+ #
71
+ # @example
72
+ #
73
+ # # Modify the configuration for all IAMPolicy clients
74
+ # ::Google::Iam::V1::IAMPolicy::Client.configure do |config|
75
+ # config.timeout = 10.0
76
+ # end
77
+ #
78
+ # @yield [config] Configure the Client client.
79
+ # @yieldparam config [Client::Configuration]
80
+ #
81
+ # @return [Client::Configuration]
82
+ #
83
+ def self.configure
84
+ @configure ||= begin
85
+ namespace = ["Google", "Iam", "V1"]
86
+ parent_config = while namespace.any?
87
+ parent_name = namespace.join "::"
88
+ parent_const = const_get parent_name
89
+ break parent_const.configure if parent_const.respond_to? :configure
90
+ namespace.pop
91
+ end
92
+ default_config = Client::Configuration.new parent_config
93
+
94
+ default_config
95
+ end
96
+ yield @configure if block_given?
97
+ @configure
98
+ end
99
+
100
+ ##
101
+ # Configure the IAMPolicy Client instance.
102
+ #
103
+ # The configuration is set to the derived mode, meaning that values can be changed,
104
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
105
+ # should be made on {Client.configure}.
106
+ #
107
+ # See {::Google::Iam::V1::IAMPolicy::Client::Configuration}
108
+ # for a description of the configuration fields.
109
+ #
110
+ # @yield [config] Configure the Client client.
111
+ # @yieldparam config [Client::Configuration]
112
+ #
113
+ # @return [Client::Configuration]
114
+ #
115
+ def configure
116
+ yield @config if block_given?
117
+ @config
118
+ end
119
+
120
+ ##
121
+ # The effective universe domain
122
+ #
123
+ # @return [String]
124
+ #
125
+ def universe_domain
126
+ @iam_policy_stub.universe_domain
127
+ end
128
+
129
+ ##
130
+ # Create a new IAMPolicy client object.
131
+ #
132
+ # @example
133
+ #
134
+ # # Create a client using the default configuration
135
+ # client = ::Google::Iam::V1::IAMPolicy::Client.new
136
+ #
137
+ # # Create a client using a custom configuration
138
+ # client = ::Google::Iam::V1::IAMPolicy::Client.new do |config|
139
+ # config.timeout = 10.0
140
+ # end
141
+ #
142
+ # @yield [config] Configure the IAMPolicy client.
143
+ # @yieldparam config [Client::Configuration]
144
+ #
145
+ def initialize
146
+ # These require statements are intentionally placed here to initialize
147
+ # the gRPC module only when it's required.
148
+ # See https://github.com/googleapis/toolkit/issues/446
149
+ require "gapic/grpc"
150
+ require "google/iam/v1/iam_policy_services_pb"
151
+
152
+ # Create the configuration object
153
+ @config = Configuration.new Client.configure
154
+
155
+ # Yield the configuration if needed
156
+ yield @config if block_given?
157
+
158
+ # Create credentials
159
+ credentials = @config.credentials
160
+ # Use self-signed JWT if the endpoint is unchanged from default,
161
+ # but only if the default endpoint does not have a region prefix.
162
+ enable_self_signed_jwt = @config.endpoint.nil? ||
163
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
164
+ !@config.endpoint.split(".").first.include?("-"))
165
+ credentials ||= Credentials.default scope: @config.scope,
166
+ enable_self_signed_jwt: enable_self_signed_jwt
167
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
168
+ credentials = Credentials.new credentials, scope: @config.scope
169
+ end
170
+ @quota_project_id = @config.quota_project
171
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
172
+
173
+ @iam_policy_stub = ::Gapic::ServiceStub.new(
174
+ ::Google::Iam::V1::IAMPolicy::Stub,
175
+ credentials: credentials,
176
+ endpoint: @config.endpoint,
177
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
178
+ universe_domain: @config.universe_domain,
179
+ channel_args: @config.channel_args,
180
+ interceptors: @config.interceptors,
181
+ channel_pool_config: @config.channel_pool,
182
+ logger: @config.logger
183
+ )
184
+
185
+ @iam_policy_stub.stub_logger&.info do |entry|
186
+ entry.set_system_name
187
+ entry.set_service
188
+ entry.message = "Created client for #{entry.service}"
189
+ entry.set_credentials_fields credentials
190
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
191
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
192
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
193
+ end
194
+ end
195
+
196
+ ##
197
+ # The logger used for request/response debug logging.
198
+ #
199
+ # @return [Logger]
200
+ #
201
+ def logger
202
+ @iam_policy_stub.logger
203
+ end
204
+
205
+ # Service calls
206
+
207
+ ##
208
+ # Sets the access control policy on the specified resource. Replaces any
209
+ # existing policy.
210
+ #
211
+ # Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
212
+ #
213
+ # @overload set_iam_policy(request, options = nil)
214
+ # Pass arguments to `set_iam_policy` via a request object, either of type
215
+ # {::Google::Iam::V1::SetIamPolicyRequest} or an equivalent Hash.
216
+ #
217
+ # @param request [::Google::Iam::V1::SetIamPolicyRequest, ::Hash]
218
+ # A request object representing the call parameters. Required. To specify no
219
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
220
+ # @param options [::Gapic::CallOptions, ::Hash]
221
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
222
+ #
223
+ # @overload set_iam_policy(resource: nil, policy: nil, update_mask: nil)
224
+ # Pass arguments to `set_iam_policy` via keyword arguments. Note that at
225
+ # least one keyword argument is required. To specify no parameters, or to keep all
226
+ # the default parameter values, pass an empty Hash as a request object (see above).
227
+ #
228
+ # @param resource [::String]
229
+ # REQUIRED: The resource for which the policy is being specified.
230
+ # See the operation documentation for the appropriate value for this field.
231
+ # @param policy [::Google::Iam::V1::Policy, ::Hash]
232
+ # REQUIRED: The complete policy to be applied to the `resource`. The size of
233
+ # the policy is limited to a few 10s of KB. An empty policy is a
234
+ # valid policy but certain Cloud Platform services (such as Projects)
235
+ # might reject them.
236
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
237
+ # OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only
238
+ # the fields in the mask will be modified. If no mask is provided, the
239
+ # following default mask is used:
240
+ #
241
+ # `paths: "bindings, etag"`
242
+ #
243
+ # @yield [response, operation] Access the result along with the RPC operation
244
+ # @yieldparam response [::Google::Iam::V1::Policy]
245
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
246
+ #
247
+ # @return [::Google::Iam::V1::Policy]
248
+ #
249
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
250
+ #
251
+ # @example Basic example
252
+ # require "google/iam/v1"
253
+ #
254
+ # # Create a client object. The client can be reused for multiple calls.
255
+ # client = Google::Iam::V1::IAMPolicy::Client.new
256
+ #
257
+ # # Create a request. To set request fields, pass in keyword arguments.
258
+ # request = Google::Iam::V1::SetIamPolicyRequest.new
259
+ #
260
+ # # Call the set_iam_policy method.
261
+ # result = client.set_iam_policy request
262
+ #
263
+ # # The returned object is of type Google::Iam::V1::Policy.
264
+ # p result
265
+ #
266
+ def set_iam_policy request, options = nil
267
+ raise ::ArgumentError, "request must be provided" if request.nil?
268
+
269
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::SetIamPolicyRequest
270
+
271
+ # Converts hash and nil to an options object
272
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
273
+
274
+ # Customize the options with defaults
275
+ metadata = @config.rpcs.set_iam_policy.metadata.to_h
276
+
277
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
278
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
279
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
280
+ gapic_version: ::Google::Cloud::Storage::Control::V2::VERSION
281
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
282
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
283
+
284
+ header_params = {}
285
+ if request.resource
286
+ header_params["resource"] = request.resource
287
+ end
288
+
289
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
290
+ metadata[:"x-goog-request-params"] ||= request_params_header
291
+
292
+ options.apply_defaults timeout: @config.rpcs.set_iam_policy.timeout,
293
+ metadata: metadata,
294
+ retry_policy: @config.rpcs.set_iam_policy.retry_policy
295
+
296
+ options.apply_defaults timeout: @config.timeout,
297
+ metadata: @config.metadata,
298
+ retry_policy: @config.retry_policy
299
+
300
+ @iam_policy_stub.call_rpc :set_iam_policy, request, options: options do |response, operation|
301
+ yield response, operation if block_given?
302
+ end
303
+ rescue ::GRPC::BadStatus => e
304
+ raise ::Google::Cloud::Error.from_error(e)
305
+ end
306
+
307
+ ##
308
+ # Gets the access control policy for a resource.
309
+ # Returns an empty policy if the resource exists and does not have a policy
310
+ # set.
311
+ #
312
+ # @overload get_iam_policy(request, options = nil)
313
+ # Pass arguments to `get_iam_policy` via a request object, either of type
314
+ # {::Google::Iam::V1::GetIamPolicyRequest} or an equivalent Hash.
315
+ #
316
+ # @param request [::Google::Iam::V1::GetIamPolicyRequest, ::Hash]
317
+ # A request object representing the call parameters. Required. To specify no
318
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
319
+ # @param options [::Gapic::CallOptions, ::Hash]
320
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
321
+ #
322
+ # @overload get_iam_policy(resource: nil, options: nil)
323
+ # Pass arguments to `get_iam_policy` via keyword arguments. Note that at
324
+ # least one keyword argument is required. To specify no parameters, or to keep all
325
+ # the default parameter values, pass an empty Hash as a request object (see above).
326
+ #
327
+ # @param resource [::String]
328
+ # REQUIRED: The resource for which the policy is being requested.
329
+ # See the operation documentation for the appropriate value for this field.
330
+ # @param options [::Google::Iam::V1::GetPolicyOptions, ::Hash]
331
+ # OPTIONAL: A `GetPolicyOptions` object for specifying options to
332
+ # `GetIamPolicy`.
333
+ #
334
+ # @yield [response, operation] Access the result along with the RPC operation
335
+ # @yieldparam response [::Google::Iam::V1::Policy]
336
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
337
+ #
338
+ # @return [::Google::Iam::V1::Policy]
339
+ #
340
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
341
+ #
342
+ # @example Basic example
343
+ # require "google/iam/v1"
344
+ #
345
+ # # Create a client object. The client can be reused for multiple calls.
346
+ # client = Google::Iam::V1::IAMPolicy::Client.new
347
+ #
348
+ # # Create a request. To set request fields, pass in keyword arguments.
349
+ # request = Google::Iam::V1::GetIamPolicyRequest.new
350
+ #
351
+ # # Call the get_iam_policy method.
352
+ # result = client.get_iam_policy request
353
+ #
354
+ # # The returned object is of type Google::Iam::V1::Policy.
355
+ # p result
356
+ #
357
+ def get_iam_policy request, options = nil
358
+ raise ::ArgumentError, "request must be provided" if request.nil?
359
+
360
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::GetIamPolicyRequest
361
+
362
+ # Converts hash and nil to an options object
363
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
364
+
365
+ # Customize the options with defaults
366
+ metadata = @config.rpcs.get_iam_policy.metadata.to_h
367
+
368
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
369
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
370
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
371
+ gapic_version: ::Google::Cloud::Storage::Control::V2::VERSION
372
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
373
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
374
+
375
+ header_params = {}
376
+ if request.resource
377
+ header_params["resource"] = request.resource
378
+ end
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.get_iam_policy.timeout,
384
+ metadata: metadata,
385
+ retry_policy: @config.rpcs.get_iam_policy.retry_policy
386
+
387
+ options.apply_defaults timeout: @config.timeout,
388
+ metadata: @config.metadata,
389
+ retry_policy: @config.retry_policy
390
+
391
+ @iam_policy_stub.call_rpc :get_iam_policy, request, options: options do |response, operation|
392
+ yield response, operation if block_given?
393
+ end
394
+ rescue ::GRPC::BadStatus => e
395
+ raise ::Google::Cloud::Error.from_error(e)
396
+ end
397
+
398
+ ##
399
+ # Returns permissions that a caller has on the specified resource.
400
+ # If the resource does not exist, this will return an empty set of
401
+ # permissions, not a `NOT_FOUND` error.
402
+ #
403
+ # Note: This operation is designed to be used for building permission-aware
404
+ # UIs and command-line tools, not for authorization checking. This operation
405
+ # may "fail open" without warning.
406
+ #
407
+ # @overload test_iam_permissions(request, options = nil)
408
+ # Pass arguments to `test_iam_permissions` via a request object, either of type
409
+ # {::Google::Iam::V1::TestIamPermissionsRequest} or an equivalent Hash.
410
+ #
411
+ # @param request [::Google::Iam::V1::TestIamPermissionsRequest, ::Hash]
412
+ # A request object representing the call parameters. Required. To specify no
413
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
414
+ # @param options [::Gapic::CallOptions, ::Hash]
415
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
416
+ #
417
+ # @overload test_iam_permissions(resource: nil, permissions: nil)
418
+ # Pass arguments to `test_iam_permissions` via keyword arguments. Note that at
419
+ # least one keyword argument is required. To specify no parameters, or to keep all
420
+ # the default parameter values, pass an empty Hash as a request object (see above).
421
+ #
422
+ # @param resource [::String]
423
+ # REQUIRED: The resource for which the policy detail is being requested.
424
+ # See the operation documentation for the appropriate value for this field.
425
+ # @param permissions [::Array<::String>]
426
+ # The set of permissions to check for the `resource`. Permissions with
427
+ # wildcards (such as '*' or 'storage.*') are not allowed. For more
428
+ # information see
429
+ # [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
430
+ #
431
+ # @yield [response, operation] Access the result along with the RPC operation
432
+ # @yieldparam response [::Google::Iam::V1::TestIamPermissionsResponse]
433
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
434
+ #
435
+ # @return [::Google::Iam::V1::TestIamPermissionsResponse]
436
+ #
437
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
438
+ #
439
+ # @example Basic example
440
+ # require "google/iam/v1"
441
+ #
442
+ # # Create a client object. The client can be reused for multiple calls.
443
+ # client = Google::Iam::V1::IAMPolicy::Client.new
444
+ #
445
+ # # Create a request. To set request fields, pass in keyword arguments.
446
+ # request = Google::Iam::V1::TestIamPermissionsRequest.new
447
+ #
448
+ # # Call the test_iam_permissions method.
449
+ # result = client.test_iam_permissions request
450
+ #
451
+ # # The returned object is of type Google::Iam::V1::TestIamPermissionsResponse.
452
+ # p result
453
+ #
454
+ def test_iam_permissions request, options = nil
455
+ raise ::ArgumentError, "request must be provided" if request.nil?
456
+
457
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::TestIamPermissionsRequest
458
+
459
+ # Converts hash and nil to an options object
460
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
461
+
462
+ # Customize the options with defaults
463
+ metadata = @config.rpcs.test_iam_permissions.metadata.to_h
464
+
465
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
466
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
467
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
468
+ gapic_version: ::Google::Cloud::Storage::Control::V2::VERSION
469
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
470
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
471
+
472
+ header_params = {}
473
+ if request.resource
474
+ header_params["resource"] = request.resource
475
+ end
476
+
477
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
478
+ metadata[:"x-goog-request-params"] ||= request_params_header
479
+
480
+ options.apply_defaults timeout: @config.rpcs.test_iam_permissions.timeout,
481
+ metadata: metadata,
482
+ retry_policy: @config.rpcs.test_iam_permissions.retry_policy
483
+
484
+ options.apply_defaults timeout: @config.timeout,
485
+ metadata: @config.metadata,
486
+ retry_policy: @config.retry_policy
487
+
488
+ @iam_policy_stub.call_rpc :test_iam_permissions, request, options: options do |response, operation|
489
+ yield response, operation if block_given?
490
+ end
491
+ rescue ::GRPC::BadStatus => e
492
+ raise ::Google::Cloud::Error.from_error(e)
493
+ end
494
+
495
+ ##
496
+ # Configuration class for the IAMPolicy API.
497
+ #
498
+ # This class represents the configuration for IAMPolicy,
499
+ # providing control over timeouts, retry behavior, logging, transport
500
+ # parameters, and other low-level controls. Certain parameters can also be
501
+ # applied individually to specific RPCs. See
502
+ # {::Google::Iam::V1::IAMPolicy::Client::Configuration::Rpcs}
503
+ # for a list of RPCs that can be configured independently.
504
+ #
505
+ # Configuration can be applied globally to all clients, or to a single client
506
+ # on construction.
507
+ #
508
+ # @example
509
+ #
510
+ # # Modify the global config, setting the timeout for
511
+ # # set_iam_policy to 20 seconds,
512
+ # # and all remaining timeouts to 10 seconds.
513
+ # ::Google::Iam::V1::IAMPolicy::Client.configure do |config|
514
+ # config.timeout = 10.0
515
+ # config.rpcs.set_iam_policy.timeout = 20.0
516
+ # end
517
+ #
518
+ # # Apply the above configuration only to a new client.
519
+ # client = ::Google::Iam::V1::IAMPolicy::Client.new do |config|
520
+ # config.timeout = 10.0
521
+ # config.rpcs.set_iam_policy.timeout = 20.0
522
+ # end
523
+ #
524
+ # @!attribute [rw] endpoint
525
+ # A custom service endpoint, as a hostname or hostname:port. The default is
526
+ # nil, indicating to use the default endpoint in the current universe domain.
527
+ # @return [::String,nil]
528
+ # @!attribute [rw] credentials
529
+ # Credentials to send with calls. You may provide any of the following types:
530
+ # * (`String`) The path to a service account key file in JSON format
531
+ # * (`Hash`) A service account key as a Hash
532
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
533
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
534
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
535
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
536
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
537
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
538
+ # * (`nil`) indicating no credentials
539
+ #
540
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
541
+ # external source for authentication to Google Cloud, you must validate it before
542
+ # providing it to a Google API client library. Providing an unvalidated credential
543
+ # configuration to Google APIs can compromise the security of your systems and data.
544
+ # For more information, refer to [Validate credential configurations from external
545
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
546
+ # @return [::Object]
547
+ # @!attribute [rw] scope
548
+ # The OAuth scopes
549
+ # @return [::Array<::String>]
550
+ # @!attribute [rw] lib_name
551
+ # The library name as recorded in instrumentation and logging
552
+ # @return [::String]
553
+ # @!attribute [rw] lib_version
554
+ # The library version as recorded in instrumentation and logging
555
+ # @return [::String]
556
+ # @!attribute [rw] channel_args
557
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
558
+ # `GRPC::Core::Channel` object is provided as the credential.
559
+ # @return [::Hash]
560
+ # @!attribute [rw] interceptors
561
+ # An array of interceptors that are run before calls are executed.
562
+ # @return [::Array<::GRPC::ClientInterceptor>]
563
+ # @!attribute [rw] timeout
564
+ # The call timeout in seconds.
565
+ # @return [::Numeric]
566
+ # @!attribute [rw] metadata
567
+ # Additional gRPC headers to be sent with the call.
568
+ # @return [::Hash{::Symbol=>::String}]
569
+ # @!attribute [rw] retry_policy
570
+ # The retry policy. The value is a hash with the following keys:
571
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
572
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
573
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
574
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
575
+ # trigger a retry.
576
+ # @return [::Hash]
577
+ # @!attribute [rw] quota_project
578
+ # A separate project against which to charge quota.
579
+ # @return [::String]
580
+ # @!attribute [rw] universe_domain
581
+ # The universe domain within which to make requests. This determines the
582
+ # default endpoint URL. The default value of nil uses the environment
583
+ # universe (usually the default "googleapis.com" universe).
584
+ # @return [::String,nil]
585
+ # @!attribute [rw] logger
586
+ # A custom logger to use for request/response debug logging, or the value
587
+ # `:default` (the default) to construct a default logger, or `nil` to
588
+ # explicitly disable logging.
589
+ # @return [::Logger,:default,nil]
590
+ #
591
+ class Configuration
592
+ extend ::Gapic::Config
593
+
594
+ # @private
595
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
596
+ DEFAULT_ENDPOINT = "iam-meta-api.googleapis.com"
597
+
598
+ config_attr :endpoint, nil, ::String, nil
599
+ config_attr :credentials, nil do |value|
600
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
601
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel
602
+ allowed.any? { |klass| klass === value }
603
+ end
604
+ config_attr :scope, nil, ::String, ::Array, nil
605
+ config_attr :lib_name, nil, ::String, nil
606
+ config_attr :lib_version, nil, ::String, nil
607
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
608
+ config_attr :interceptors, nil, ::Array, nil
609
+ config_attr :timeout, nil, ::Numeric, nil
610
+ config_attr :metadata, nil, ::Hash, nil
611
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
612
+ config_attr :quota_project, nil, ::String, nil
613
+ config_attr :universe_domain, nil, ::String, nil
614
+ config_attr :logger, :default, ::Logger, nil, :default
615
+
616
+ # @private
617
+ def initialize parent_config = nil
618
+ @parent_config = parent_config unless parent_config.nil?
619
+
620
+ yield self if block_given?
621
+ end
622
+
623
+ ##
624
+ # Configurations for individual RPCs
625
+ # @return [Rpcs]
626
+ #
627
+ def rpcs
628
+ @rpcs ||= begin
629
+ parent_rpcs = nil
630
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
631
+ Rpcs.new parent_rpcs
632
+ end
633
+ end
634
+
635
+ ##
636
+ # Configuration for the channel pool
637
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
638
+ #
639
+ def channel_pool
640
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
641
+ end
642
+
643
+ ##
644
+ # Configuration RPC class for the IAMPolicy API.
645
+ #
646
+ # Includes fields providing the configuration for each RPC in this service.
647
+ # Each configuration object is of type `Gapic::Config::Method` and includes
648
+ # the following configuration fields:
649
+ #
650
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
651
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
652
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
653
+ # include the following keys:
654
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
655
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
656
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
657
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
658
+ # trigger a retry.
659
+ #
660
+ class Rpcs
661
+ ##
662
+ # RPC-specific configuration for `set_iam_policy`
663
+ # @return [::Gapic::Config::Method]
664
+ #
665
+ attr_reader :set_iam_policy
666
+ ##
667
+ # RPC-specific configuration for `get_iam_policy`
668
+ # @return [::Gapic::Config::Method]
669
+ #
670
+ attr_reader :get_iam_policy
671
+ ##
672
+ # RPC-specific configuration for `test_iam_permissions`
673
+ # @return [::Gapic::Config::Method]
674
+ #
675
+ attr_reader :test_iam_permissions
676
+
677
+ # @private
678
+ def initialize parent_rpcs = nil
679
+ set_iam_policy_config = parent_rpcs.set_iam_policy if parent_rpcs.respond_to? :set_iam_policy
680
+ @set_iam_policy = ::Gapic::Config::Method.new set_iam_policy_config
681
+ get_iam_policy_config = parent_rpcs.get_iam_policy if parent_rpcs.respond_to? :get_iam_policy
682
+ @get_iam_policy = ::Gapic::Config::Method.new get_iam_policy_config
683
+ test_iam_permissions_config = parent_rpcs.test_iam_permissions if parent_rpcs.respond_to? :test_iam_permissions
684
+ @test_iam_permissions = ::Gapic::Config::Method.new test_iam_permissions_config
685
+
686
+ yield self if block_given?
687
+ end
688
+ end
689
+ end
690
+ end
691
+ end
692
+ end
693
+ end
694
+ end