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