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