google-cloud-resource_settings-v1 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,21 @@
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
+ # This gem does not autoload during Bundler.require. To load this gem,
20
+ # issue explicit require statements for the packages desired, e.g.:
21
+ # require "google/cloud/resource_settings/v1"
@@ -0,0 +1,38 @@
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/resource_settings/v1/resource_settings_service"
20
+ require "google/cloud/resource_settings/v1/version"
21
+
22
+ module Google
23
+ module Cloud
24
+ module ResourceSettings
25
+ ##
26
+ # To load this package, including all its services, and instantiate a client:
27
+ #
28
+ # require "google/cloud/resource_settings/v1"
29
+ # client = ::Google::Cloud::ResourceSettings::V1::ResourceSettingsService::Client.new
30
+ #
31
+ module V1
32
+ end
33
+ end
34
+ end
35
+ end
36
+
37
+ helper_path = ::File.join __dir__, "v1", "_helpers.rb"
38
+ require "google/cloud/resource_settings/v1/_helpers" if ::File.file? helper_path
@@ -0,0 +1,60 @@
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 "gapic/common"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/cloud/resource_settings/v1/version"
24
+
25
+ require "google/cloud/resource_settings/v1/resource_settings_service/credentials"
26
+ require "google/cloud/resource_settings/v1/resource_settings_service/paths"
27
+ require "google/cloud/resource_settings/v1/resource_settings_service/client"
28
+
29
+ module Google
30
+ module Cloud
31
+ module ResourceSettings
32
+ module V1
33
+ ##
34
+ # An interface to interact with resource settings and setting values throughout
35
+ # the resource hierarchy.
36
+ #
37
+ # Services may surface a number of settings for users to control how their
38
+ # resources behave. Values of settings applied on a given Cloud resource are
39
+ # evaluated hierarchically and inherited by all descendants of that resource.
40
+ #
41
+ # For all requests, returns a `google.rpc.Status` with
42
+ # `google.rpc.Code.PERMISSION_DENIED` if the IAM check fails or the `parent`
43
+ # resource is not in a Cloud Organization.
44
+ # For all requests, returns a `google.rpc.Status` with
45
+ # `google.rpc.Code.INVALID_ARGUMENT` if the request is malformed.
46
+ #
47
+ # To load this service and instantiate a client:
48
+ #
49
+ # require "google/cloud/resource_settings/v1/resource_settings_service"
50
+ # client = ::Google::Cloud::ResourceSettings::V1::ResourceSettingsService::Client.new
51
+ #
52
+ module ResourceSettingsService
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
58
+
59
+ helper_path = ::File.join __dir__, "resource_settings_service", "helpers.rb"
60
+ require "google/cloud/resource_settings/v1/resource_settings_service/helpers" if ::File.file? helper_path
@@ -0,0 +1,574 @@
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
+ #
43
+ class Client
44
+ include Paths
45
+
46
+ # @private
47
+ attr_reader :resource_settings_service_stub
48
+
49
+ ##
50
+ # Configure the ResourceSettingsService Client class.
51
+ #
52
+ # See {::Google::Cloud::ResourceSettings::V1::ResourceSettingsService::Client::Configuration}
53
+ # for a description of the configuration fields.
54
+ #
55
+ # ## Example
56
+ #
57
+ # To modify the configuration for all ResourceSettingsService clients:
58
+ #
59
+ # ::Google::Cloud::ResourceSettings::V1::ResourceSettingsService::Client.configure do |config|
60
+ # config.timeout = 10.0
61
+ # end
62
+ #
63
+ # @yield [config] Configure the Client client.
64
+ # @yieldparam config [Client::Configuration]
65
+ #
66
+ # @return [Client::Configuration]
67
+ #
68
+ def self.configure
69
+ @configure ||= begin
70
+ namespace = ["Google", "Cloud", "ResourceSettings", "V1"]
71
+ parent_config = while namespace.any?
72
+ parent_name = namespace.join "::"
73
+ parent_const = const_get parent_name
74
+ break parent_const.configure if parent_const.respond_to? :configure
75
+ namespace.pop
76
+ end
77
+ default_config = Client::Configuration.new parent_config
78
+
79
+ default_config.rpcs.list_settings.timeout = 60.0
80
+ default_config.rpcs.list_settings.retry_policy = {
81
+ initial_delay: 1.0,
82
+ max_delay: 10.0,
83
+ multiplier: 1.3,
84
+ retry_codes: [14, 4]
85
+ }
86
+
87
+ default_config
88
+ end
89
+ yield @configure if block_given?
90
+ @configure
91
+ end
92
+
93
+ ##
94
+ # Configure the ResourceSettingsService Client instance.
95
+ #
96
+ # The configuration is set to the derived mode, meaning that values can be changed,
97
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
98
+ # should be made on {Client.configure}.
99
+ #
100
+ # See {::Google::Cloud::ResourceSettings::V1::ResourceSettingsService::Client::Configuration}
101
+ # for a description of the configuration fields.
102
+ #
103
+ # @yield [config] Configure the Client client.
104
+ # @yieldparam config [Client::Configuration]
105
+ #
106
+ # @return [Client::Configuration]
107
+ #
108
+ def configure
109
+ yield @config if block_given?
110
+ @config
111
+ end
112
+
113
+ ##
114
+ # Create a new ResourceSettingsService client object.
115
+ #
116
+ # ## Examples
117
+ #
118
+ # To create a new ResourceSettingsService client with the default
119
+ # configuration:
120
+ #
121
+ # client = ::Google::Cloud::ResourceSettings::V1::ResourceSettingsService::Client.new
122
+ #
123
+ # To create a new ResourceSettingsService client with a custom
124
+ # configuration:
125
+ #
126
+ # client = ::Google::Cloud::ResourceSettings::V1::ResourceSettingsService::Client.new do |config|
127
+ # config.timeout = 10.0
128
+ # end
129
+ #
130
+ # @yield [config] Configure the ResourceSettingsService client.
131
+ # @yieldparam config [Client::Configuration]
132
+ #
133
+ def initialize
134
+ # These require statements are intentionally placed here to initialize
135
+ # the gRPC module only when it's required.
136
+ # See https://github.com/googleapis/toolkit/issues/446
137
+ require "gapic/grpc"
138
+ require "google/cloud/resourcesettings/v1/resource_settings_services_pb"
139
+
140
+ # Create the configuration object
141
+ @config = Configuration.new Client.configure
142
+
143
+ # Yield the configuration if needed
144
+ yield @config if block_given?
145
+
146
+ # Create credentials
147
+ credentials = @config.credentials
148
+ # Use self-signed JWT if the scope and endpoint are unchanged from default,
149
+ # but only if the default endpoint does not have a region prefix.
150
+ enable_self_signed_jwt = @config.scope == Client.configure.scope &&
151
+ @config.endpoint == Client.configure.endpoint &&
152
+ !@config.endpoint.split(".").first.include?("-")
153
+ credentials ||= Credentials.default scope: @config.scope,
154
+ enable_self_signed_jwt: enable_self_signed_jwt
155
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
156
+ credentials = Credentials.new credentials, scope: @config.scope
157
+ end
158
+ @quota_project_id = @config.quota_project
159
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
160
+
161
+ @resource_settings_service_stub = ::Gapic::ServiceStub.new(
162
+ ::Google::Cloud::ResourceSettings::V1::ResourceSettingsService::Stub,
163
+ credentials: credentials,
164
+ endpoint: @config.endpoint,
165
+ channel_args: @config.channel_args,
166
+ interceptors: @config.interceptors
167
+ )
168
+ end
169
+
170
+ # Service calls
171
+
172
+ ##
173
+ # Lists all the settings that are available on the Cloud resource `parent`.
174
+ #
175
+ # @overload list_settings(request, options = nil)
176
+ # Pass arguments to `list_settings` via a request object, either of type
177
+ # {::Google::Cloud::ResourceSettings::V1::ListSettingsRequest} or an equivalent Hash.
178
+ #
179
+ # @param request [::Google::Cloud::ResourceSettings::V1::ListSettingsRequest, ::Hash]
180
+ # A request object representing the call parameters. Required. To specify no
181
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
182
+ # @param options [::Gapic::CallOptions, ::Hash]
183
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
184
+ #
185
+ # @overload list_settings(parent: nil, page_size: nil, page_token: nil, view: nil)
186
+ # Pass arguments to `list_settings` via keyword arguments. Note that at
187
+ # least one keyword argument is required. To specify no parameters, or to keep all
188
+ # the default parameter values, pass an empty Hash as a request object (see above).
189
+ #
190
+ # @param parent [::String]
191
+ # Required. The Cloud resource that parents the setting. Must be in one of the
192
+ # following forms:
193
+ #
194
+ # * `projects/{project_number}`
195
+ # * `projects/{project_id}`
196
+ # * `folders/{folder_id}`
197
+ # * `organizations/{organization_id}`
198
+ # @param page_size [::Integer]
199
+ # Unused. The size of the page to be returned.
200
+ # @param page_token [::String]
201
+ # Unused. A page token used to retrieve the next page.
202
+ # @param view [::Google::Cloud::ResourceSettings::V1::SettingView]
203
+ # The SettingView for this request.
204
+ #
205
+ # @yield [response, operation] Access the result along with the RPC operation
206
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::ResourceSettings::V1::Setting>]
207
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
208
+ #
209
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::ResourceSettings::V1::Setting>]
210
+ #
211
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
212
+ #
213
+ def list_settings request, options = nil
214
+ raise ::ArgumentError, "request must be provided" if request.nil?
215
+
216
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ResourceSettings::V1::ListSettingsRequest
217
+
218
+ # Converts hash and nil to an options object
219
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
220
+
221
+ # Customize the options with defaults
222
+ metadata = @config.rpcs.list_settings.metadata.to_h
223
+
224
+ # Set x-goog-api-client and x-goog-user-project headers
225
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
226
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
227
+ gapic_version: ::Google::Cloud::ResourceSettings::V1::VERSION
228
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
229
+
230
+ header_params = {
231
+ "parent" => request.parent
232
+ }
233
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
234
+ metadata[:"x-goog-request-params"] ||= request_params_header
235
+
236
+ options.apply_defaults timeout: @config.rpcs.list_settings.timeout,
237
+ metadata: metadata,
238
+ retry_policy: @config.rpcs.list_settings.retry_policy
239
+ options.apply_defaults metadata: @config.metadata,
240
+ retry_policy: @config.retry_policy
241
+
242
+ @resource_settings_service_stub.call_rpc :list_settings, request, options: options do |response, operation|
243
+ response = ::Gapic::PagedEnumerable.new @resource_settings_service_stub, :list_settings, request, response, operation, options
244
+ yield response, operation if block_given?
245
+ return response
246
+ end
247
+ rescue ::GRPC::BadStatus => e
248
+ raise ::Google::Cloud::Error.from_error(e)
249
+ end
250
+
251
+ ##
252
+ # Gets a setting.
253
+ #
254
+ # Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the
255
+ # setting does not exist.
256
+ #
257
+ # @overload get_setting(request, options = nil)
258
+ # Pass arguments to `get_setting` via a request object, either of type
259
+ # {::Google::Cloud::ResourceSettings::V1::GetSettingRequest} or an equivalent Hash.
260
+ #
261
+ # @param request [::Google::Cloud::ResourceSettings::V1::GetSettingRequest, ::Hash]
262
+ # A request object representing the call parameters. Required. To specify no
263
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
264
+ # @param options [::Gapic::CallOptions, ::Hash]
265
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
266
+ #
267
+ # @overload get_setting(name: nil, view: nil)
268
+ # Pass arguments to `get_setting` via keyword arguments. Note that at
269
+ # least one keyword argument is required. To specify no parameters, or to keep all
270
+ # the default parameter values, pass an empty Hash as a request object (see above).
271
+ #
272
+ # @param name [::String]
273
+ # Required. The name of the setting to get. See {::Google::Cloud::ResourceSettings::V1::Setting Setting} for naming
274
+ # requirements.
275
+ # @param view [::Google::Cloud::ResourceSettings::V1::SettingView]
276
+ # The SettingView for this request.
277
+ #
278
+ # @yield [response, operation] Access the result along with the RPC operation
279
+ # @yieldparam response [::Google::Cloud::ResourceSettings::V1::Setting]
280
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
281
+ #
282
+ # @return [::Google::Cloud::ResourceSettings::V1::Setting]
283
+ #
284
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
285
+ #
286
+ def get_setting request, options = nil
287
+ raise ::ArgumentError, "request must be provided" if request.nil?
288
+
289
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ResourceSettings::V1::GetSettingRequest
290
+
291
+ # Converts hash and nil to an options object
292
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
293
+
294
+ # Customize the options with defaults
295
+ metadata = @config.rpcs.get_setting.metadata.to_h
296
+
297
+ # Set x-goog-api-client and x-goog-user-project headers
298
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
299
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
300
+ gapic_version: ::Google::Cloud::ResourceSettings::V1::VERSION
301
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
302
+
303
+ header_params = {
304
+ "name" => request.name
305
+ }
306
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
307
+ metadata[:"x-goog-request-params"] ||= request_params_header
308
+
309
+ options.apply_defaults timeout: @config.rpcs.get_setting.timeout,
310
+ metadata: metadata,
311
+ retry_policy: @config.rpcs.get_setting.retry_policy
312
+ options.apply_defaults metadata: @config.metadata,
313
+ retry_policy: @config.retry_policy
314
+
315
+ @resource_settings_service_stub.call_rpc :get_setting, request, options: options do |response, operation|
316
+ yield response, operation if block_given?
317
+ return response
318
+ end
319
+ rescue ::GRPC::BadStatus => e
320
+ raise ::Google::Cloud::Error.from_error(e)
321
+ end
322
+
323
+ ##
324
+ # Updates a setting.
325
+ #
326
+ # Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the
327
+ # setting does not exist.
328
+ # Returns a `google.rpc.Status` with `google.rpc.Code.FAILED_PRECONDITION` if
329
+ # the setting is flagged as read only.
330
+ # Returns a `google.rpc.Status` with `google.rpc.Code.ABORTED` if the etag
331
+ # supplied in the request does not match the persisted etag of the setting
332
+ # value.
333
+ #
334
+ # On success, the response will contain only `name`, `local_value` and
335
+ # `etag`. The `metadata` and `effective_value` cannot be updated through
336
+ # this API.
337
+ #
338
+ # Note: the supplied setting will perform a full overwrite of the
339
+ # `local_value` field.
340
+ #
341
+ # @overload update_setting(request, options = nil)
342
+ # Pass arguments to `update_setting` via a request object, either of type
343
+ # {::Google::Cloud::ResourceSettings::V1::UpdateSettingRequest} or an equivalent Hash.
344
+ #
345
+ # @param request [::Google::Cloud::ResourceSettings::V1::UpdateSettingRequest, ::Hash]
346
+ # A request object representing the call parameters. Required. To specify no
347
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
348
+ # @param options [::Gapic::CallOptions, ::Hash]
349
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
350
+ #
351
+ # @overload update_setting(setting: nil)
352
+ # Pass arguments to `update_setting` via keyword arguments. Note that at
353
+ # least one keyword argument is required. To specify no parameters, or to keep all
354
+ # the default parameter values, pass an empty Hash as a request object (see above).
355
+ #
356
+ # @param setting [::Google::Cloud::ResourceSettings::V1::Setting, ::Hash]
357
+ # Required. The setting to update. See {::Google::Cloud::ResourceSettings::V1::Setting Setting} for field requirements.
358
+ #
359
+ # @yield [response, operation] Access the result along with the RPC operation
360
+ # @yieldparam response [::Google::Cloud::ResourceSettings::V1::Setting]
361
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
362
+ #
363
+ # @return [::Google::Cloud::ResourceSettings::V1::Setting]
364
+ #
365
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
366
+ #
367
+ def update_setting request, options = nil
368
+ raise ::ArgumentError, "request must be provided" if request.nil?
369
+
370
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ResourceSettings::V1::UpdateSettingRequest
371
+
372
+ # Converts hash and nil to an options object
373
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
374
+
375
+ # Customize the options with defaults
376
+ metadata = @config.rpcs.update_setting.metadata.to_h
377
+
378
+ # Set x-goog-api-client and x-goog-user-project headers
379
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
380
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
381
+ gapic_version: ::Google::Cloud::ResourceSettings::V1::VERSION
382
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
383
+
384
+ header_params = {
385
+ "setting.name" => request.setting.name
386
+ }
387
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
388
+ metadata[:"x-goog-request-params"] ||= request_params_header
389
+
390
+ options.apply_defaults timeout: @config.rpcs.update_setting.timeout,
391
+ metadata: metadata,
392
+ retry_policy: @config.rpcs.update_setting.retry_policy
393
+ options.apply_defaults metadata: @config.metadata,
394
+ retry_policy: @config.retry_policy
395
+
396
+ @resource_settings_service_stub.call_rpc :update_setting, request, options: options do |response, operation|
397
+ yield response, operation if block_given?
398
+ return response
399
+ end
400
+ rescue ::GRPC::BadStatus => e
401
+ raise ::Google::Cloud::Error.from_error(e)
402
+ end
403
+
404
+ ##
405
+ # Configuration class for the ResourceSettingsService API.
406
+ #
407
+ # This class represents the configuration for ResourceSettingsService,
408
+ # providing control over timeouts, retry behavior, logging, transport
409
+ # parameters, and other low-level controls. Certain parameters can also be
410
+ # applied individually to specific RPCs. See
411
+ # {::Google::Cloud::ResourceSettings::V1::ResourceSettingsService::Client::Configuration::Rpcs}
412
+ # for a list of RPCs that can be configured independently.
413
+ #
414
+ # Configuration can be applied globally to all clients, or to a single client
415
+ # on construction.
416
+ #
417
+ # # Examples
418
+ #
419
+ # To modify the global config, setting the timeout for list_settings
420
+ # to 20 seconds, and all remaining timeouts to 10 seconds:
421
+ #
422
+ # ::Google::Cloud::ResourceSettings::V1::ResourceSettingsService::Client.configure do |config|
423
+ # config.timeout = 10.0
424
+ # config.rpcs.list_settings.timeout = 20.0
425
+ # end
426
+ #
427
+ # To apply the above configuration only to a new client:
428
+ #
429
+ # client = ::Google::Cloud::ResourceSettings::V1::ResourceSettingsService::Client.new do |config|
430
+ # config.timeout = 10.0
431
+ # config.rpcs.list_settings.timeout = 20.0
432
+ # end
433
+ #
434
+ # @!attribute [rw] endpoint
435
+ # The hostname or hostname:port of the service endpoint.
436
+ # Defaults to `"resourcesettings.googleapis.com"`.
437
+ # @return [::String]
438
+ # @!attribute [rw] credentials
439
+ # Credentials to send with calls. You may provide any of the following types:
440
+ # * (`String`) The path to a service account key file in JSON format
441
+ # * (`Hash`) A service account key as a Hash
442
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
443
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
444
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
445
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
446
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
447
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
448
+ # * (`nil`) indicating no credentials
449
+ # @return [::Object]
450
+ # @!attribute [rw] scope
451
+ # The OAuth scopes
452
+ # @return [::Array<::String>]
453
+ # @!attribute [rw] lib_name
454
+ # The library name as recorded in instrumentation and logging
455
+ # @return [::String]
456
+ # @!attribute [rw] lib_version
457
+ # The library version as recorded in instrumentation and logging
458
+ # @return [::String]
459
+ # @!attribute [rw] channel_args
460
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
461
+ # `GRPC::Core::Channel` object is provided as the credential.
462
+ # @return [::Hash]
463
+ # @!attribute [rw] interceptors
464
+ # An array of interceptors that are run before calls are executed.
465
+ # @return [::Array<::GRPC::ClientInterceptor>]
466
+ # @!attribute [rw] timeout
467
+ # The call timeout in seconds.
468
+ # @return [::Numeric]
469
+ # @!attribute [rw] metadata
470
+ # Additional gRPC headers to be sent with the call.
471
+ # @return [::Hash{::Symbol=>::String}]
472
+ # @!attribute [rw] retry_policy
473
+ # The retry policy. The value is a hash with the following keys:
474
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
475
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
476
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
477
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
478
+ # trigger a retry.
479
+ # @return [::Hash]
480
+ # @!attribute [rw] quota_project
481
+ # A separate project against which to charge quota.
482
+ # @return [::String]
483
+ #
484
+ class Configuration
485
+ extend ::Gapic::Config
486
+
487
+ config_attr :endpoint, "resourcesettings.googleapis.com", ::String
488
+ config_attr :credentials, nil do |value|
489
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
490
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
491
+ allowed.any? { |klass| klass === value }
492
+ end
493
+ config_attr :scope, nil, ::String, ::Array, nil
494
+ config_attr :lib_name, nil, ::String, nil
495
+ config_attr :lib_version, nil, ::String, nil
496
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
497
+ config_attr :interceptors, nil, ::Array, nil
498
+ config_attr :timeout, nil, ::Numeric, nil
499
+ config_attr :metadata, nil, ::Hash, nil
500
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
501
+ config_attr :quota_project, nil, ::String, nil
502
+
503
+ # @private
504
+ def initialize parent_config = nil
505
+ @parent_config = parent_config unless parent_config.nil?
506
+
507
+ yield self if block_given?
508
+ end
509
+
510
+ ##
511
+ # Configurations for individual RPCs
512
+ # @return [Rpcs]
513
+ #
514
+ def rpcs
515
+ @rpcs ||= begin
516
+ parent_rpcs = nil
517
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
518
+ Rpcs.new parent_rpcs
519
+ end
520
+ end
521
+
522
+ ##
523
+ # Configuration RPC class for the ResourceSettingsService API.
524
+ #
525
+ # Includes fields providing the configuration for each RPC in this service.
526
+ # Each configuration object is of type `Gapic::Config::Method` and includes
527
+ # the following configuration fields:
528
+ #
529
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
530
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
531
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
532
+ # include the following keys:
533
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
534
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
535
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
536
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
537
+ # trigger a retry.
538
+ #
539
+ class Rpcs
540
+ ##
541
+ # RPC-specific configuration for `list_settings`
542
+ # @return [::Gapic::Config::Method]
543
+ #
544
+ attr_reader :list_settings
545
+ ##
546
+ # RPC-specific configuration for `get_setting`
547
+ # @return [::Gapic::Config::Method]
548
+ #
549
+ attr_reader :get_setting
550
+ ##
551
+ # RPC-specific configuration for `update_setting`
552
+ # @return [::Gapic::Config::Method]
553
+ #
554
+ attr_reader :update_setting
555
+
556
+ # @private
557
+ def initialize parent_rpcs = nil
558
+ list_settings_config = parent_rpcs.list_settings if parent_rpcs.respond_to? :list_settings
559
+ @list_settings = ::Gapic::Config::Method.new list_settings_config
560
+ get_setting_config = parent_rpcs.get_setting if parent_rpcs.respond_to? :get_setting
561
+ @get_setting = ::Gapic::Config::Method.new get_setting_config
562
+ update_setting_config = parent_rpcs.update_setting if parent_rpcs.respond_to? :update_setting
563
+ @update_setting = ::Gapic::Config::Method.new update_setting_config
564
+
565
+ yield self if block_given?
566
+ end
567
+ end
568
+ end
569
+ end
570
+ end
571
+ end
572
+ end
573
+ end
574
+ end