google-cloud-storage-control-v2 1.8.1 → 1.10.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.
@@ -1,711 +0,0 @@
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
- # * (`Google::Auth::Credentials`) A googleauth credentials object
531
- # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
532
- # * (`Signet::OAuth2::Client`) A signet oauth2 client object
533
- # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
534
- # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
535
- # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
536
- # * (`nil`) indicating no credentials
537
- #
538
- # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials
539
- # is deprecated. Providing an unvalidated credential configuration to
540
- # Google APIs can compromise the security of your systems and data.
541
- #
542
- # @example
543
- #
544
- # # The recommended way to provide credentials is to use the `make_creds` method
545
- # # on the appropriate credentials class for your environment.
546
- #
547
- # require "googleauth"
548
- #
549
- # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds(
550
- # json_key_io: ::File.open("/path/to/keyfile.json")
551
- # )
552
- #
553
- # client = ::Google::Iam::V1::IAMPolicy::Client.new do |config|
554
- # config.credentials = credentials
555
- # end
556
- #
557
- # @note Warning: If you accept a credential configuration (JSON file or Hash) from an
558
- # external source for authentication to Google Cloud, you must validate it before
559
- # providing it to a Google API client library. Providing an unvalidated credential
560
- # configuration to Google APIs can compromise the security of your systems and data.
561
- # For more information, refer to [Validate credential configurations from external
562
- # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
563
- # @return [::Object]
564
- # @!attribute [rw] scope
565
- # The OAuth scopes
566
- # @return [::Array<::String>]
567
- # @!attribute [rw] lib_name
568
- # The library name as recorded in instrumentation and logging
569
- # @return [::String]
570
- # @!attribute [rw] lib_version
571
- # The library version as recorded in instrumentation and logging
572
- # @return [::String]
573
- # @!attribute [rw] channel_args
574
- # Extra parameters passed to the gRPC channel. Note: this is ignored if a
575
- # `GRPC::Core::Channel` object is provided as the credential.
576
- # @return [::Hash]
577
- # @!attribute [rw] interceptors
578
- # An array of interceptors that are run before calls are executed.
579
- # @return [::Array<::GRPC::ClientInterceptor>]
580
- # @!attribute [rw] timeout
581
- # The call timeout in seconds.
582
- # @return [::Numeric]
583
- # @!attribute [rw] metadata
584
- # Additional gRPC headers to be sent with the call.
585
- # @return [::Hash{::Symbol=>::String}]
586
- # @!attribute [rw] retry_policy
587
- # The retry policy. The value is a hash with the following keys:
588
- # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
589
- # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
590
- # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
591
- # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
592
- # trigger a retry.
593
- # @return [::Hash]
594
- # @!attribute [rw] quota_project
595
- # A separate project against which to charge quota.
596
- # @return [::String]
597
- # @!attribute [rw] universe_domain
598
- # The universe domain within which to make requests. This determines the
599
- # default endpoint URL. The default value of nil uses the environment
600
- # universe (usually the default "googleapis.com" universe).
601
- # @return [::String,nil]
602
- # @!attribute [rw] logger
603
- # A custom logger to use for request/response debug logging, or the value
604
- # `:default` (the default) to construct a default logger, or `nil` to
605
- # explicitly disable logging.
606
- # @return [::Logger,:default,nil]
607
- #
608
- class Configuration
609
- extend ::Gapic::Config
610
-
611
- # @private
612
- # The endpoint specific to the default "googleapis.com" universe. Deprecated.
613
- DEFAULT_ENDPOINT = "iam-meta-api.googleapis.com"
614
-
615
- config_attr :endpoint, nil, ::String, nil
616
- config_attr :credentials, nil do |value|
617
- allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
618
- allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel
619
- allowed.any? { |klass| klass === value }
620
- end
621
- config_attr :scope, nil, ::String, ::Array, nil
622
- config_attr :lib_name, nil, ::String, nil
623
- config_attr :lib_version, nil, ::String, nil
624
- config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
625
- config_attr :interceptors, nil, ::Array, nil
626
- config_attr :timeout, nil, ::Numeric, nil
627
- config_attr :metadata, nil, ::Hash, nil
628
- config_attr :retry_policy, nil, ::Hash, ::Proc, nil
629
- config_attr :quota_project, nil, ::String, nil
630
- config_attr :universe_domain, nil, ::String, nil
631
- config_attr :logger, :default, ::Logger, nil, :default
632
-
633
- # @private
634
- def initialize parent_config = nil
635
- @parent_config = parent_config unless parent_config.nil?
636
-
637
- yield self if block_given?
638
- end
639
-
640
- ##
641
- # Configurations for individual RPCs
642
- # @return [Rpcs]
643
- #
644
- def rpcs
645
- @rpcs ||= begin
646
- parent_rpcs = nil
647
- parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
648
- Rpcs.new parent_rpcs
649
- end
650
- end
651
-
652
- ##
653
- # Configuration for the channel pool
654
- # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
655
- #
656
- def channel_pool
657
- @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
658
- end
659
-
660
- ##
661
- # Configuration RPC class for the IAMPolicy API.
662
- #
663
- # Includes fields providing the configuration for each RPC in this service.
664
- # Each configuration object is of type `Gapic::Config::Method` and includes
665
- # the following configuration fields:
666
- #
667
- # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
668
- # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
669
- # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
670
- # include the following keys:
671
- # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
672
- # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
673
- # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
674
- # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
675
- # trigger a retry.
676
- #
677
- class Rpcs
678
- ##
679
- # RPC-specific configuration for `set_iam_policy`
680
- # @return [::Gapic::Config::Method]
681
- #
682
- attr_reader :set_iam_policy
683
- ##
684
- # RPC-specific configuration for `get_iam_policy`
685
- # @return [::Gapic::Config::Method]
686
- #
687
- attr_reader :get_iam_policy
688
- ##
689
- # RPC-specific configuration for `test_iam_permissions`
690
- # @return [::Gapic::Config::Method]
691
- #
692
- attr_reader :test_iam_permissions
693
-
694
- # @private
695
- def initialize parent_rpcs = nil
696
- set_iam_policy_config = parent_rpcs.set_iam_policy if parent_rpcs.respond_to? :set_iam_policy
697
- @set_iam_policy = ::Gapic::Config::Method.new set_iam_policy_config
698
- get_iam_policy_config = parent_rpcs.get_iam_policy if parent_rpcs.respond_to? :get_iam_policy
699
- @get_iam_policy = ::Gapic::Config::Method.new get_iam_policy_config
700
- test_iam_permissions_config = parent_rpcs.test_iam_permissions if parent_rpcs.respond_to? :test_iam_permissions
701
- @test_iam_permissions = ::Gapic::Config::Method.new test_iam_permissions_config
702
-
703
- yield self if block_given?
704
- end
705
- end
706
- end
707
- end
708
- end
709
- end
710
- end
711
- end