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